This commit is contained in:
jingganjiaoyu 2024-08-05 02:09:40 +08:00
parent d26d1024f7
commit 49f7726917
12 changed files with 50 additions and 40 deletions

View File

@ -7,9 +7,9 @@ import (
"shylinux.com/x/education/src/jiaowuxitong/model" "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] { switch arg[0] {
case model.GRADE: case model.GRADE:
y := kit.Int(kit.Split(m.Time(), "-")[0]) 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 type ClassType int

View File

@ -9,11 +9,11 @@ import (
type classUser struct { type classUser struct {
portal Portal portal Portal
userClass userClass 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) { 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) { func (s classUser) List(m *ice.Message, arg ...string) {
m.Cmdy(s.userClass, s.userClass.User, arg).Display("") m.Cmdy(s.userClass, s.userClass.User, arg).Display("")

View File

@ -1,12 +1,13 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) } _init: function(can, msg) {
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.user_class_role] if (msg.IsDetail()) { can.onexport.share_title(can, msg, "user_class_role"); return msg.Show(can) }
return can.onimport.itemcard(can, value, [ can.onimport.itemcards(can, msg, function(value) { value._style = [value.user_class_role]
return [
{view: html.TITLE, list: [{text: value.user_name}, {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)}]}, {view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
]) ]
})) })
}, },
}) })

View File

@ -8,6 +8,10 @@ import (
"shylinux.com/x/education/src/jiaowuxitong/model" "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 { type Table struct {
gonganxitong.Table gonganxitong.Table
list string `name:"list class_uid uid auto" role:"void"` list string `name:"list class_uid uid auto" role:"void"`

View File

@ -9,22 +9,17 @@ import (
type homework struct { type homework struct {
Table Table
portal string `data:"true"` class class
create string `name:"create content*" role:"void"` userClass userClass
portal string `data:"true"`
create string `name:"create content*" role:"void"`
} }
func (s homework) Create(m *ice.Message, arg ...string) { func (s homework) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CLASS_UID))...) s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.CLASS_UID))...)
} }
func (s homework) List(m *ice.Message, arg ...string) { func (s homework) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { s.TablesWithRole(m, arg, s, s.userClass, s.class, model.CONTENT).Display("")
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("")
} }
func init() { ice.TeamCtxCmd(homework{}) } func init() { ice.TeamCtxCmd(homework{}) }

View File

@ -2,13 +2,14 @@ var UID = "uid", CLASS_NAME = "class_name"
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [ 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}]}, {view: html.STATUS, list: [{text: value.content}]},
] }) ] })
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_content", 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-"))) msg.Option("_share_title", can.base.trimPrefix(value.created_at.split(" ")[0], can.base.Time(null, "%y-")))
} else {
can.onexport.title(can)
} }
}, },
}) })

View File

@ -8,6 +8,7 @@ const (
TYPE = "type" TYPE = "type"
ROLE = "role" ROLE = "role"
GRADE = "grade" GRADE = "grade"
CONTENT = "content"
USER_UID = "user_uid" USER_UID = "user_uid"
USER_CLASS_ROLE = "user_class_role" USER_CLASS_ROLE = "user_class_role"
CLASS_UID = "class_uid" CLASS_UID = "class_uid"
@ -39,8 +40,8 @@ type School struct {
} }
type Homework struct { type Homework struct {
db.ModelWithUID db.ModelWithUID
ClassUID string `gorm:"type:char(32);index:idx_class_user"` ClassUID string `gorm:"type:char(32)"`
UserUID string `gorm:"type:char(32);index:idx_class_user"` UserUID string `gorm:"type:char(32)"`
Content string Content string
} }

View File

@ -9,5 +9,5 @@ type Portal struct {
} }
func init() { func init() {
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userClass{}, Class{}, school{})}) gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userClass{}, class{}, school{})})
} }

View File

