This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-10-01 00:12:56 +08:00
parent b1b4e0d28c
commit 0fa35941f3
3 changed files with 18 additions and 37 deletions

View File

@ -4,7 +4,7 @@ import "shylinux.com/x/community/src/gonganxitong"
type Portal struct {
gonganxitong.Portal
placeCreate string `name:"placeCreate city_name* school_name* class_name* class_type*:select grade*:select" role:"void"`
placeCreate string `name:"placeCreate city_name* school_name* class_name* class_type:select grade*:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(NewPortal(userClass{}, class{})) }

View File

@ -9,8 +9,9 @@ import (
type school struct {
Table
modify string `name:"modify school_info" role:"void"`
list string `name:"list school_name auto" role:"void"`
modify string `name:"modify info" role:"tech"`
list string `name:"list city_name school_name auto" role:"void"`
authCreate string `name:"authCreate" role:"tech"`
}
func (s school) FindOrCreateByName(m *ice.Message, arg ...string) {
@ -22,27 +23,25 @@ func (s school) FindOrCreateByName(m *ice.Message, arg ...string) {
}
}
func (s school) Modify(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(model.INFO, m.Option(model.SCHOOL_INFO)), model.NAME, m.Option(model.SCHOOL_NAME))
s.Update(m, kit.Dict(m.OptionSimple(model.INFO)), m.OptionSimple(model.UID)...)
}
func (s school) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
if m.IsTech() {
s.Select(m, arg...)
s.CityList(m)
} else if len(arg) == 1 {
msg := s.CityList(m.Spawn(), arg[0])
s.Select(m, model.CITY_UID, msg.Append(model.UID))
} else if len(arg) == 2 {
msg := s.CityList(m.Spawn(), arg[0])
s.Select(m, model.CITY_UID, msg.Append(model.UID), model.NAME, arg[1])
if m.Append(model.AUTH_UID) == "" && m.IsTech() {
m.EchoInfoButton("请申请学校认证", s.AuthCreate)
}
} else {
msg := s.Select(m.Spawn(), model.NAME, arg[0])
m.Option(model.SCHOOL_NAME, msg.Append(model.NAME))
m.Option(model.SCHOOL_INFO, msg.Append(model.INFO))
m.Option(model.SCHOOL_AVATAR, msg.Append(model.AVATAR))
m.Option(model.SCHOOL_BACKGROUND, msg.Append(model.BACKGROUND))
msg.Table(func(value ice.Maps) {
if value[model.AUTH_UID] != "" {
m.Cmdy("web.team.renzhengshouquan.auth", value[model.AUTH_UID])
}
})
kit.If(m.IsTech(), func() { m.Action(s.Modify) })
m.Display("")
}
}
func (s school) AuthCreate(m *ice.Message, arg ...string) {
msg := m.Cmd("web.team.gonganxitong.city", s.Select, model.UID, m.Option(model.CITY_UID))
s.Table.AuthCreate(m, 5, msg.Append(model.AUTH_UID), m.OptionSimple(model.UID)...)
}
func init() { ice.TeamCtxCmd(school{}) }

View File

@ -1,18 +0,0 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { msg.Option("_share_title", msg.Option("school_name"))
can.ui = can.page.Appends(can, can._output, [html.HEAD, html.LIST])
can.page.Append(can, can.ui.head, [{img: can.misc.Resource(can, "usr/icons/background.jpg")}])
can.page.Append(can, can.ui.head, [can.onimport.itemcard(can, {avatar: msg.Option("school_avatar")}, [
{view: html.TITLE, list: [msg.Option("school_name"), can.onimport.titleAction(can, msg)]},
{view: html.STATUS, list: [msg.Option("school_info")]},
])])
can.onimport.myView(can, msg, function(value) {
return [
{view: html.TITLE, list: [value.name]},
{view: html.STATUS, list: [value.info]},
]
}, function(event, value) {
// can.onimport.myPlugin(can, {space: value.space, index: value.index, args: [value.place_uid]})
}, can.ui.list)
},
})