1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00

opt share

This commit is contained in:
shylinux 2021-04-25 21:57:38 +08:00
parent 728e77a71b
commit 39382e8f1a
2 changed files with 29 additions and 2 deletions

View File

@ -97,7 +97,7 @@ Volcanos("user", {help: "用户模块", agent: {
var src = can.user.MergeURL(can, {_path: "/share/"+msg.Result()}, true) var src = can.user.MergeURL(can, {_path: "/share/"+msg.Result()}, true)
var ui = can.user.toast(can, { var ui = can.user.toast(can, {
title: can.page.Format("a", "/share?share="+msg.Result(), "share"), title: can.page.Format("a", "/share?share="+msg.Result(), "share"),
content: can.page.Format("img", src+"/share"), content: can.page.Format("img", src+"/share")+"<br/>"+can.user.MergeURL(can, {share: msg.Result()}, true),
button: ["close"], duration: 100000, button: ["close"], duration: 100000,
width: 300, height: 300, width: 300, height: 300,
}) })
@ -107,7 +107,7 @@ Volcanos("user", {help: "用户模块", agent: {
var ui = can.user.input({clientX: 100, clientY: 100}, can, [ var ui = can.user.input({clientX: 100, clientY: 100}, can, [
{username: "username", name: "用户"}, {username: "username", name: "用户"},
{password: "password", name: "密码"}, {password: "password", name: "密码"},
{button: ["登录", "扫码"]}, {button: ["登录", "扫码", "注册"]},
], function(event, button, data, list) { ], function(event, button, data, list) {
switch (button) { switch (button) {
case "登录": can.user.Cookie(can, "sessid", "") case "登录": can.user.Cookie(can, "sessid", "")
@ -117,6 +117,28 @@ Volcanos("user", {help: "用户模块", agent: {
} }
can.user.alert("用户或密码错误") can.user.alert("用户或密码错误")
}) })
break
case "扫码":
can.misc.WSS(can, {type: "chrome"}, function(event, msg, cmd, arg) { if (!msg) { return }
if (cmd == "pwd") {
can.user.share(can, can.request(event, {text: arg[0]}), ["action", "apply"])
msg.Reply()
return
}
if (cmd == "sessid") {
can.user.Cookie(can, "sessid", arg[0])
can.user.reload(true)
return
}
can.run(event, ["search"].concat(msg["detail"]||[]), function(msg) {
msg.Reply()
})
})
return true
break
case "注册":
break break
} }
}) })

View File

@ -174,6 +174,11 @@ Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg,
can.onlayout.topic(can) can.onlayout.topic(can)
can.user.isLocalFile? init(): can.run({}, ["check"], function(msg) { can.user.isLocalFile? init(): can.run({}, ["check"], function(msg) {
if (msg.Option("type") == "apply" && msg.Option("name") == "") {
if (can.user.confirm("auth "+msg.Option("text"))) {
can.run(event, ["action", "auth", "share", can.user.Search(can, "share")])
}
}
msg.Result()? init(): msg.Option("sso")? can.user.jumps(msg.Option("sso")): can.user.login(can, init) msg.Result()? init(): msg.Option("sso")? can.user.jumps(msg.Option("sso")): can.user.login(can, init)
}) })
}, },