diff --git a/frame.js b/frame.js index a2df26f7..95d7c3b5 100644 --- a/frame.js +++ b/frame.js @@ -312,6 +312,10 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list, var mode= ["float", "full", "cmd"]; for (var i in mode) { if (can.page.ClassList.has(can, can._target, mode[i])) { table.onlayout[mode[i]](table); break } } + can.page.Select(can, can._output, "input[type=button]", function(target) { + if (target.value == target.name) { target.value = can.user.trans(can, target.name) } + }) + can.user.isMobile && can.ConfHeight() > can.ConfWidth() && can.onmotion.hidden(can, can._action) can.onaction._output(can, msg), can.base.isFunc(cb) && cb(msg) }, target: output||can._output}) }) diff --git a/page/index.css b/page/index.css index 7730882a..4e2b6b77 100644 --- a/page/index.css +++ b/page/index.css @@ -257,6 +257,7 @@ body.mobile fieldset.River>div.output { width:320px; } body.mobile fieldset.River>div.output div.item { font-size:1.6rem; } body.mobile fieldset.Action.main { margin-top:3rem; margin-bottom:3rem; } body.mobile fieldset.Action.main.cmd { margin-top:0; margin-bottom:0; } +body.mobile fieldset.Action>div.output { overflow:hidden; } body.mobile fieldset.Footer.foot { width:-webkit-fill-available; } body.mobile fieldset.Footer.foot { background-color:#000000b8; font-size:1.6rem; height:3rem; position:fixed; bottom:0; } body.mobile fieldset.Footer.foot div.output { height:3rem; } diff --git a/panel/action.js b/panel/action.js index 17f4c909..58d84f57 100644 --- a/panel/action.js +++ b/panel/action.js @@ -213,7 +213,7 @@ Volcanos(chat.ONACTION, {help: "操作数据", _init: function(can, cb, target) // var cb = can.onlayout[button]; if (can.base.isFunc(cb)? cb(can, silent): (can.getActionSize(function(height, width) { // can.ConfHeight(can.base.Min(200, height-can.Conf(html.MARGIN_Y)-(can.isCmdMode()? 0: 200))), can.ConfWidth(width-can.Conf(html.MARGIN_X)) // }), false)) { return } - can.page.style(can, can._target, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth()) + can.page.style(can, can._target, html.HEIGHT, can.ConfHeight()+can.Conf(html.MARGIN_Y), html.WIDTH, can.ConfWidth()+can.Conf(html.MARGIN_X)) can.core.Next(can._plugins, function(sub, next) { can.onmotion.delay(can, function() { sub.onaction._resize(sub, button == "" || button == ice.AUTO, can.ConfHeight(), can.ConfWidth()), next() if (button == "" || button == ice.AUTO) { can.page.style(can, sub._output, html.MAX_HEIGHT, "") } diff --git a/panel/river.js b/panel/river.js index 4a0bcdac..0838d6ae 100644 --- a/panel/river.js +++ b/panel/river.js @@ -78,7 +78,7 @@ Volcanos(chat.ONACTION, {help: "操作数据", list: [mdb.CREATE, web.SHARE, web can.onmotion.select(can, can._output, html.DIV_ITEM, can.river_list[river]) can.onmotion.select(can, can._output, [html.DIV_LIST, html.DIV_ITEM], can.storm_list[can.core.Keys(river, storm)]) - can.onmotion.delay(can, function() { can.onlayout._init(can) + can.onmotion.delay(can, function() { // can.onlayout._init(can) can.onengine.signal(can, chat.ONSTORM_SELECT, can.request(event, { river: can.Conf(chat.RIVER, river), storm: can.Conf(chat.STORM, storm), })) diff --git a/plugin/local/mall/goods.css b/plugin/local/mall/goods.css index 0d54fc73..d1493e69 100644 --- a/plugin/local/mall/goods.css +++ b/plugin/local/mall/goods.css @@ -1,7 +1,6 @@ -fieldset.goods>div.output>div.item>div { padding:10px; float:left; clear:none; } fieldset.goods>div.output>div.item { height:170px; float:left; border-radius:10px; } +fieldset.goods>div.output>div.item>div { padding:10px; float:left; clear:none; } fieldset.goods>div.output>div.item>div.image img { border-radius:10px; } fieldset.goods>div.output>div.item>div.content { float:right; } fieldset.goods>div.output>div.item>div.content>div.title { height:50px; white-space:break-spaces; overflow:hidden; } -fieldset.goods>div.output>div.item>div.content>div.price { color:red; } -body.mobile>fieldset.Action>div.output { overflow:hidden; } \ No newline at end of file +fieldset.goods>div.output>div.item>div.content>div.price { color:red; } \ No newline at end of file diff --git a/plugin/local/mall/goods.js b/plugin/local/mall/goods.js index 3b248008..2f684136 100644 --- a/plugin/local/mall/goods.js +++ b/plugin/local/mall/goods.js @@ -1,27 +1,26 @@ -Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.clear(can) +Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { var width = can.onexport.width(can); can.user.isMobile && can.page.style(can, can._output, html.HEIGHT, can.ConfHeight()) - can.page.Appends(can, target, msg.Table(function(value) { - return {view: html.ITEM+" "+(value.status||""), style: {width: width}, 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], style: {width: width-190}}, - {view: [wiki.CONTENT, html.DIV, value.text]}, - {view: ["price", html.DIV, "¥ "+value.price]}, - {view: ["count", html.DIV, "还剩 "+value.count]}, - {view: html.ACTION, inner: value.action, onclick: function(event) { - can.run(can.request(event, value), [ctx.ACTION, event.target.name]) - }}, + can.page.Appends(can, target, msg.Table(function(item) { + return {view: html.ITEM, style: {width: width}, list: [ + {view: wiki.IMAGE, list: [{img: can.misc.MergeURL(can, {_path: "/share/cache/"+can.core.Split(item.image)[0]}), width: 150}]}, + {view: wiki.CONTENT, list: [ + {view: [wiki.TITLE, html.DIV, item.name], style: {width: width-190}}, + {view: [wiki.CONTENT, html.DIV, item.text]}, + {view: [mall.PRICE, html.DIV, "¥ "+(item.price||0)]}, + {view: [mall.COUNT, html.DIV, "还剩 "+(item.count||0)]}, + {view: html.ACTION, inner: item.action}, ]}, ], onclick: function(event) { - if (can.page.tagis(event.target, html.INPUT)) { return } - can.Option(mdb.HASH, value.hash), can.Update() + if (can.page.tagis(event.target, html.INPUT) && event.target.type == html.BUTTON) { + can.run(can.request(event, item), [ctx.ACTION, event.target.name]) + } else { + can.Option(mdb.HASH, item.hash), can.Update() + } }} })), 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) } - }) }, - layout: function(can) { can.page.style(can, can._output, html.HEIGHT, can.ConfHeight()) - var width = can.onexport.width(can); can.page.Select(can, can._output, "div.item", function(target) { + layout: function(can) { can.user.isMobile && can.page.style(can, can._output, html.HEIGHT, can.ConfHeight()) + var width = can.onexport.width(can); can.page.Select(can, can._output, html.DIV_ITEM, function(target) { can.page.style(can, target, html.WIDTH, width), can.page.Select(can, target, "div.title", function(target) { can.page.style(can, target, html.WIDTH, width-190) }) diff --git a/plugin/state.js b/plugin/state.js index 7ba04c75..3a3f34d8 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -91,6 +91,9 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _process: function(can, msg) { } var sub = can.core.Value(can, chat._OUTPUTS_CURRENT); if (!sub) { return } sub.ConfHeight(can.ConfHeight()), sub.ConfWidth(can.ConfWidth()) if (mode) { sub.Mode(can.Mode(mode)), sub.onlayout[mode](sub) } else { can.onaction["刷新页面"]({}, can, "刷新页面", sub) } + if (can.user.isMobile) { + can.onmotion.toggle(can, can._action, can.ConfHeight() < can.ConfWidth()) + } }, title: function(can, title) { can.isCmdMode() && can.user.title(title) @@ -120,7 +123,7 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [ _resize: function(can, auto, height, width) { can.onimport.size(can, height, width, auto) }, _output: function(can, msg) { }, - "刷新页面": function(event, can, button, sub) { can.core.CallFunc([sub.onlayout, "_init"], {can: sub}), can.user.toastSuccess(can, button) }, + "刷新页面": function(event, can, button, sub) { can.core.CallFunc([sub.onlayout, "_init"], {can: sub}) }, "刷新数据": function(event, can) { can.Update({}, can.Input([], true)) }, "切换浮动": function(event, can, button, sub) { can.onaction._switch(can, sub, "float", function() { diff --git a/proto.js b/proto.js index c8c9dd92..7af8c14b 100644 --- a/proto.js +++ b/proto.js @@ -226,6 +226,7 @@ var team = { } var mall = { ASSET: "asset", SALARY: "salary", + PRICE: "price", COUNT: "count", } var svg = {