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

add camera

This commit is contained in:
shaoying 2021-01-13 08:39:21 +08:00
parent f481733bfe
commit 0740f85d48
7 changed files with 82 additions and 39 deletions

View File

@ -428,7 +428,7 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
}) })
}) })
if (can.user.isMobile || can.user.Search(can, "share")) { return } if (can.user.isMobile) { return }
can.onengine.trigger(can, can.request(event, {width: width, height: height}), "resize") can.onengine.trigger(can, can.request(event, {width: width, height: height}), "resize")
can.page.Select(can, target, ["fieldset.main"], function(field, index) { can.page.Select(can, target, ["fieldset.main"], function(field, index) {
@ -444,26 +444,35 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
}, },
profile: function(can, target) { profile: function(can, target) {
can.ui = can.page.Append(can, target, [{type: "table", list: [{type: "tr", list: [ return can.page.Append(can, target, [{view: ["void", "table"], list: [{type: "tr", list: [
{type: "td", list: [{view: ["project", "div", "project"]}]}, {type: "td", list: [{view: ["project"]}]},
{type: "td", list: [{type: "tr", list: [{type: "table", list: [ {type: "td", list: [
{type: "td", list: [{view: ["content", "div", "content"]}]}, {view: ["void", "table"], list: [
{type: "td", list: [{view: ["profile", "div", "profile"]}]}, {type: "tr", list: [{view: ["void", "table"], list: [
]}]}, {type: "tr", list: [ {type: "tr", list: [
{type: "td", list: [{view: ["display", "div", "display"]}]} {type: "td", list: [{view: ["content"]}]},
]}]} {type: "td", list: [{view: ["profile"]}]},
]}
]}]},
{type: "tr", list: [
{type: "td", list: [{view: ["display"]}]}
]}
]}
]}
]}] }]) ]}] }])
}, },
project: function(can, target) { project: function(can, target) {
can.ui = can.page.Append(can, target, [{type: "table", list: [{type: "tr", list: [ can.ui = can.page.Append(can, target, [{view: ["void", "table"], list: [{type: "tr", list: [
{type: "td", list: [{view: "project"}]}, {type: "td", list: [ {type: "td", list: [{view: "project"}]}, {type: "td", list: [
{view: ["void", "table"], list: [
{type: "tr", list: [{view: "content"}]}, {type: "tr", list: [{view: "content"}]},
{type: "tr", list: [{view: "display"}]}, {type: "tr", list: [{view: "display"}]},
]} ]}
]}
]}] }]) ]}] }])
}, },
display: function(can, target) { target = target || can._target display: function(can, target) { target = target || can._target
return can.page.Appends(can, target, [{type: "table", list: [ return can.page.Appends(can, target, [{view: ["void", "table"], list: [
{type: "tr", list: [{view: "content"}]}, {type: "tr", list: [{view: "content"}]},
{type: "tr", list: [{view: "display"}]}, {type: "tr", list: [{view: "display"}]},
]}]) ]}])

View File

@ -46,6 +46,11 @@ Volcanos("user", {help: "用户模块", agent: {
can.user.toast(can, text, "复制成功") can.user.toast(can, text, "复制成功")
}, },
camera: function(can, msg, cb) {
navigator.getUserMedia({video: true}, cb, function(error) {
can.base.Log(error)
})
},
trans: function(can, text) { trans: function(can, text) {
if (typeof text == "function") { if (typeof text == "function") {
text = text.name || "" text = text.name || ""

View File

@ -77,6 +77,25 @@ select {
padding:0 10px; padding:0 10px;
} }
table.void>tr {
margin:0;border:0;padding:0;
}
table.void>tr>th {
margin:0;border:0;padding:0;
}
table.void>tr>td {
margin:0;border:0;padding:0;
}
table.void>tr:hover {
background-color:#0fbd4500;
}
table.void>tr>th:hover {
background-color:#0fbd4500;
}
table.void>tr>td:hover {
background-color:#0fbd4500;
}
table { table {
border:0; white-space:pre; border:0; white-space:pre;
font-size:14px; font-family:monospace; font-size:14px; font-family:monospace;

View File

@ -5,7 +5,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.run({}, ["search", "Header.onimport.menu", "river", can.run({}, ["search", "Header.onimport.menu", "river",
["添加", "创建群组", "添加应用", "添加工具", "添加用户", "添加设备"], ["添加", "创建群组", "添加应用", "添加工具", "添加用户", "添加设备"],
["访问", "访问研发", "访问应用", "访问工具", "访问用户", "访问设备"], ["访问", "访问研发", "访问应用", "访问工具", "访问用户", "访问设备", "访问任务"],
["共享", "共享群组", "共享应用", "共享工具", "共享用户", "共享设备"], ["共享", "共享群组", "共享应用", "共享工具", "共享用户", "共享设备"],
], function(event, item) { ], function(event, item) {
var cb = can.ondetail[item]; typeof cb == "function" && cb(event, can, item, can.Conf(RIVER), can.Conf(STORM)) var cb = can.ondetail[item]; typeof cb == "function" && cb(event, can, item, can.Conf(RIVER), can.Conf(STORM))
@ -221,8 +221,8 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加用户
}) })
}, },
"访问用户": function(event, can, button, river, storm) { "访问研发": function(event, can, button, river, storm) {
can.user.select(event, can, "user", "time,type,name,text") can.user.select(event, can, "github", "time,type,name,text")
}, },
"访问应用": function(event, can, button, river, storm) { "访问应用": function(event, can, button, river, storm) {
can.user.select(event, can, "storm", "type,name,text") can.user.select(event, can, "storm", "type,name,text")
@ -230,11 +230,15 @@ Volcanos("ondetail", {help: "菜单交互", list: ["共享群组", "添加用户
"访问工具": function(event, can, button, river, storm) { "访问工具": function(event, can, button, river, storm) {
can.user.select(event, can, "plugin", "type,name,text") can.user.select(event, can, "plugin", "type,name,text")
}, },
"访问用户": function(event, can, button, river, storm) {
can.user.select(event, can, "user", "time,type,name,text")
},
"访问设备": function(event, can, button, river, storm) { "访问设备": function(event, can, button, river, storm) {
can.user.select(event, can, "space", "time,type,name,text") can.user.select(event, can, "space", "time,type,name,text")
}, },
"访问研发": function(event, can, button, river, storm) { "访问任务": function(event, can, button, river, storm) {
can.user.select(event, can, "github", "time,type,name,text") var msg = can.request(event, {index: "web.team.task"})
can.user.select(event, can, "task", "time,type,name,text")
}, },
}) })
Volcanos("onexport", {help: "导出数据", list: [], Volcanos("onexport", {help: "导出数据", list: [],

View File

@ -20,3 +20,7 @@ fieldset.Search div.output div.display {
max-height:200px; max-height:200px;
overflow:auto; overflow:auto;
} }
fieldset.Search div.output div.profile {
max-height:400px;
overflow:auto;
}

View File

@ -1,31 +1,32 @@
Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
can.ui = can.page.Append(can, can._output, [ can.ui = can.onlayout.profile(can, can._output)
{input: ["word", function(event) { can.onkeypop.input(event, can) can.ui.table = can.page.Append(can, can.ui.display, [{type: "table"}]).first
can.ui.word = can.page.Append(can, can._action, [{input: ["word", function(event) { can.onkeypop.input(event, can)
if (event.key == "Escape") { can.onmotion.hide(can) } if (event.key == "Escape") { can.onmotion.hide(can) }
if (event.key == "Enter") { event.stopPropagation(), event.preventDefault() if (event.key == "Enter") { event.stopPropagation(), event.preventDefault()
if (event.ctrlKey && can.onaction.choice(event, can, 0)) { return } if (event.ctrlKey && can.onaction.choice(event, can, 0)) { return }
can.input(event, event.target.value) can.input(event, event.target.value)
} }
}]}, }]}]).first
{view: "content"}, {view: "display", list: [{type: "table"}]},
])
typeof cb == "function" && cb(msg) typeof cb == "function" && cb(msg)
}, },
_table: function(can, msg, fields) { can.onmotion.clear(can, can.ui.content) _table: function(can, msg, fields) { can.onmotion.clear(can, can.ui.content)
var table = can.onappend.table(can, msg, can.ui.content, "table", function(value, key, index, line) { var table = can.onappend.table(can, msg, can.ui.content, "table", function(value, key, index, line) { can.Status("count", index+1)
can.Status("count", index+1)
return {text: [key == "text" && typeof line.text == "function" && line.text.help || value, "td"], onclick: function(event) { return {text: [key == "text" && typeof line.text == "function" && line.text.help || value, "td"], onclick: function(event) {
if (event.shiftKey) { var msg = can.request(event, line) // if (event.shiftKey) {
can.onappend.plugin(can, {index: line.ctx+"."+line.cmd}, function(story, meta) { can.onappend.plugin(can, {index: msg.Option("index")||line.ctx+"."+line.cmd, arg: [line.type, line.name]}, function(story, meta) {
story.run = function(event, cmds, cb, silent) { story.run = function(event, cmds, cb, silent) {
can.run(event, ["plugin", "run", meta.index].concat(cmds), function(msg) { can.run(event, ["action", "command", "run", meta.index].concat(cmds), function(msg) {
typeof cb == "function" && cb(msg) typeof cb == "function" && cb(msg)
}) })
} }
}, can.ui.display) }, can.ui.profile)
return can.onmotion.clear(can, can.ui.profile)
} // return
// }
if (line.ctx == "web.chat" && line.cmd == "/search") { if (line.ctx == "web.chat" && line.cmd == "/search") {
can.onimport.select(can, can.request(), [line.type, line.name, line.text], can.cb) can.onimport.select(can, can.request(), [line.type, line.name, line.text], can.cb)
return return
@ -50,10 +51,11 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.page.Modify(can, can.ui.table, {style: {width: table.offsetWidth}}) can.page.Modify(can, can.ui.table, {style: {width: table.offsetWidth}})
}, },
_word: function(can, msg, cmds, fields) { _word: function(can, msg, cmds, fields) {
var msg = can.request({}, {fields: fields.join(","), word: cmds}) can.request(msg._event, {fields: fields.join(","), word: cmds})
can.onengine.trigger(can, msg, "search") can.onengine.trigger(can, msg, "search")
can.onmotion.clear(can, can.ui.content) can.onmotion.clear(can, can.ui.content)
can.onmotion.clear(can, can.ui.profile)
can.run(msg._event, cmds, function(msg) { can.list = msg.Table() can.run(msg._event, cmds, function(msg) { can.list = msg.Table()
can.onimport._table(can, msg, fields) can.onimport._table(can, msg, fields)
}) })
@ -77,7 +79,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.page.Modify(can, can._target, {style: {left: item.offsetWidth}}) can.page.Modify(can, can._target, {style: {left: item.offsetWidth}})
}) })
can.onmotion.show(can), can.ui.input.focus() can.onmotion.show(can), can.ui.word.focus()
can.onimport._word(can, msg, cmds, fields) can.onimport._word(can, msg, cmds, fields)
}, },
}) })

View File

@ -65,7 +65,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, meta,
var input = feature && feature[name]; if (input) { var input = feature && feature[name]; if (input) {
return can.sup.onaction.input(event, can.sup, name, function(msg) { return can.sup.onaction.input(event, can.sup, name, function(msg) {
if (can.sup._outputs && can.sup._outputs.length > 0) { var i = can.sup._outputs.length - 1 if (can.sup._outputs && can.sup._outputs.length > 0) { var i = can.sup._outputs.length - 1
can.sup._outputs[i].onimport._process(can.sup._outputs[i], msg) can.sup._outputs[i].onimport._process && can.sup._outputs[i].onimport._process(can.sup._outputs[i], msg)
return return
}; can.sup.onimport._process(can.sup, msg) }; can.sup.onimport._process(can.sup, msg)
}) })