1
0
forked from x/volcanos
This commit is contained in:
harveyshao 2021-12-27 23:03:11 +08:00
parent 19b63c3b7b
commit 6c297a9192
4 changed files with 24 additions and 26 deletions

View File

@ -163,24 +163,27 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
} }
}, },
CookieSessid: shy("会话变量", function(can, value, path) {
var name = ice.MSG_SESSID+"_"+location.host.replaceAll(".", "_").replaceAll(":", "_")
return can.misc.Cookie(can, name, value, path)
}),
Cookie: shy("会话变量", function(can, key, value, path) { Cookie: shy("会话变量", function(can, key, value, path) {
function set(k, v) { document.cookie = k+"="+v+";path="+(path||ice.PS) } function set(k, v) { document.cookie = k+"="+v+";path="+(path||ice.PS) }
if (can.base.isObject(key)) { if (can.base.isObject(key)) {
for (var k in key) { set(k, key[k]) } for (var k in key) { set(k, key[k]) }
key = null key = undefined
} }
if (key == undefined) { var cs = {} if (key == undefined) { var cs = {}
document.cookie.split("; ").forEach(function(item) { document.cookie.split("; ").forEach(function(item) {
var cookie = item.split("=") var ls = item.split("="); cs[ls[0]] = ls[1]
cs[cookie[0]] = cookie[1]
}) })
return cs return cs
} }
value != undefined && set(key, value) value != undefined && set(key, value)
var result = (new RegExp(key+"=([^;]*);?")).exec(document.cookie) var val = (new RegExp(key+"=([^;]*);?")).exec(document.cookie)
return result && result.length > 0? result[1]: "" return val && val.length > 0? val[1]: ""
}), }),
Search: shy("请求参数", function(can, key, value) { var args = {} Search: shy("请求参数", function(can, key, value) { var args = {}
if (value == undefined && can.base.isString(key)) { if (value == undefined && can.base.isString(key)) {
@ -257,7 +260,13 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
return obj.stack || "" return obj.stack || ""
}, },
_time: function() { var now = new Date() _time: function() { var now = new Date()
return now.getHours()+":"+now.getMinutes()+":"+now.getSeconds() var hour = now.getHours()
if (hour < 10) { hour = "0"+hour }
var minute = now.getMinutes()
if (minute < 10) { minute = "0"+minute }
var second = now.getSeconds()
if (second < 10) { second = "0"+second }
return hour+":"+minute+":"+second
}, },
}) })

View File

@ -139,7 +139,7 @@ Volcanos("user", {help: "用户操作", agent: {
return can.user.toast(can, arg[2], arg[1], -1), msg.Reply() return can.user.toast(can, arg[2], arg[1], -1), msg.Reply()
} }
if (cmd == ice.MSG_SESSID) { if (cmd == ice.MSG_SESSID) {
return can.misc.Cookie(can, ice.MSG_SESSID, arg[0]), msg.Reply(), can.user.reload(true) return can.misc.CookieSessid(can, arg[0]), msg.Reply(), can.user.reload(true)
} }
can.search(event, msg[ice.MSG_DETAIL]||[], function(msg) { msg.Reply() }) can.search(event, msg[ice.MSG_DETAIL]||[], function(msg) { msg.Reply() })
}) })
@ -152,7 +152,7 @@ Volcanos("user", {help: "用户操作", agent: {
can.page.Modify(can, ui._target, {className: "input login", style: {left: (window.innerWidth-ui._target.offsetWidth)/2, top: window.innerHeight/6}}) can.page.Modify(can, ui._target, {className: "input login", style: {left: (window.innerWidth-ui._target.offsetWidth)/2, top: window.innerHeight/6}})
}, },
logout: function(can, force) { if (force||can.user.confirm("logout?")) { logout: function(can, force) { if (force||can.user.confirm("logout?")) {
can.run({}, [ctx.ACTION, aaa.LOGOUT], function(msg) { can.misc.Cookie(can, ice.MSG_SESSID, "") can.run({}, [ctx.ACTION, aaa.LOGOUT], function(msg) {
can.misc.Search(can, chat.SHARE)? can.misc.Search(can, chat.SHARE, ""): can.user.reload(true) can.misc.Search(can, chat.SHARE)? can.misc.Search(can, chat.SHARE, ""): can.user.reload(true)
}) })
} }, } },

View File

@ -7,9 +7,6 @@ fieldset.panel.cmd>div.output>fieldset.plugin {
fieldset.panel.cmd>div.output>fieldset.plugin>legend { fieldset.panel.cmd>div.output>fieldset.plugin>legend {
display:none; display:none;
} }
fieldset.panel.cmd>div.output>fieldset.plugin>div.legend {
display:none;
}
fieldset.panel.cmd>div.output>fieldset.plugin>div.legend { fieldset.panel.cmd>div.output>fieldset.plugin>div.legend {
float:left; padding:0 10px; margin-right:3px; float:left; padding:0 10px; margin-right:3px;
height:25px; font-size:18px; height:25px; font-size:18px;
@ -22,6 +19,3 @@ fieldset.plugin>legend {
body.white fieldset.panel.cmd>div.output>fieldset.plugin>div.legend { body.white fieldset.panel.cmd>div.output>fieldset.plugin>div.legend {
background-color:honeydew; background-color:honeydew;
} }
fieldset.panel.cmd>div.output>fieldset.plugin>div.status {
display:none;
}

View File

@ -1,24 +1,19 @@
Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg, list, cb, target) { Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg, list, cb, target) {
can.onmotion.float.auto(can, can._output, chat.CARTE) can.page.ClassList.add(can, can._target, "Action")
can.onmotion.float.auto(can, window, chat.CARTE)
can.base.isFunc(cb) && cb() can.base.isFunc(cb) && cb()
}, },
onlogin: function(can) { can._names = location.pathname onlogin: function(can) { can._names = location.pathname
var msg = can.request({})
can.Conf(chat.TOOL)? can.core.Next(can.Conf(chat.TOOL), function(item, next) { can.Conf(chat.TOOL)? can.core.Next(can.Conf(chat.TOOL), function(item, next) {
can.core.Timer(500, function() { can.core.Timer(500, function() { can.onaction._plugin(can, item, next) })
can.onaction._plugin(can, item, next)
})
}): can.run(msg._event, [ctx.ACTION, ctx.COMMAND], function(msg) { }): can.run(can.request()._event, [ctx.ACTION, ctx.COMMAND], function(msg) {
can.core.Next(msg.Table(), function(item, next) { can.core.Next(msg.Table(), function(item, next) {
can.onaction._plugin(can, item, next) can.onaction._plugin(can, item, next)
}) })
}) })
can.page.ClassList.add(can, can._target, "Action")
}, },
_plugin: function(can, item, next) { _plugin: function(can, item, next) {
item.height = window.innerHeight, item.width = window.innerWidth, item.opts = can.misc.Search(can) can.base.Copy(item, {height: window.innerHeight, width: window.innerWidth, opts: can.misc.Search(can)})
can.onappend.plugin(can, item, function(sub, meta) { can.user.title(meta.name), next() }) can.onappend.plugin(can, item, function(sub, meta) { can.user.title(meta.name), next() })
}, },
}) })