diff --git a/client/mp/app.js b/client/mp/app.js index ef51b771..55535c6e 100644 --- a/client/mp/app.js +++ b/client/mp/app.js @@ -1,8 +1,8 @@ const kit = require("utils/kit.js") App({ - // data: {}, conf: {serve: "https://shylinux.com/chat", space: "mac"}, - data: {}, conf: {serve: "https://shylinux.com/chat", space: ""}, + data: {}, conf: {serve: "https://shylinux.com/chat", space: "mac"}, + // data: {}, conf: {serve: "https://shylinux.com/chat", space: ""}, request: function(cmd, data, cb) { var app = this; data.sessid = app.conf.sessid, data.pod = app.conf.space wx.request({method: "POST", url: app.conf.serve+"/"+cmd, data: data, success: function(res) { var msg = res.data if (res.statusCode == 401) { return app.usercode(function() {app.request(cmd, data, cb)}) } diff --git a/client/mp/app.wxss b/client/mp/app.wxss index ace2ca12..6772bd11 100644 --- a/client/mp/app.wxss +++ b/client/mp/app.wxss @@ -38,12 +38,21 @@ view.option view.select picker view { view.output { clear:both; } -view.output>view.item { +view.output view.item { text-align:center; font-size:18px; padding:10px; border:solid 1px green; } +view.output view.list view.item { + background-color:darkgray; + margin-left:20px; +} +view.output view.code { + margin-left:10px; + padding:10px; + border-left:solid 2px cyan; +} view.title { margin-top:20px; diff --git a/client/mp/pages/action/action.js b/client/mp/pages/action/action.js index 7c32a497..702764b9 100644 --- a/client/mp/pages/action/action.js +++ b/client/mp/pages/action/action.js @@ -4,8 +4,8 @@ const app = getApp() Page({ data: { action: ["扫码", "清屏", "刷新", "串行", "并行", "共享"], + river: "", storm: "", title: "", res: [], his: {}, inputs: {}, - river: "", storm: "", }, action: { "扫码": function(event, page, data, name) { @@ -19,7 +19,9 @@ Page({ }, "刷新": function(event, page, data, name) { var list = []; app.data[page.data.river+page.data.storm] = page.data.res = list + wx.showLoading() app.request("action", {cmds: [page.data.river, page.data.storm]}, function(msg) { + wx.hideLoading() msg.Table(function(line, index) { page.data.his[index] = [] line.inputs = JSON.parse(line.inputs) @@ -204,7 +206,9 @@ Page({ if (cmds[i] === "") {cmds.pop()} else {break} } + wx.showLoading() app.request("action", {cmds: cmds}, function(msg) { + wx.hideLoading() page.data.res[order].msg = msg page.setData({res: page.data.res}) typeof cb == "function" && cb(msg) @@ -276,8 +280,9 @@ Page({ app.conf.sessid = options.sessid || app.conf.sessid this.data.river = options.river this.data.storm = options.storm - + this.data.title = options.title app.title(options.title) + var data = app.data[options.river+options.storm] if (data) {return this.setData({res: this.data.res = data})} this.onaction({}, {}, "刷新") @@ -293,11 +298,9 @@ Page({ onShareAppMessage: function (res) { console.log(res) return { - title: "some", - path: "pages/action/action?river="+this.data.river+"&storm="+this.data.storm, - success: function(res) { - console.log(res) - }, + title: this.data.title, + path: "pages/action/action?river="+this.data.river+"&storm="+this.data.storm+"&title="+this.data.title, + success: function(res) { console.log(res) }, } } }) diff --git a/client/mp/pages/action/action.wxml b/client/mp/pages/action/action.wxml index a60c0cf2..6f61d41d 100644 --- a/client/mp/pages/action/action.wxml +++ b/client/mp/pages/action/action.wxml @@ -38,7 +38,7 @@ - {{item}} + {{item}} diff --git a/client/mp/pages/river/river.js b/client/mp/pages/river/river.js index 8e7c408f..bc0d356d 100644 --- a/client/mp/pages/river/river.js +++ b/client/mp/pages/river/river.js @@ -4,7 +4,7 @@ const app = getApp() Page({ data: { action: ["扫码", "刷新", "登录", "授权"], - msg: {append: ["key", "name"]}, + river: {}, }, action: { "扫码": function(event, page, data, name) { @@ -13,8 +13,13 @@ Page({ }) }, "刷新": function(event, page, data, name) { + wx.showLoading() app.request("river", {}, function(msg) { - page.setData({msg: msg}), msg.nRow() == 1 && page.ondetail(event, data, 0) + wx.hideLoading() + var river = {}; msg.Table(function(value) { + river[value.key] = value + }) + page.setData({river: river}) }) }, "登录": function(event, page, data, name) { @@ -33,10 +38,30 @@ Page({ console.log("action", "river", name) this.action[name](event, this, data) }, - ondetail: function(event, data, index) { - data = data || event.target.dataset, index = index||data.index||0 - console.log("detail", "river", index) - app.jumps("storm/storm", {river: this.data.msg.key[index], title: this.data.msg.name[index]}) + ondetail: function(event, data) { var page = this + data = data || event.target.dataset.item + + console.log("detail", "river", data) + var river = page.data.river[data.key] + if (river.tool) { + river.hidetool = !river.hidetool + page.setData({river: page.data.river}) + return + } + + wx.showLoading() + app.request("storm", {cmds: [data.key]}, function(msg) { + wx.hideLoading() + river.tool = {}; msg.Table(function(value) { + river.tool[value.key] = value + value.river = data + }) + page.setData({river: page.data.river}) + }) + }, + onchange: function(event, data) { var page = this + data = data || event.target.dataset.item + app.jumps("action/action", {river: data.river.key, storm: data.key, title: data.river.name+"."+data.name}) }, onLoad: function (options) { diff --git a/client/mp/pages/river/river.wxml b/client/mp/pages/river/river.wxml index 2b895331..e9e54504 100644 --- a/client/mp/pages/river/river.wxml +++ b/client/mp/pages/river/river.wxml @@ -1,4 +1,12 @@ - + + + + {{item.name}} + + {{item.name}} + + + diff --git a/client/mp/plugin/story/paste.js b/client/mp/plugin/story/paste.js new file mode 100644 index 00000000..eb11f367 --- /dev/null +++ b/client/mp/plugin/story/paste.js @@ -0,0 +1,4 @@ + +module.exports = { + onimport: function() {}, +} diff --git a/client/mp/plugin/story/paste.wxml b/client/mp/plugin/story/paste.wxml new file mode 100644 index 00000000..43c226f3 --- /dev/null +++ b/client/mp/plugin/story/paste.wxml @@ -0,0 +1 @@ +hello wrold diff --git a/client/mp/project.config.json b/client/mp/project.config.json index 3e3c8a4e..7b64dc28 100644 --- a/client/mp/project.config.json +++ b/client/mp/project.config.json @@ -77,10 +77,10 @@ "scene": null }, { - "id": -1, + "id": 4, "name": "pages/action/action", "pathName": "pages/action/action", - "query": "river=d82c1d&storm=f7a8c9&title=mac.hi", + "query": "river=d82c1d&storm=12d1d7&title=mac.paste", "scene": null } ] diff --git a/plugin/story/paste.js b/plugin/story/paste.js new file mode 100644 index 00000000..43c6ab8e --- /dev/null +++ b/plugin/story/paste.js @@ -0,0 +1,24 @@ +Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { can._output.innerHTML = ""; + can.ui = can.page.Append(can, can._target, [ + {view: ["content", "div"]}, {view: ["display", "pre"]}, + ]) + can.onappend.table(can, can.ui.content, "table", msg) + can.onappend.board(can, can.ui.display, "board", msg) + return typeof cb == "function" && cb(msg) + }, +}) +Volcanos("onaction", {help: "控件交互", list: [], + onclick: function(event, can) { + can.run(event, [], function() {}) + }, +}) +Volcanos("ondetail", {help: "控件交互", list: ["编辑", "删除"], + "编辑": function(event, can, key) { + console.log(key) + }, + "删除": function(event, can, key) { + console.log(key) + }, +}) + +