mirror of
https://shylinux.com/x/education
synced 2025-04-25 10:08:05 +08:00
add some
This commit is contained in:
parent
7e14e50872
commit
4fe3e79a48
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
||||
|
||||
type document struct {
|
||||
Table
|
||||
fields string `data:"subject,grade,document_type,title,content,icon,link"`
|
||||
fields string `data:"subject,grade,document_type,title,content,icon,link,user_uid"`
|
||||
create string `name:"create subject* grade* document_type*:select title* content* icon link" role:"teacher"`
|
||||
remove string `name:"remove" role:"teacher"`
|
||||
}
|
||||
|
||||
func (s document) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
|
||||
func (s document) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
|
||||
func (s document) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
|
||||
func init() { ice.TeamCtxCmd(document{}) }
|
||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.myView(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [value.title]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at)]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value)]},
|
||||
{view: html.STATUS, list: [value.school, value.grade, value.subject]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
{view: html.OUTPUT, list: [{type: "a", href: value.link, inner: "在线阅读"}]},
|
||||
|
@ -48,10 +48,10 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
func (s Table) SelectJoinSchool(m *ice.Message) *ice.Message {
|
||||
return s.SelectJoin(m, school{}, model.NAME, model.CITY_UID)
|
||||
}
|
||||
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
|
||||
func (s Table) CheckRole(m *ice.Message, arg ...string) {
|
||||
role := UserClassRole(s.UserPlaceRole(m))
|
||||
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserClassCreator.String())...), role.String())
|
||||
return m
|
||||
m.Option(model.USER_ROLE, kit.Format(role))
|
||||
}
|
||||
|
||||
type Tables struct{ Table }
|
||||
|
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
||||
|
||||
type homework struct {
|
||||
Table
|
||||
fields string `data:"title,content"`
|
||||
fields string `data:"title,content,user_uid"`
|
||||
create string `name:"create title* content*" role:"teacher"`
|
||||
remove string `name:"remove" role:"leader"`
|
||||
}
|
||||
|
||||
func (s homework) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
|
||||
func (s homework) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
|
||||
func (s homework) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
|
||||
func init() { ice.TeamCtxCmd(homework{}) }
|
||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.myView(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [value.title]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
] })
|
||||
},
|
||||
|
@ -10,6 +10,7 @@ const (
|
||||
TITLE = "title"
|
||||
CONTENT = "content"
|
||||
USER_UID = "user_uid"
|
||||
USER_ROLE = "user_role"
|
||||
USER_CLASS_ROLE = "user_class_role"
|
||||
CLASS_UID = "class_uid"
|
||||
CLASS_NAME = "class_name"
|
||||
|
@ -15,7 +15,7 @@ func (s school) List(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s school) FindOrCreateByName(m *ice.Message, arg ...string) {
|
||||
if msg := m.Cmd(s, s.Select, model.NAME, arg[3], arg[0], arg[1]); msg.Length() == 0 {
|
||||
msg := m.Cmd(s, s.Create, model.NAME, arg[3], arg[0], arg[1])
|
||||
msg := m.Cmd(s, s.Insert, model.NAME, arg[3], arg[0], arg[1])
|
||||
arg[2], arg[3] = model.SCHOOL_UID, msg.Result()
|
||||
} else {
|
||||
arg[2], arg[3] = model.SCHOOL_UID, msg.Append(model.UID)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"portal": "考试系统",
|
||||
"question": "场景应用",
|
||||
"question": "试题",
|
||||
"icons": {
|
||||
"question": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
},
|
||||
|
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
||||
|
||||
type question struct {
|
||||
Table
|
||||
fields string `data:"title,content"`
|
||||
fields string `data:"title,content,user_uid"`
|
||||
create string `name:"create title* content*" role:"teacher"`
|
||||
remove string `name:"remove" role:"teacher"`
|
||||
}
|
||||
|
||||
func (s question) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
|
||||
func (s question) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
|
||||
func (s question) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
|
||||
func init() { ice.TeamCtxCmd(question{}) }
|
||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.myView(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [value.title]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
] })
|
||||
},
|
||||
|
@ -2,10 +2,13 @@ package {{.Option "zone"}}
|
||||
|
||||
import "shylinux.com/x/ice"
|
||||
|
||||
type {{.Option "name"}} struct{ Tables }
|
||||
|
||||
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) {
|
||||
s.Table.List(m, arg...)
|
||||
type {{.Option "name"}} struct {
|
||||
Table
|
||||
fields string `data:"title,content,user_uid"`
|
||||
create string `name:"create title* content*" role:"leader"`
|
||||
remove string `name:"remove" role:"leader"`
|
||||
}
|
||||
|
||||
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
|
||||
func init() { ice.TeamCtxCmd({{.Option "name"}}{}) }
|
||||
|
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
||||
|
||||
type lesson struct {
|
||||
Table
|
||||
fields string `data:"title,content"`
|
||||
fields string `data:"title,content,user_uid"`
|
||||
create string `name:"create title* content*" role:"teacher"`
|
||||
remove string `name:"remove" role:"teacher"`
|
||||
}
|
||||
|
||||
func (s lesson) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
|
||||
func (s lesson) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
|
||||
func (s lesson) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
|
||||
func init() { ice.TeamCtxCmd(lesson{}) }
|
||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.myView(can, msg, function(value) { return [
|
||||
{view: html.TITLE, list: [value.title]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
|
||||
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
] })
|
||||
},
|
||||
|
@ -1,9 +1,7 @@
|
||||
{
|
||||
"portal": "在线课堂",
|
||||
"course": "课程",
|
||||
"lesson": "章节",
|
||||
"icons": {
|
||||
"course": "https://img.icons8.com/officel/80/activity-grid.png",
|
||||
"lesson": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
},
|
||||
"input": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user