mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt user.input
This commit is contained in:
parent
d6cfbbb924
commit
5c5930cd91
3
frame.js
3
frame.js
@ -299,7 +299,6 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
||||
if (can.core.CallFunc([can, "onimport._process"], [can, msg, cmds, cb])) { return }
|
||||
typeof cb == "function" && cb(msg)
|
||||
})
|
||||
return true
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -430,7 +429,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
||||
},
|
||||
|
||||
figure: function(can, meta, key, target) {
|
||||
if (key.indexOf("@") != 0) { return }
|
||||
if (!key || key.indexOf("@") != 0) { return }
|
||||
var list = can.core.Split(key, "@=", "@=")
|
||||
var pkey = list[0], pval = list[1]||""
|
||||
|
||||
|
26
lib/user.js
26
lib/user.js
@ -168,7 +168,7 @@ Volcanos("user", {help: "用户模块", agent: {
|
||||
args.push(item.name, item.value)
|
||||
return data[item.name] = item.value
|
||||
})
|
||||
if (typeof cb == "function" && cb(event, button, data, list, args)) {
|
||||
if (typeof cb == "function" && !cb(event, button, data, list, args)) {
|
||||
can.page.Remove(can, ui.first)
|
||||
}
|
||||
}
|
||||
@ -192,7 +192,7 @@ Volcanos("user", {help: "用户模块", agent: {
|
||||
}
|
||||
|
||||
|
||||
var button; var ui = can.page.Append(can, document.body, [{view: ["input", "fieldset"], style: {left: x+"px", top: y+"px"}, list: [
|
||||
var button; var ui = can.page.Append(can, document.body, [{view: ["input inputs", "fieldset"], style: {left: x+"px", top: y+"px"}, list: [
|
||||
{view: ["option", "table"], list: can.core.List(form, function(item) {
|
||||
if (item.button) { button = can.core.List(item.button, function(item) {
|
||||
return {button: typeof item == "object"? item: [item, function(event) { cbs(event, item) }]}
|
||||
@ -206,7 +206,7 @@ Volcanos("user", {help: "用户模块", agent: {
|
||||
|
||||
function _init(target) {
|
||||
can.onappend.figure(can, item, item.value, target)
|
||||
target.value = target.value||msg.Option(item.name)
|
||||
target.value = target.value || msg.Option(typeof item == "string"? item: item.name)
|
||||
}
|
||||
|
||||
return {type: ["tr"], list: [
|
||||
@ -217,19 +217,21 @@ Volcanos("user", {help: "用户模块", agent: {
|
||||
item._input? /* input */ {type: "input", data: (item.type = item._input, item), _init: _init}:
|
||||
item.length > 0? /* select */ {select: [item]}:
|
||||
/* other */ item,
|
||||
], _init: function(target) {
|
||||
target.value = target.value || msg.Option(item.name)
|
||||
}},
|
||||
]},
|
||||
]}
|
||||
})},
|
||||
{view: "action", list: button||[{button: ["提交", function(event) {
|
||||
cbs(event, "提交")
|
||||
}]}, {button: ["关闭", function(event, button) {
|
||||
can.page.Remove(can, ui.first)
|
||||
}]}]},
|
||||
{view: "action"},
|
||||
]}])
|
||||
|
||||
can.onappend._action(can, button||["提交", "关闭"], ui.action, {
|
||||
"提交": function(event) { cbs(event, "提交") },
|
||||
"关闭": function(event) { can.page.Remove(can, ui.first) },
|
||||
})
|
||||
|
||||
can.page.Select(can, ui.first, "input", function(item, index) {
|
||||
index == 0 && (item.focus(), item.setSelectionRange(0, -1))
|
||||
index == 0 && can.core.Timer(100, function() {
|
||||
item.focus(), item.setSelectionRange(0, -1)
|
||||
})
|
||||
})
|
||||
return ui
|
||||
},
|
||||
|
@ -80,7 +80,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
typeof cb == "function" && cb(res.resultStr)
|
||||
} }) },
|
||||
getLocation: function(cb) { wx.getLocation({type: "gcj02", success: function (res) {
|
||||
typeof cb == "function" && cb({latitude: parseInt(res.latitude*100000), longitude: parseInt(res.longitude*100000) })
|
||||
typeof cb == "function" && cb({type: "gcj02", name: "当前位置", text: "当前位置", latitude: parseInt(res.latitude*100000), longitude: parseInt(res.longitude*100000) })
|
||||
} }) },
|
||||
openLocation: function(msg) { wx.openLocation({
|
||||
latitude: parseInt(msg.Option("latitude"))/100000,
|
||||
@ -189,7 +189,6 @@ Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg,
|
||||
can.run(event, ["webpack"], function(msg) {
|
||||
toast.Close(), can.user.toast(can, "打包成功", "webpack")
|
||||
})
|
||||
return true
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -109,7 +109,6 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加用户
|
||||
], function(event, button, meta, list) {
|
||||
var msg = can.request(event)
|
||||
can.user.share(can, msg, [river, "action", "share", "type", "river", "name", meta.name])
|
||||
return true
|
||||
})
|
||||
},
|
||||
"添加用户": function(event, can, button, river) {
|
||||
@ -159,7 +158,6 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加用户
|
||||
can.user.share(can, msg, [river, "action", "share", "type", "storm", "name", meta.name,
|
||||
"storm", storm,
|
||||
])
|
||||
return true
|
||||
})
|
||||
},
|
||||
"添加工具": function(event, can, button, river, storm) {
|
||||
@ -222,7 +220,6 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加用户
|
||||
{_input: "text", name: "name", value: river},
|
||||
], function(event, button, meta, list) {
|
||||
can.user.share(can, can.request(event), [river, "action", "share", "type", "login"])
|
||||
return true
|
||||
})
|
||||
},
|
||||
"共享设备": function(event, can, button, river, storm) {
|
||||
@ -249,7 +246,6 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加用户
|
||||
can.user.open(can.user.MergeURL(can, {pod: msg.Option("name")}))
|
||||
can.user.toast(can, can.user.MergeURL(can, {pod: msg.Option("name")}))
|
||||
})
|
||||
return true
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -291,7 +291,6 @@ Volcanos("onaction", {help: "控件交互", list: ["项目", "运行", "搜索"]
|
||||
], function(msg) {
|
||||
can.user.toast(can, "收藏成功")
|
||||
}, true)
|
||||
return true
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -171,7 +171,6 @@ Volcanos("onaction", {help: "组件交互", list: [
|
||||
if (key == "close_time") { value = value || time }
|
||||
key && value && args.push(key, value)
|
||||
}), can.run(event, args)
|
||||
return true
|
||||
})
|
||||
},
|
||||
modifyTask: function(event, can, task, key, value) {
|
||||
|
@ -50,7 +50,7 @@ Volcanos("onfigure", {help: "组件菜单", list: [],
|
||||
sub.Status("位置", order+1+"/"+can.list.length), sub.Status("file", path)
|
||||
}; show(order)
|
||||
|
||||
sub.onappend._action(sub, ["关闭", "下载", "上一个", "下一个", "设置背景"], sub._action, {
|
||||
sub.onappend._action(sub, ["关闭", "下载", "上一个", "下一个", "设置背景", "复制链接"], sub._action, {
|
||||
"关闭": function(event) { sub.page.Remove(sub, sub._target) },
|
||||
"下载": function(event) { can.user.download(can, path) },
|
||||
"上一个": function(event) { order > 0? show(--order): can.user.toast(can, "已经是第一张啦!") },
|
||||
@ -58,6 +58,9 @@ Volcanos("onfigure", {help: "组件菜单", list: [],
|
||||
"设置背景": function(event) { var msg = can.request(event, {url: can.onimport._file(can, can.list[order].path)})
|
||||
sub.run(event, ["search", "Header.onimport.background"])
|
||||
},
|
||||
"复制链接": function(event) {
|
||||
can.user.copy(event, can, can.user.MergeURL(can, {_path: path}, true))
|
||||
},
|
||||
})
|
||||
}, document.body)
|
||||
}, _init: function(target) { can.Status("file", path) },
|
||||
|
@ -70,12 +70,14 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
|
||||
}).catch((err) => { can.base.Log(err) })
|
||||
},
|
||||
getLocation: function(event, can, cmd) { var msg = can.request(can)
|
||||
can.user.agent.getLocation(function(res) {
|
||||
var arg = []; can.core.Item(res, function(key, value) { arg.push(key, value) })
|
||||
can.user.agent.getLocation(function(res) { can.request(event, res)
|
||||
can.user.input(event, can, ["type", "name", "text", "latitude", "longitude"], function(ev, button, data, list, arg) {
|
||||
can.core.Item(res, function(key, value) { arg.push(key, value) })
|
||||
can.run(event, ["action", cmd].concat(arg), function(msg) {
|
||||
can.user.toast(can, "添加成功")
|
||||
can.user.toast(can, "添加成功"), can.run()
|
||||
}, true)
|
||||
})
|
||||
})
|
||||
},
|
||||
openLocation: function(event, can) { can.user.agent.openLocation(can.request(event)) },
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user