diff --git a/src/gonganxitong/apply.go b/src/gonganxitong/apply.go index 5ebc6e3..ec4d8d7 100644 --- a/src/gonganxitong/apply.go +++ b/src/gonganxitong/apply.go @@ -39,16 +39,15 @@ func (s apply) List(m *ice.Message, arg ...string) { s.Select(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID)) } else if len(arg) == 2 { s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1]) - m.Table(func(value ice.Maps) { - switch ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) { - case ApplyCreate: - m.PushButton(s.Cancel, s.Submit) - case ApplySubmit: - m.EchoQRCode(s.Link(m, arg[0], s.Prefix(m, allow{}), arg[1])).Echo("请让管理员扫码或等待审批") - case ApplyRejected, ApplyApproved: - s.DoneMessage(m) - } - }) + switch ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) { + case ApplyCreate: + m.PushButton(s.Cancel, s.Submit) + case ApplySubmit: + m.EchoQRCode(s.Link(m, arg[0], s.Prefix(m, allow{}), arg[1])).Echo("请让管理员扫码或等待审批") + defer func() { m.Echo("", m.Resource(m.Append(model.USER_AVATAR))) }() + case ApplyRejected, ApplyApproved: + s.DoneMessage(m) + } } else { return } diff --git a/src/gonganxitong/common.go b/src/gonganxitong/common.go index d6810b5..5b22dcb 100644 --- a/src/gonganxitong/common.go +++ b/src/gonganxitong/common.go @@ -64,6 +64,9 @@ func (s Table) Init(m *ice.Message, arg ...string) { func (s Table) AfterMigrate(m *ice.Message, arg ...string) { kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) }) } +func (s Table) BeforeAction(m *ice.Message, arg ...string) *ice.Message { + return m +} func (s Table) Inputs(m *ice.Message, arg ...string) { switch arg[0] { case model.USER_PLACE_ROLE: @@ -135,12 +138,12 @@ func (s Table) ValueList(m *ice.Message, arg []string, fields ...ice.Any) *ice.M } if s.ValueModel(m, s.ValueList, arg...); len(arg) == 1 { s.UserPlaceInit(m) - if m.Length() == 0 { - m.Echo("没有数据") - } if s.IsLeader(m) { s.Button(m, "") } else { + if m.Length() == 0 { + m.Echo("没有数据") + } m.Action() } } @@ -459,6 +462,18 @@ func (s Table) SaveBack(m *ice.Message, arg ...string) func() { kit.For(arg, func(i int, k string) { m.Option(k, list[i]) }) } } +func (s Table) SpaceOpsCmdy(m *ice.Message, arg ...ice.Any) *ice.Message { + return s.SpaceCmdy(m, ice.OPS, arg...) +} +func (s Table) SpaceOpsCmd(m *ice.Message, arg ...ice.Any) *ice.Message { + return s.SpaceCmd(m, ice.OPS, arg...) +} +func (s Table) SpaceCmdy(m *ice.Message, space string, arg ...ice.Any) *ice.Message { + return m.Cmdy(append([]ice.Any{web.SPACE, space, kit.Dict(ice.MSG_USERROLE, aaa.TECH)}, arg...)...) +} +func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Message { + return m.Cmd(append([]ice.Any{web.SPACE, space, kit.Dict(ice.MSG_USERROLE, aaa.TECH)}, arg...)...) +} func (s Table) AutoCmdy(m *ice.Message, arg ...ice.Any) *ice.Message { defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)() return m.Cmdy(append([]ice.Any{s.findSpaceCmd(m, arg[0])}, arg[1:]...)...) diff --git a/src/gonganxitong/member.go b/src/gonganxitong/member.go index 978beb1..5c4fecf 100644 --- a/src/gonganxitong/member.go +++ b/src/gonganxitong/member.go @@ -11,6 +11,7 @@ type member struct { Tables user user order string `data:"102"` + role string `data:"leader,worker,server"` remove string `name:"remove" role:"void"` enable string `name:"enable" role:"void"` disable string `name:"disable" role:"void"` diff --git a/src/gonganxitong/portal.css b/src/gonganxitong/portal.css index ed68959..41135a4 100644 --- a/src/gonganxitong/portal.css +++ b/src/gonganxitong/portal.css @@ -14,17 +14,15 @@ $action div.item.button span { display:none; } $action div.item.button i { display:none; } $output div.title div.action div.item.notice input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } $output { background-color:var(--plugin-bg-color); } -$output>div.header { - // border-radius:100px; background-color:var(--notice-bg-color); - background-image:linear-gradient(var(--notice-bg-color), var(--plugin-bg-color)); -height:300px; width:100%; position:absolute; top:-50px; left:0; } +$output>div.header { background-image:linear-gradient(var(--notice-bg-color), var(--plugin-bg-color)); height:300px; width:100%; position:absolute; top:-50px; left:0; } $output>div.header img { height:100%; width:100%; object-fit:cover; } -$output>div.footer { border-radius:100px; background-color:var(--notice-bg-color); height:300px; width:100%; position:absolute; bottom:-100px; left:0; } +$output div.output>div.code { font-size:16px; position:relative; } +$output div.output>div.code img.avatar { border-radius:10px; height:64px !important; width:64px !important; object-fit:cover; position:absolute; top:153px; left:calc(50% - 32px); } +body.width6 $output>div.output>div.code img.avatar { top:183px; } $output>div.action>div.list { margin:0 10px; } $output>div>div.code { margin-bottom:240px; display:flex; flex-direction:column; align-items:center; } $output>div>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; } -$output>div>div.list.myplace>div.output { padding:0 10px; max-height:420px; } -// $output>div>div.list.mycount { min-height:105px; } +$output>div>div.list.myplace>div.output { padding:0 10px; max-height:320px; } $output>div>div.list.mynotice { cursor:pointer; } $output>div>div.list.mynotice:not(.hide) { display:flex; align-items:center; } $output>div>div.list.mynotice>span.title { flex-grow:1; margin:0 5px; } @@ -32,7 +30,8 @@ $output>div>div.list.mynotice>span:first-child { background-color:var(--hover-bg $output>div>div.list.mynotice>span:last-child { color:gray; } $output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; } $output>div>div.list>div.title span:first-child { flex-grow:1; } -$output>div>div.list>div.title div.action div.item.filter input:focus { width:200px; transition:width 0.5s; } +$output>div>div.list>div.title div.action div.item.filter input:focus { width:320px; transition:width 0.5s; } +body.mobile $output>div>div.list>div.title div.action div.item.filter input:focus { width:200px; transition:width 0.5s; } $output>div>div.list>div.title div.action div.item.filter input { transition:width 0.8s; } $output>div>div.list>div.title div.action { overflow:hidden; } $output>div>div.list>div.title div.action div.item { margin-right:5px; } @@ -51,19 +50,23 @@ $output>div>div.list>div.output>div.item.index img { height:36px; width:36px; ob $output>div>div.list>div.output>div.item.index span { font-size:12px; white-space:pre; } $output>div>div.list div.code { text-align:center; } $output>div>div.list div.code input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); font-size:18px; margin:auto; min-width:200px; display:block; margin-top:10px; } -$output>div>div.list fieldset.story>div.output { background-color:var(--output-bg-color); } +// $output>div>div.list fieldset.story>div.output { background-color:var(--output-bg-color); } $output div.head>img { height:200px; width:100%; object-fit:cover; } $output div.head div.item.card img { border-radius:25px; } $output div.head>div.item.card div.title div.item.button i { display:none; } $output div.tabs { height:32px; display:flex; position:unset; } $output div.tabs span { padding:5px 10px; } $output div.tabs span.select { background-color:var(--output-bg-color); color:var(--hover-fg-color); } -$output div.item.card { margin-bottom:2px; } +$output div.item.card:not(:last-child) { margin-bottom:2px; } +body:not(.mobile) $output div.item.card { background-color:var(--output-bg-color); flex-direction:row-reverse; } +body:not(.mobile) $output div.item.card>div.action { position:static; flex-shrink:0; } +body:not(.mobile) $output div.item.card>div.output { flex-grow:1; } $output div.item.card>div.output>div { width:100%; } -$output div.item.card div.title { width:100%; display:flex; align-items:center; } +$output div.item.card div.title { width:100%; display:flex; align-items:center; position:relative; } $output div.item.card div.title span:first-child { word-break:break-all; } $output div.item.card div.title span.auth { font-size:14px; } $output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; } +$output div.item.card div.title div.action input { margin-right:0; } $output div.item.card div.status span { word-break:break-all; } $output div.item.card img { border-radius:5px; padding:0; margin:0; margin-right:10px; height:48px; width:48px; min-width:48px; object-fit:cover; } $output div.item.card.sticky>div.output { background-color:var(--plugin-bg-color); color:var(--notice-bg-color); } @@ -80,8 +83,8 @@ $output span.role.danger { color:var(--danger-bg-color); } $output span.status.danger { color:var(--danger-bg-color); } $output table.content { background-color:var(--output-bg-color); } $output table.content td.action input.icons { display:unset; } -$output table.content td.action input { padding:0 20px; min-width:80px; } $output table.content td.action i { display:none; } +$output table.content.detail td.action input { padding:0 20px; min-width:80px; } $output table.content.detail tr.action input.icons { display:unset; } $output table.content.detail tr.action i { display:none; } $output table.content.detail tr.uid { display:none; } @@ -108,7 +111,6 @@ $output>fieldset.story>div.output div.item.card>div.output { padding:10px; width $output>fieldset.story>div.output div.item.card>div.output div.output { padding:5px 0; white-space:pre-line; } $output fieldset.story.form>div.output>div.code>input[type=button] { font-size:18px; margin:10px; height:36px; } $output>fieldset.story.web.team.renzhengshouquan.profile { margin-top:0; } -fieldset.web.team.renzhengshouquan.profile>div.output div.code { margin-top:60px; margin-bottom:240px; } $output>fieldset.story.web.team.credit { margin-top:0; } $output>fieldset.story.web.team.credit>div.output>div.code { margin-top:32px; } $output>fieldset.message div.tabs span.select { border-top:var(--box-border); } @@ -131,6 +133,7 @@ $output.public>div>div.list>div.title { display:none; } $output.public>div>div.list.myplace>div.output { padding:0; } $output.public>div>div.list.myplace div.item.card div.output { padding:0; } fieldset.web.team.storage.file div.item.card div.title span:first-child { flex-grow:1; } +fieldset.web.team.renzhengshouquan.profile>div.output div.code { margin-top:60px; margin-bottom:240px; } body.dark $output>div>div.list.mynotice>span:first-child { background-color:var(--hover-bg-color); color:yellow; white-space:pre; } body.mobile $output img.qrcode { width:100%; margin:0; } body.mobile div.input.float { position:absolute; top:0 !important; margin:0; width:100% !important; max-width:100% !important; } diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index e9915fc..c12e56e 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -94,6 +94,9 @@ func (s Portal) Run(m *ice.Message, arg ...string) { m.Option(s.Keys(s.Place, model.UID), arg[1]) } } + if action, ok := cmd.Actions["beforeAction"]; ok { + action.Hand(m.Message, arg[1:]...) + } if s.UserPlaceRole(m); kit.IsIn(role, "", aaa.VOID, aaa.TECH, aaa.ROOT) { kit.If(!ctx.PodCmd(m.Message, arg) && aaa.Right(m.Message, arg), func() { m.Cmdy(arg) }) } else { @@ -107,19 +110,19 @@ func (s Portal) Run(m *ice.Message, arg ...string) { }) } func (s Portal) List(m *ice.Message, arg ...string) { - if m.Option(mdb.VIEW) == mdb.TABLE { - s.Hash.List(m, arg...).PushAction(mdb.DETAIL, s.Hash.Remove).SortInt(mdb.ORDER) + if m.Option(mdb.VIEW) == mdb.TABLE || len(arg) > 0 && arg[0] == mdb.TABLE { + s.Hash.List(m, kit.Slice(arg, 1)...).PushAction(mdb.DETAIL, s.Hash.Remove).Action().SortInt(mdb.ORDER) return } m.Option(model.SERVICE_UID, ServiceUID(m)) if len(arg) == 0 { m.Cmdy(m.PrefixKey(), s.PlaceList, m.Option(model.USER_UID)).PushAction(s.PlaceRemove).Action(s.PlaceCreate) + kit.If(m.Length() > 0, func() { m.EchoQRCode(m.Cmdx("", s.Link)) }) s.Button(m, "", s.PlaceCreate) } else { if msg := s.PlaceListOption(m, arg...); arg[0] != "" && msg.Length() > 0 { defer s.AddRecent(msg, arg[0]) - defer m.Echo(msg.Append(model.CITY_NAME) + " " + msg.Append(s.Keys(s.Street, model.NAME)) + " " + msg.Append(s.Keys(s.Place, model.NAME))) - defer m.EchoQRCode(s.Link(m.Spawn(), arg[0]).Result()) + defer m.EchoQRCode(m.Cmdx("", s.Link, arg[0])) } s.Hash.List(m).SortInt(mdb.ORDER) } @@ -159,12 +162,14 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) { } else if s.Street.FindOrCreateByName(m, arg...); m.IsErr() { return } - name := m.Option(s.Keys(s.Place, model.NAME)) - arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.NAME), model.NAME, s.Keys(s.Place, model.INFO), model.INFO, s.Keys(s.Place, model.TYPE), model.TYPE) + prefix := s.Keys(s.Place, "") + for i := 0; i < len(arg); i += 2 { + arg[i] = kit.TrimPrefix(arg[i], prefix) + } if m.Options(arg).Cmdy(s.Place, s.Insert, arg[2:]).IsErr() { return } - s.RecordEventWithName(m.Options(mdb.NAME, name, s.Keys(s.Place, model.UID), m.Result()), "") + s.RecordEventWithName(m.Options(s.Keys(s.Place, model.UID), m.Result()), "") args := kit.Simple(m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID), model.ROLE, UserPlaceCreator) m.SetResult().Cmdy(s.UserPlace, s.Insert, args) args = append(args, s.Keys(s.UserPlace, model.UID), m.Result()) @@ -263,13 +268,9 @@ func (s Portal) MarketInsert(m *ice.Message, arg ...string) { m.Cmdy(s.Prefix(m, market{}), s.Create, arg) } func (s Portal) DashboardCreate(m *ice.Message, name string, arg ...string) func() { - m.Info("what %v", m.FormatChain()) - m.Info("what %v", m.Option(model.AUTH_UID)) defer s.SaveBack(m, ice.MSG_USERPOD)() kit.If(name == "", func() { name = m.Option(s.Keys(s.Place, model.NAME)) }) s.AutoCmdy(m, api.DASHBOARD_PORTAL, s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), model.DASHBOARD_NAME, name, model.DASHBOARD_TYPE, "0") - m.Info("what %v", m.Option(model.AUTH_UID)) - m.Info("what %v", m.FormatChain()) s.AutoCmd(m, api.RENZHENGSHOUQUAN_AUTH, s.UpdateField, m.OptionSimple(model.DASHBOARD_UID), model.UID, m.Option(model.AUTH_UID)) return func() { s.DashboardUpdate(m) } } @@ -344,6 +345,9 @@ func (s Portal) Show(m *ice.Message, arg ...string) { m.Cmd(s.Prefix(m, s), s.Create, ctx.INDEX, m.PrefixKey()) } func (s Portal) Link(m *ice.Message, arg ...string) *ice.Message { + if len(arg) == 0 { + return m.Echo(m.MergePodCmd("", s.Prefix(m, s))) + } return m.Echo(m.MergePodCmd("", s.Prefix(m, s), s.Keys(s.Place, model.UID), arg[0]) + "#" + kit.TrimSuffix(kit.Join([]string{arg[0], kit.Select("", arg, 1), kit.Select("", arg, 2)}, ":"), ":", ":")) } diff --git a/src/gonganxitong/portal.js b/src/gonganxitong/portal.js index 2208306..867860a 100644 --- a/src/gonganxitong/portal.js +++ b/src/gonganxitong/portal.js @@ -19,7 +19,10 @@ Volcanos(chat.ONIMPORT, { return value }, myTitle: function(can, name, help, target) { - can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, name, help)}]}]) + can.page.Appends(can, target||can.ui.list, [{view: html.TITLE, list: [{text: can.user.trans(can, name, help)}]}]) + }, + qrcode: function(can, msg, avatar, target) { target = target||can.ui.output, can.onappend.board(can, msg, target) + can.page.Append(can, can.page.SelectOne(can, target, "div.code"), [{img: can.misc.Resource(can, avatar||can.ConfIcons()||can.user.info.favicon), className: "avatar"}]) }, myPortal: function(can, msg) { can.sup.current = {} can.core.List(["_place_uid", "_place_name", "_place_type", "_user_place_role", "_street_name"], function(key) { can.Conf(key, msg.Option(key)) }) @@ -50,6 +53,7 @@ Volcanos(chat.ONIMPORT, { can.onimport.myOrder(can, msg, can.ui.myorder) } if (can.Option(PLACE_UID) == "") { var uid = can.onimport.myPlace(can, msg, can.ui.myplace) + if (msg.Length() > 0) { msg.Echo(can.ConfHelp()+" "+can.user.info.titles), can.onimport.qrcode(can, msg) } msg.Length() > 0? can.run({}, [uid], function(msg) { showIndex(can._index_msg = msg) }): can.run({}, [uid], function(msg) { can.onimport.myOrder(can, can._index_msg = msg, can.ui.myorder) }) } else { can.onappend.style(can, "public", can._output) var _msg = can.request({}); if (msg.Option(PLACE_NAME)) { _msg.Push(kit.Dict(UID, "", msg.OptionSimple( @@ -57,8 +61,9 @@ Volcanos(chat.ONIMPORT, { "member_status", "auth_status", "auth_name", "auth_info", "auth_avatar", "auth_background", "dashboard_uid", ))) } can.onimport.myPlace(can, _msg, can.ui.myplace) if (_msg.Length() == 0) { can.onimport.myOrder(can, msg, can.ui.myorder) } else { showIndex(can._index_msg = msg) } - can.onappend.board(can, msg, can.ui.output), can.onexport.value(can, can.sup.current) can.user.agent.init(can, [msg.Option(CITY_NAME), msg.Option(STREET_NAME), msg.Option("auth_info")].join(" "), msg.Option("auth_avatar")) + msg.Echo([msg.Option(CITY_NAME), msg.Option(STREET_NAME), msg.Option(PLACE_NAME)].join(" ")) + can.onexport.value(can, can.sup.current), can.onimport.qrcode(can, msg, can.sup.current.auth_avatar) } }, myPlace: function(can, msg, target) { var place_uid @@ -70,12 +75,13 @@ Volcanos(chat.ONIMPORT, { msg.Length() > 0 && can.page.Append(can, can.ui._target, msg.Table(function(value) { can.onimport.myTrans(can, value) place_uid = place_uid||value._uid, value._uid == can.onexport.place(can) && (place_uid = value._uid), place_uid == value._uid && (can.sup.current = value) return can.onimport.itemcard(can, value, can.onimport.myValue(can, value), function(event) { can.onexport.value(can, value) }) - })), msg.Result() && can.onappend.board(can, msg.Result(), can.ui._target) + })), msg.Length() == 0 && msg.Result() && can.onappend.board(can, msg.Result(), can.ui._target) return place_uid||"" }, myInit: function(can, msg, value, target) { if (!msg) { return } can.onmotion.toggle(can, target, !!value._init) - if (can.onmotion.cache(can, function() { return value._uid }, target)) { return } can.onimport.myTitle(can, "My Init", "我的初始化", target) + if (can.onmotion.cache(can, function() { return value._uid }, target)) { return } msg.Table(function(val) { if (parseInt(val.init) == parseInt(value.init)+1) { value._init = true, val.args = [value._uid] + can.onimport.myTitle(can, "My Init", "我的初始化", target) can.onappend.plugin(can, val, function(sub) { var run = sub.run; sub.run = function(event, cmds, cb) { can.onimport.myField(can, sub) run(can.request(event, {place_uid: value._uid, place_init: value.init}), cmds, function(msg) { if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { @@ -180,7 +186,7 @@ Volcanos(chat.ONACTION, { sub.Option("capital_name", "国资委") sub.Option("channel_name", "公众号") sub.Option("cloud_name", "系统云") - sub.Option("repos_name", "ContextOS") + // sub.Option("repos_name", "ContextOS") sub.Option("story_name", "ContextOS") sub.Option("reception_name", "科室1") @@ -196,7 +202,10 @@ Volcanos(chat.ONEXPORT, { value: function(can, value) { if (!value || !value._uid) { return } can.sup.current = value, can.onexport.index(can, can.sup.current) can.onexport.place(can, value._uid), can.onexport.hash(can, value._uid), can.onexport.title(can, value._name, can.ConfHelp()) can.user.agent.init(can, value.city_name+" "+value._street) - can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(item) { can.onmotion.select(can, can.ui._target, html.DIV_ITEM, item) }) + can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(target) { + can.onmotion.select(can, can.ui._target, html.DIV_ITEM, target) + can.onmotion.scrollIntoView(can, target) + }) var status = !value.member_status || value.member_status == "normal" can.ui.myinit && can.onimport.myInit(can, can._index_msg, value, can.ui.myinit) can.ui.mycount && can.onimport.myCount(can, value, can.ui.mycount) diff --git a/src/gonganxitong/portal.json b/src/gonganxitong/portal.json index 2cfc6d6..bc3779f 100644 --- a/src/gonganxitong/portal.json +++ b/src/gonganxitong/portal.json @@ -9,6 +9,7 @@ "marketInsert": "推广", "commentCreate": "评论", "applyQRCode": "邀请码", "user": "用户信息", "city": "城市信息", "street": "街道信息", "school": "学校信息", "company": "公司信息", "auth": "认证", "authCreate": "认证申请", "authCity": "城市认证", "authPersonal": "个人认证", "authService": "服务认证", "authCompany": "公司认证", + "config": "配置", "code": "编程", "data": "数据", "icons": { "user": "https://img.icons8.com/officel/80/qr-code.png", "city": "https://img.icons8.com/officel/80/qr-code.png", diff --git a/src/gonganxitong/qrcode.go b/src/gonganxitong/qrcode.go index 95af1e2..e6f9b25 100644 --- a/src/gonganxitong/qrcode.go +++ b/src/gonganxitong/qrcode.go @@ -2,6 +2,7 @@ package gonganxitong import ( "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/gonganxitong/model" ) @@ -15,18 +16,27 @@ type qrcode struct { applyQRCode string `name:"applyQRCode" role:"void"` } +func (s Table) EchoQRCode(m *ice.Message, arg ...string) *ice.Message { + m.EchoQRCode(s.Link(m, arg...)).Echo("", m.Resource(kit.Select(ice.Info.NodeIcon, m.Option(model.AUTH_AVATAR)))) + return m +} func (s qrcode) ApplyQRCode(m *ice.Message, arg ...string) { m.Option(ice.MSG_FG, "blue") - s.info(m, arg[0], "apply").EchoQRCode(s.Link(m, arg[0], s.Prefix(m, s.apply))).Echo("请让申请人扫码") + s.info(m, arg[0], "apply") + s.EchoQRCode(m, arg[0], s.Prefix(m, s.apply)).Echo("请让申请人扫码,然后审批权限") } func (s qrcode) List(m *ice.Message, arg ...string) { - s.info(m, arg[0], "portal").EchoQRCode(s.Link(m, arg[0])) + s.info(m, arg[0], "portal") + s.EchoQRCode(m, arg[0]) + m.Echo(kit.JoinWord(m.Append(model.CITY_NAME), m.Append(s.Keys(s.Street, model.NAME)), m.Append(s.Keys(s.Place, model.NAME)))) } func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) } func (s qrcode) info(m *ice.Message, place_uid, cmd string) *ice.Message { - m.Cmdy(s.Prefix(m, s.portal), s.portal.PlaceList, m.Option(model.USER_UID), place_uid).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME)) + m.Cmdy(s.Prefix(m, s.portal), s.portal.PlaceList, m.Option(model.USER_UID), place_uid) + m.Option(model.AUTH_AVATAR, m.Append(model.AUTH_AVATAR)) + m.Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME)) m.Push(model.QRCODE_TYPE, cmd).Action(s.ApplyQRCode) return m } diff --git a/src/gonganxitong/service.go b/src/gonganxitong/service.go index 28ce6a1..a3c035a 100644 --- a/src/gonganxitong/service.go +++ b/src/gonganxitong/service.go @@ -14,6 +14,7 @@ import ( "shylinux.com/x/icebergs/core/code" kit "shylinux.com/x/toolkits" + "shylinux.com/x/community/src/api" "shylinux.com/x/community/src/gonganxitong/model" ) @@ -39,18 +40,17 @@ func (s service) Update(m *ice.Message, arg ...string) { m.Cmd(s.PrefixPortal(m), Portal{}.CommandUpdate, uid) } func (s service) Autogen(m *ice.Message, arg ...string) { + table := m.Option(mdb.TABLE) + msg := m.Cmd(api.GONGANXITONG_SERVICE) + p, from := path.Join(nfs.SRC, m.Option(mdb.NAME)), "template/" + m.Option(nfs.MODULE, code.AutogenImport(m.Message, m.Option(mdb.NAME))) m.Option("CLASS", strings.ToUpper(m.Option(mdb.CLASS))) m.Option("Class", kit.Capital(m.Option(mdb.CLASS))) m.Option("class", kit.LowerCapital(m.Option(mdb.CLASS))) - table := m.Option(mdb.TABLE) m.Option("TABLE", strings.ToUpper(table)) m.Option("Table", kit.Capital(table)) m.Option("table", kit.LowerCapital(table)) - code.AutogenImport(m.Message, m.Option(mdb.NAME)) - m.Option(nfs.MODULE, path.Join(code.AutogenMod(m.Message), nfs.SRC, m.Option(mdb.NAME))) - p, from := path.Join(nfs.SRC, m.Option(mdb.NAME)), "template/" - msg := m.Cmd("web.team.gonganxitong.service") - m.Option("table", kit.LowerCapital(table)) + m.Option("what", kit.LowerCapital(table)) m.Cmd(nfs.DEFS, path.Join(p, "model/model.go"), msg.Template(from+"model/model.go")) m.Cmd(nfs.DEFS, path.Join(p, "common.go"), msg.Template(from+"common.go")) m.Cmd(nfs.DEFS, path.Join(p, "portal.go"), msg.Template(from+"portal.go")) @@ -81,7 +81,7 @@ func (s service) List(m *ice.Message, arg ...string) { s.SelectDetail(m, model.UID, arg[1]) } if m.IsTech() { - m.PushAction(s.Open, s.Conf).Action(s.Autogen, s.Compile, s.Oauth) + m.PushAction(s.Open, s.Conf, s.Code, s.Data).Action(s.Autogen, s.Compile, s.Oauth) } else { m.PushAction(s.Open).Action() } @@ -89,10 +89,23 @@ func (s service) List(m *ice.Message, arg ...string) { s.DisplayBase(m, "") } func (s service) Open(m *ice.Message, arg ...string) { - m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX))) + s.spaceOpen(m, m.Option(ctx.INDEX)) } func (s service) Conf(m *ice.Message, arg ...string) { - m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX)) + "?view=table") + s.spaceOpen(m, m.Option(ctx.INDEX), mdb.VIEW, mdb.TABLE) +} +func (s service) Code(m *ice.Message, arg ...string) { + s.spaceOpen(m, code.VIMER, nfs.PATH, nfs.SRC, nfs.FILE, s.name(m)+"/portal.go") +} +func (s service) Data(m *ice.Message, arg ...string) { + s.spaceOpen(m, web.CODE_MYSQL_QUERY, aaa.SESS, "mysql", mdb.DATABASE, s.name(m)) } func init() { ice.TeamCtxCmd(service{}) } + +func (s service) name(m *ice.Message) string { + return kit.Select("", strings.Split(m.Option(ctx.INDEX), "."), -2) +} +func (s service) spaceOpen(m *ice.Message, index string, arg ...ice.Any) { + m.ProcessOpen(kit.MergeURL(web.S(m.Option(web.SPACE))+web.C(index), arg...)) +} diff --git a/src/renzhengshouquan/profile.js b/src/renzhengshouquan/profile.js index 0192f2d..8f0e745 100644 --- a/src/renzhengshouquan/profile.js +++ b/src/renzhengshouquan/profile.js @@ -11,18 +11,16 @@ Volcanos(chat.ONIMPORT, { ], function() {})]) }) switch (msg.Append(AUTH_TYPE)) { - case "root": can.onimport.myTitle(can, "My City", "城市列表", can.ui.list); break - case "city": can.onimport.myTitle(can, "My Company", "组织列表", can.ui.list); break + case "root": can.onimport.myTitle(can, "My City", "城市列表"); break + case "city": can.onimport.myTitle(can, "My Company", "组织列表"); break default: can.onimport.myTitle(can, "My Auth", "服务列表"); break } msg.Append(AUTH_TYPE) == "personal"? can.onimport.serviceList(can, msg, can.ui.list): msg.Append(AUTH_TYPE) == "service"? can.onimport.memberList(can, msg, can.ui.list): can.onimport.authList(can, msg) - can.onimport.fromList(can, msg, can.ui.from), can.onappend.board(can, msg) + can.onimport.fromList(can, msg, can.ui.from) + can.onimport.qrcode(can, msg, msg.Append("auth_avatar")||msg.Append("avatar")||msg.Append("command_icon")||msg.Append("service_icon"), can._output) msg.Option("_share_title", msg.Append(mdb.NAME)), msg.Option("_share_content", msg.Append(mdb.INFO)), msg.Option("_share_icons", msg.Append(aaa.AVATAR)) if (!can.base.isIn(msg.Option(USER_ROLE), "1", "2", "3")) { delete(can.onaction.updateAvatar), delete(can.onaction.updateBackground) } }, - myTitle: function(can, name, help, target) { - can.page.Appends(can, target||can.ui.list, [{view: html.TITLE, list: [{text: can.user.trans(can, name, help)}]}]) - }, authList: function(can, msg, action, uid, target) { can.runAction({}, action||"authList", [uid||msg.Append(UID)], function(msg) { if (msg.Length() == 0) { return can.onmotion.hidden(can, target) } can.onimport.myView(can, msg, function(value) { @@ -52,8 +50,7 @@ Volcanos(chat.ONIMPORT, { }, can.ui.list) }) }, - serviceList: function(can, msg, target) { - can.onimport.myTitle(can, "My Auth", "服务列表") + serviceList: function(can, msg, target) { can.onimport.myTitle(can, "My Auth", "服务列表") can.onimport.authList(can, msg, "serviceList", msg.Append(USER_UID)) }, fromList: function(can, msg, target) { can.onimport.myTitle(can, "My From", "认证机构", target)