diff --git a/client/mp/app.js b/client/mp/app.js
index ef51b771..379b7bbc 100644
--- a/client/mp/app.js
+++ b/client/mp/app.js
@@ -74,44 +74,55 @@ App({
wx.scanCode({success: function(res) { console.log("scan", res)
try {
var value = JSON.parse(res.result)
- 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("回执成功")
- })
+ } 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
+ })
+ 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("授权成功")
- })
+ 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
+ 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)
- }
- } catch(e) {
- typeof cb == "function" && cb({type: "", text: res.result})
+ })
+ break
+ default:
+ typeof cb == "function" && cb(value)
}
}})
},
diff --git a/client/mp/pages/action/action.js b/client/mp/pages/action/action.js
index 3c3f8e7a..c135ec90 100644
--- a/client/mp/pages/action/action.js
+++ b/client/mp/pages/action/action.js
@@ -33,6 +33,7 @@ Page({
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 = ""
}
@@ -124,8 +125,8 @@ Page({
return
}
- switch (data.input.value) {
- case "Last":
+ switch (data.input.name) {
+ case "返回":
// 恢复命令
page.data.his[data.order].pop()
var line = page.data.his[data.order].pop()
diff --git a/client/mp/pages/action/action.wxml b/client/mp/pages/action/action.wxml
index eb7bda9e..3e226aa3 100644
--- a/client/mp/pages/action/action.wxml
+++ b/client/mp/pages/action/action.wxml
@@ -23,7 +23,7 @@
-
+
diff --git a/client/mp/pages/insert/insert.js b/client/mp/pages/insert/insert.js
index fdd72ee5..70bd8c0f 100644
--- a/client/mp/pages/insert/insert.js
+++ b/client/mp/pages/insert/insert.js
@@ -41,6 +41,7 @@ Page({
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 = "")
diff --git a/client/mp/pages/river/river.js b/client/mp/pages/river/river.js
index 15ef80ef..14983590 100644
--- a/client/mp/pages/river/river.js
+++ b/client/mp/pages/river/river.js
@@ -7,11 +7,17 @@ Page({
river: {},
},
action: {
- "扫码": function(event, page, data) {
- app.scans(function(res) {
- page.onaction(event, res, res.name)
- })
- },
+ "扫码": 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) {
diff --git a/client/mp/utils/kit.js b/client/mp/utils/kit.js
index d93928a3..8c5fae8d 100644
--- a/client/mp/utils/kit.js
+++ b/client/mp/utils/kit.js
@@ -31,5 +31,12 @@ module.exports = {
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
+ },
}