mirror of
https://shylinux.com/x/community
synced 2025-05-03 04:37:01 +08:00
62 lines
3.1 KiB
JavaScript
62 lines
3.1 KiB
JavaScript
Volcanos(chat.ONIMPORT, {
|
|
_init: function(can, msg) { msg.Option("_share_title", msg.Append(mdb.NAME))
|
|
if (!can.base.isIn(msg.Option("user_role"), "1", "2", "3")) { delete(can.onaction.updateAvatar), delete(can.onaction.updateBackground) }
|
|
can.ui = can.page.Appends(can, can._output, [html.HEAD, html.LIST])
|
|
msg.Table(function(value) {
|
|
can.page.Append(can, can.ui.head, [{img: can.misc.Resource(can, value.background||"usr/icons/background.jpg"), onclick: function(event) {
|
|
can.onaction.updateBackground && can.onaction.updateBackground(event, can)
|
|
}}])
|
|
can.page.Append(can, can.ui.head, [can.onimport.itemcard(can, {avatar: value.avatar||"usr/icons/avatar.jpg"}, [
|
|
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type"), can.onimport.titleAction(can, msg)]},
|
|
{view: html.STATUS, list: [value.info]},
|
|
])])
|
|
})
|
|
var cmd = msg.Append("auth_type") == "personal"? can.onimport.systemList(can, msg):
|
|
msg.Append("auth_type") == "service"? can.onimport.memberList(can, msg):
|
|
can.onimport.authList(can, msg)
|
|
},
|
|
authList: function(can, msg) {
|
|
can.runAction(can.request({}, {auth_uid: msg.Append(UID)}), "authList", [], function(msg) {
|
|
can.onimport.myView(can, msg, function(value) { value.avatar = value.avatar||"usr/icons/avatar.jpg"
|
|
return [
|
|
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type")]},
|
|
{view: html.STATUS, list: [value.info]},
|
|
]
|
|
}, function(event, value) {
|
|
can.Option("auth_uid", value.uid), can.Update(event)
|
|
}, can.ui.list)
|
|
})
|
|
},
|
|
memberList: function(can, msg) {
|
|
can.runAction(can.request({}, {auth_uid: msg.Append(UID)}), "memberList", [], function(msg) {
|
|
can.onimport.myView(can, msg, function(value) { value.avatar = value.user_avatar||"usr/icons/avatar.jpg"
|
|
return [
|
|
{view: html.TITLE, list: [value.auth_name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type")]},
|
|
{view: html.STATUS, list: [value.user_info]},
|
|
]
|
|
}, function(event, value) {
|
|
if (value.auth_uid) {
|
|
can.Option("auth_uid", value.auth_uid), can.Update(event)
|
|
} else {
|
|
can.onimport.myStory(can, {index: "web.team.gonganxitong.user", args: [value.user_uid]})
|
|
}
|
|
}, can.ui.list)
|
|
})
|
|
},
|
|
systemList: function(can, msg) {
|
|
can.runAction(can.request({}, {}), "systemList", [msg.Append("user_uid")||msg.Option("user_uid")], function(msg) {
|
|
can.onimport.myView(can, msg, function(value) { value.avatar = value.avatar||"usr/icons/avatar.jpg"
|
|
return [
|
|
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type")]},
|
|
{view: html.STATUS, list: [value.info]},
|
|
]
|
|
}, function(event, value) {
|
|
can.Option("auth_uid", value.uid), can.Update(event)
|
|
}, can.ui.list)
|
|
})
|
|
},
|
|
})
|
|
Volcanos(chat.ONACTION, {
|
|
updateBackground: function(event, can) { can.user.upload(can.request(event, {field: aaa.BACKGROUND}), can) },
|
|
updateAvatar: function(event, can) { can.user.upload(can.request(event, {field: aaa.AVATAR}), can) },
|
|
}) |