mirror of
https://shylinux.com/x/education
synced 2025-04-25 18:18:06 +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 {
|
type document struct {
|
||||||
Table
|
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"`
|
create string `name:"create subject* grade* document_type*:select title* content* icon link" role:"teacher"`
|
||||||
remove string `name:"remove" 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 (s document) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(document{}) }
|
func init() { ice.TeamCtxCmd(document{}) }
|
||||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onimport.myView(can, msg, function(value) { return [
|
can.onimport.myView(can, msg, function(value) { return [
|
||||||
{view: html.TITLE, list: [value.title]},
|
{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.STATUS, list: [value.school, value.grade, value.subject]},
|
||||||
{view: html.OUTPUT, list: [value.content]},
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
{view: html.OUTPUT, list: [{type: "a", href: value.link, inner: "在线阅读"}]},
|
{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 {
|
func (s Table) SelectJoinSchool(m *ice.Message) *ice.Message {
|
||||||
return s.SelectJoin(m, school{}, model.NAME, model.CITY_UID)
|
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))
|
role := UserClassRole(s.UserPlaceRole(m))
|
||||||
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserClassCreator.String())...), role.String())
|
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 }
|
type Tables struct{ Table }
|
||||||
|
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
|||||||
|
|
||||||
type homework struct {
|
type homework struct {
|
||||||
Table
|
Table
|
||||||
fields string `data:"title,content"`
|
fields string `data:"title,content,user_uid"`
|
||||||
create string `name:"create title* content*" role:"teacher"`
|
create string `name:"create title* content*" role:"teacher"`
|
||||||
remove string `name:"remove" role:"leader"`
|
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 (s homework) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(homework{}) }
|
func init() { ice.TeamCtxCmd(homework{}) }
|
||||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onimport.myView(can, msg, function(value) { return [
|
can.onimport.myView(can, msg, function(value) { return [
|
||||||
{view: html.TITLE, list: [value.title]},
|
{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]},
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
] })
|
] })
|
||||||
},
|
},
|
||||||
|
@ -10,6 +10,7 @@ const (
|
|||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
CONTENT = "content"
|
CONTENT = "content"
|
||||||
USER_UID = "user_uid"
|
USER_UID = "user_uid"
|
||||||
|
USER_ROLE = "user_role"
|
||||||
USER_CLASS_ROLE = "user_class_role"
|
USER_CLASS_ROLE = "user_class_role"
|
||||||
CLASS_UID = "class_uid"
|
CLASS_UID = "class_uid"
|
||||||
CLASS_NAME = "class_name"
|
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) {
|
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 {
|
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()
|
arg[2], arg[3] = model.SCHOOL_UID, msg.Result()
|
||||||
} else {
|
} else {
|
||||||
arg[2], arg[3] = model.SCHOOL_UID, msg.Append(model.UID)
|
arg[2], arg[3] = model.SCHOOL_UID, msg.Append(model.UID)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"portal": "考试系统",
|
"portal": "考试系统",
|
||||||
"question": "场景应用",
|
"question": "试题",
|
||||||
"icons": {
|
"icons": {
|
||||||
"question": "https://img.icons8.com/officel/80/activity-grid.png"
|
"question": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||||
},
|
},
|
||||||
|
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
|||||||
|
|
||||||
type question struct {
|
type question struct {
|
||||||
Table
|
Table
|
||||||
fields string `data:"title,content"`
|
fields string `data:"title,content,user_uid"`
|
||||||
create string `name:"create title* content*" role:"teacher"`
|
create string `name:"create title* content*" role:"teacher"`
|
||||||
remove string `name:"remove" 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 (s question) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(question{}) }
|
func init() { ice.TeamCtxCmd(question{}) }
|
||||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onimport.myView(can, msg, function(value) { return [
|
can.onimport.myView(can, msg, function(value) { return [
|
||||||
{view: html.TITLE, list: [value.title]},
|
{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]},
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
] })
|
] })
|
||||||
},
|
},
|
||||||
|
@ -2,10 +2,13 @@ package {{.Option "zone"}}
|
|||||||
|
|
||||||
import "shylinux.com/x/ice"
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
type {{.Option "name"}} struct{ Tables }
|
type {{.Option "name"}} struct {
|
||||||
|
Table
|
||||||
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) {
|
fields string `data:"title,content,user_uid"`
|
||||||
s.Table.List(m, arg...)
|
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"}}{}) }
|
func init() { ice.TeamCtxCmd({{.Option "name"}}{}) }
|
||||||
|
@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
|
|||||||
|
|
||||||
type lesson struct {
|
type lesson struct {
|
||||||
Table
|
Table
|
||||||
fields string `data:"title,content"`
|
fields string `data:"title,content,user_uid"`
|
||||||
create string `name:"create title* content*" role:"teacher"`
|
create string `name:"create title* content*" role:"teacher"`
|
||||||
remove string `name:"remove" 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 (s lesson) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(lesson{}) }
|
func init() { ice.TeamCtxCmd(lesson{}) }
|
||||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onimport.myView(can, msg, function(value) { return [
|
can.onimport.myView(can, msg, function(value) { return [
|
||||||
{view: html.TITLE, list: [value.title]},
|
{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]},
|
{view: html.OUTPUT, list: [value.content]},
|
||||||
] })
|
] })
|
||||||
},
|
},
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"portal": "在线课堂",
|
"portal": "在线课堂",
|
||||||
"course": "课程",
|
|
||||||
"lesson": "章节",
|
"lesson": "章节",
|
||||||
"icons": {
|
"icons": {
|
||||||
"course": "https://img.icons8.com/officel/80/activity-grid.png",
|
|
||||||
"lesson": "https://img.icons8.com/officel/80/activity-grid.png"
|
"lesson": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||||
},
|
},
|
||||||
"input": {
|
"input": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user