diff --git a/src/gonganxitong/portal.css b/src/gonganxitong/portal.css index 05cc6df..690a366 100644 --- a/src/gonganxitong/portal.css +++ b/src/gonganxitong/portal.css @@ -50,7 +50,7 @@ $output>div>div.list>div.role span.leader.select { border-bottom:var(--box-dange $output>div>div.list>div.role span.boss.select { border-bottom:var(--box-danger); } $output>div>div.list>div.output>div.item.index:not(.hide) { padding:5px 10px; display:flex; flex-direction:column; align-items:center; float:left; } $output>div>div.list>div.output>div.item.index img { height:36px; width:36px; object-fit:contain; } -$output>div>div.list>div.output>div.item.index span { font-size:12px; white-space:pre; } +$output>div>div.list>div.output>div.item.index span { font-size:12px; white-space:pre; max-width:80px; } $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); } diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index 142a835..77e01f3 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -128,7 +128,7 @@ func (s Portal) List(m *ice.Message, arg ...string) { } if m.Option(model.USER_UID) == "" || m.Cmd(s.user, s.Table.Select, model.UID, m.Option(model.USER_UID)).Length() == 0 { if msg := m.Cmd(s.user, s.Table.Select, model.OPEN_ID, m.Option(ice.MSG_USERNAME)); msg.Length() == 0 { - msg := m.Cmd(s.user, s.Table.Create, m.Option(ice.MSG_USERNAME)) + msg := m.Cmd(s.user, s.Table.Create, m.Option(ice.MSG_USERNAME), "", m.OptionDefault(ice.MSG_USERNICK, m.Option(ice.MSG_USERNAME))) m.ProcessCookie(model.USER_UID, msg.Result()) } else { m.ProcessCookie(model.USER_UID, msg.Append(model.UID)) diff --git a/src/gonganxitong/portal.js b/src/gonganxitong/portal.js index 1919e5a..a9728d1 100644 --- a/src/gonganxitong/portal.js +++ b/src/gonganxitong/portal.js @@ -246,16 +246,16 @@ Volcanos(chat.ONEXPORT, { can.ui.role && can.onmotion.toggle(can, can.ui.role, value._role == "creator") parseInt(role) > 0 || can.ui.role && can.onmotion.select(can, can.ui.role, html.SPAN, can.page.SelectOne(can, can.ui.role, "span."+role)) can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) { var list = target.className.split(" ") - if (list.indexOf("issued") > -1 && value.auth_status != "issued") { + if (list.indexOf(log.DEBUG) > -1 && !can.misc.isDebug(can)) { can.onmotion.toggle(can, target, false) - } else if (list.indexOf("tech") > -1 && can.user.info.userrole != "tech") { - can.onmotion.toggle(can, target, false) - } else if (list.indexOf("debug") > -1 && !can.misc.isDebug(can)) { + } else if (list.indexOf(aaa.TECH) > -1 && !can.user.isTechOrRoot(can)) { can.onmotion.toggle(can, target, false) } else if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value._type) == -1) { can.onmotion.toggle(can, target, false) } else if (list.indexOf(aaa.ROLE) > -1 && (list.indexOf(role) == -1 && role != "creator")) { can.onmotion.toggle(can, target, false) + } else if (list.indexOf("issued") > -1 && value.auth_status != "issued") { + can.onmotion.toggle(can, target, false) } else { can.onmotion.toggle(can, target, true) } diff --git a/src/gonganxitong/service.go b/src/gonganxitong/service.go index cc6395b..f541453 100644 --- a/src/gonganxitong/service.go +++ b/src/gonganxitong/service.go @@ -45,40 +45,6 @@ func (s service) Update(m *ice.Message, arg ...string) { s.Table.Update(m, kit.Dict(arg, m.OptionSimple(mdb.NAME, mdb.ICON), nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions()), model.UID, uid) 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, m.Cmdx(web.SPACE, m.Option(web.DREAM), code.AUTOGEN, code.IMPORT, m.Option(mdb.NAME))) - // m.Option(nfs.MODULE, code.AutogenImport(m.Message, m.Option(mdb.NAME))) - if m.Option(web.DREAM) != "" { - m.Cmd(web.SPACE, m.Option(web.DREAM), nfs.DEFS, "src/template/web.code.autogen/demo.go", msg.Template("src/template/web.code.autogen/demo.go")) - } - 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))) - m.Option("TABLE", strings.ToUpper(table)) - m.Option("Table", kit.Capital(table)) - m.Option("table", kit.LowerCapital(table)) - m.Option("what", kit.LowerCapital(table)) - save := func(name string, arg ...string) { - m.Cmd(web.SPACE, m.Option(web.DREAM), nfs.DEFS, path.Join(p, name), msg.Template(from+kit.Select(name, arg, 0))) - } - save("model/model.go") - save("common.go") - save("portal.go") - save("portal.json") - save("user"+m.Option("Class")+".go", "userClass.go") - save(m.Option("class")+".go", "class.go") - kit.For(kit.Split(m.Option(mdb.TABLE)), func(table string) { - msg.Option(mdb.TABLE, kit.LowerCapital(table)) - save(m.Option(mdb.TABLE)+".go", "homework.go") - save(m.Option(mdb.TABLE)+".js", "homework.js") - }) -} -func (s service) Compile(m *ice.Message, arg ...string) { - m.Cmdy(code.VIMER, code.COMPILE) -} func (s service) Oauth(m *ice.Message, arg ...string) { m.Options(m.Cmd(web.CHAT_WX_ACCESS).AppendSimple()) m.Option("sess_cmd", kit.JoinWord(m.Prefix(aaa.SESS), mdb.CREATE)) @@ -88,6 +54,47 @@ func (s service) Oauth(m *ice.Message, arg ...string) { m.Cmd(grant{}, web.HEADER) m.ProcessHold() } +func (s service) Autogen(m *ice.Message, arg ...string) { + p, table := path.Join(nfs.SRC, m.Option(mdb.NAME)), m.Option(mdb.TABLE) + m.Option(nfs.MODULE, m.Cmdx(web.SPACE, m.Option(web.DREAM), code.AUTOGEN, code.IMPORT, 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))) + m.Option("TABLE", strings.ToUpper(table)) + m.Option("Table", kit.Capital(table)) + m.Option("table", kit.LowerCapital(table)) + m.Option("what", kit.LowerCapital(table)) + msg := m.Cmd(api.GONGANXITONG_SERVICE) + cmd := func(arg ...string) { m.Cmd(web.SPACE, m.Option(web.DREAM), arg) } + if m.Option(web.DREAM) != "" { + option := func(ctx, mod string) { cmd(code.AUTOGEN, code.IMPORT, mod, ctx, nfs.SRC_OPTION_GO) } + option("shylinux.com/x/mysql-story", "db/mysql") + option("shylinux.com/x/mysql-story", "db/sqlite") + option("shylinux.com/x/community", "gonganxitong") + option("shylinux.com/x/community", "renzhengshouquan") + demo := func(p string) { cmd(nfs.SAVE, p, m.Cmdx(nfs.CAT, p)) } + demo("src/template/web.code.autogen/demo.go") + demo("src/template/web.code.go/demo.go") + demo("src/template/web.code.js/demo.js") + } + save := func(name string, arg ...string) { + cmd(nfs.DEFS, path.Join(p, name), msg.Template("template/"+kit.Select(name, arg, 0))) + } + save("model/model.go") + save("common.go") + save("portal.go") + save("portal.json") + save("user"+m.Option("Class")+".go", "userClass.go") + save(m.Option("class")+".go", "class.go") + kit.For(kit.Split(m.Option(mdb.TABLE)), func(table string) { + msg.Option(mdb.TABLE, kit.LowerCapital(table)) + save(table+".go", "homework.go") + save(table+".js", "homework.js") + }) +} +func (s service) Compile(m *ice.Message, arg ...string) { + m.Cmdy(code.VIMER, code.COMPILE) +} func (s service) List(m *ice.Message, arg ...string) { if len(arg) < 2 { s.Orders(m, s.Desc(model.UPDATED_AT)).Select(m) @@ -95,7 +102,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, s.Code, s.Data).Action(s.Autogen, s.Oauth) + m.PushAction(s.Open, s.Conf, s.Code, s.Data).Action(s.Oauth, s.Autogen) } else { m.PushAction(s.Open).Action() } diff --git a/src/gonganxitong/user.go b/src/gonganxitong/user.go index 4da3a19..e1f4f7b 100644 --- a/src/gonganxitong/user.go +++ b/src/gonganxitong/user.go @@ -66,7 +66,7 @@ func (s user) List(m *ice.Message, arg ...string) { func (s user) SelectTotal(m *ice.Message, arg ...string) string { msg := m.Spawn() s.Fields(msg, "count(*) AS total") - return s.Select(msg, arg...).Append("total") + return s.Select(msg, arg...).Append(model.TOTAL) } func (s user) Email(m *ice.Message, arg ...string) { s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL))) @@ -76,10 +76,8 @@ func (s user) AuthCreate(m *ice.Message, arg ...string) { if msg.Length() == 0 { s.Insert(m.Spawn(), model.UID, m.Option(model.USER_UID), model.NAME, m.Option(ice.MSG_USERNAME)) m.Options(model.NAME, m.Option(ice.MSG_USERNAME)) - m.Info("what %v", m.Option(model.NAME)) } else { m.Options(msg.AppendSimple(model.NAME, model.INFO)) - m.Info("what %v", m.Option(model.NAME)) } s.Table.AuthCreate(m, 2, m.Option(model.AUTH_UID)) } diff --git a/src/renzhengshouquan/profile.js b/src/renzhengshouquan/profile.js index 372e178..e68d4be 100644 --- a/src/renzhengshouquan/profile.js +++ b/src/renzhengshouquan/profile.js @@ -1,7 +1,7 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.ui = can.page.Appends(can, can._output, [html.HEAD, html.LIST, "from"]) msg.Table(function(value) { - can.page.Append(can, can.ui.head, [{img: can.misc.Resource(can, value.background||html.BACKGROUND_JPG), onclick: function(event) { + can.page.Append(can, can.ui.head, [{img: can.misc.Resource(can, value.background||html.BACKGROUND_PNG), onclick: function(event) { can.onaction.updateBackground && can.onaction.updateBackground(event, can) }}]) can.page.Append(can, can.ui.head, [can.onimport.itemcard(can, value, [ diff --git a/src/template/web.code.autogen/demo.go b/src/template/web.code.autogen/demo.go index 3eecd76..0a53642 100644 --- a/src/template/web.code.autogen/demo.go +++ b/src/template/web.code.autogen/demo.go @@ -4,6 +4,7 @@ import "shylinux.com/x/ice" type {{.Option "name"}} struct { Tables + order string `data:"1"` fields string `data:"title,content,user_uid"` create string `name:"create title* content*" role:"leader"` remove string `name:"remove" role:"leader"` diff --git a/src/template/web.code.go/demo.go b/src/template/web.code.go/demo.go new file mode 100644 index 0000000..0a53642 --- /dev/null +++ b/src/template/web.code.go/demo.go @@ -0,0 +1,17 @@ +package {{.Option "zone"}} + +import "shylinux.com/x/ice" + +type {{.Option "name"}} struct { + Tables + order string `data:"1"` + 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"}}{}) }