mirror of
https://shylinux.com/x/community
synced 2025-07-01 21:21:19 +08:00
add some
This commit is contained in:
parent
38b327496c
commit
05be2c3aa5
@ -1,6 +1,6 @@
|
|||||||
~ssh
|
~ssh
|
||||||
source local.shy
|
source local.shy
|
||||||
return
|
|
||||||
~web.chat.macos
|
~web.chat.macos
|
||||||
desktop create index web.team.gonganxitong.recent name recent icon "src/gonganxitong/credit.png"
|
desktop create index web.team.gonganxitong.recent score 1000 name recent text "最近访问" icon "src/gonganxitong/credit.png"
|
||||||
desktop create index web.team.gonganxitong.service name service icon "src/gonganxitong/setting.png"
|
desktop create index web.team.gonganxitong.service score 1000 name service text "服务发现" icon "src/gonganxitong/setting.png"
|
||||||
|
return
|
||||||
|
@ -69,7 +69,8 @@ func (s Table) LoadTrans(m *ice.Message, arg ...string) {
|
|||||||
cmd := m.Target().Commands[m.CommandKey()]
|
cmd := m.Target().Commands[m.CommandKey()]
|
||||||
cmd.Icon = m.Resource(p)
|
cmd.Icon = m.Resource(p)
|
||||||
})
|
})
|
||||||
if path.Dir(h) != path.Dir(p) && m.CommandKey() != web.PORTAL {
|
// if path.Dir(h) != path.Dir(p) && m.CommandKey() != web.PORTAL {
|
||||||
|
if path.Dir(h) != path.Dir(p) {
|
||||||
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(h), "portal.json"))).Message, m.CommandKey(), m.GetCommand().Command)
|
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(h), "portal.json"))).Message, m.CommandKey(), m.GetCommand().Command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +79,14 @@ func (s Table) Init(m *ice.Message, arg ...string) {
|
|||||||
s.Table.Init(m, arg...)
|
s.Table.Init(m, arg...)
|
||||||
}
|
}
|
||||||
func (s Table) AfterInit(m *ice.Message, arg ...string) {
|
func (s Table) AfterInit(m *ice.Message, arg ...string) {
|
||||||
m.Cmd("applications", mdb.REMOVE, kit.Hashs(","+m.PrefixKey()+","))
|
if m.CommandKey() == "portal" {
|
||||||
|
cmd := m.GetCommand()
|
||||||
|
m.Cmd("applications", mdb.CREATE, web.SPACE, "", ctx.INDEX, m.PrefixKey(),
|
||||||
|
mdb.NAME, kit.Select("", strings.Split(m.PrefixKey(), "."), -2)+".portal",
|
||||||
|
mdb.TEXT, cmd.Help, mdb.ICON, kit.Select(ice.Info.NodeIcon, cmd.Icon), mdb.SCORE, "10000")
|
||||||
|
} else {
|
||||||
|
m.Cmd("applications", mdb.REMOVE, kit.Hashs(","+m.PrefixKey()+","))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func (s Table) AfterMigrate(m *ice.Message, arg ...string) {
|
func (s Table) AfterMigrate(m *ice.Message, arg ...string) {
|
||||||
kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) })
|
kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) })
|
||||||
@ -224,6 +232,8 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
value = MemberStatus(kit.Int(value)).String()
|
value = MemberStatus(kit.Int(value)).String()
|
||||||
case model.PLACE_TYPE:
|
case model.PLACE_TYPE:
|
||||||
value = PlaceType(kit.Int(value)).String()
|
value = PlaceType(kit.Int(value)).String()
|
||||||
|
case model.USER_STATUS:
|
||||||
|
value = UserStatus(kit.Int(value)).String()
|
||||||
case model.AUTH_TYPE:
|
case model.AUTH_TYPE:
|
||||||
value = AuthType(kit.Int(value)).String()
|
value = AuthType(kit.Int(value)).String()
|
||||||
case model.AUTH_STATUS:
|
case model.AUTH_STATUS:
|
||||||
|
@ -27,6 +27,7 @@ type member struct {
|
|||||||
setLanguage string `name:"setLanguage language" help:"语言" role:"worker"`
|
setLanguage string `name:"setLanguage language" help:"语言" role:"worker"`
|
||||||
sessList string `name:"sessList" role:"leader"`
|
sessList string `name:"sessList" role:"leader"`
|
||||||
userInfo string `name:"userInfo" help:"个人主页" role:"void"`
|
userInfo string `name:"userInfo" help:"个人主页" role:"void"`
|
||||||
|
userDisable string `name:"userDisable" help:"封号" style:"danger"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s member) Remove(m *ice.Message, arg ...string) {
|
func (s member) Remove(m *ice.Message, arg ...string) {
|
||||||
@ -56,13 +57,13 @@ func (s member) List(m *ice.Message, arg ...string) {
|
|||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
|
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
|
||||||
defer s.Place.RewriteAppend(m)
|
defer s.Place.RewriteAppend(m)
|
||||||
defer m.Sort(kit.Fields(model.MEMBER_STATUS, USER_PLACE_ROLE, model.SCORE, model.AUTH_STATUS, model.CREATED_AT), ice.INT, ice.INT, ice.INT_R, ice.INT, ice.STR)
|
defer m.Sort(kit.Fields(model.USER_STATUS, model.MEMBER_STATUS, USER_PLACE_ROLE, model.SCORE, model.AUTH_STATUS, model.CREATED_AT), ice.INT, ice.INT, ice.INT, ice.INT_R, ice.INT, ice.STR)
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
m.FieldsSetDetail().Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0], s.Key(s.UserPlace, model.UID), arg[1]).Action()
|
m.FieldsSetDetail().Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0], s.Key(s.UserPlace, model.UID), arg[1]).Action()
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.LANGUAGE, model.AUTH_UID)
|
s.SelectJoinUser(m, model.NAME, model.INFO, model.STATUS, model.AVATAR, model.LANGUAGE, model.AUTH_UID)
|
||||||
if s.SelectJoinAuth(m); s.IsLeader(m) {
|
if s.SelectJoinAuth(m); s.IsLeader(m) {
|
||||||
s.SelectJoinSess(m)
|
s.SelectJoinSess(m)
|
||||||
s.OtherListCmd(m, s.SessList)
|
s.OtherListCmd(m, s.SessList)
|
||||||
@ -76,6 +77,7 @@ func (s member) List(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
button := []ice.Any{}
|
button := []ice.Any{}
|
||||||
|
defer func() { m.PushButton(button...) }()
|
||||||
if value[model.AUTH_UID] == "" {
|
if value[model.AUTH_UID] == "" {
|
||||||
if value[model.USER_UID] == user_uid {
|
if value[model.USER_UID] == user_uid {
|
||||||
button = append(button, s.Auth)
|
button = append(button, s.Auth)
|
||||||
@ -95,6 +97,12 @@ func (s member) List(m *ice.Message, arg ...string) {
|
|||||||
if value[model.USER_UID] != user_uid && m.IsTech() {
|
if value[model.USER_UID] != user_uid && m.IsTech() {
|
||||||
button = append(button, s.SetCookie)
|
button = append(button, s.SetCookie)
|
||||||
}
|
}
|
||||||
|
if value[model.USER_UID] != user_uid && m.IsTech() {
|
||||||
|
if value[model.USER_STATUS] == "1" {
|
||||||
|
} else {
|
||||||
|
button = append(button, s.UserDisable)
|
||||||
|
}
|
||||||
|
}
|
||||||
if MemberStatus(kit.Int(value[model.MEMBER_STATUS])) == MemberNormal {
|
if MemberStatus(kit.Int(value[model.MEMBER_STATUS])) == MemberNormal {
|
||||||
if isCreator {
|
if isCreator {
|
||||||
switch kit.Int(value[USER_PLACE_ROLE]) {
|
switch kit.Int(value[USER_PLACE_ROLE]) {
|
||||||
@ -120,7 +128,6 @@ func (s member) List(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.PushButton(button...)
|
|
||||||
})
|
})
|
||||||
s.DisplayBase(m, "").DisplayCSS("")
|
s.DisplayBase(m, "").DisplayCSS("")
|
||||||
}
|
}
|
||||||
@ -167,6 +174,10 @@ func (s member) SetCookie(m *ice.Message, arg ...string) {
|
|||||||
m.Cmdy(s.UserPlace, s.Select, model.UID, m.Option(model.UID))
|
m.Cmdy(s.UserPlace, s.Select, model.UID, m.Option(model.UID))
|
||||||
m.ProcessCookie(ice.MSG_USERUID, m.Append(model.USER_UID))
|
m.ProcessCookie(ice.MSG_USERUID, m.Append(model.USER_UID))
|
||||||
}
|
}
|
||||||
|
func (s member) UserDisable(m *ice.Message, arg ...string) {
|
||||||
|
msg := m.Cmd(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), m.Option(model.PLACE_UID), s.Key(s.UserPlace, model.UID), m.Option(model.UID))
|
||||||
|
m.Cmdy(user{}, s.UpdateField, []string{model.STATUS, "1"}, model.UID, msg.Append(model.USER_UID))
|
||||||
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(member{Tables: newTables()}) }
|
func init() { ice.TeamCtxCmd(member{Tables: newTables()}) }
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
can.onimport.spaceView(can, value),
|
can.onimport.spaceView(can, value),
|
||||||
can.onimport.unitView(can, value, "score", "星"),
|
can.onimport.unitView(can, value, "score", "星"),
|
||||||
can.onimport.textView(can, value, USER_PLACE_ROLE),
|
can.onimport.textView(can, value, USER_PLACE_ROLE),
|
||||||
|
can.onimport.textView(can, value, "user_status"),
|
||||||
value.member_status != "normal" && can.onimport.textView(can, value, "member_status"),
|
value.member_status != "normal" && can.onimport.textView(can, value, "member_status"),
|
||||||
]},
|
]},
|
||||||
value.location && {view: html.STATUS, list: [value.location, value.system]},
|
value.location && {view: html.STATUS, list: [value.location, value.system]},
|
||||||
|
@ -23,6 +23,7 @@ const (
|
|||||||
USER_UID = "user_uid"
|
USER_UID = "user_uid"
|
||||||
USER_NAME = "user_name"
|
USER_NAME = "user_name"
|
||||||
USER_INFO = "user_info"
|
USER_INFO = "user_info"
|
||||||
|
USER_STATUS = "user_status"
|
||||||
USER_ROLE = "user_role"
|
USER_ROLE = "user_role"
|
||||||
USER_AVATAR = "user_avatar"
|
USER_AVATAR = "user_avatar"
|
||||||
USER_BACKGROUND = "user_background"
|
USER_BACKGROUND = "user_background"
|
||||||
|
@ -19,7 +19,7 @@ $action div.item.user_info { padding:10px; }
|
|||||||
$action div.item.user_info>div.name { display:flex; flex-direction:column; align-items:end; }
|
$action div.item.user_info>div.name { display:flex; flex-direction:column; align-items:end; }
|
||||||
$action div.item.user_info>div.name>span.time { font-size:10px; color:var(--label-fg-color); }
|
$action div.item.user_info>div.name>span.time { font-size:10px; color:var(--label-fg-color); }
|
||||||
$action div.item.space { flex-grow:1; background-color:transparent; cursor:default; }
|
$action div.item.space { flex-grow:1; background-color:transparent; cursor:default; }
|
||||||
$action div.item.place input { font-weight:bold; font-style:italic; }
|
body:not(.mobile) $action div.item.place input { font-weight:bold; font-style:italic; }
|
||||||
body:not(.mobile) $action div.item.scanQRCode { display:none; }
|
body:not(.mobile) $action div.item.scanQRCode { display:none; }
|
||||||
fieldset>div.output>div.tabs { display:flex; }
|
fieldset>div.output>div.tabs { display:flex; }
|
||||||
fieldset>div.output>div.tabs>div.item { padding:5px; line-height:20px; }
|
fieldset>div.output>div.tabs>div.item { padding:5px; line-height:20px; }
|
||||||
@ -78,6 +78,7 @@ $output div.item.card div.title span:first-child { word-break:break-all; }
|
|||||||
body.mobile $output div.item.card div.title span:first-child { font-weight:bold; }
|
body.mobile $output div.item.card div.title span:first-child { font-weight:bold; }
|
||||||
$output div.item.card div.title span.type { line-height:18px; }
|
$output div.item.card div.title span.type { line-height:18px; }
|
||||||
$output div.item.card div.title span.status { line-height:18px; }
|
$output div.item.card div.title span.status { line-height:18px; }
|
||||||
|
$output div.item.card div.title span.status.已封号 { color:var(--danger-bg-color); }
|
||||||
$output div.item.card div.title span.price { color:var(--danger-bg-color); }
|
$output div.item.card div.title span.price { color:var(--danger-bg-color); }
|
||||||
body.width1 $output div.item.card div.title span.price { margin-left:auto; }
|
body.width1 $output div.item.card div.title span.price { margin-left:auto; }
|
||||||
$output div.item.card div.title span.score { background-color:var(--hover-bg-color); color:var(--danger-bg-color); padding:0 5px; }
|
$output div.item.card div.title span.score { background-color:var(--hover-bg-color); color:var(--danger-bg-color); padding:0 5px; }
|
||||||
|
@ -73,7 +73,7 @@ func (s Portal) Command(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
func (s Portal) Run(m *ice.Message, arg ...string) {
|
func (s Portal) Run(m *ice.Message, arg ...string) {
|
||||||
if m.Option(ice.MSG_USERSTATUS) == "1" {
|
if m.Option(ice.MSG_USERSTATUS) == "1" {
|
||||||
m.Echo("用户已禁用").Option("display.style", html.OUTPUT)
|
m.Echo("此用户已封号").Option("display.style", html.OUTPUT)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if m.Option(model.MESSAGE_UID) != "" {
|
if m.Option(model.MESSAGE_UID) != "" {
|
||||||
@ -141,7 +141,7 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
func (s Portal) List(m *ice.Message, arg ...string) {
|
func (s Portal) List(m *ice.Message, arg ...string) {
|
||||||
if m.Option(ice.MSG_USERSTATUS) == "1" {
|
if m.Option(ice.MSG_USERSTATUS) == "1" {
|
||||||
m.Echo("用户已禁用").Option("display.style", html.OUTPUT)
|
m.Echo("此用户已封号").Option("display.style", html.OUTPUT)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Option(model.USER_UID, m.Option(ice.MSG_USERUID))
|
m.Option(model.USER_UID, m.Option(ice.MSG_USERUID))
|
||||||
@ -182,6 +182,7 @@ func (s Portal) List(m *ice.Message, arg ...string) {
|
|||||||
p := kit.ExtChange(m.Resource(ctx.GetCmdFile(m.Message, m.PrefixKey())), "js")
|
p := kit.ExtChange(m.Resource(ctx.GetCmdFile(m.Message, m.PrefixKey())), "js")
|
||||||
defer func() { m.Option(ice.MSG_DISPLAY, p+","+m.Option(ice.MSG_DISPLAY)) }()
|
defer func() { m.Option(ice.MSG_DISPLAY, p+","+m.Option(ice.MSG_DISPLAY)) }()
|
||||||
s.DisplayBase(m, "").DisplayCSS("")
|
s.DisplayBase(m, "").DisplayCSS("")
|
||||||
|
m.Option("display.style", "portal")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Portal) Create(m *ice.Message, arg ...string) {
|
func (s Portal) Create(m *ice.Message, arg ...string) {
|
||||||
@ -214,6 +215,9 @@ func (s Portal) Link(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
return m.Echo(p + "#" + h)
|
return m.Echo(p + "#" + h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s Portal) PlaceUIDKey(m *ice.Message, arg ...string) {
|
||||||
|
m.Echo(s.Keys(s.Place, model.UID))
|
||||||
|
}
|
||||||
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
|
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
|
||||||
m.OptionDefault(model.USER_UID, m.Option(ice.MSG_USERUID))
|
m.OptionDefault(model.USER_UID, m.Option(ice.MSG_USERUID))
|
||||||
if s.city.FindOrCreateByName(m, arg...); m.IsErr() {
|
if s.city.FindOrCreateByName(m, arg...); m.IsErr() {
|
||||||
|
@ -3,7 +3,14 @@ var USER_UID = "user_uid", USER_ROLE = "user_role", AUTH_UID = "auth_uid", AUTH_
|
|||||||
var TYPE = "type", ROLE = "role", STATUS = "status"
|
var TYPE = "type", ROLE = "role", STATUS = "status"
|
||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onappend.style(can, html.OUTPUT), can.onimport.myPortal(can, msg)
|
if (can.isCmdMode()) {
|
||||||
|
can.onappend.style(can, html.OUTPUT)
|
||||||
|
} else {
|
||||||
|
can.onmotion.hidden(can, can._option)
|
||||||
|
can.onmotion.hidden(can, can._action)
|
||||||
|
can.onmotion.hidden(can, can._status)
|
||||||
|
}
|
||||||
|
can.onimport.myPortal(can, msg)
|
||||||
can.misc.Cookie(can, "user_uid", "")
|
can.misc.Cookie(can, "user_uid", "")
|
||||||
},
|
},
|
||||||
qrcode: function(can, msg, avatar, target) { target = target||can.ui.output, can.onappend.board(can, msg, target)
|
qrcode: function(can, msg, avatar, target) { target = target||can.ui.output, can.onappend.board(can, msg, target)
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
"My Place": "我的场景",
|
"My Place": "我的场景",
|
||||||
"user_uid": "用户",
|
"user_uid": "用户",
|
||||||
"user_name": "用户昵称",
|
"user_name": "用户昵称",
|
||||||
|
"user_status": "用户状态",
|
||||||
"user_info": "用户信息",
|
"user_info": "用户信息",
|
||||||
"user_avatar": "用户头像",
|
"user_avatar": "用户头像",
|
||||||
"user_background": "用户背景",
|
"user_background": "用户背景",
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package gonganxitong
|
package gonganxitong
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
"shylinux.com/x/community/src/gonganxitong/model"
|
"shylinux.com/x/community/src/gonganxitong/model"
|
||||||
@ -16,6 +19,8 @@ type qrcode struct {
|
|||||||
applyQRCode string `name:"applyQRCode" help:"邀请码" role:"void"`
|
applyQRCode string `name:"applyQRCode" help:"邀请码" role:"void"`
|
||||||
placeQRCode string `name:"placeQRCode" help:"场景码" role:"void"`
|
placeQRCode string `name:"placeQRCode" help:"场景码" role:"void"`
|
||||||
scanQRCode string `name:"scanQRCode" help:"扫码" role:"void"`
|
scanQRCode string `name:"scanQRCode" help:"扫码" role:"void"`
|
||||||
|
enter string `name:"enter" help:"进入" role:"void"`
|
||||||
|
open string `name:"open" help:"打开" role:"void"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s qrcode) ApplyQRCode(m *ice.Message, arg ...string) {
|
func (s qrcode) ApplyQRCode(m *ice.Message, arg ...string) {
|
||||||
@ -29,11 +34,35 @@ func (s qrcode) PlaceQRCode(m *ice.Message, arg ...string) {
|
|||||||
func (s qrcode) ScanQRCode(m *ice.Message, arg ...string) {
|
func (s qrcode) ScanQRCode(m *ice.Message, arg ...string) {
|
||||||
m.FieldsSetDetail()
|
m.FieldsSetDetail()
|
||||||
for i := 0; i < len(arg); i += 2 {
|
for i := 0; i < len(arg); i += 2 {
|
||||||
m.Push(arg[i], arg[i+1])
|
if arg[i] != "_origin" {
|
||||||
|
m.Push(arg[i], arg[i+1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(m.Append("text"), "http") {
|
||||||
|
msg := m.Spawn()
|
||||||
|
web.ParseURL(msg.Message, m.Append("text"))
|
||||||
|
m.Push("space", msg.Option("pod"))
|
||||||
|
if strings.Contains(m.Append("text"), "#") {
|
||||||
|
ls := strings.Split(strings.Split(m.Append("text"), "#")[1], ":")
|
||||||
|
m.Push("index", ls[1])
|
||||||
|
m.Push("args", strings.TrimSuffix(kit.Join([]string{ls[0], kit.Select("", ls, 2)}, ","), ","))
|
||||||
|
} else {
|
||||||
|
m.Push("index", msg.Option("cmd"))
|
||||||
|
m.Push("args", m.Append(m.Cmdx(web.SPACE, msg.Option("pod"), msg.Option("cmd"), "placeUIDKey")))
|
||||||
|
}
|
||||||
|
m.PushAction(s.Enter, s.Open, "copyText")
|
||||||
|
} else {
|
||||||
|
m.PushAction("copyText")
|
||||||
}
|
}
|
||||||
m.EchoQRCode(m.Append("text")).Action(s.ApplyQRCode, s.PlaceQRCode, s.ScanQRCode)
|
m.EchoQRCode(m.Append("text")).Action(s.ApplyQRCode, s.PlaceQRCode, s.ScanQRCode)
|
||||||
m.Display("/plugin/table.js")
|
m.Display("/plugin/table.js")
|
||||||
}
|
}
|
||||||
|
func (s qrcode) Enter(m *ice.Message, arg ...string) {
|
||||||
|
m.ProcessPodCmd(m.Option("space"), m.Option("index"), kit.Split(m.Option("args")), arg...)
|
||||||
|
}
|
||||||
|
func (s qrcode) Open(m *ice.Message, arg ...string) {
|
||||||
|
m.ProcessOpen(m.Option("text"))
|
||||||
|
}
|
||||||
func (s qrcode) List(m *ice.Message, arg ...string) {
|
func (s qrcode) List(m *ice.Message, arg ...string) {
|
||||||
s.PlaceQRCode(m, arg[0])
|
s.PlaceQRCode(m, arg[0])
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package gonganxitong
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/core/chat/macos"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
"shylinux.com/x/community/src/api"
|
"shylinux.com/x/community/src/api"
|
||||||
@ -121,6 +124,11 @@ func init() { ice.TeamCtxCmd(setting{Table: newTable()}) }
|
|||||||
func (s Table) HashSelect(m *ice.Message, arg ...string) {
|
func (s Table) HashSelect(m *ice.Message, arg ...string) {
|
||||||
s.Hash.Select(m, arg...)
|
s.Hash.Select(m, arg...)
|
||||||
}
|
}
|
||||||
|
func (s Table) DesktopInsert(m *ice.Message, arg ...string) {
|
||||||
|
macos.DeskAppend(m.Message, m.Option("icons"), s.PrefixPortal(m), ctx.ARGS, m.Option(model.PLACE_UID),
|
||||||
|
mdb.TEXT, m.Option("place_name"), mdb.SCORE, m.OptionDefault(mdb.SCORE, "20000"),
|
||||||
|
)
|
||||||
|
}
|
||||||
func (s Table) SettingCreate(m *ice.Message, arg ...string) {
|
func (s Table) SettingCreate(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(s.PrefixSetting(m), s.Create, model.NAME, arg[0],
|
m.Cmdy(s.PrefixSetting(m), s.Create, model.NAME, arg[0],
|
||||||
model.TYPE, kit.Select(SETTING_RADIO, arg, 1),
|
model.TYPE, kit.Select(SETTING_RADIO, arg, 1),
|
||||||
|
@ -4,22 +4,30 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
if (value.type == "title") { return {view: [[html.ITEM, html.TITLE], "", can.user.trans(can, value.name, value.help)]} }
|
if (value.type == "title") { return {view: [[html.ITEM, html.TITLE], "", can.user.trans(can, value.name, value.help)]} }
|
||||||
return {view: [[html.ITEM, value.type, value.name]], list: [{text: [can.user.trans(can, value.name, value.help, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]}
|
return {view: [[html.ITEM, value.type, value.name]], list: [{text: [can.user.trans(can, value.name, value.help, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]}
|
||||||
}))
|
}))
|
||||||
can.onappend.input(can, {type: html.BUTTON, name: "website", value: "进入官网", onclick: function() {
|
can.user.trans(can, {
|
||||||
can.user.open("/")
|
desktopInsert: "添加到桌面",
|
||||||
}}, "", can._output)
|
openAddress: "选择地址",
|
||||||
can.user.isMobile && can.onappend.input(can, {type: html.BUTTON, name: "scan", value: "扫码识别", onclick: function(event) {
|
openLocation: "查看位置",
|
||||||
can.user.agent.scanQRCode(can, function(value) {
|
getLocation: "上报位置",
|
||||||
var data = can.misc.ParseURL(can, value.text)
|
scan: "扫码",
|
||||||
can.onimport.myStory(can, {space: data.pod, index: data.cmd, opts: data})
|
portal: "进入官网",
|
||||||
can.page.Append(can, can._output, [{text: value.text, onclick: function(event) {
|
logout: "退出登录",
|
||||||
can.user.copy(event, can, value.text)
|
})
|
||||||
}}])
|
can.core.List([
|
||||||
})
|
can.user.isTechOrRoot(can) && "desktopInsert",
|
||||||
}}, "", can._output)
|
can.user.isMobile && can.user.isWeiXin && "openAddress",
|
||||||
can.onappend.input(can, {type: html.BUTTON, name: "logout", value: "退出登录", style: "danger", onclick: function() {
|
can.user.isMobile && can.user.isWeiXin && "openLocation",
|
||||||
if (can.user.confirm("请确认退出登录")) { can.misc.CookieSessid(can, ""), location.reload() }
|
can.user.isMobile && can.user.isWeiXin && "getLocation",
|
||||||
}}, "", can._output)
|
can.user.isMobile && can.user.isWeiXin && "scan",
|
||||||
|
"portal",
|
||||||
|
"logout",
|
||||||
|
], function(item) { if (!item) { return } typeof item == "string" && (item = {name: item})
|
||||||
|
item.type = item.type||html.BUTTON, item.onclick = function(event) {
|
||||||
|
var cb = can.onaction[item.name]; if (cb) { return cb(event, can, item.name) }
|
||||||
|
var cb = can.sup.onaction[item.name]; if (cb) { return cb(event, can.sup, item.name) }
|
||||||
|
can.runAction(event, item.name, [])
|
||||||
|
}, can.onappend.input(can, item, "", can._output)
|
||||||
|
})
|
||||||
if (!can.misc.isDebug(can)) { return }
|
if (!can.misc.isDebug(can)) { return }
|
||||||
can.user.isTechOrRoot(can) && can.onimport._plugin(can, {index: "can.cookie"})
|
can.user.isTechOrRoot(can) && can.onimport._plugin(can, {index: "can.cookie"})
|
||||||
localStorage.length && can.onimport._plugin(can, {index: "can.localStorage"})
|
localStorage.length && can.onimport._plugin(can, {index: "can.localStorage"})
|
||||||
@ -59,8 +67,24 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
}}
|
}}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONACTION, {
|
||||||
|
desktopInsert: function(event, can, button) {
|
||||||
|
var icons = ""; can.core.List(can._stacks_current, function(p) { if (!p.current) { return } icons = p.current.icons||p.ConfIcons()||can.misc.Resource(can, can._stacks_current[0].Conf("icon"), can._stacks_current[0].Conf("space"))||icons })
|
||||||
|
can.runAction(can.request(event, {icons: icons, score: "20000"}), button, [])
|
||||||
|
},
|
||||||
|
scan: function(event, can, button) {
|
||||||
|
can.user.agent.scanQRCode(can, function(value) {
|
||||||
|
var data = can.misc.ParseURL(can, value.text)
|
||||||
|
can.onimport.myStory(can, {space: data.pod, index: data.cmd, opts: data})
|
||||||
|
can.page.Append(can, can._output, [{text: value.text, onclick: function(event) {
|
||||||
|
can.user.copy(event, can, value.text)
|
||||||
|
}}])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
portal: function(event, can, button) {
|
||||||
|
can.user.open("/")
|
||||||
|
},
|
||||||
logout: function(event, can, button) {
|
logout: function(event, can, button) {
|
||||||
can.user.logout(can)
|
if (can.user.confirm("请确认退出登录")) { can.misc.CookieSessid(can, ""), location.reload() }
|
||||||
},
|
},
|
||||||
})
|
})
|
@ -145,3 +145,10 @@ const (
|
|||||||
UserEnabled UserStatus = iota
|
UserEnabled UserStatus = iota
|
||||||
UserDisabled
|
UserDisabled
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var UserStatusList = map[UserStatus]string{
|
||||||
|
UserEnabled: "",
|
||||||
|
UserDisabled: "❌ 已封号",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s UserStatus) String() string { return UserStatusList[s] }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user