123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- // E:/dashitech/廖明明(项目)/itsm(new)/itsm-wx-handle/node_modules/weixin-jsapi/index.js
- !function(a, b) {
- function c(b2, c2, d2) {
- a.WeixinJSBridge ? WeixinJSBridge.invoke(b2, e(c2), function(a2) {
- g(b2, a2, d2);
- }) : j(b2, d2);
- }
- function d(b2, c2, d2) {
- a.WeixinJSBridge ? WeixinJSBridge.on(b2, function(a2) {
- d2 && d2.trigger && d2.trigger(a2), g(b2, a2, c2);
- }) : d2 ? j(b2, d2) : j(b2, c2);
- }
- function e(a2) {
- return a2 = a2 || {}, a2.appId = z.appId, a2.verifyAppId = z.appId, a2.verifySignType = "sha1", a2.verifyTimestamp = z.timestamp + "", a2.verifyNonceStr = z.nonceStr, a2.verifySignature = z.signature, a2;
- }
- function f(a2) {
- return {
- timeStamp: a2.timestamp + "",
- nonceStr: a2.nonceStr,
- "package": a2.package,
- paySign: a2.paySign,
- signType: a2.signType || "SHA1"
- };
- }
- function g(a2, b2, c2) {
- var d2, e2, f2;
- switch (delete b2.err_code, delete b2.err_desc, delete b2.err_detail, d2 = b2.errMsg, d2 || (d2 = b2.err_msg, delete b2.err_msg, d2 = h(a2, d2, c2), b2.errMsg = d2), c2 = c2 || {}, c2._complete && (c2._complete(b2), delete c2._complete), d2 = b2.errMsg || "", z.debug && !c2.isInnerInvoke && alert(JSON.stringify(b2)), e2 = d2.indexOf(":"), f2 = d2.substring(e2 + 1)) {
- case "ok":
- c2.success && c2.success(b2);
- break;
- case "cancel":
- c2.cancel && c2.cancel(b2);
- break;
- default:
- c2.fail && c2.fail(b2);
- }
- c2.complete && c2.complete(b2);
- }
- function h(a2, b2) {
- var d2, e2, f2, g2;
- if (b2) {
- switch (d2 = b2.indexOf(":"), a2) {
- case o.config:
- e2 = "config";
- break;
- case o.openProductSpecificView:
- e2 = "openProductSpecificView";
- break;
- default:
- e2 = b2.substring(0, d2), e2 = e2.replace(/_/g, " "), e2 = e2.replace(/\b\w+\b/g, function(a3) {
- return a3.substring(0, 1).toUpperCase() + a3.substring(1);
- }), e2 = e2.substring(0, 1).toLowerCase() + e2.substring(1), e2 = e2.replace(/ /g, ""), -1 != e2.indexOf("Wcpay") && (e2 = e2.replace("Wcpay", "WCPay")), f2 = p[e2], f2 && (e2 = f2);
- }
- g2 = b2.substring(d2 + 1), "confirm" == g2 && (g2 = "ok"), "failed" == g2 && (g2 = "fail"), -1 != g2.indexOf("failed_") && (g2 = g2.substring(7)), -1 != g2.indexOf("fail_") && (g2 = g2.substring(5)), g2 = g2.replace(/_/g, " "), g2 = g2.toLowerCase(), ("access denied" == g2 || "no permission to execute" == g2) && (g2 = "permission denied"), "config" == e2 && "function not exist" == g2 && (g2 = "ok"), b2 = e2 + ":" + g2;
- }
- return b2;
- }
- function i(a2) {
- var b2, c2, d2, e2;
- if (a2) {
- for (b2 = 0, c2 = a2.length; c2 > b2; ++b2)
- d2 = a2[b2], e2 = o[d2], e2 && (a2[b2] = e2);
- return a2;
- }
- }
- function j(a2, b2) {
- if (!(!z.debug || b2 && b2.isInnerInvoke)) {
- var c2 = p[a2];
- c2 && (a2 = c2), b2 && b2._complete && delete b2._complete, console.log('"' + a2 + '",', b2 || "");
- }
- }
- function k() {
- if (!("6.0.2" > w || y.systemType < 0)) {
- var b2 = new Image();
- y.appId = z.appId, y.initTime = x.initEndTime - x.initStartTime, y.preVerifyTime = x.preVerifyEndTime - x.preVerifyStartTime, C.getNetworkType({
- isInnerInvoke: true,
- success: function(a2) {
- y.networkType = a2.networkType;
- var c2 = "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;
- b2.src = c2;
- }
- });
- }
- }
- function l() {
- return (/* @__PURE__ */ new Date()).getTime();
- }
- function m(b2) {
- t && (a.WeixinJSBridge ? b2() : q.addEventListener && q.addEventListener("WeixinJSBridgeReady", b2, false));
- }
- function n() {
- C.invoke || (C.invoke = function(b2, c2, d2) {
- a.WeixinJSBridge && WeixinJSBridge.invoke(b2, e(c2), d2);
- }, C.on = function(b2, c2) {
- a.WeixinJSBridge && WeixinJSBridge.on(b2, c2);
- });
- }
- var o, p, q, r, s, t, u, v, w, x, y, z, A, B, C;
- if (!a.jWeixin)
- return o = {
- config: "preVerifyJSAPI",
- onMenuShareTimeline: "menu:share:timeline",
- onMenuShareAppMessage: "menu:share:appmessage",
- onMenuShareQQ: "menu:share:qq",
- onMenuShareWeibo: "menu:share:weiboApp",
- onMenuShareQZone: "menu:share:QZone",
- previewImage: "imagePreview",
- getLocation: "geoLocation",
- openProductSpecificView: "openProductViewWithPid",
- addCard: "batchAddCard",
- openCard: "batchViewCard",
- chooseWXPay: "getBrandWCPayRequest"
- }, p = function() {
- var b2, a2 = {};
- for (b2 in o)
- a2[o[b2]] = b2;
- return a2;
- }(), q = a.document, r = q.title, 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 a2 = s.match(/micromessenger\/(\d+\.\d+\.\d+)/) || s.match(/micromessenger\/(\d+\.\d+)/);
- return a2 ? a2[1] : "";
- }(), x = { initStartTime: l(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 }, y = {
- version: 1,
- appId: "",
- initTime: 0,
- preVerifyTime: 0,
- networkType: "",
- isPreVerifyOk: 1,
- systemType: v ? 1 : u ? 2 : -1,
- clientVersion: w,
- url: encodeURIComponent(location.href)
- }, z = {}, A = { _completes: [] }, B = { state: 0, res: {} }, m(function() {
- x.initEndTime = l();
- }), C = {
- config: function(a2) {
- z = a2, j("config", a2);
- var b2 = z.check === false ? false : true;
- m(function() {
- var a3, d2, e2;
- if (b2)
- c(o.config, { verifyJsApiList: i(z.jsApiList) }, function() {
- A._complete = function(a5) {
- x.preVerifyEndTime = l(), B.state = 1, B.res = a5;
- }, A.success = function() {
- y.isPreVerifyOk = 0;
- }, A.fail = function(a5) {
- A._fail ? A._fail(a5) : B.state = -1;
- };
- var a4 = A._completes;
- return a4.push(function() {
- z.debug || k();
- }), A.complete = function() {
- for (var c2 = 0, d3 = a4.length; d3 > c2; ++c2)
- a4[c2]();
- A._completes = [];
- }, A;
- }()), x.preVerifyStartTime = l();
- else {
- for (B.state = 1, a3 = A._completes, d2 = 0, e2 = a3.length; e2 > d2; ++d2)
- a3[d2]();
- A._completes = [];
- }
- }), z.beta && n();
- },
- ready: function(a2) {
- 0 != B.state ? a2() : (A._completes.push(a2), !t && z.debug && a2());
- },
- error: function(a2) {
- "6.0.2" > w || (-1 == B.state ? a2(B.res) : A._fail = a2);
- },
- checkJsApi: function(a2) {
- var b2 = function(a3) {
- var c2, d2, b3 = a3.checkResult;
- for (c2 in b3)
- d2 = p[c2], d2 && (b3[d2] = b3[c2], delete b3[c2]);
- return a3;
- };
- c("checkJsApi", { jsApiList: i(a2.jsApiList) }, function() {
- return a2._complete = function(a3) {
- if (u) {
- var c2 = a3.checkResult;
- c2 && (a3.checkResult = JSON.parse(c2));
- }
- a3 = b2(a3);
- }, a2;
- }());
- },
- onMenuShareTimeline: function(a2) {
- d(o.onMenuShareTimeline, {
- complete: function() {
- c("shareTimeline", {
- title: a2.title || r,
- desc: a2.title || r,
- img_url: a2.imgUrl || "",
- link: a2.link || location.href
- }, a2);
- }
- }, a2);
- },
- onMenuShareAppMessage: function(a2) {
- d(o.onMenuShareAppMessage, {
- complete: function() {
- c("sendAppMessage", {
- title: a2.title || r,
- desc: a2.desc || "",
- link: a2.link || location.href,
- img_url: a2.imgUrl || "",
- type: a2.type || "link",
- data_url: a2.dataUrl || ""
- }, a2);
- }
- }, a2);
- },
- onMenuShareQQ: function(a2) {
- d(o.onMenuShareQQ, {
- complete: function() {
- c("shareQQ", {
- title: a2.title || r,
- desc: a2.desc || "",
- img_url: a2.imgUrl || "",
- link: a2.link || location.href
- }, a2);
- }
- }, a2);
- },
- onMenuShareWeibo: function(a2) {
- d(o.onMenuShareWeibo, {
- complete: function() {
- c("shareWeiboApp", {
- title: a2.title || r,
- desc: a2.desc || "",
- img_url: a2.imgUrl || "",
- link: a2.link || location.href
- }, a2);
- }
- }, a2);
- },
- onMenuShareQZone: function(a2) {
- d(o.onMenuShareQZone, {
- complete: function() {
- c("shareQZone", {
- title: a2.title || r,
- desc: a2.desc || "",
- img_url: a2.imgUrl || "",
- link: a2.link || location.href
- }, a2);
- }
- }, a2);
- },
- startRecord: function(a2) {
- c("startRecord", {}, a2);
- },
- stopRecord: function(a2) {
- c("stopRecord", {}, a2);
- },
- onVoiceRecordEnd: function(a2) {
- d("onVoiceRecordEnd", a2);
- },
- playVoice: function(a2) {
- c("playVoice", { localId: a2.localId }, a2);
- },
- pauseVoice: function(a2) {
- c("pauseVoice", { localId: a2.localId }, a2);
- },
- stopVoice: function(a2) {
- c("stopVoice", { localId: a2.localId }, a2);
- },
- onVoicePlayEnd: function(a2) {
- d("onVoicePlayEnd", a2);
- },
- uploadVoice: function(a2) {
- c("uploadVoice", { localId: a2.localId, isShowProgressTips: 0 == a2.isShowProgressTips ? 0 : 1 }, a2);
- },
- downloadVoice: function(a2) {
- c("downloadVoice", { serverId: a2.serverId, isShowProgressTips: 0 == a2.isShowProgressTips ? 0 : 1 }, a2);
- },
- translateVoice: function(a2) {
- c("translateVoice", { localId: a2.localId, isShowProgressTips: 0 == a2.isShowProgressTips ? 0 : 1 }, a2);
- },
- chooseImage: function(a2) {
- c("chooseImage", {
- scene: "1|2",
- count: a2.count || 9,
- sizeType: a2.sizeType || ["original", "compressed"],
- sourceType: a2.sourceType || ["album", "camera"]
- }, function() {
- return a2._complete = function(a3) {
- if (u) {
- var b2 = a3.localIds;
- b2 && (a3.localIds = JSON.parse(b2));
- }
- }, a2;
- }());
- },
- previewImage: function(a2) {
- c(o.previewImage, { current: a2.current, urls: a2.urls }, a2);
- },
- uploadImage: function(a2) {
- c("uploadImage", { localId: a2.localId, isShowProgressTips: 0 == a2.isShowProgressTips ? 0 : 1 }, a2);
- },
- downloadImage: function(a2) {
- c("downloadImage", { serverId: a2.serverId, isShowProgressTips: 0 == a2.isShowProgressTips ? 0 : 1 }, a2);
- },
- getNetworkType: function(a2) {
- var b2 = function(a3) {
- var c2, d2, e2, b3 = a3.errMsg;
- if (a3.errMsg = "getNetworkType:ok", c2 = a3.subtype, delete a3.subtype, c2)
- a3.networkType = c2;
- else
- switch (d2 = b3.indexOf(":"), e2 = b3.substring(d2 + 1)) {
- case "wifi":
- case "edge":
- case "wwan":
- a3.networkType = e2;
- break;
- default:
- a3.errMsg = "getNetworkType:fail";
- }
- return a3;
- };
- c("getNetworkType", {}, function() {
- return a2._complete = function(a3) {
- a3 = b2(a3);
- }, a2;
- }());
- },
- openLocation: function(a2) {
- c("openLocation", {
- latitude: a2.latitude,
- longitude: a2.longitude,
- name: a2.name || "",
- address: a2.address || "",
- scale: a2.scale || 28,
- infoUrl: a2.infoUrl || ""
- }, a2);
- },
- getLocation: function(a2) {
- a2 = a2 || {}, c(o.getLocation, { type: a2.type || "wgs84" }, function() {
- return a2._complete = function(a3) {
- delete a3.type;
- }, a2;
- }());
- },
- hideOptionMenu: function(a2) {
- c("hideOptionMenu", {}, a2);
- },
- showOptionMenu: function(a2) {
- c("showOptionMenu", {}, a2);
- },
- closeWindow: function(a2) {
- a2 = a2 || {}, c("closeWindow", { immediate_close: a2.immediateClose || 0 }, a2);
- },
- hideMenuItems: function(a2) {
- c("hideMenuItems", { menuList: a2.menuList }, a2);
- },
- showMenuItems: function(a2) {
- c("showMenuItems", { menuList: a2.menuList }, a2);
- },
- hideAllNonBaseMenuItem: function(a2) {
- c("hideAllNonBaseMenuItem", {}, a2);
- },
- showAllNonBaseMenuItem: function(a2) {
- c("showAllNonBaseMenuItem", {}, a2);
- },
- scanQRCode: function(a2) {
- a2 = a2 || {}, c("scanQRCode", {
- needResult: a2.needResult || 0,
- scanType: a2.scanType || ["qrCode", "barCode"]
- }, function() {
- return a2._complete = function(a3) {
- var b2, c2;
- v && (b2 = a3.resultStr, b2 && (c2 = JSON.parse(b2), a3.resultStr = c2 && c2.scan_code && c2.scan_code.scan_result));
- }, a2;
- }());
- },
- openProductSpecificView: function(a2) {
- c(o.openProductSpecificView, { pid: a2.productId, view_type: a2.viewType || 0 }, a2);
- },
- addCard: function(a2) {
- var e2, f2, g2, h2, b2 = a2.cardList, d2 = [];
- for (e2 = 0, f2 = b2.length; f2 > e2; ++e2)
- g2 = b2[e2], h2 = { card_id: g2.cardId, card_ext: g2.cardExt }, d2.push(h2);
- c(o.addCard, { card_list: d2 }, function() {
- return a2._complete = function(a3) {
- var c2, d3, e3, b3 = a3.card_list;
- if (b3) {
- for (b3 = JSON.parse(b3), c2 = 0, d3 = b3.length; d3 > c2; ++c2)
- e3 = b3[c2], e3.cardId = e3.card_id, e3.cardExt = e3.card_ext, e3.isSuccess = e3.is_succ ? true : false, delete e3.card_id, delete e3.card_ext, delete e3.is_succ;
- a3.cardList = b3, delete a3.card_list;
- }
- }, a2;
- }());
- },
- chooseCard: function(a2) {
- c("chooseCard", {
- app_id: z.appId,
- location_id: a2.shopId || "",
- sign_type: a2.signType || "SHA1",
- card_id: a2.cardId || "",
- card_type: a2.cardType || "",
- card_sign: a2.cardSign,
- time_stamp: a2.timestamp + "",
- nonce_str: a2.nonceStr
- }, function() {
- return a2._complete = function(a3) {
- a3.cardList = a3.choose_card_info, delete a3.choose_card_info;
- }, a2;
- }());
- },
- openCard: function(a2) {
- var e2, f2, g2, h2, b2 = a2.cardList, d2 = [];
- for (e2 = 0, f2 = b2.length; f2 > e2; ++e2)
- g2 = b2[e2], h2 = { card_id: g2.cardId, code: g2.code }, d2.push(h2);
- c(o.openCard, { card_list: d2 }, a2);
- },
- chooseWXPay: function(a2) {
- c(o.chooseWXPay, f(a2), a2);
- }
- }, b && (a.wx = a.jWeixin = C), C;
- }(window, true);
- var weixin_jsapi_default = window.wx;
- export {
- weixin_jsapi_default as default
- };
- //# sourceMappingURL=weixin-jsapi.js.map
|