mirror of
https://shylinux.com/x/education
synced 2025-04-25 10:08:05 +08:00
opt some
This commit is contained in:
parent
7c796c4ae0
commit
3cfd410a5a
@ -33,25 +33,17 @@ func init() { ice.TeamCtxCmd(Class{}) }
|
||||
type ClassType int
|
||||
|
||||
const (
|
||||
ClassHouse ClassType = iota
|
||||
ClassHotel
|
||||
ClassStore
|
||||
ClassPublic
|
||||
ClassSchool
|
||||
ClassOffice
|
||||
ClassFactory
|
||||
ClassHospital
|
||||
ClassTerm ClassType = iota
|
||||
ClassWeekly
|
||||
ClassStep
|
||||
ClassFree
|
||||
)
|
||||
|
||||
var ClassTypeList = map[ClassType]string{
|
||||
ClassHouse: "house",
|
||||
ClassHotel: "hotel",
|
||||
ClassStore: "store",
|
||||
ClassPublic: "public",
|
||||
ClassSchool: "school",
|
||||
ClassOffice: "office",
|
||||
ClassFactory: "factory",
|
||||
ClassHospital: "hospital",
|
||||
ClassTerm: "term",
|
||||
ClassWeekly: "weekly",
|
||||
ClassStep: "step",
|
||||
ClassFree: "free",
|
||||
}
|
||||
|
||||
func (s ClassType) String() string { return ClassTypeList[s] }
|
||||
|
22
src/jiaowuxitong/classUser.go
Normal file
22
src/jiaowuxitong/classUser.go
Normal file
@ -0,0 +1,22 @@
|
||||
package jiaowuxitong
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
|
||||
"shylinux.com/x/education/src/jiaowuxitong/model"
|
||||
)
|
||||
|
||||
type classUser struct {
|
||||
portal Portal
|
||||
userClass userClass
|
||||
list string `name:"list class_uid uid auto" role:"void" help:"班级成员" icon:"https://img.icons8.com/officel/80/crowd.png"`
|
||||
}
|
||||
|
||||
func (s classUser) Init(m *ice.Message, arg ...string) {
|
||||
s.portal.Show(m, model.ROLE, "creator,landlord")
|
||||
}
|
||||
func (s classUser) List(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(s.userClass, s.userClass.User, arg).Display("")
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(classUser{}) }
|
12
src/jiaowuxitong/classUser.js
Normal file
12
src/jiaowuxitong/classUser.js
Normal file
@ -0,0 +1,12 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
|
||||
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.user_class_role]
|
||||
return can.onimport.itemcard(can, value, [
|
||||
{view: html.TITLE, list: [{text: value.user_name},
|
||||
{text: [can.user.transValue(can, value, "user_class_role"), "", aaa.ROLE]},
|
||||
]},
|
||||
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
|
||||
])
|
||||
}))
|
||||
},
|
||||
})
|
@ -37,5 +37,6 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
kit.If(key == model.USER_CLASS_ROLE, func() { value = UserClassRole(kit.Int(value)).String() })
|
||||
return value
|
||||
})
|
||||
s.Table.RewriteAppend(m)
|
||||
return m
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import "shylinux.com/x/mysql-story/src/db"
|
||||
const (
|
||||
UID = "uid"
|
||||
NAME = "name"
|
||||
TYPE = "type"
|
||||
ROLE = "role"
|
||||
GRADE = "grade"
|
||||
USER_UID = "user_uid"
|
||||
USER_CLASS_ROLE = "user_class_role"
|
||||
@ -32,13 +34,13 @@ type Class struct {
|
||||
type School struct {
|
||||
db.ModelWithUID
|
||||
CityUID string `gorm:"type:char(32);index"`
|
||||
Name string `gorm:"type:varchar(256);index"`
|
||||
Name string `gorm:"type:varchar(256)"`
|
||||
Info string
|
||||
}
|
||||
type Homework struct {
|
||||
db.ModelWithUID
|
||||
ClassUID string `gorm:"type:char(32);index"`
|
||||
UserUID string `gorm:"type:char(32)"`
|
||||
ClassUID string `gorm:"type:char(32);index:idx_class_user"`
|
||||
UserUID string `gorm:"type:char(32);index:idx_class_user"`
|
||||
Content string
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
"icons": {
|
||||
"homework": "https://img.icons8.com/officel/80/homework.png"
|
||||
},
|
||||
"style": {
|
||||
"placeRemove": "danger"
|
||||
},
|
||||
"input": {
|
||||
"My Class": "我的班级",
|
||||
"grade": "入学年份",
|
||||
"user_class_role": "用户角色",
|
||||
"class_uid": "班级",
|
||||
@ -20,9 +18,15 @@
|
||||
},
|
||||
"value": {
|
||||
"class_type": {
|
||||
"term": "学期制",
|
||||
"weekly": "周期性",
|
||||
"step": "阶段性",
|
||||
"free": "自由式"
|
||||
},
|
||||
"user_class_role": {
|
||||
"teacher": "老师"
|
||||
"teacher": "老师",
|
||||
"student": "学生",
|
||||
"parent": "家长"
|
||||
}
|
||||
}
|
||||
}
|
@ -12,16 +12,25 @@ type userClass struct {
|
||||
school school
|
||||
}
|
||||
|
||||
func (s userClass) User(m *ice.Message, arg ...string) {
|
||||
s.Select(m, model.CLASS_UID, arg[0]).RenameAppend(model.ROLE, model.USER_CLASS_ROLE)
|
||||
s.SelectJoinUser(m)
|
||||
s.RewriteAppend(m)
|
||||
}
|
||||
func (s userClass) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.class, s.school).FieldsWithCreatedAT(m, s,
|
||||
model.CLASS_NAME, model.CLASS_TYPE, model.USER_CLASS_ROLE,
|
||||
model.SCHOOL_NAME, model.GRADE,
|
||||
model.CLASS_UID, model.CITY_UID,
|
||||
)
|
||||
if len(arg) == 1 {
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
s.Select(m, model.USER_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.USER_UID, arg[0], model.CLASS_UID, arg[1])
|
||||
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s.class, model.UID), arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user