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
|
type ClassType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ClassHouse ClassType = iota
|
ClassTerm ClassType = iota
|
||||||
ClassHotel
|
ClassWeekly
|
||||||
ClassStore
|
ClassStep
|
||||||
ClassPublic
|
ClassFree
|
||||||
ClassSchool
|
|
||||||
ClassOffice
|
|
||||||
ClassFactory
|
|
||||||
ClassHospital
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var ClassTypeList = map[ClassType]string{
|
var ClassTypeList = map[ClassType]string{
|
||||||
ClassHouse: "house",
|
ClassTerm: "term",
|
||||||
ClassHotel: "hotel",
|
ClassWeekly: "weekly",
|
||||||
ClassStore: "store",
|
ClassStep: "step",
|
||||||
ClassPublic: "public",
|
ClassFree: "free",
|
||||||
ClassSchool: "school",
|
|
||||||
ClassOffice: "office",
|
|
||||||
ClassFactory: "factory",
|
|
||||||
ClassHospital: "hospital",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s ClassType) String() string { return ClassTypeList[s] }
|
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() })
|
kit.If(key == model.USER_CLASS_ROLE, func() { value = UserClassRole(kit.Int(value)).String() })
|
||||||
return value
|
return value
|
||||||
})
|
})
|
||||||
|
s.Table.RewriteAppend(m)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import "shylinux.com/x/mysql-story/src/db"
|
|||||||
const (
|
const (
|
||||||
UID = "uid"
|
UID = "uid"
|
||||||
NAME = "name"
|
NAME = "name"
|
||||||
|
TYPE = "type"
|
||||||
|
ROLE = "role"
|
||||||
GRADE = "grade"
|
GRADE = "grade"
|
||||||
USER_UID = "user_uid"
|
USER_UID = "user_uid"
|
||||||
USER_CLASS_ROLE = "user_class_role"
|
USER_CLASS_ROLE = "user_class_role"
|
||||||
@ -32,13 +34,13 @@ type Class struct {
|
|||||||
type School struct {
|
type School struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
CityUID string `gorm:"type:char(32);index"`
|
CityUID string `gorm:"type:char(32);index"`
|
||||||
Name string `gorm:"type:varchar(256);index"`
|
Name string `gorm:"type:varchar(256)"`
|
||||||
Info string
|
Info string
|
||||||
}
|
}
|
||||||
type Homework struct {
|
type Homework struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
ClassUID string `gorm:"type:char(32);index"`
|
ClassUID string `gorm:"type:char(32);index:idx_class_user"`
|
||||||
UserUID string `gorm:"type:char(32)"`
|
UserUID string `gorm:"type:char(32);index:idx_class_user"`
|
||||||
Content string
|
Content string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
"icons": {
|
"icons": {
|
||||||
"homework": "https://img.icons8.com/officel/80/homework.png"
|
"homework": "https://img.icons8.com/officel/80/homework.png"
|
||||||
},
|
},
|
||||||
"style": {
|
|
||||||
"placeRemove": "danger"
|
|
||||||
},
|
|
||||||
"input": {
|
"input": {
|
||||||
|
"My Class": "我的班级",
|
||||||
"grade": "入学年份",
|
"grade": "入学年份",
|
||||||
"user_class_role": "用户角色",
|
"user_class_role": "用户角色",
|
||||||
"class_uid": "班级",
|
"class_uid": "班级",
|
||||||
@ -20,9 +18,15 @@
|
|||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"class_type": {
|
"class_type": {
|
||||||
|
"term": "学期制",
|
||||||
|
"weekly": "周期性",
|
||||||
|
"step": "阶段性",
|
||||||
|
"free": "自由式"
|
||||||
},
|
},
|
||||||
"user_class_role": {
|
"user_class_role": {
|
||||||
"teacher": "老师"
|
"teacher": "老师",
|
||||||
|
"student": "学生",
|
||||||
|
"parent": "家长"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,16 +12,25 @@ type userClass struct {
|
|||||||
school school
|
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) {
|
func (s userClass) List(m *ice.Message, arg ...string) {
|
||||||
s.Tables(m, s.class, s.school).FieldsWithCreatedAT(m, s,
|
s.Tables(m, s.class, s.school).FieldsWithCreatedAT(m, s,
|
||||||
model.CLASS_NAME, model.CLASS_TYPE, model.USER_CLASS_ROLE,
|
model.CLASS_NAME, model.CLASS_TYPE, model.USER_CLASS_ROLE,
|
||||||
model.SCHOOL_NAME, model.GRADE,
|
model.SCHOOL_NAME, model.GRADE,
|
||||||
model.CLASS_UID, model.CITY_UID,
|
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])
|
s.Select(m, model.USER_UID, arg[0])
|
||||||
} else if len(arg) == 2 {
|
} 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 {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user