升级到微信官方 js sdk 1.2.0

This commit is contained in:
yanxi.me 2017-01-21 00:44:17 +08:00
parent b915a5e185
commit 87843e8bed
4 changed files with 405 additions and 316 deletions

View File

@ -3,9 +3,9 @@
说明: 仅将官方 js-sdk 发布到 npm便于 browserify 使用 说明: 仅将官方 js-sdk 发布到 npm便于 browserify 使用
js源码: [http://res.wx.qq.com/open/js/jweixin-1.0.0.js](http://res.wx.qq.com/open/js/jweixin-1.0.0.js) js源码: https://res.wx.qq.com/open/js/jweixin-1.2.0.js
官方使用说明: [http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html](http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html) 官方使用说明: https://mp.weixin.qq.com/wiki 微信网页开发 - iOS 网页开发适配指南
安装: 安装:
@ -14,3 +14,7 @@ js源码: [http://res.wx.qq.com/open/js/jweixin-1.0.0.js](http://res.wx.qq.com/o
使用: 使用:
var wx = require('weixin-js-sdk'); var wx = require('weixin-js-sdk');
### Old version
[1.0.0](https://github.com/yanxi-me/weixin-js-sdk/tree/1.0.0)

319
index.js
View File

@ -3,33 +3,40 @@
}(window, function (a, b) { }(window, function (a, b) {
function c(b, c, d) { function c(b, c, d) {
a.WeixinJSBridge ? WeixinJSBridge.invoke(b, e(c), function (a) { a.WeixinJSBridge ? WeixinJSBridge.invoke(b, e(c), function (a) {
g(b, a, d) h(b, a, d)
}) : j(b, d) }) : k(b, d)
} }
function d(b, c, d) { function d(b, c, d) {
a.WeixinJSBridge ? WeixinJSBridge.on(b, function (a) { a.WeixinJSBridge ? WeixinJSBridge.on(b, function (a) {
d && d.trigger && d.trigger(a), g(b, a, c) d && d.trigger && d.trigger(a), h(b, a, c)
}) : d ? j(b, d) : j(b, c) }) : d ? k(b, d) : k(b, c)
} }
function e(a) { function e(a) {
return a = a || {}, a.appId = z.appId, a.verifyAppId = z.appId, a.verifySignType = "sha1", a.verifyTimestamp = z.timestamp + "", a.verifyNonceStr = z.nonceStr, a.verifySignature = z.signature, a return a = a || {}, a.appId = D.appId, a.verifyAppId = D.appId, a.verifySignType = "sha1", a.verifyTimestamp = D.timestamp + "", a.verifyNonceStr = D.nonceStr, a.verifySignature = D.signature, a
} }
function f(a) { function f(a) {
return { return {
timeStamp: a.timestamp + "", timeStamp: a.timestamp + "",
nonceStr: a.nonceStr, nonceStr: a.nonceStr,
"package": a.package, "package": a["package"],
paySign: a.paySign, paySign: a.paySign,
signType: a.signType || "SHA1" signType: a.signType || "SHA1"
} }
} }
function g(a, b, c) { function g(a) {
var d, e, f; return a.postalCode = a.addressPostalCode, delete a.addressPostalCode, a.provinceName = a.proviceFirstStageName, delete a.proviceFirstStageName, a.cityName = a.addressCitySecondStageName, delete a.addressCitySecondStageName, a.countryName = a.addressCountiesThirdStageName, delete a.addressCountiesThirdStageName, a.detailInfo = a.addressDetailInfo, delete a.addressDetailInfo, a
switch (delete b.err_code, delete b.err_desc, delete b.err_detail, d = b.errMsg, d || (d = b.err_msg, delete b.err_msg, d = h(a, d, c), b.errMsg = d), c = c || {}, c._complete && (c._complete(b), delete c._complete), d = b.errMsg || "", z.debug && !c.isInnerInvoke && alert(JSON.stringify(b)), e = d.indexOf(":"), f = d.substring(e + 1)) { }
function h(a, b, c) {
"openEnterpriseChat" == a && (b.errCode = b.err_code), delete b.err_code, delete b.err_desc, delete b.err_detail;
var d = b.errMsg;
d || (d = b.err_msg, delete b.err_msg, d = i(a, d), b.errMsg = d), c = c || {}, c._complete && (c._complete(b), delete c._complete), d = b.errMsg || "", D.debug && !c.isInnerInvoke && alert(JSON.stringify(b));
var e = d.indexOf(":"), f = d.substring(e + 1);
switch (f) {
case"ok": case"ok":
c.success && c.success(b); c.success && c.success(b);
break; break;
@ -42,73 +49,66 @@
c.complete && c.complete(b) c.complete && c.complete(b)
} }
function h(a, b) { function i(a, b) {
var d, e, f, g; var c = a, d = q[c];
d && (c = d);
var e = "ok";
if (b) { if (b) {
switch (d = b.indexOf(":"), a) { var f = b.indexOf(":");
case o.config: e = b.substring(f + 1), "confirm" == e && (e = "ok"), "failed" == e && (e = "fail"), -1 != e.indexOf("failed_") && (e = e.substring(7)), -1 != e.indexOf("fail_") && (e = e.substring(5)), e = e.replace(/_/g, " "), e = e.toLowerCase(), ("access denied" == e || "no permission to execute" == e) && (e = "permission denied"), "config" == c && "function not exist" == e && (e = "ok"), "" == e && (e = "fail")
e = "config";
break;
case o.openProductSpecificView:
e = "openProductSpecificView";
break;
default:
e = b.substring(0, d), e = e.replace(/_/g, " "), e = e.replace(/\b\w+\b/g, function (a) {
return a.substring(0, 1).toUpperCase() + a.substring(1)
}), e = e.substring(0, 1).toLowerCase() + e.substring(1), e = e.replace(/ /g, ""), -1 != e.indexOf("Wcpay") && (e = e.replace("Wcpay", "WCPay")), f = p[e], f && (e = f)
} }
g = b.substring(d + 1), "confirm" == g && (g = "ok"), "failed" == g && (g = "fail"), -1 != g.indexOf("failed_") && (g = g.substring(7)), -1 != g.indexOf("fail_") && (g = g.substring(5)), g = g.replace(/_/g, " "), g = g.toLowerCase(), ("access denied" == g || "no permission to execute" == g) && (g = "permission denied"), "config" == e && "function not exist" == g && (g = "ok"), b = e + ":" + g return b = c + ":" + e
}
return b
} }
function i(a) { function j(a) {
var b, c, d, e;
if (a) { if (a) {
for (b = 0, c = a.length; c > b; ++b)d = a[b], e = o[d], e && (a[b] = e); for (var b = 0, c = a.length; c > b; ++b) {
var d = a[b], e = p[d];
e && (a[b] = e)
}
return a return a
} }
} }
function j(a, b) { function k(a, b) {
if (!(!z.debug || b && b.isInnerInvoke)) { if (!(!D.debug || b && b.isInnerInvoke)) {
var c = p[a]; var c = q[a];
c && (a = c), b && b._complete && delete b._complete, console.log('"' + a + '",', b || "") c && (a = c), b && b._complete && delete b._complete, console.log('"' + a + '",', b || "")
} }
} }
function k() { function l(a) {
if (!("6.0.2" > w || y.systemType < 0)) { if (!(v || w || D.debug || "6.0.2" > A || C.systemType < 0)) {
var b = new Image; var b = new Image;
y.appId = z.appId, y.initTime = x.initEndTime - x.initStartTime, y.preVerifyTime = x.preVerifyEndTime - x.preVerifyStartTime, C.getNetworkType({ C.appId = D.appId, C.initTime = B.initEndTime - B.initStartTime, C.preVerifyTime = B.preVerifyEndTime - B.preVerifyStartTime, I.getNetworkType({
isInnerInvoke: !0, isInnerInvoke: !0,
success: function (a) { success: function (a) {
y.networkType = a.networkType; C.networkType = a.networkType;
var c = "https://open.weixin.qq.com/sdk/report?v=" + y.version + "&o=" + y.isPreVerifyOk + "&s=" + y.systemType + "&c=" + y.clientVersion + "&a=" + y.appId + "&n=" + y.networkType + "&i=" + y.initTime + "&p=" + y.preVerifyTime + "&u=" + y.url; var c = "https://open.weixin.qq.com/sdk/report?v=" + C.version + "&o=" + C.isPreVerifyOk + "&s=" + C.systemType + "&c=" + C.clientVersion + "&a=" + C.appId + "&n=" + C.networkType + "&i=" + C.initTime + "&p=" + C.preVerifyTime + "&u=" + C.url;
b.src = c b.src = c
} }
}) })
} }
} }
function l() { function m() {
return (new Date).getTime() return (new Date).getTime()
} }
function m(b) { function n(b) {
t && (a.WeixinJSBridge ? b() : q.addEventListener && q.addEventListener("WeixinJSBridgeReady", b, !1)) x && (a.WeixinJSBridge ? b() : r.addEventListener && r.addEventListener("WeixinJSBridgeReady", b, !1))
} }
function n() { function o() {
C.invoke || (C.invoke = function (b, c, d) { I.invoke || (I.invoke = function (b, c, d) {
a.WeixinJSBridge && WeixinJSBridge.invoke(b, e(c), d) a.WeixinJSBridge && WeixinJSBridge.invoke(b, e(c), d)
}, C.on = function (b, c) { }, I.on = function (b, c) {
a.WeixinJSBridge && WeixinJSBridge.on(b, c) a.WeixinJSBridge && WeixinJSBridge.on(b, c)
}) })
} }
var o, p, q, r, s, t, u, v, w, x, y, z, A, B, C; if (!a.jWeixin) {
if (!a.jWeixin)return o = { var p = {
config: "preVerifyJSAPI", config: "preVerifyJSAPI",
onMenuShareTimeline: "menu:share:timeline", onMenuShareTimeline: "menu:share:timeline",
onMenuShareAppMessage: "menu:share:appmessage", onMenuShareAppMessage: "menu:share:appmessage",
@ -120,67 +120,76 @@
openProductSpecificView: "openProductViewWithPid", openProductSpecificView: "openProductViewWithPid",
addCard: "batchAddCard", addCard: "batchAddCard",
openCard: "batchViewCard", openCard: "batchViewCard",
chooseWXPay: "getBrandWCPayRequest" chooseWXPay: "getBrandWCPayRequest",
}, p = function () { openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
var b, a = {}; startSearchBeacons: "startMonitoringBeacons",
for (b in o)a[o[b]] = b; stopSearchBeacons: "stopMonitoringBeacons",
onSearchBeacons: "onBeaconsInRange",
consumeAndShareCard: "consumedShareCard",
openAddress: "editAddress"
}, q = function () {
var a = {};
for (var b in p)a[p[b]] = b;
return a return a
}(), q = a.document, }(), r = a.document, s = r.title, t = navigator.userAgent.toLowerCase(), u = navigator.platform.toLowerCase(), v = !(!u.match("mac") && !u.match("win")), w = -1 != t.indexOf("wxdebugger"), x = -1 != t.indexOf("micromessenger"), y = -1 != t.indexOf("android"), z = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad"), A = function () {
r = q.title, var a = t.match(/micromessenger\/(\d+\.\d+\.\d+)/) || t.match(/micromessenger\/(\d+\.\d+)/);
s = navigator.userAgent.toLowerCase(), t = -1 != s.indexOf("micromessenger"), u = -1 != s.indexOf("android"), v = -1 != s.indexOf("iphone") || -1 != s.indexOf("ipad"), w = function () {
var a = s.match(/micromessenger\/(\d+\.\d+\.\d+)/) || s.match(/micromessenger\/(\d+\.\d+)/);
return a ? a[1] : "" return a ? a[1] : ""
}(), x = {initStartTime: l(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0}, y = { }(), B = {initStartTime: m(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0}, C = {
version: 1, version: 1,
appId: "", appId: "",
initTime: 0, initTime: 0,
preVerifyTime: 0, preVerifyTime: 0,
networkType: "", networkType: "",
isPreVerifyOk: 1, isPreVerifyOk: 1,
systemType: v ? 1 : u ? 2 : -1, systemType: z ? 1 : y ? 2 : -1,
clientVersion: w, clientVersion: A,
url: encodeURIComponent(location.href) url: encodeURIComponent(location.href)
}, z = {}, A = {_completes: []}, B = {state: 0, res: {}}, m(function () { }, D = {}, E = {_completes: []}, F = {state: 0, data: {}};
x.initEndTime = l() n(function () {
}), C = { B.initEndTime = m()
});
var G = !1, H = [], I = {
config: function (a) { config: function (a) {
z = a, j("config", a); D = a, k("config", a);
var b = z.check === !1 ? !1 : !0; var b = D.check === !1 ? !1 : !0;
m(function () { n(function () {
var a, d, e; if (b)c(p.config, {verifyJsApiList: j(D.jsApiList)}, function () {
if (b)c(o.config, {verifyJsApiList: i(z.jsApiList)}, function () { E._complete = function (a) {
A._complete = function (a) { B.preVerifyEndTime = m(), F.state = 1, F.data = a
x.preVerifyEndTime = l(), B.state = 1, B.res = a }, E.success = function (a) {
}, A.success = function () { C.isPreVerifyOk = 0
y.isPreVerifyOk = 0 }, E.fail = function (a) {
}, A.fail = function (a) { E._fail ? E._fail(a) : F.state = -1
A._fail ? A._fail(a) : B.state = -1
}; };
var a = A._completes; var a = E._completes;
return a.push(function () { return a.push(function () {
z.debug || k() l()
}), A.complete = function () { }), E.complete = function (b) {
for (var c = 0, d = a.length; d > c; ++c)a[c](); for (var c = 0, d = a.length; d > c; ++c)a[c]();
A._completes = [] E._completes = []
}, A }, E
}()), x.preVerifyStartTime = l(); else { }()), B.preVerifyStartTime = m(); else {
for (B.state = 1, a = A._completes, d = 0, e = a.length; e > d; ++d)a[d](); F.state = 1;
A._completes = [] for (var a = E._completes, d = 0, e = a.length; e > d; ++d)a[d]();
E._completes = []
} }
}), z.beta && n() }), D.beta && o()
}, ready: function (a) { }, ready: function (a) {
0 != B.state ? a() : (A._completes.push(a), !t && z.debug && a()) 0 != F.state ? a() : (E._completes.push(a), !x && D.debug && a())
}, error: function (a) { }, error: function (a) {
"6.0.2" > w || (-1 == B.state ? a(B.res) : A._fail = a) "6.0.2" > A || (-1 == F.state ? a(F.data) : E._fail = a)
}, checkJsApi: function (a) { }, checkJsApi: function (a) {
var b = function (a) { var b = function (a) {
var c, d, b = a.checkResult; var b = a.checkResult;
for (c in b)d = p[c], d && (b[d] = b[c], delete b[c]); for (var c in b) {
var d = q[c];
d && (b[d] = b[c], delete b[c])
}
return a return a
}; };
c("checkJsApi", {jsApiList: i(a.jsApiList)}, function () { c("checkJsApi", {jsApiList: j(a.jsApiList)}, function () {
return a._complete = function (a) { return a._complete = function (a) {
if (u) { if (y) {
var c = a.checkResult; var c = a.checkResult;
c && (a.checkResult = JSON.parse(c)) c && (a.checkResult = JSON.parse(c))
} }
@ -188,21 +197,23 @@
}, a }, a
}()) }())
}, onMenuShareTimeline: function (a) { }, onMenuShareTimeline: function (a) {
d(o.onMenuShareTimeline, { d(p.onMenuShareTimeline, {
complete: function () { complete: function () {
c("shareTimeline", { c("shareTimeline", {
title: a.title || r, title: a.title || s,
desc: a.title || r, desc: a.title || s,
img_url: a.imgUrl || "", img_url: a.imgUrl || "",
link: a.link || location.href link: a.link || location.href,
type: a.type || "link",
data_url: a.dataUrl || ""
}, a) }, a)
} }
}, a) }, a)
}, onMenuShareAppMessage: function (a) { }, onMenuShareAppMessage: function (a) {
d(o.onMenuShareAppMessage, { d(p.onMenuShareAppMessage, {
complete: function () { complete: function () {
c("sendAppMessage", { c("sendAppMessage", {
title: a.title || r, title: a.title || s,
desc: a.desc || "", desc: a.desc || "",
link: a.link || location.href, link: a.link || location.href,
img_url: a.imgUrl || "", img_url: a.imgUrl || "",
@ -212,10 +223,10 @@
} }
}, a) }, a)
}, onMenuShareQQ: function (a) { }, onMenuShareQQ: function (a) {
d(o.onMenuShareQQ, { d(p.onMenuShareQQ, {
complete: function () { complete: function () {
c("shareQQ", { c("shareQQ", {
title: a.title || r, title: a.title || s,
desc: a.desc || "", desc: a.desc || "",
img_url: a.imgUrl || "", img_url: a.imgUrl || "",
link: a.link || location.href link: a.link || location.href
@ -223,10 +234,10 @@
} }
}, a) }, a)
}, onMenuShareWeibo: function (a) { }, onMenuShareWeibo: function (a) {
d(o.onMenuShareWeibo, { d(p.onMenuShareWeibo, {
complete: function () { complete: function () {
c("shareWeiboApp", { c("shareWeiboApp", {
title: a.title || r, title: a.title || s,
desc: a.desc || "", desc: a.desc || "",
img_url: a.imgUrl || "", img_url: a.imgUrl || "",
link: a.link || location.href link: a.link || location.href
@ -234,10 +245,10 @@
} }
}, a) }, a)
}, onMenuShareQZone: function (a) { }, onMenuShareQZone: function (a) {
d(o.onMenuShareQZone, { d(p.onMenuShareQZone, {
complete: function () { complete: function () {
c("shareQZone", { c("shareQZone", {
title: a.title || r, title: a.title || s,
desc: a.desc || "", desc: a.desc || "",
img_url: a.imgUrl || "", img_url: a.imgUrl || "",
link: a.link || location.href link: a.link || location.href
@ -272,22 +283,36 @@
sourceType: a.sourceType || ["album", "camera"] sourceType: a.sourceType || ["album", "camera"]
}, function () { }, function () {
return a._complete = function (a) { return a._complete = function (a) {
if (u) { if (y) {
var b = a.localIds; var b = a.localIds;
b && (a.localIds = JSON.parse(b)) b && (a.localIds = JSON.parse(b))
} }
}, a }, a
}()) }())
}, getLocation: function (a) {
}, previewImage: function (a) { }, previewImage: function (a) {
c(o.previewImage, {current: a.current, urls: a.urls}, a) c(p.previewImage, {current: a.current, urls: a.urls}, a)
}, uploadImage: function (a) { }, uploadImage: function (a) {
c("uploadImage", {localId: a.localId, isShowProgressTips: 0 == a.isShowProgressTips ? 0 : 1}, a) c("uploadImage", {localId: a.localId, isShowProgressTips: 0 == a.isShowProgressTips ? 0 : 1}, a)
}, downloadImage: function (a) { }, downloadImage: function (a) {
c("downloadImage", {serverId: a.serverId, isShowProgressTips: 0 == a.isShowProgressTips ? 0 : 1}, a) c("downloadImage", {serverId: a.serverId, isShowProgressTips: 0 == a.isShowProgressTips ? 0 : 1}, a)
}, getLocalImgData: function (a) {
G === !1 ? (G = !0, c("getLocalImgData", {localId: a.localId}, function () {
return a._complete = function (a) {
if (G = !1, H.length > 0) {
var b = H.shift();
wx.getLocalImgData(b)
}
}, a
}())) : H.push(a)
}, getNetworkType: function (a) { }, getNetworkType: function (a) {
var b = function (a) { var b = function (a) {
var c, d, e, b = a.errMsg; var b = a.errMsg;
if (a.errMsg = "getNetworkType:ok", c = a.subtype, delete a.subtype, c)a.networkType = c; else switch (d = b.indexOf(":"), e = b.substring(d + 1)) { a.errMsg = "getNetworkType:ok";
var c = a.subtype;
if (delete a.subtype, c)a.networkType = c; else {
var d = b.indexOf(":"), e = b.substring(d + 1);
switch (e) {
case"wifi": case"wifi":
case"edge": case"edge":
case"wwan": case"wwan":
@ -296,6 +321,7 @@
default: default:
a.errMsg = "getNetworkType:fail" a.errMsg = "getNetworkType:fail"
} }
}
return a return a
}; };
c("getNetworkType", {}, function () { c("getNetworkType", {}, function () {
@ -313,7 +339,7 @@
infoUrl: a.infoUrl || "" infoUrl: a.infoUrl || ""
}, a) }, a)
}, getLocation: function (a) { }, getLocation: function (a) {
a = a || {}, c(o.getLocation, {type: a.type || "wgs84"}, function () { a = a || {}, c(p.getLocation, {type: a.type || "wgs84"}, function () {
return a._complete = function (a) { return a._complete = function (a) {
delete a.type delete a.type
}, a }, a
@ -323,7 +349,7 @@
}, showOptionMenu: function (a) { }, showOptionMenu: function (a) {
c("showOptionMenu", {}, a) c("showOptionMenu", {}, a)
}, closeWindow: function (a) { }, closeWindow: function (a) {
a = a || {}, c("closeWindow", {immediate_close: a.immediateClose || 0}, a) a = a || {}, c("closeWindow", {}, a)
}, hideMenuItems: function (a) { }, hideMenuItems: function (a) {
c("hideMenuItems", {menuList: a.menuList}, a) c("hideMenuItems", {menuList: a.menuList}, a)
}, showMenuItems: function (a) { }, showMenuItems: function (a) {
@ -338,27 +364,44 @@
scanType: a.scanType || ["qrCode", "barCode"] scanType: a.scanType || ["qrCode", "barCode"]
}, function () { }, function () {
return a._complete = function (a) { return a._complete = function (a) {
var b, c; if (z) {
v && (b = a.resultStr, b && (c = JSON.parse(b), a.resultStr = c && c.scan_code && c.scan_code.scan_result)) var b = a.resultStr;
if (b) {
var c = JSON.parse(b);
a.resultStr = c && c.scan_code && c.scan_code.scan_result
}
}
}, a
}())
}, openAddress: function (a) {
c(p.openAddress, {}, function () {
return a._complete = function (a) {
a = g(a)
}, a }, a
}()) }())
}, openProductSpecificView: function (a) { }, openProductSpecificView: function (a) {
c(o.openProductSpecificView, {pid: a.productId, view_type: a.viewType || 0}, a) c(p.openProductSpecificView, {pid: a.productId, view_type: a.viewType || 0, ext_info: a.extInfo}, a)
}, addCard: function (a) { }, addCard: function (a) {
var e, f, g, h, b = a.cardList, d = []; for (var b = a.cardList, d = [], e = 0, f = b.length; f > e; ++e) {
for (e = 0, f = b.length; f > e; ++e)g = b[e], h = {card_id: g.cardId, card_ext: g.cardExt}, d.push(h); var g = b[e], h = {card_id: g.cardId, card_ext: g.cardExt};
c(o.addCard, {card_list: d}, function () { d.push(h)
}
c(p.addCard, {card_list: d}, function () {
return a._complete = function (a) { return a._complete = function (a) {
var c, d, e, b = a.card_list; var b = a.card_list;
if (b) { if (b) {
for (b = JSON.parse(b), c = 0, d = b.length; d > c; ++c)e = b[c], e.cardId = e.card_id, e.cardExt = e.card_ext, e.isSuccess = e.is_succ ? !0 : !1, delete e.card_id, delete e.card_ext, delete e.is_succ; b = JSON.parse(b);
for (var c = 0, d = b.length; d > c; ++c) {
var e = b[c];
e.cardId = e.card_id, e.cardExt = e.card_ext, e.isSuccess = e.is_succ ? !0 : !1, delete e.card_id, delete e.card_ext, delete e.is_succ
}
a.cardList = b, delete a.card_list a.cardList = b, delete a.card_list
} }
}, a }, a
}()) }())
}, chooseCard: function (a) { }, chooseCard: function (a) {
c("chooseCard", { c("chooseCard", {
app_id: z.appId, app_id: D.appId,
location_id: a.shopId || "", location_id: a.shopId || "",
sign_type: a.signType || "SHA1", sign_type: a.signType || "SHA1",
card_id: a.cardId || "", card_id: a.cardId || "",
@ -372,11 +415,53 @@
}, a }, a
}()) }())
}, openCard: function (a) { }, openCard: function (a) {
var e, f, g, h, b = a.cardList, d = []; for (var b = a.cardList, d = [], e = 0, f = b.length; f > e; ++e) {
for (e = 0, f = b.length; f > e; ++e)g = b[e], h = {card_id: g.cardId, code: g.code}, d.push(h); var g = b[e], h = {card_id: g.cardId, code: g.code};
c(o.openCard, {card_list: d}, a) d.push(h)
}, chooseWXPay: function (a) { }
c(o.chooseWXPay, f(a), a) c(p.openCard, {card_list: d}, a)
}, consumeAndShareCard: function (a) {
c(p.consumeAndShareCard, {consumedCardId: a.cardId, consumedCode: a.code}, a)
}, chooseWXPay: function (a) {
c(p.chooseWXPay, f(a), a)
}, openEnterpriseRedPacket: function (a) {
c(p.openEnterpriseRedPacket, f(a), a)
}, startSearchBeacons: function (a) {
c(p.startSearchBeacons, {ticket: a.ticket}, a)
}, stopSearchBeacons: function (a) {
c(p.stopSearchBeacons, {}, a)
}, onSearchBeacons: function (a) {
d(p.onSearchBeacons, a)
}, openEnterpriseChat: function (a) {
c("openEnterpriseChat", {useridlist: a.userIds, chatname: a.groupName}, a)
}
}, J = 1, K = {};
return r.addEventListener("error", function (a) {
if (!y) {
var b = a.target, c = b.tagName, d = b.src;
if ("IMG" == c || "VIDEO" == c || "AUDIO" == c || "SOURCE" == c) {
var e = -1 != d.indexOf("wxlocalresource://");
if (e) {
a.preventDefault(), a.stopPropagation();
var f = b["wx-id"];
if (f || (f = J++, b["wx-id"] = f), K[f])return;
K[f] = !0, wx.getLocalImgData({
localId: d, success: function (a) {
b.src = a.localData
}
})
}
}
}
}, !0), r.addEventListener("load", function (a) {
if (!y) {
var b = a.target, c = b.tagName;
b.src;
if ("IMG" == c || "VIDEO" == c || "AUDIO" == c || "SOURCE" == c) {
var d = b["wx-id"];
d && (K[d] = !1)
}
}
}, !0), b && (a.wx = a.jWeixin = I), I
} }
}, b && (a.wx = a.jWeixin = C), C
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "weixin-js-sdk", "name": "weixin-js-sdk",
"version": "1.0.7", "version": "1.2.0",
"main": "index.js", "main": "index.js",
"description": "微信官方 js-sdk CommonJS 版", "description": "微信官方 js-sdk CommonJS 版",
"repository": { "repository": {