diff --git a/pane/Debug.css b/pane/Debug.css
new file mode 100644
index 00000000..4d68a9a9
--- /dev/null
+++ b/pane/Debug.css
@@ -0,0 +1,3 @@
+fieldset.Debug>div.output td {
+ padding:2px;
+}
diff --git a/pane/Debug.js b/pane/Debug.js
new file mode 100644
index 00000000..627b83ce
--- /dev/null
+++ b/pane/Debug.js
@@ -0,0 +1,20 @@
+Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) {
+ can.require(["/plugin/github.com/Tencent/vConsole/dist/vconsole.min.js"], function(can) {
+ var v = new VConsole();
+ console.log(v);
+ })
+ },
+})
+Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg, list, cb, target) {
+ can.onimport._init(can, msg, list, cb, target)
+ can.user.log = function() {
+ can.page.Append(can, can._output, [{td: [
+ can.base.Time(),
+ can.base.FileLine(),
+ ].concat(can.core.List(arguments))}])
+ }
+ },
+})
+Volcanos("onexport", {help: "导出数据", list: []})
+
+
diff --git a/publish/chrome/chrome.html b/publish/chrome/chrome.html
new file mode 100644
index 00000000..4ea6fceb
--- /dev/null
+++ b/publish/chrome/chrome.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/publish/chrome/chrome.js b/publish/chrome/chrome.js
new file mode 100644
index 00000000..3b9a129a
--- /dev/null
+++ b/publish/chrome/chrome.js
@@ -0,0 +1,96 @@
+var can = Volcanos("chrome", {
+ chrome: function(msg, cmd, cb) {
+ if (cmd.length == 0) {
+ // 窗口列表
+ chrome.windows.getAll(function(wins) {
+ can.core.List(wins, function(win) {win.wid = win.id
+ msg.Push(win, ["wid", "state", "left", "top", "width", "height"])
+ })
+ typeof cb == "function" && cb(msg)
+ })
+ return
+ }
+ if (cmd.length == 1) {
+ // 标签列表
+ chrome.tabs.getAllInWindow(parseInt(cmd[0]), function(tabs) {
+ can.core.List(tabs, function(tab) {tab.tid = tab.id
+ msg.Push(tab, ["tid", "active", "width", "height", "index", "title", "url"])
+ })
+ typeof cb == "function" && cb(msg)
+ })
+ return
+ }
+
+ delete(msg._can)
+ delete(msg._event)
+ if (cmd[1] == "") {
+ chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
+ cmd[1] = tabs[0].id
+ chrome.tabs.sendMessage(parseInt(cmd[1]), msg, function (res) {
+ msg.Copy(res), typeof cb == "function" && cb(msg)
+ })
+ })
+ } else {
+ chrome.tabs.sendMessage(parseInt(cmd[1]), msg, function (res) {
+ msg.Copy(res), typeof cb == "function" && cb(msg)
+ })
+ }
+ return
+
+ // 新建标签
+ chrome.tabs.create({windowId: parseInt(cmd[0]), url: cmd[1], selected: false}, function() {
+ can.chrome(msg, [cmd[0]], cb)
+ })
+ },
+ bookmark: function(msg, cmd, cb) {
+ chrome.bookmarks.getSubTree(cmd[0]||"0", function(labs) {
+ for (var i = 0; i < labs.length; i++) {labs[i].pid = labs[i].parentId
+ msg.Push("time", can.base.Time(labs[i].dateAdded))
+ msg.Push(labs[i], ["pid", "id", "index", "title", "url"])
+ labs = labs.concat(labs[i].children||[])
+ }
+ typeof cb == "function" && cb(msg)
+ })
+ },
+}, ["/lib/base", "/lib/core", "/lib/misc", "/lib/page", "/lib/user"], function(can) {can.Conf({iceberg: "http://localhost:9020/"})
+ can.user.toast = function(message, title) {chrome.notifications.create(null, {
+ message: message, title: title||"volcanos", iconUrl: "/favicon.ico", type: "basic",
+ })},
+
+ can.misc.WSS(can, "ws://localhost:9020/space/", {name: "chrome", type: "chrome"}, function(event, msg) {
+ if (msg.Option("_handle")) { return can.user.toast(msg.result.join("")) }
+
+ // can.user.toast(msg.detail.join(" "))
+ try {
+ switch (msg.detail[0]) {
+ case "space": can._share = msg.detail[2]; break
+ case "pwd": msg.Echo("hello world"); break
+ default: (can[msg.detail[0]]||can.chrome[msg.detail[0]])(msg, msg.detail.slice(1), function(msg) {
+ msg.Reply(msg)
+ }); return
+ }
+ } catch (e) {
+ can.user.toast(e)
+ }
+ msg.Reply(msg)
+ }, function() {can.user.toast("wss connect", "iceberg")})
+
+ can.run = function(event, cmd, cb, silent) { var msg = can.request(event)
+ can.misc.Run(event, can, {names: "code/chrome/crx"}, cmd, cb)
+ },
+ chrome.history.onVisited.addListener(function(item) {
+ can.run({}, ["history", item.id, item.title, item.url])
+ })
+ chrome.contextMenus.create({
+ title: "favor",
+ onclick: function(event) {
+ chrome.tabs.query({ active: true}, function (tabs) {
+ chrome.tabs.sendMessage(tabs[0].id, { action: "copy" }, function (response) {
+ console.log(response)
+ can.run({}, ["history", "id", response.title, response.src])
+ })
+ })
+ },
+ })
+})
+
diff --git a/publish/chrome/contexts.js b/publish/chrome/contexts.js
new file mode 100644
index 00000000..bfb96d67
--- /dev/null
+++ b/publish/chrome/contexts.js
@@ -0,0 +1,56 @@
+var can = Volcanos("chrome", {
+ spide: function(can, msg) {
+ can.page.Select(can, document.body, "video", function(item) {
+ var p = can.page.Select(can, document.body, "p.title")[0]
+
+ var ls = item.src.split("?")
+ var ls = ls[0].split(".")
+ msg.Push("time", can.base.Time())
+ msg.Push("type", "video")
+ msg.Push("name", (p && p.innerText || "video")+"."+ls[ls.length-1])
+ msg.Push("text", item.src)
+ msg.Push("link", item.src)
+ })
+ can.page.Select(can, document.body, "img", function(item) {
+ var ls = item.src.split("?")
+ var ls = ls[0].split("/")
+
+ msg.Push("time", can.base.Time())
+ msg.Push("type", "img")
+
+ if (item.src.startsWith("data:image")) {
+ msg.Push("name", item.src.slice(item.src.length-20))
+ } else {
+ msg.Push("name", ls[ls.length-1]||"image.jpg")
+ }
+
+ msg.Push("text", item.src)
+ msg.Push("link", item.src)
+ })
+ },
+}, [], function(can) {
+ can.user = user
+ can.page = page
+ can.misc = misc
+ can.core = core
+ can.base = base
+
+ chrome.extension.onMessage.addListener( function (msg, sender, cb) { var action = can[msg.detail[3]||"spide"]
+ msg = can.request({}, msg)
+ delete(msg._event)
+ delete(msg._can)
+ typeof action == "function" && action(can, msg) || typeof cb == "function" && cb(msg)
+ })
+ return
+
+ chrome.extension.onMessage.addListener( function (request, sender, sendResponse) {
+ var title = can.page.Select(can, document.body, "p.title", function(item) {
+ return item.innerText
+ }).join("-")
+ can.page.Select(can, document.body, "video", function(item) {
+ sendResponse({poster: item.poster, src: item.src, title: title})
+ console.log(item)
+ })
+ })
+})
+
diff --git a/publish/chrome/popup.html b/publish/chrome/popup.html
new file mode 100644
index 00000000..36ca8697
--- /dev/null
+++ b/publish/chrome/popup.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/publish/chrome/popup.js b/publish/chrome/popup.js
new file mode 100644
index 00000000..7690efe9
--- /dev/null
+++ b/publish/chrome/popup.js
@@ -0,0 +1,12 @@
+Volcanos({name: "demo", volcano: "/frame.js", iceberg: "http://localhost:9020/chat/", intshell: "plug.sh",
+ libs: ["/lib/base", "/lib/core", "/lib/misc", "/lib/page", "/lib/user"], panes: [
+ {name: "Header", help: "标题栏", pos: "head", state: ["time", "username"]},
+ {name: "River", help: "群聊组", pos: "left"},
+ {name: "Action", help: "工作台", pos: "middle"},
+ {name: "Search", help: "搜索框", pos: "float"},
+ {name: "Footer", help: "状态条", pos: "foot", state: ["ncmd" ]},
+ ], main: {name: "Header", engine: "remote", list: ["/publish/order.js"]}, plugin: [
+ "/plugin/state.js", "/plugin/input.js", "/plugin/table.js",
+ ],
+})
+
diff --git a/publish/chrome/spided.js b/publish/chrome/spided.js
new file mode 100644
index 00000000..c1e61515
--- /dev/null
+++ b/publish/chrome/spided.js
@@ -0,0 +1,28 @@
+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, msg, can.ui.content, "table")
+ can.onappend.board(can, msg,can.ui.display, "board")
+ var refresh = msg.Option("_refresh") || can.Conf("feature")["_refresh"]
+ refresh && can.core.Timer(refresh, function() {
+ can.run({})
+ })
+ 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)
+ },
+})
+
+
diff --git a/publish/client/mp/app.js b/publish/client/mp/app.js
new file mode 100644
index 00000000..c52e4b1a
--- /dev/null
+++ b/publish/client/mp/app.js
@@ -0,0 +1,134 @@
+const kit = require("utils/kit.js")
+
+App({
+ // 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)}) }
+ console.log("POST", cmd, msg)
+
+ msg.__proto__ = {
+ nRow: function() { return msg.append && msg.append[0] && msg[msg.append[0]].length || 0 },
+ Result: function() { return msg.result && msg.result.length > 0 && msg.result.join("") || "" },
+ Table: function(cb) { var row = 0
+ for (var i = 0; i < msg.append.length; i++) {
+ row = msg[msg.append[i]].length > row? msg[msg.append[i]].length: row
+ }
+ for (var i = 0; i < row; i++) { var line = {}
+ for (var k in msg.append) {
+ line[msg.append[k]] = msg[msg.append[k]][i]
+ }
+ typeof cb == "function" && cb(line, i, row)
+ }
+ },
+ }
+ var row = 0
+ var index = []
+ if (msg.append) {
+ for (var i = 0; i < msg.append.length; i++) {
+ row = msg[msg.append[i]].length > row? msg[msg.append[i]].length: row
+ }
+ for (var i = 0; i < row; i++) {
+ index.push(i)
+ }
+ }
+ msg._index = index
+
+ typeof cb == "function" && cb(msg)
+ }})
+ },
+ download: function(cmd, data, cb) { var app = this; data.sessid = app.conf.sessid
+ wx.downloadFile({url: app.conf.serve+"/"+cmd, data: data, success: cb})
+ },
+ usercode: function(cb) { var app = this
+ wx.login({success: function(res) { app.request("mp/login/sess", {code: res.code}, function(msg) {
+ wx.setStorage({key: "sessid", data: msg.Result()})
+ app.conf.sessid = msg.Result(), typeof cb == "function" && cb()
+ })}})
+ },
+ userinfo: function(cb) { var app = this
+ if (app.conf.userInfo) {
+ app.request("mp/login/user", app.conf.userInfo, function(msg) {
+ typeof cb == "function" && cb(app.conf.userInfo)
+ })
+ return
+ }
+ app.usercode(function() {
+ wx.getSetting({ success: function(res) { res.authSetting['scope.userInfo'] && wx.getUserInfo({success: function(res) {
+ app.request("mp/login/user", res.userInfo, function(msg) { app.conf.userInfo = res.userInfo
+ typeof cb == "function" && cb(res.userInfo)
+ })
+ }})}})
+ })
+ },
+ location: function(arg) { wx.chooseLocation(arg) },
+
+ title: function(title) { wx.setNavigationBarTitle({title: title, success: function() {}})},
+ modal: function(title, content, cb) { wx.showModal({title: title||"", content: content||"", success: cb})},
+ toast: function(title, content) { wx.showToast({title: title, content: content||""})},
+ jumps: function(url, args, cb) { var next = "/pages/"+kit.Args(url, args)
+ console.log("jump", next), wx.navigateTo({url: next, success: cb})
+ },
+ scans: function(cb) { var app = this
+ wx.scanCode({success: function(res) { console.log("scan", res)
+ try {
+ var value = JSON.parse(res.result)
+ } catch(e) {
+ try {
+ var value = {"type": "url", "text": res.result}
+ var ls = res.result.split("?"); if (ls.length > 1) { ls = ls[1].split("&")
+ for (var i = 0; i < ls.length; i++) { var vs = ls[i].split("=")
+ value[vs[0]] = decodeURIComponent(vs[1])
+ }
+ }
+ } catch(e) {
+ typeof cb == "function" && cb({type: "", text: res.result})
+ return
+ }
+ }
+
+ switch (value.type) {
+ case "share":
+ switch (value.name) {
+ case "invite":
+ app.userinfo(function(userInfo) {
+ app.modal("接受邀请", value.name, function(res) {
+ res.confirm && app.request("mp/login/auth", value, function(msg) {
+ app.toast("回执成功")
+ })
+ })
+ })
+ break
+ }
+ break
+
+ case "login":
+ app.userinfo(function(userInfo) {
+ app.modal("授权登录", value.name, function(res) {
+ res.confirm && app.request("mp/login/auth", value, function(msg) {
+ app.toast("授权成功")
+ })
+ })
+ })
+ break
+ case "active":
+ app.userinfo(function(userInfo) {
+ app.modal("授权登录", value.name, function(res) {
+ res.confirm && app.request("mp/login/auth", value, function(msg) {
+ app.toast("授权成功")
+ })
+ })
+ })
+ break
+ default:
+ typeof cb == "function" && cb(value)
+ }
+ }})
+ },
+
+ onLaunch: function() {
+ this.conf.sessid = wx.getStorageSync("sessid")
+ console.log("load", "sessid", this.conf.sessid)
+ },
+})
diff --git a/publish/client/mp/app.json b/publish/client/mp/app.json
new file mode 100644
index 00000000..35adc4ae
--- /dev/null
+++ b/publish/client/mp/app.json
@@ -0,0 +1,16 @@
+{
+ "pages": [
+ "pages/river/river",
+ "pages/action/action",
+ "pages/insert/insert"
+ ],
+ "window": {
+ "backgroundColor": "#000",
+ "backgroundTextStyle": "dark",
+ "navigationBarBackgroundColor": "#000",
+ "navigationBarTitleText": "终端工具链",
+ "navigationBarTextStyle": "white"
+ },
+ "style": "v2",
+ "sitemapLocation": "sitemap.json"
+}
diff --git a/publish/client/mp/app.wxml b/publish/client/mp/app.wxml
new file mode 100644
index 00000000..16dd762e
--- /dev/null
+++ b/publish/client/mp/app.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+ {{item}}
+
+
diff --git a/publish/client/mp/app.wxss b/publish/client/mp/app.wxss
new file mode 100644
index 00000000..6772bd11
--- /dev/null
+++ b/publish/client/mp/app.wxss
@@ -0,0 +1,84 @@
+page {
+ color:white;
+ font-size:14px;
+ font-family:monospace;
+ background-color:#272822;
+ white-space:pre;
+}
+
+view.action>view.item {
+ float:left;
+}
+view.option>view.item {
+ padding:0;
+ border: 0;
+ float:left;
+}
+view.option input {
+ width:80px;
+ margin:2px;
+ padding:2px;
+ border:solid 1px green;
+}
+view.option view.textarea {
+ clear:both;
+ width:calc(100% - 2px);
+ border:solid 1px green;
+}
+view.option view.select {
+ border:solid 1px green;
+ float:left;
+ /* width:40px; */
+ padding:6px;
+}
+view.option view.select picker {
+}
+view.option view.select picker view {
+}
+view.output {
+ clear:both;
+}
+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;
+ margin-bottom:10px;
+ font-weight:bold;
+ font-size:18px;
+}
+view.field {
+}
+
+table {
+}
+tr {
+ display:flex;
+ justify-content:space-between;
+}
+th {
+ padding:5px;
+ width:100%;
+ text-align:center;
+ border:solid 1px red;
+}
+td {
+ padding:5px;
+ width:100%;
+ text-align:center;
+ border:solid 1px green;
+}
+
diff --git a/publish/client/mp/pages/action/action.js b/publish/client/mp/pages/action/action.js
new file mode 100644
index 00000000..c135ec90
--- /dev/null
+++ b/publish/client/mp/pages/action/action.js
@@ -0,0 +1,185 @@
+const kit = require("../../utils/kit.js")
+const app = getApp()
+
+Page({
+ data: {
+ action: ["扫码", "刷新", "清屏", "串行", "并行"],
+ river: "", storm: "", title: "",
+ res: [], his: {}, inputs: {},
+ },
+ action: {
+ "扫码": function(event, page, data, name) {
+ // app.jumps("scans/scans")
+ app.scans(function(res) {
+ res["sess.river"] = page.data.river
+ res["sess.storm"] = page.data.storm
+ app.request("mp/login/scan", res)
+ page.onaction(event, res, res.name)
+ })
+ },
+ "刷新": 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) {
+ line.name = line.name.split(" ")[0]
+ page.data.his[index] = []
+ line.inputs = JSON.parse(line.list)
+ line.feature = JSON.parse(line.meta)
+ if (!line.inputs || line.inputs.length === 0) {
+ line.inputs = [{_input: "text"}, {_input: "button", value: "执行"}]
+ }
+ list.push(line), line.inputs.forEach(function(input) {
+ input.action = input.action || input.value
+ input.value == "auto" && (input.value = "")
+ input.value = input.value || kit.Value(line, "feature.trans."+input.name)
+ if (input.value && input.value.startsWith("@")) {
+ input.value = ""
+ }
+ if (input._input == "select") {
+ input.values = input.values || input.value && input.value.split("|")
+ }
+ input._input == "button" && input.action == "auto" && page.run(event, index)
+ })
+ })
+ page.setData({res: list})
+ })
+ },
+ "串行": function(event, page, data, name) {
+ function cb(i) {
+ page.run(event, i, null, function() {i < page.data.res.length - 1&& cb(i+1)})
+ }
+ cb(0)
+ },
+ "并行": function(event, page, data, name) {
+ kit.List(page.data.res, function(field, index) {
+ page.run(event, index)
+ })
+ },
+ "清屏": function(event, page, data, name) {
+ kit.List(page.data.res, function(field, index) {
+ delete(field.msg)
+ })
+ page.setData({res: page.data.res})
+ },
+ },
+ onaction: function(event, data, name) {
+ data = data || event.target.dataset, name = name || data.name
+ console.log("action", "action", name)
+ this.action[name](event, this, data)
+ },
+
+ run: function(event, order, cmd, cb) {var page = this, field = page.data.res[order]
+ var cmds = [page.data.river, page.data.storm, field.id || field.key]
+ cmds = cmds.concat(cmd||kit.List(field.inputs, function(input) {
+ if (["text", "textarea", "select"].indexOf(input._input) > -1) {
+ return input.value || ""
+ }
+ }))
+
+ for (var i = cmds.length-1; i > 0; i--) {
+ if (cmds[i] === "") {cmds.pop()} else {break}
+ }
+
+ wx.showLoading()
+ app.request("action?="+field.name, {cmds: cmds}, function(msg) {
+ wx.hideLoading()
+ page.data.res[order].msg = msg
+ page.setData({res: page.data.res})
+ typeof cb == "function" && cb(msg)
+ })
+ },
+
+ onBlur: function(event) {var page = this, data = event.target.dataset
+ },
+ onFocus: function(event) {},
+ onInput: function(event) {var page = this, data = event.target.dataset
+ page.data.res[data.order].inputs[data.index].value = event.detail.value
+ page.setData({res: page.data.res})
+ },
+ onChange: function(event) {var page = this, data = event.target.dataset
+ page.data.res[data.order].inputs[data.index].index = parseInt(event.detail.value)
+ page.data.res[data.order].inputs[data.index].value = data.input.values[parseInt(event.detail.value)]
+ page.setData({res: page.data.res})
+ },
+ onEnter: function(event) {var page = this, data = event.target.dataset
+ page.data.res[data.order].inputs[data.index].value = event.detail.value
+ },
+
+ onClick: function(event) {var page = this, data = event.target.dataset
+ var field = page.data.res[data.order]
+
+ if (field.feature[data.input.name]) {
+ app.data.insert = {
+ field: field, input: data.input,
+ data: {}, list: field.feature[data.input.name], cb: function(res) {
+ var list = ["action", data.input.name]
+ kit.Item(res, function(key, value) {
+ key && value && list.push(key, value)
+ })
+ page.run(event, data.order, list)
+ }
+ }
+ app.jumps("insert/insert", {river: page.data.river, storm: page.data.storm, title: field.name})
+ return
+ }
+
+ switch (data.input.name) {
+ case "返回":
+ // 恢复命令
+ page.data.his[data.order].pop()
+ var line = page.data.his[data.order].pop()
+ kit.List(field.inputs, function(input, index) {
+ input.value = line && line[index] || ""
+ })
+ default:
+ // 执行命令
+ page.data.his[data.order].push(kit.List(field.inputs, function(input) {
+ return input.value
+ })) && page.run(event, data.order)
+ }
+ },
+ onWhich: function(event) {var page = this, data = event.target.dataset
+ var field = page.data.res[data.order]
+ field.inputs.forEach(function(input, index) {
+ if (input.name == data.field) {
+ // 导入参数
+ page.data.res[data.order].inputs[index].value = data.value
+ page.setData({res: page.data.res})
+ // 执行命令
+ input.action == "auto" && page.data.his[data.order].push(kit.List(field.inputs, function(input) {
+ return input.value
+ })) && page.run(event, data.order)
+ }
+ })
+ },
+
+ onLoad: function (options) {
+ console.log("page", "action", options)
+ 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({}, {}, "刷新")
+ },
+ onReady: function () {},
+ onShow: function () {},
+ onHide: function () {},
+ onUnload: function () {},
+ onPullDownRefresh: function () {
+ this.onaction({}, {}, "刷新")
+ },
+ onReachBottom: function () {},
+ onShareAppMessage: function (res) {
+ console.log("action", "share", res)
+ return {
+ title: this.data.title,
+ path: "pages/action/action?river="+this.data.river+"&storm="+this.data.storm+"&title="+this.data.title,
+ }
+ },
+})
diff --git a/publish/client/mp/pages/action/action.json b/publish/client/mp/pages/action/action.json
new file mode 100644
index 00000000..5ed4543e
--- /dev/null
+++ b/publish/client/mp/pages/action/action.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
diff --git a/publish/client/mp/pages/action/action.wxml b/publish/client/mp/pages/action/action.wxml
new file mode 100644
index 00000000..3e226aa3
--- /dev/null
+++ b/publish/client/mp/pages/action/action.wxml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ {{field.name}}({{field.help}})
+
+
+
+
+
+
+
+
+
+
+
+ {{item.values[item.index||0]}}
+
+
+
+
+
+
+
+
+
+
+
+ {{item}} |
+
+ {{field.msg[item][line]}} |
+
+
+
+
+
+
+
+
+
diff --git a/publish/client/mp/pages/action/action.wxss b/publish/client/mp/pages/action/action.wxss
new file mode 100644
index 00000000..8cef7a7f
--- /dev/null
+++ b/publish/client/mp/pages/action/action.wxss
@@ -0,0 +1,6 @@
+view.option view.item {
+ padding:0;
+}
+view.option view.item.select {
+ padding:3px;
+}
diff --git a/publish/client/mp/pages/insert/insert.js b/publish/client/mp/pages/insert/insert.js
new file mode 100644
index 00000000..7c0e79f3
--- /dev/null
+++ b/publish/client/mp/pages/insert/insert.js
@@ -0,0 +1,80 @@
+const kit = require("../../utils/kit.js")
+const app = getApp()
+
+Page({
+ data: {
+ action: ["扫码"],
+ field: {},
+ insert: [],
+ },
+ action: {
+ "扫码": function(event, page, data, name) {
+ app.scans(function(res) {
+ res["sess.river"] = page.data.river
+ res["sess.storm"] = page.data.storm
+ app.request("mp/login/scan", res)
+ page.onaction(event, res, res.name)
+ })
+ },
+ },
+ onaction: function(event, data, name) {
+ data = data || event.target.dataset, name = name || data.name
+ console.log("action", "action", name)
+ this.action[name](event, this, data)
+ },
+
+ onInput: function(event) {var page = this, data = event.target.dataset
+ app.data.insert[data.index].value = event.detail.value
+ },
+ onFocus: function(event) {},
+ onConfirm: function (event) { var page = this
+ kit.List(page.data.insert, function(item) {
+ app.data.insert.data[item.name] = item.value
+ })
+ app.data.insert.cb(app.data.insert.data)
+ wx.navigateBack()
+ },
+ onLoad: function (options) {
+ this.data.insert = app.data.insert.list
+
+ var p = app.data.insert.input.action
+ if (p.startsWith("@")) {
+ var cb = this.plugin[p.slice(1,-1)]; cb && cb(this)
+ }
+ var cb = this.plugin[p]; cb && cb(this)
+ kit.List(app.data.insert.list, function(item) {
+ item.action = item.action || item.value
+ item.value && item.value.startsWith("@") && (item.value = "")
+ app.data.insert.data[item.name] = item.value
+ })
+ console.log("page", "insert", options)
+ app.title(options.title)
+ this.setData(this.data)
+ },
+ onReady: function () {},
+ onShow: function () {},
+ onHide: function () {},
+ onUnload: function () {},
+ onPullDownRefresh: function () {},
+ onReachBottom: function () {},
+
+ plugin: {
+ getLocation: function(page, data) { app.location({success: function(res) {
+ res.latitude = parseInt(res.latitude * 100000)
+ res.longitude = parseInt(res.longitude * 100000)
+ kit.List(page.data.insert, function(item) {
+ res[item.name] && (item.value = res[item.name])
+ }), page.setData(page.data)
+ }}) },
+ scanQRCode: function(page) { app.scans(function(res) {
+ kit.List(page.data.insert, function(item) {
+ res[item.name] && (item.value = res[item.name])
+ }), page.setData(page.data)
+ }) },
+ paste: function(page, data) { wx.getClipboardData({success: function(res) {
+ kit.List(page.data.insert, function(item) {
+ res[item.name] && (item.value = res[item.name])
+ }), page.setData(page.data)
+ }}) },
+ },
+})
diff --git a/publish/client/mp/pages/insert/insert.json b/publish/client/mp/pages/insert/insert.json
new file mode 100644
index 00000000..8835af06
--- /dev/null
+++ b/publish/client/mp/pages/insert/insert.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/publish/client/mp/pages/insert/insert.wxml b/publish/client/mp/pages/insert/insert.wxml
new file mode 100644
index 00000000..d412598b
--- /dev/null
+++ b/publish/client/mp/pages/insert/insert.wxml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.values[item.index||0]}}
+
+
+
+
+
+
+
+
+
diff --git a/publish/client/mp/pages/insert/insert.wxss b/publish/client/mp/pages/insert/insert.wxss
new file mode 100644
index 00000000..b96c7b27
--- /dev/null
+++ b/publish/client/mp/pages/insert/insert.wxss
@@ -0,0 +1 @@
+/* pages/insert/insert.wxss */
\ No newline at end of file
diff --git a/publish/client/mp/pages/river/river.js b/publish/client/mp/pages/river/river.js
new file mode 100644
index 00000000..14983590
--- /dev/null
+++ b/publish/client/mp/pages/river/river.js
@@ -0,0 +1,84 @@
+const kit = require("../../utils/kit.js")
+const app = getApp()
+
+Page({
+ data: {
+ action: ["扫码", "刷新", "登录"],
+ river: {},
+ },
+ action: {
+ "扫码": function(event, page, data) { app.scans(function(res) {
+ switch (res.type) {
+ case "url":
+ app.request("mp/login/scan", res, function(msg) {
+ page.onaction({}, {}, "刷新")
+ })
+ break
+ default:
+ res.name && page.onaction(event, res, res.name)
+ }
+ }) },
+ "刷新": function(event, page, data) {
+ wx.showLoading()
+ app.request("river", {}, function(msg) {
+ wx.hideLoading()
+ var river = {}; msg.Table(function(value) {
+ river[value.hash] = value
+ })
+ page.setData({river: river})
+ })
+ },
+ "登录": function(event, page, data) { app.conf.sessid = "",
+ app.userinfo(function(res) {
+ page.onaction(event, data, "刷新")
+ })
+ },
+ },
+ onaction: function(event, data, name) {
+ data = data || event.target.dataset, name = name || data.name
+ console.log("action", "river", name)
+ this.action[name](event, this, data)
+ },
+ ondetail: function(event, data) { var page = this
+ data = data || event.target.dataset.item
+ console.log("detail", "river", data)
+
+ var river = page.data.river[data.hash]
+ if (river.tool) {
+ river.hidetool = !river.hidetool
+ page.setData({river: page.data.river})
+ return
+ }
+
+ wx.showLoading()
+ app.request("river", {cmds: [data.hash, "tool"]}, function(msg) {
+ wx.hideLoading()
+ river.tool = {}; msg.Table(function(value) {
+ river.tool[value.hash] = 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.hash, storm: data.hash, title: data.river.name+"."+data.name})
+ },
+
+ onLoad: function (options) { var page = this
+ console.log("page", "river", options)
+ app.conf.sessid = options.sessid || app.conf.sessid
+ app.usercode(function() {
+ page.onaction({}, options, "刷新")
+ })
+ },
+ onReady: function () {},
+ onShow: function () {},
+ onHide: function () {},
+ onUnload: function () {},
+ onPullDownRefresh: function () {
+ this.onaction({}, {}, "刷新")
+ },
+ onReachBottom: function () {},
+ onShareAppMessage: function () {}
+})
diff --git a/publish/client/mp/pages/river/river.json b/publish/client/mp/pages/river/river.json
new file mode 100644
index 00000000..5ed4543e
--- /dev/null
+++ b/publish/client/mp/pages/river/river.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
diff --git a/publish/client/mp/pages/river/river.wxml b/publish/client/mp/pages/river/river.wxml
new file mode 100644
index 00000000..e9e54504
--- /dev/null
+++ b/publish/client/mp/pages/river/river.wxml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ {{item.name}}
+
+ {{item.name}}
+
+
+
diff --git a/publish/client/mp/pages/river/river.wxss b/publish/client/mp/pages/river/river.wxss
new file mode 100644
index 00000000..e69de29b
diff --git a/publish/client/mp/plugin/story/paste.js b/publish/client/mp/plugin/story/paste.js
new file mode 100644
index 00000000..eb11f367
--- /dev/null
+++ b/publish/client/mp/plugin/story/paste.js
@@ -0,0 +1,4 @@
+
+module.exports = {
+ onimport: function() {},
+}
diff --git a/publish/client/mp/plugin/story/paste.wxml b/publish/client/mp/plugin/story/paste.wxml
new file mode 100644
index 00000000..43c226f3
--- /dev/null
+++ b/publish/client/mp/plugin/story/paste.wxml
@@ -0,0 +1 @@
+hello wrold
diff --git a/publish/client/mp/project.config.json b/publish/client/mp/project.config.json
new file mode 100644
index 00000000..7b64dc28
--- /dev/null
+++ b/publish/client/mp/project.config.json
@@ -0,0 +1,89 @@
+{
+ "description": "项目配置文件",
+ "packOptions": {
+ "ignore": []
+ },
+ "setting": {
+ "urlCheck": true,
+ "es6": true,
+ "postcss": true,
+ "minified": true,
+ "newFeature": true,
+ "autoAudits": false,
+ "coverView": true,
+ "showShadowRootInWxmlPanel": true,
+ "scopeDataCheck": false
+ },
+ "compileType": "miniprogram",
+ "libVersion": "2.0.4",
+ "appid": "wxf4e5104d83476ed6",
+ "projectname": "%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7%E9%93%BE",
+ "debugOptions": {
+ "hidedInDevtools": []
+ },
+ "isGameTourist": false,
+ "simulatorType": "wechat",
+ "simulatorPluginLibVersion": {},
+ "condition": {
+ "search": {
+ "current": -1,
+ "list": []
+ },
+ "conversation": {
+ "current": -1,
+ "list": []
+ },
+ "plugin": {
+ "current": -1,
+ "list": []
+ },
+ "game": {
+ "currentL": -1,
+ "list": []
+ },
+ "gamePlugin": {
+ "current": -1,
+ "list": []
+ },
+ "miniprogram": {
+ "current": -1,
+ "list": [
+ {
+ "id": 0,
+ "name": "pages/action/action",
+ "pathName": "pages/action/action",
+ "query": "river=c796cd&storm=9092d5",
+ "scene": 1008
+ },
+ {
+ "id": 1,
+ "name": "action",
+ "pathName": "pages/action/action",
+ "query": "river=d022b3&storm= c22d21",
+ "scene": null
+ },
+ {
+ "id": 2,
+ "name": "pages/river/river",
+ "pathName": "pages/river/river",
+ "query": "river=c796cd&storm=9092d5",
+ "scene": null
+ },
+ {
+ "id": -1,
+ "name": "pages/scans/scans",
+ "pathName": "pages/scans/scans",
+ "query": "river=c796cd&storm=9092d5",
+ "scene": null
+ },
+ {
+ "id": 4,
+ "name": "pages/action/action",
+ "pathName": "pages/action/action",
+ "query": "river=d82c1d&storm=12d1d7&title=mac.paste",
+ "scene": null
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/publish/client/mp/sitemap.json b/publish/client/mp/sitemap.json
new file mode 100644
index 00000000..ca02add2
--- /dev/null
+++ b/publish/client/mp/sitemap.json
@@ -0,0 +1,7 @@
+{
+ "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
+ "rules": [{
+ "action": "allow",
+ "page": "*"
+ }]
+}
\ No newline at end of file
diff --git a/publish/client/mp/utils/kit.js b/publish/client/mp/utils/kit.js
new file mode 100644
index 00000000..8c5fae8d
--- /dev/null
+++ b/publish/client/mp/utils/kit.js
@@ -0,0 +1,42 @@
+module.exports = {
+ Number: function(d, n) {var res = [];
+ while (d > 0) {res.push(d % 10); d = parseInt(d / 10); n--}
+ while (n > 0) {res.push("0"); n--}
+ return res.reverse(), res.join("");
+ },
+ Time: function(t, fmt) {var now = t? new Date(t): new Date();
+ fmt = fmt || "%y-%m-%d %H:%M:%S";
+ fmt = fmt.replace("%y", now.getFullYear())
+ fmt = fmt.replace("%m", Number(now.getMonth()+1, 2))
+ fmt = fmt.replace("%d", Number(now.getDate(), 2))
+ fmt = fmt.replace("%H", Number(now.getHours(), 2))
+ fmt = fmt.replace("%M", Number(now.getMinutes(), 2))
+ fmt = fmt.replace("%S", Number(now.getSeconds(), 2))
+ return fmt
+ },
+ Args: function(url, args) {var list = []
+ for (var k in args) {
+ list.push(encodeURIComponent(k)+"="+encodeURIComponent(args[k]))
+ }
+ return url+"?"+list.join("&")
+ },
+ List: function(list, cb, cbs) {var res = [], val;
+ for (var i = 0; i < list.length; i++) {
+ typeof cb == "function"? (val = cb(list[i], i, list)) != undefined && res.push(val): res.push(list[i])
+ }
+ return typeof cbs == "function" && cbs(res), res
+ },
+ Item: function(list, cb, cbs) {
+ for (var k in list) {
+ cb(k, list[k])
+ }
+ },
+ Value: function(item, key) {
+ var p = item, ls = key.split(".")
+ while (p && ls.length > 0) {
+ p = p[ls[0]], ls = ls.slice(1)
+ }
+ return p
+ },
+}
+
diff --git a/publish/client/mp/utils/util.js b/publish/client/mp/utils/util.js
new file mode 100644
index 00000000..4149ac48
--- /dev/null
+++ b/publish/client/mp/utils/util.js
@@ -0,0 +1,50 @@
+const formatTime = date => {
+ const year = date.getFullYear()
+ const month = date.getMonth() + 1
+ const day = date.getDate()
+ const hour = date.getHours()
+ const minute = date.getMinutes()
+ const second = date.getSeconds()
+
+ return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+}
+
+const formatNumber = n => {
+ n = n.toString()
+ return n[1] ? n : '0' + n
+}
+function Number(d, n) {var res = [];
+ while (d > 0) {res.push(d % 10); d = parseInt(d / 10); n--}
+ while (n > 0) {res.push("0"); n--}
+ return res.reverse(), res.join("");
+}
+function Time(t, fmt) {var now = t? new Date(t): new Date();
+ fmt = fmt || "%y-%m-%d %H:%M:%S";
+ fmt = fmt.replace("%y", now.getFullYear())
+ fmt = fmt.replace("%m", Number(now.getMonth()+1, 2))
+ fmt = fmt.replace("%d", Number(now.getDate(), 2))
+ fmt = fmt.replace("%H", Number(now.getHours(), 2))
+ fmt = fmt.replace("%M", Number(now.getMinutes(), 2))
+ fmt = fmt.replace("%S", Number(now.getSeconds(), 2))
+ return fmt
+}
+function Args(url, args) {var list = []
+ for (var k in args) {
+ list.push(encodeURIComponent(k)+"="+encodeURIComponent(args[k]))
+ }
+ return url+"?"+list.join("&")
+}
+
+module.exports = {
+ formatTime: formatTime,
+ Time: Time,
+ Args: Args,
+ List: function(list, cb) {
+ var res = [], val;
+ for (var i = 0; i < list.length; i++) {
+ typeof cb == "function"? (val = cb(list[i], i, list)) != undefined && res.push(val): res.push(list[i])
+
+ }
+ return res
+ },
+}