forked from x/volcanos
opt share
This commit is contained in:
parent
63a8cd6eed
commit
2e4f12dafa
@ -58,7 +58,7 @@ var user = Volcanos("user", {help: "用户模块",
|
||||
share: function(can, msg, cmd) {
|
||||
can.run(msg._event, cmd||["action", "share"], function(msg) {
|
||||
var src = can.user.Share(can, {_path: "/share/"+msg.Result()}, true)
|
||||
var ui = can.user.toast(can, {title: can.page.Format("a", src, msg.Result()), text: can.page.Format("img", src+"/share"),
|
||||
var ui = can.user.toast(can, {title: can.page.Format("a", "/?share="+msg.Result(), "share"), text: can.page.Format("img", src+"/share"),
|
||||
width: 300, height: 300, duration: 100000, button: [{button: ["确定", function(event) {
|
||||
ui.Close()
|
||||
}]}] })
|
||||
|
@ -42,7 +42,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, meta,
|
||||
}), can.page.ClassList.add(can, event.target, "select")
|
||||
}, oncontextmenu: function(event) {
|
||||
// 右键点击
|
||||
can.user.carte(can, {}, ["添加工具", "重命名", "保存参数", "删除应用"], function(ev, item, meta) {
|
||||
can.user.carte(can, {}, ["添加工具", "重命名", "保存参数", "共享应用", "删除应用"], function(ev, item, meta) {
|
||||
switch (item) {
|
||||
case "重命名":
|
||||
can.user.input(event, can, ["name"], function(event, button, meta, list) {
|
||||
@ -83,7 +83,7 @@ Volcanos("onaction", {help: "控件交互", list: ["创建", "刷新"], _init: f
|
||||
"创建": function(event, can) { can.onaction.create(can) },
|
||||
"刷新": function(event, can) { can.user.Search(can, {river: can.Conf(RIVER), storm: can.Conf(STORM)}) },
|
||||
})
|
||||
Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加设备", "添加用户", "重命名", "共享", "删除群组"], _init: function(can, msg, list, cb, target) {
|
||||
Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加设备", "添加用户", "重命名", "共享群组", "删除群组"], _init: function(can, msg, list, cb, target) {
|
||||
can.onexport._init(can, msg, list, cb, target)
|
||||
},
|
||||
"添加工具": function(event, can, button, storm) {
|
||||
@ -111,6 +111,18 @@ Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加设备
|
||||
can.user.toast(can, "保存成功", STORM)
|
||||
})
|
||||
},
|
||||
"共享应用": function(event, can, button, storm) {
|
||||
can.user.input(event, can, [
|
||||
{_input: "text", name: "username", value: "@key=hi"},
|
||||
{_input: "text", name: "userrole", value: "@key=void"},
|
||||
{_input: "text", name: "title", value: storm.name},
|
||||
], function(event, button, meta, list) {
|
||||
var msg = can.request(event)
|
||||
can.user.share(can, msg, [can.Conf(RIVER), "action", "share",
|
||||
"username", meta.username, "userrole", meta.userrole, "title", meta.title, "storm", storm.hash])
|
||||
return true
|
||||
})
|
||||
},
|
||||
"删除应用": function(event, can, button, storm) {
|
||||
var msg = can.request(event); msg.Option("hash", storm.hash)
|
||||
can.run(event, [can.Conf(RIVER), "tool", "action", "remove"], function(msg) {
|
||||
@ -161,10 +173,11 @@ Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加设备
|
||||
return true
|
||||
})
|
||||
},
|
||||
"共享": function(event, can, value) {
|
||||
"共享群组": function(event, can, value) {
|
||||
can.user.input(event, can, ["name"], function(event, button, meta, list) {
|
||||
var msg = can.request(event)
|
||||
can.user.share(can, msg, [value.hash, "action", "share", meta.name])
|
||||
msg.Option()
|
||||
can.user.share(can, msg, [value.hash, "action", "share", "name", meta.name])
|
||||
return true
|
||||
})
|
||||
|
||||
|
@ -48,7 +48,7 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view",
|
||||
|
||||
"股价图": function(event, can) { var sub = can.sub, data = can.data
|
||||
if (!can.list) { var count = 0, add = 0, del = 0, max = 0, begin = ""
|
||||
can.max = 0, can.rest = 0, can.list = can.core.List(data, function(value, index) {
|
||||
can.max = 0, can.min = 0, can.rest = 0, can.list = can.core.List(data, function(value, index) {
|
||||
if (index == 0) { begin = value.date }
|
||||
var line = {};
|
||||
line.note = value[can.msg.append[4]]
|
||||
@ -67,9 +67,8 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view",
|
||||
if (line.max - line.min > max) {
|
||||
max = line.max - line.min
|
||||
}
|
||||
if (line.max > can.max) {
|
||||
can.max = line.max
|
||||
}
|
||||
if (line.max > can.max) { can.max = line.max }
|
||||
if (line.min < can.min) { can.min = line.min }
|
||||
return line
|
||||
})
|
||||
can.Status("from", begin)
|
||||
@ -91,12 +90,13 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view",
|
||||
sub.svg.innerHTML = ""
|
||||
can.ui.display.innerHTML = ""
|
||||
|
||||
function compute(y) { return (y - can.min)/(can.max - can.min)*view }
|
||||
var i = 0; can.core.Next(can.list, function(line, next) {
|
||||
(function() { var index = i++
|
||||
sub.onimport.draw({}, sub, {
|
||||
shape: "line", point: [
|
||||
{x: space/2+step*index+step/4, y: space/2+view-line.min/can.max*view},
|
||||
{x: space/2+step*index+step/4, y: space/2+view-line.max/can.max*view},
|
||||
{x: space/2+step*index+step/4, y: space/2+view-compute(line.min)},
|
||||
{x: space/2+step*index+step/4, y: space/2+view-compute(line.max)},
|
||||
], style: line.begin < line.close? {
|
||||
"stroke-width": 1, "stroke": "white",
|
||||
}: {
|
||||
@ -106,19 +106,17 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view",
|
||||
|
||||
var one = line.begin < line.close? sub.onimport.draw({}, sub, {
|
||||
shape: "rect", point: [
|
||||
{x: space/2+step*index, y: space/2+view-line.begin/can.max*view},
|
||||
{x: space/2+step*index+step/2, y: space/2+view-line.close/can.max*view},
|
||||
{x: space/2+step*index, y: space/2+view-compute(line.begin)},
|
||||
{x: space/2+step*index+step/2, y: space/2+view-compute(line.close)},
|
||||
], style: {
|
||||
"rx": 0, "ry": 0,
|
||||
"stroke-width": 1, "stroke": "white", "fill": "white",
|
||||
"rx": 0, "ry": 0, "stroke-width": 1, "stroke": "white", "fill": "white",
|
||||
},
|
||||
}): sub.onimport.draw({}, sub, {
|
||||
shape: "rect", point: [
|
||||
{x: space/2+step*index, y: space/2+view-line.close/can.max*view},
|
||||
{x: space/2+step*index+step/2, y: space/2+view-line.begin/can.max*view},
|
||||
{x: space/2+step*index, y: space/2+view-compute(line.close)},
|
||||
{x: space/2+step*index+step/2, y: space/2+view-compute(line.begin)},
|
||||
], style: {
|
||||
"rx": 0, "ry": 0,
|
||||
"stroke-width": 1, "stroke": "black", "fill": "black",
|
||||
"rx": 0, "ry": 0, "stroke-width": 1, "stroke": "black", "fill": "black",
|
||||
},
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user