mirror of
https://shylinux.com/x/education
synced 2025-04-25 01:58:05 +08:00
opt some
This commit is contained in:
parent
d26d1024f7
commit
49f7726917
@ -7,9 +7,9 @@ import (
|
||||
"shylinux.com/x/education/src/jiaowuxitong/model"
|
||||
)
|
||||
|
||||
type Class struct{ Table }
|
||||
type class struct{ Table }
|
||||
|
||||
func (s Class) Inputs(m *ice.Message, arg ...string) {
|
||||
func (s class) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case model.GRADE:
|
||||
y := kit.Int(kit.Split(m.Time(), "-")[0])
|
||||
@ -28,7 +28,7 @@ func (s Class) Inputs(m *ice.Message, arg ...string) {
|
||||
}
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(Class{}) }
|
||||
func init() { ice.TeamCtxCmd(class{}) }
|
||||
|
||||
type ClassType int
|
||||
|
||||
|
@ -9,11 +9,11 @@ import (
|
||||
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"`
|
||||
list string `name:"list class_uid uid auto" help:"班级成员" icon:"https://img.icons8.com/officel/80/crowd.png" role:"void"`
|
||||
}
|
||||
|
||||
func (s classUser) Init(m *ice.Message, arg ...string) {
|
||||
s.portal.Show(m, model.ROLE, "creator,landlord")
|
||||
s.portal.Show(m, model.ROLE, "creator,teacher")
|
||||
}
|
||||
func (s classUser) List(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(s.userClass, s.userClass.User, arg).Display("")
|
||||
|
@ -1,12 +1,13 @@
|
||||
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, [
|
||||
_init: function(can, msg) {
|
||||
if (msg.IsDetail()) { can.onexport.share_title(can, msg, "user_class_role"); return msg.Show(can) }
|
||||
can.onimport.itemcards(can, msg, function(value) { value._style = [value.user_class_role]
|
||||
return [
|
||||
{view: html.TITLE, list: [{text: value.user_name},
|
||||
{text: [can.user.transValue(can, value, "user_class_role"), "", aaa.ROLE]},
|
||||
{text: [can.user.transValue(can, value, "user_class_role"), "", [aaa.ROLE, value.user_class_role]]},
|
||||
]},
|
||||
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
|
||||
])
|
||||
}))
|
||||
]
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -8,6 +8,10 @@ import (
|
||||
"shylinux.com/x/education/src/jiaowuxitong/model"
|
||||
)
|
||||
|
||||
type Tables struct {
|
||||
gonganxitong.Tables
|
||||
list string `name:"list class_uid uid auto" role:"void"`
|
||||
}
|
||||
type Table struct {
|
||||
gonganxitong.Table
|
||||
list string `name:"list class_uid uid auto" role:"void"`
|
||||
|
@ -9,22 +9,17 @@ import (
|
||||
|
||||
type homework struct {
|
||||
Table
|
||||
portal string `data:"true"`
|
||||
create string `name:"create content*" role:"void"`
|
||||
class class
|
||||
userClass userClass
|
||||
portal string `data:"true"`
|
||||
create string `name:"create content*" role:"void"`
|
||||
}
|
||||
|
||||
func (s homework) Create(m *ice.Message, arg ...string) {
|
||||
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CLASS_UID))...)
|
||||
}
|
||||
func (s homework) List(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 1 {
|
||||
s.Table.Select(m, model.CLASS_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.SelectDetail(m, model.CLASS_UID, arg[0], model.UID, arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
s.SelectJoinUser(m).Display("")
|
||||
s.TablesWithRole(m, arg, s, s.userClass, s.class, model.CONTENT).Display("")
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(homework{}) }
|
||||
|
@ -2,13 +2,14 @@ var UID = "uid", CLASS_NAME = "class_name"
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.itemcards(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [{text: value.user_name}, {text: can.base.TimeTrim(value.created_at)}]},
|
||||
{view: html.TITLE, list: [{text: value.user_name},
|
||||
{text: [can.user.transValue(can, value, "user_class_role"), "", aaa.ROLE]},
|
||||
{text: can.base.TimeTrim(value.created_at)},
|
||||
]},
|
||||
{view: html.STATUS, list: [{text: value.content}]},
|
||||
] })
|
||||
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_content", value.content)
|
||||
can.onexport.title(can, can.base.trimPrefix(value.created_at.split(" ")[0], can.base.Time(null, "%y-")))
|
||||
} else {
|
||||
can.onexport.title(can)
|
||||
msg.Option("_share_title", can.base.trimPrefix(value.created_at.split(" ")[0], can.base.Time(null, "%y-")))
|
||||
}
|
||||
},
|
||||
})
|
@ -8,6 +8,7 @@ const (
|
||||
TYPE = "type"
|
||||
ROLE = "role"
|
||||
GRADE = "grade"
|
||||
CONTENT = "content"
|
||||
USER_UID = "user_uid"
|
||||
USER_CLASS_ROLE = "user_class_role"
|
||||
CLASS_UID = "class_uid"
|
||||
@ -39,8 +40,8 @@ type School struct {
|
||||
}
|
||||
type Homework struct {
|
||||
db.ModelWithUID
|
||||
ClassUID string `gorm:"type:char(32);index:idx_class_user"`
|
||||
UserUID string `gorm:"type:char(32);index:idx_class_user"`
|
||||
ClassUID string `gorm:"type:char(32)"`
|
||||
UserUID string `gorm:"type:char(32)"`
|
||||
Content string
|
||||
}
|
||||
|
||||
|
@ -9,5 +9,5 @@ type Portal struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userClass{}, Class{}, school{})})
|
||||
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userClass{}, class{}, school{})})
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"portal": "教务系统",
|
||||
"scanQRCode": "扫码添加",
|
||||
"placeCreate": "创建班级",
|
||||
"placeRemove": "删除班级",
|
||||
"homework": "家庭作业",
|
||||
@ -13,8 +12,8 @@
|
||||
"user_class_role": "用户角色",
|
||||
"class_uid": "班级",
|
||||
"class_name": "班级名称",
|
||||
"school_name": "学校名称",
|
||||
"city_name": "城市名称"
|
||||
"class_type": "班级类型",
|
||||
"school_name": "学校名称"
|
||||
},
|
||||
"value": {
|
||||
"class_type": {
|
||||
@ -24,6 +23,8 @@
|
||||
"free": "自由式"
|
||||
},
|
||||
"user_class_role": {
|
||||
"creator": "创建人",
|
||||
"visitor": "访客",
|
||||
"teacher": "老师",
|
||||
"student": "学生",
|
||||
"parent": "家长"
|
||||
|
@ -8,12 +8,19 @@ import (
|
||||
|
||||
type userClass struct {
|
||||
Table
|
||||
class Class
|
||||
class class
|
||||
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)
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.CLASS_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.Select(m, model.CLASS_UID, arg[0], model.UID, arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
m.RenameAppend(model.ROLE, model.USER_CLASS_ROLE)
|
||||
s.SelectJoinUser(m)
|
||||
s.RewriteAppend(m)
|
||||
}
|
||||
|
@ -4,12 +4,12 @@
|
||||
"access": "gh_8769c32f3b68",
|
||||
"appid": "wx338c18ca22ab4911",
|
||||
"expire": "2024-07-28 07:25:37.435",
|
||||
"expires": "2024-08-04 13:09:09.296",
|
||||
"expires": "2024-08-05 01:06:25.260",
|
||||
"secret": "84d243609c7e99d00b5b06595328051b",
|
||||
"ticket": "O3SMpm8bG7kJnF36aXbe83SKaC2_udWbTITRsiilTR-dZVtWQWDXh0-OAZ7Pk2Uloj9ZL9M_vMlSHNFmaxldeg",
|
||||
"time": "2024-07-25 11:42:55.081",
|
||||
"token": "wx20240711",
|
||||
"tokens": "83_Dvf9iVL40Jnm4zC6JICX8fH3jjsNTpTrOWDepa7rGYMXKIk0-TuYRumxLKBaPcMWixu3A4zxxJntPRHFabGk2Xs-4a0Q2YBf8_VYk_j6lJw4uqhqRbHNHsxUSf4DNObABAOYZ",
|
||||
"tokens": "83_ADeg_zSlPTEfjFEEJICX8fH3jjsNTpTrOWDepQ-YqbJz6Y-sD95PwbaxVIP2d5Z3LuA5GLRBj2LMrWbl43YdC9_u5DgJMJm2HdudrDZV9Z7inKIVO9xrD2pBOBEQXQdAAAYFY",
|
||||
"type": "web"
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"index": "web.team.jiaowuxitong.homework",
|
||||
"name": "家庭作业",
|
||||
"order": "6",
|
||||
"time": "2024-08-04 11:44:07.329"
|
||||
"time": "2024-08-04 21:24:37.384"
|
||||
}
|
||||
},
|
||||
"0d55746b9fbdefff96b30c2aa36a48aa": {
|
||||
@ -17,7 +17,7 @@
|
||||
"name": "权限审批",
|
||||
"order": "4",
|
||||
"role": "creator,teacher",
|
||||
"time": "2024-08-04 11:50:04.378"
|
||||
"time": "2024-08-04 23:10:14.970"
|
||||
}
|
||||
},
|
||||
"1a3d216c5a854d78045f3d2acacf567b": {
|
||||
@ -27,7 +27,7 @@
|
||||
"index": "web.team.jiaowuxitong.apply",
|
||||
"name": "权限申请",
|
||||
"order": "3",
|
||||
"time": "2024-08-04 11:45:12.765"
|
||||
"time": "2024-08-04 23:01:00.755"
|
||||
}
|
||||
},
|
||||
"4719bb45bb02427346be9634cc7a8fe3": {
|
||||
@ -47,7 +47,7 @@
|
||||
"index": "web.team.jiaowuxitong.classUser",
|
||||
"name": "班级成员",
|
||||
"order": "5",
|
||||
"time": "2024-08-04 11:50:04.378"
|
||||
"time": "2024-08-04 21:28:17.024"
|
||||
}
|
||||
},
|
||||
"c73251765fb5286cea9c8ceefb74530c": {
|
||||
@ -58,7 +58,7 @@
|
||||
"name": "事件流",
|
||||
"order": "2",
|
||||
"role": "creator,teacher",
|
||||
"time": "2024-08-04 11:52:25.148"
|
||||
"time": "2024-08-04 22:46:59.068"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user