@ -1,6 +1,5 @@
{ {
"portal": "教务系统", "portal": "教务系统",
"scanQRCode": "扫码添加",
"placeCreate": "创建班级", "placeCreate": "创建班级",
"placeRemove": "删除班级", "placeRemove": "删除班级",
"homework": "家庭作业", "homework": "家庭作业",
@ -13,8 +12,8 @@
"user_class_role": "用户角色", "user_class_role": "用户角色",
"class_uid": "班级", "class_uid": "班级",
"class_name": "班级名称", "class_name": "班级名称",
"school_name": "学校名称", "class_type": "班级类型",
"city_name": "城市名称" "school_name": "学校名称"
}, },
"value": { "value": {
"class_type": { "class_type": {
@ -24,6 +23,8 @@
"free": "自由式" "free": "自由式"
}, },
"user_class_role": { "user_class_role": {
"creator": "创建人",
"visitor": "访客",
"teacher": "老师", "teacher": "老师",
"student": "学生", "student": "学生",
"parent": "家长" "parent": "家长"

View File

@ -8,12 +8,19 @@ import (
type userClass struct { type userClass struct {
Table Table
class Class class class
school school school school
} }
func (s userClass) User(m *ice.Message, arg ...string) { 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.SelectJoinUser(m)
s.RewriteAppend(m) s.RewriteAppend(m)
} }

View File

@ -4,12 +4,12 @@
"access": "gh_8769c32f3b68", "access": "gh_8769c32f3b68",
"appid": "wx338c18ca22ab4911", "appid": "wx338c18ca22ab4911",
"expire": "2024-07-28 07:25:37.435", "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", "secret": "84d243609c7e99d00b5b06595328051b",
"ticket": "O3SMpm8bG7kJnF36aXbe83SKaC2_udWbTITRsiilTR-dZVtWQWDXh0-OAZ7Pk2Uloj9ZL9M_vMlSHNFmaxldeg", "ticket": "O3SMpm8bG7kJnF36aXbe83SKaC2_udWbTITRsiilTR-dZVtWQWDXh0-OAZ7Pk2Uloj9ZL9M_vMlSHNFmaxldeg",
"time": "2024-07-25 11:42:55.081", "time": "2024-07-25 11:42:55.081",
"token": "wx20240711", "token": "wx20240711",
"tokens": "83_Dvf9iVL40Jnm4zC6JICX8fH3jjsNTpTrOWDepa7rGYMXKIk0-TuYRumxLKBaPcMWixu3A4zxxJntPRHFabGk2Xs-4a0Q2YBf8_VYk_j6lJw4uqhqRbHNHsxUSf4DNObABAOYZ", "tokens": "83_ADeg_zSlPTEfjFEEJICX8fH3jjsNTpTrOWDepQ-YqbJz6Y-sD95PwbaxVIP2d5Z3LuA5GLRBj2LMrWbl43YdC9_u5DgJMJm2HdudrDZV9Z7inKIVO9xrD2pBOBEQXQdAAAYFY",
"type": "web" "type": "web"
} }
} }

View File

@ -6,7 +6,7 @@
"index": "web.team.jiaowuxitong.homework", "index": "web.team.jiaowuxitong.homework",
"name": "家庭作业", "name": "家庭作业",
"order": "6", "order": "6",
"time": "2024-08-04 11:44:07.329" "time": "2024-08-04 21:24:37.384"
} }
}, },
"0d55746b9fbdefff96b30c2aa36a48aa": { "0d55746b9fbdefff96b30c2aa36a48aa": {
@ -17,7 +17,7 @@
"name": "权限审批", "name": "权限审批",
"order": "4", "order": "4",
"role": "creator,teacher", "role": "creator,teacher",
"time": "2024-08-04 11:50:04.378" "time": "2024-08-04 23:10:14.970"
} }
}, },
"1a3d216c5a854d78045f3d2acacf567b": { "1a3d216c5a854d78045f3d2acacf567b": {
@ -27,7 +27,7 @@
"index": "web.team.jiaowuxitong.apply", "index": "web.team.jiaowuxitong.apply",
"name": "权限申请", "name": "权限申请",
"order": "3", "order": "3",
"time": "2024-08-04 11:45:12.765" "time": "2024-08-04 23:01:00.755"
} }
}, },
"4719bb45bb02427346be9634cc7a8fe3": { "4719bb45bb02427346be9634cc7a8fe3": {
@ -47,7 +47,7 @@
"index": "web.team.jiaowuxitong.classUser", "index": "web.team.jiaowuxitong.classUser",
"name": "班级成员", "name": "班级成员",
"order": "5", "order": "5",
"time": "2024-08-04 11:50:04.378" "time": "2024-08-04 21:28:17.024"
} }
}, },
"c73251765fb5286cea9c8ceefb74530c": { "c73251765fb5286cea9c8ceefb74530c": {
@ -58,7 +58,7 @@
"name": "事件流", "name": "事件流",
"order": "2", "order": "2",
"role": "creator,teacher", "role": "creator,teacher",
"time": "2024-08-04 11:52:25.148" "time": "2024-08-04 22:46:59.068"
} }
} }
} }