1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
harveyshao 2022-10-17 23:10:16 +08:00
parent 73ee223d22
commit 1c4947dc63
12 changed files with 104 additions and 19 deletions

View File

@ -491,7 +491,7 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
target._can = sub, sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }
can.base.isFunc(cb) && cb(sub, _cbs), can.base.isFunc(meta._init) && meta._init(sub, sub._target)
}, can._root._target)
}, target, last) } })
}, target, last) } }), can.onfigure[input]._init && can.onfigure[input]._init(can, target)
})
},
})

View File

@ -338,7 +338,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
})
})
},
upload: function(event, can) { var begin = new Date()
upload: function(event, can, cb) { var begin = new Date()
var ui = can.page.Append(can, document.body, [{view: html.UPLOAD, style: {left: 0, top: 0}, list: [
{view: html.ACTION}, {view: html.OUTPUT, list: [{view: "progress"}]},
{view: html.STATUS, list: [{view: html.SHOW}, {view: "cost"}, {view: "size"}]},
@ -358,7 +358,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
var msg = can.request(event, can.Option(), {_handle: "true"})
msg._upload = upload[0].files[0], msg._progress = action.show
can.runAction(event, html.UPLOAD, [], function(msg) {
can.runAction(event, html.UPLOAD, [], cb||function(msg) {
can.user.toastSuccess(can), can.Update(), action.close()
})
},

View File

@ -13,7 +13,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg) {
can.page.style(can, sub._output, html.MAX_WIDTH, can.ConfWidth())
sub.run = function(event, cmds, cb) {
return can.run(sub.request(event), can.misc.concat(can, [river, storm, meta.id||meta.index], cmds), cb)
return can.run(sub.request(event, {width: sub.ConfWidth(), height: sub.ConfHeight()}), can.misc.concat(can, [river, storm, meta.id||meta.index], cmds), cb)
}, can._plugins = can.misc.concat(can, can._plugins, [sub])
var tabs = [{view: [html.TABS, html.DIV, meta.name], onclick: function(event) {
@ -37,7 +37,8 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg) {
}) },
_cmd: function(can, item, next) { can.onengine.signal(can, chat.ONACTION_CMD)
can.onappend.plugin(can, can.base.Copy(item, {mode: "cmd", opts: can.misc.Search(can)}), function(sub, meta, skip) {
sub.run = function(event, cmds, cb) { can.runActionCommand(event, sub._index, cmds, cb) }
sub.run = function(event, cmds, cb) {
can.runActionCommand(can.request(event, {width: can.ConfWidth(), height: can.ConfHeight()}), sub._index, cmds, cb) }
can._plugins = can.misc.concat(can, can._plugins, [sub])
can.user.title(meta.name), skip || next()
})

View File

@ -9,3 +9,8 @@ fieldset.Header>div.output div.state.avatar>img { height:31px; }
fieldset.Header>div.output div.search { margin-left:20px; float:left; }
fieldset.Header>div.output div.search>input { margin-top:-5px; border-radius:0; }
fieldset.goods>div.output>div.item>div { padding:10px; float:left; clear:none; }
fieldset.goods>div.output>div.item { height:170px; width:430px; float:left; border-radius:10px; }
fieldset.goods>div.output>div.item>div.image img { border-radius:10px; }
fieldset.goods>div.output>div.item>div.content>div.title { width:240px; height:50px; white-space:break-spaces; overflow:auto; }
fieldset.goods>div.output>div.item>div.content>div.price { color:red; }

12
plugin/input/img.js Normal file
View File

@ -0,0 +1,12 @@
Volcanos(chat.ONFIGURE, {help: "控件详情", img: {
_init: function(can, target) { can.onmotion.hidden(can, target)
for (var i = 0; i < 1; i++) {
can.page.Append(can, target.parentNode, [{type: html.DIV, style: {width: 90, height: 90, "background-color": "yellow"}, onclick: function(event) {
can.user.upload(event, can, function(msg) {
target.value = can.core.Split(target.value).concat([msg.Result()]).join(ice.FS)
can.page.Append(can, event.target, [{img: can.misc.MergeURL(can, {_path: "/share/cache/"+msg.Result()}, true), width: 90, height: 90}])
})
}}])
}
},
}})

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
_init: function(event, can, cbs, target, name, value) {
_load: function(event, can, cbs, target, name, value) {
can.runAction(event, mdb.INPUTS, [name, value||target.value], function(msg) {
if (name == ctx.INDEX) {
can.core.Item(can.onengine.plugin.meta, function(key, cb) {
@ -23,7 +23,7 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
can.onmotion.clear(can), can.onappend.table(can, msg, function(value, key, index, line) { value = line[key]
return {text: [value, html.TD], style: msg.append && msg.append.length == 1? {"min-width": target.offsetWidth-16}: {}, onclick: function(event) { can.base.isFunc(cbs) && cbs(can, value, target.value)
msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() {
can.onfigure.key._init(event, can, cbs, target, name, value)
can.onfigure.key._load(event, can, cbs, target, name, value)
})
}}
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length())
@ -37,7 +37,7 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
if (meta.msg && meta.msg.Length() > 0) {
can.onfigure.key._show(sub, meta.msg, cbs, target, meta.name)
} else {
can.onfigure.key._init(event, sub, cbs, target, meta.name)
can.onfigure.key._load(event, sub, cbs, target, meta.name)
}
})
},
@ -66,8 +66,8 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
onkeyup: function(event, can, meta, cb, target, last) { var sub = target._can; if (!sub) { return }
if (can.onfigure.key._select(event, can, target)) { return }
switch (event.key) {
case ice.PS: can.onfigure.key._init(event, sub, sub._cbs, target, meta.name, event.target.value); break
case ice.PS: can.onfigure.key._load(event, sub, sub._cbs, target, meta.name, event.target.value); break
}
can.onmotion.selectInputTable(event, sub, function() { can.onfigure.key._init(event, sub, sub._cbs, target, meta.name) }, target)
can.onmotion.selectInputTable(event, sub, function() { can.onfigure.key._load(event, sub, sub._cbs, target, meta.name) }, target)
},
}})

View File

@ -1,10 +1,4 @@
Volcanos(chat.ONPLUGIN, {help: "导入数据", _init: function(can, sub, cb) { const SEARCH = "can.code.inner.search"; var history = []
can.onengine.plugin(can, SEARCH, shy("搜索", {}, ["word=main", "filter", "grep:button", "make", "history", "last"], function(can, msg, cmds, cb) { can.misc.runAction(can, msg, cmds, cb, kit.Dict(
nfs.GREP, function(cmds) { can.runAction(msg, nfs.GREP, [cmds[0]], function(msg) { show(msg, cmds[0]) }) },
"history", function(cmds) { can.core.List(can.history, function(item) { msg.PushRecord(item) }), show(msg) },
"last", function(cmds) { history.pop(), show(history.pop()) },
)) })), can.onimport.toolkit(can, {index: SEARCH}, function(sub) { can.ui.search = sub, can.base.isFunc(cb) && cb(sub) })
function show(msg, word) { if (!msg) { return } history.push(msg); var sub = msg._can
sub.onimport.size(sub, can.ConfHeight()/4, can.ConfWidth()-can.ui.project.offsetWidth, true)
sub.onmotion.clear(sub), sub.onappend.table(sub, msg, function(value, key, index, line) {
@ -14,4 +8,10 @@ Volcanos(chat.ONPLUGIN, {help: "导入数据", _init: function(can, sub, cb) { c
}, sub._output), sub.onappend.board(sub, msg.Result()), sub.onappend._status(sub, msg.Option(ice.MSG_STATUS))
!sub.page.ClassList.has(sub, sub._legend, html.SELECT) && sub.select(), sub.Focus(), sub.Option("word", word||msg._word||"")
}
can.onengine.plugin(can, SEARCH, shy("搜索", {}, ["word=main", "filter", "grep:button", "make", "history", "last"], function(can, msg, cmds, cb) { can.misc.runAction(can, msg, cmds, cb, kit.Dict(
nfs.GREP, function(cmds) { can.runAction(msg, nfs.GREP, [cmds[0]], function(msg) { show(msg, cmds[0]) }) },
"history", function(cmds) { can.core.List(can.history, function(item) { msg.PushRecord(item) }), show(msg) },
"last", function(cmds) { history.pop(), show(history.pop()) },
)) })), can.onimport.toolkit(can, {index: SEARCH}, function(sub) { can.ui.search = sub, sub._show = show, can.base.isFunc(cb) && cb(sub) })
}})

View File

@ -269,7 +269,13 @@ Volcanos(chat.ONACTION, {help: "控件交互",
},
compile: function(event, can, button) {
can.runAction(can.request(event, {_toast: "编译中..."}), button, [], function(msg) {
if (msg.Length() > 0) { return can.ui.search._show(msg) }
if (msg.Length() > 0 || msg.Result()) {
can.onimport.exts(can, "inner/search.js", function() {
can.ui.search._show(msg)
})
return
}
var toast = can.user.toastProcess(can, "重启中...")
can.onmotion.delay(can, function() { toast.close(), can.onaction[cli.SHOW]({}, can) }, 3000)
})

View File

@ -0,0 +1,5 @@
fieldset.goods>div.output>div.item>div { padding:10px; float:left; clear:none; }
fieldset.goods>div.output>div.item { height:170px; width:488px; float:left; border-radius:10px; }
fieldset.goods>div.output>div.item>div.image img { border-radius:10px; }
fieldset.goods>div.output>div.item>div.content>div.title { width:298px; height:50px; white-space:break-spaces; overflow:auto; }
fieldset.goods>div.output>div.item>div.content>div.price { color:red; }

View File

@ -0,0 +1,26 @@
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) { can.onmotion.clear(can)
can.page.Appends(can, target, msg.Table(function(value) {
return {view: html.ITEM+" "+(value.status||""), list: [
{view: "image", list: [{img: can.misc.MergeURL(can, {_path: "/share/cache/"+can.core.Split(value.image)[0]}), width: 150}]}, {view: "content", list: [
{view: [wiki.TITLE, html.DIV, value.name]},
{view: [wiki.CONTENT, html.DIV, value.text]},
{view: ["price", html.DIV, "¥"+value.price]},
{view: html.ACTION, inner: value.action, onclick: function(event) {
can.run(can.request(event, value), [ctx.ACTION, event.target.name])
}},
]},
], onclick: function(event) {
if (can.page.tagis(event.target, html.INPUT)) { return }
can.Option(mdb.HASH, value.hash), can.Update()
}}
}))
can.page.Select(can, target, "input[type=button]", function(target) {
if (target.value == target.name) { target.value = can.user.trans(can, target.name) }
})
can.base.isFunc(cb) && cb(msg)
can.page.style(can, can._output, html.HEIGHT, can.ConfHeight())
},
onlayout: function(can) {
can.page.style(can, can._output, html.HEIGHT, can.ConfHeight())
},
}, [""])

View File

@ -9,6 +9,8 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
can.user.isMobile && !can.user.isLandscape() && can.onmotion.hidden(can, can.ui.project)
!can.user.isMobile && can.onmotion.toggle(can, can.ui.profile, true)
!can.user.isMobile && can.onmotion.toggle(can, can.ui.display, true)
can.onmotion.hidden(can, can.ui.project)
can.onmotion.hidden(can, can.ui.profile)
},
_content: function(can, msg, head, list, key, get, set) { var begin_time = can.base.Date(can.Option("begin_time"))
var hash = {}; msg.Table(function(value, index) { var k = key(can.base.Date(value.begin_time)); hash[k] = (hash[k]||[]).concat([value]) })
@ -35,7 +37,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
can.onmotion.select(can, can.ui.content, html.TD, target.parentNode), can.onimport._profile(can, task)
}) }, null, can.ui.project); task._target = target, target.onclick = function(event) { item.click() }
can.sup.task = can.sup.task||task, can.sup.task.zone == task.zone && can.sup.task.id == task.id && (can.sup.task._target = target)
var ls = can.core.Split(location.hash.slice(1))||[]; if (ls[0] == task.zone && ls[1] == task.id) { can.sup.task = task }
var ls = can.core.Split(decodeURIComponent(location.hash.slice(1)))||[]; if (ls[0] == task.zone && ls[1] == task.id) { can.sup.task = task }
},
}
}),
@ -129,7 +131,9 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight())
}
}
can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth), can.core.List(can._plugins_display, function(sub) {
can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
if (can.ui.display.style.display == html.NONE) { return }
can.core.List(can._plugins_display, function(sub) {
sub.onimport.size(sub, can.ConfHeight()-can.ui.content.offsetHeight-html.ACTION_HEIGHT-sub.onexport.statusHeight(sub), sub.ConfWidth(can.ConfWidth()-can.ui.project.offsetWidth), true)
})
}

View File

@ -12,6 +12,9 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
can.onappend.board(can, msg, target)
can.onmotion.story.auto(can, target)
can.base.isFunc(cb) && cb(msg)
can.page.Select(can, target, "input[type=button]", function(target) {
if (target.value == target.name) { target.value = can.user.trans(can, target.name) }
})
},
_open: function(can, msg, list) {
can.core.List(list, function(item) {
@ -162,6 +165,29 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
})
can.base.isFunc(cb) && cb(msg)
},
card_detail: function(can, msg, cb, target) {
},
card_left: function(can, msg, cb, target) {
can.page.Appends(can, target, msg.Table(function(value) {
return {view: html.ITEM+" "+(value.status||""), list: [
{view: "image", list: [{img: can.misc.MergeURL(can, {_path: "/share/cache/"+can.core.Split(value.image)[0]}), width: 150}]}, {view: "content", list: [
{view: [wiki.TITLE, html.DIV, value.name]},
{view: [wiki.CONTENT, html.DIV, value.text]},
{view: ["price", html.DIV, "¥"+value.price]},
{view: html.ACTION, inner: value.action, onclick: function(event) {
can.run(can.request(event, value), [ctx.ACTION, event.target.name])
}},
]},
], onclick: function(event) {
if (can.page.tagis(event.target, html.INPUT)) { return }
can.Option(mdb.HASH, value.hash), can.Update()
}}
}))
can.page.Select(can, target, "input[type=button]", function(target) {
if (target.value == target.name) { target.value = can.user.trans(can, target.name) }
})
can.base.isFunc(cb) && cb(msg)
},
plug: function(can, meta, target, cb) { if (!meta || !meta.index) { return }
meta.type = "plug", can.onappend.plugin(can, meta, function(sub) { sub.sup = can
sub.ConfHeight(target.offsetHeight-2*html.ACTION_HEIGHT), sub.ConfWidth(target.offsetWidth)