index.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. !(function (e, n) {
  2. module.exports = n(e);
  3. })(typeof window === "object" && window, function (r, e) {
  4. if (!r) {
  5. console.warn("can't use weixin-js-sdk in server side");
  6. return;
  7. }
  8. var a, c, n, i, t, o, s, d, l, u, p, f, m, g, h, S, y, I, v, _, w, T;
  9. if (!r.jWeixin)
  10. return (
  11. (a = {
  12. config: "preVerifyJSAPI",
  13. onMenuShareTimeline: "menu:share:timeline",
  14. onMenuShareAppMessage: "menu:share:appmessage",
  15. onMenuShareQQ: "menu:share:qq",
  16. onMenuShareWeibo: "menu:share:weiboApp",
  17. onMenuShareQZone: "menu:share:QZone",
  18. previewImage: "imagePreview",
  19. getLocation: "geoLocation",
  20. openProductSpecificView: "openProductViewWithPid",
  21. addCard: "batchAddCard",
  22. openCard: "batchViewCard",
  23. chooseWXPay: "getBrandWCPayRequest",
  24. openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
  25. startSearchBeacons: "startMonitoringBeacons",
  26. stopSearchBeacons: "stopMonitoringBeacons",
  27. onSearchBeacons: "onBeaconsInRange",
  28. consumeAndShareCard: "consumedShareCard",
  29. openAddress: "editAddress",
  30. }),
  31. (c = (function () {
  32. var e,
  33. n = {};
  34. for (e in a) n[a[e]] = e;
  35. return n;
  36. })()),
  37. (n = r.document),
  38. (i = n.title),
  39. (t = navigator.userAgent.toLowerCase()),
  40. (f = navigator.platform.toLowerCase()),
  41. (o = !(!f.match("mac") && !f.match("win"))),
  42. (s = -1 != t.indexOf("wxdebugger")),
  43. (d = -1 != t.indexOf("micromessenger")),
  44. (l = -1 != t.indexOf("android")),
  45. (u = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad")),
  46. (p = (f =
  47. t.match(/micromessenger\/(\d+\.\d+\.\d+)/) ||
  48. t.match(/micromessenger\/(\d+\.\d+)/))
  49. ? f[1]
  50. : ""),
  51. (m = {
  52. initStartTime: L(),
  53. initEndTime: 0,
  54. preVerifyStartTime: 0,
  55. preVerifyEndTime: 0,
  56. }),
  57. (g = {
  58. version: 1,
  59. appId: "",
  60. initTime: 0,
  61. preVerifyTime: 0,
  62. networkType: "",
  63. isPreVerifyOk: 1,
  64. systemType: u ? 1 : l ? 2 : -1,
  65. clientVersion: p,
  66. url: encodeURIComponent(location.href),
  67. }),
  68. (h = {}),
  69. (S = { _completes: [] }),
  70. (y = { state: 0, data: {} }),
  71. O(function () {
  72. m.initEndTime = L();
  73. }),
  74. (I = !1),
  75. (v = []),
  76. (_ = {
  77. config: function (e) {
  78. C("config", (h = e));
  79. var o = !1 !== h.check;
  80. O(function () {
  81. if (o)
  82. k(
  83. a.config,
  84. {
  85. verifyJsApiList: A(h.jsApiList),
  86. verifyOpenTagList: A(h.openTagList),
  87. },
  88. ((S._complete = function (e) {
  89. (m.preVerifyEndTime = L()), (y.state = 1), (y.data = e);
  90. }),
  91. (S.success = function (e) {
  92. g.isPreVerifyOk = 0;
  93. }),
  94. (S.fail = function (e) {
  95. S._fail ? S._fail(e) : (y.state = -1);
  96. }),
  97. (t = S._completes).push(function () {
  98. B();
  99. }),
  100. (S.complete = function (e) {
  101. for (var n = 0, i = t.length; n < i; ++n) t[n]();
  102. S._completes = [];
  103. }),
  104. S)
  105. ),
  106. (m.preVerifyStartTime = L());
  107. else {
  108. y.state = 1;
  109. for (var e = S._completes, n = 0, i = e.length; n < i; ++n)
  110. e[n]();
  111. S._completes = [];
  112. }
  113. var t;
  114. }),
  115. _.invoke ||
  116. ((_.invoke = function (e, n, i) {
  117. r.WeixinJSBridge && WeixinJSBridge.invoke(e, P(n), i);
  118. }),
  119. (_.on = function (e, n) {
  120. r.WeixinJSBridge && WeixinJSBridge.on(e, n);
  121. }));
  122. },
  123. ready: function (e) {
  124. (0 != y.state || (S._completes.push(e), !d && h.debug)) && e();
  125. },
  126. error: function (e) {
  127. p < "6.0.2" || (-1 == y.state ? e(y.data) : (S._fail = e));
  128. },
  129. checkJsApi: function (e) {
  130. k(
  131. "checkJsApi",
  132. { jsApiList: A(e.jsApiList) },
  133. ((e._complete = function (e) {
  134. l && (i = e.checkResult) && (e.checkResult = JSON.parse(i));
  135. var n,
  136. i = e,
  137. t = i.checkResult;
  138. for (n in t) {
  139. var o = c[n];
  140. o && ((t[o] = t[n]), delete t[n]);
  141. }
  142. }),
  143. e)
  144. );
  145. },
  146. onMenuShareTimeline: function (e) {
  147. M(
  148. a.onMenuShareTimeline,
  149. {
  150. complete: function () {
  151. k(
  152. "shareTimeline",
  153. {
  154. title: e.title || i,
  155. desc: e.title || i,
  156. img_url: e.imgUrl || "",
  157. link: e.link || location.href,
  158. type: e.type || "link",
  159. data_url: e.dataUrl || "",
  160. },
  161. e
  162. );
  163. },
  164. },
  165. e
  166. );
  167. },
  168. onMenuShareAppMessage: function (n) {
  169. M(
  170. a.onMenuShareAppMessage,
  171. {
  172. complete: function (e) {
  173. "favorite" === e.scene
  174. ? k("sendAppMessage", {
  175. title: n.title || i,
  176. desc: n.desc || "",
  177. link: n.link || location.href,
  178. img_url: n.imgUrl || "",
  179. type: n.type || "link",
  180. data_url: n.dataUrl || "",
  181. })
  182. : k(
  183. "sendAppMessage",
  184. {
  185. title: n.title || i,
  186. desc: n.desc || "",
  187. link: n.link || location.href,
  188. img_url: n.imgUrl || "",
  189. type: n.type || "link",
  190. data_url: n.dataUrl || "",
  191. },
  192. n
  193. );
  194. },
  195. },
  196. n
  197. );
  198. },
  199. onMenuShareQQ: function (e) {
  200. M(
  201. a.onMenuShareQQ,
  202. {
  203. complete: function () {
  204. k(
  205. "shareQQ",
  206. {
  207. title: e.title || i,
  208. desc: e.desc || "",
  209. img_url: e.imgUrl || "",
  210. link: e.link || location.href,
  211. },
  212. e
  213. );
  214. },
  215. },
  216. e
  217. );
  218. },
  219. onMenuShareWeibo: function (e) {
  220. M(
  221. a.onMenuShareWeibo,
  222. {
  223. complete: function () {
  224. k(
  225. "shareWeiboApp",
  226. {
  227. title: e.title || i,
  228. desc: e.desc || "",
  229. img_url: e.imgUrl || "",
  230. link: e.link || location.href,
  231. },
  232. e
  233. );
  234. },
  235. },
  236. e
  237. );
  238. },
  239. onMenuShareQZone: function (e) {
  240. M(
  241. a.onMenuShareQZone,
  242. {
  243. complete: function () {
  244. k(
  245. "shareQZone",
  246. {
  247. title: e.title || i,
  248. desc: e.desc || "",
  249. img_url: e.imgUrl || "",
  250. link: e.link || location.href,
  251. },
  252. e
  253. );
  254. },
  255. },
  256. e
  257. );
  258. },
  259. updateTimelineShareData: function (e) {
  260. k(
  261. "updateTimelineShareData",
  262. { title: e.title, link: e.link, imgUrl: e.imgUrl },
  263. e
  264. );
  265. },
  266. updateAppMessageShareData: function (e) {
  267. k(
  268. "updateAppMessageShareData",
  269. { title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl },
  270. e
  271. );
  272. },
  273. startRecord: function (e) {
  274. k("startRecord", {}, e);
  275. },
  276. stopRecord: function (e) {
  277. k("stopRecord", {}, e);
  278. },
  279. onVoiceRecordEnd: function (e) {
  280. M("onVoiceRecordEnd", e);
  281. },
  282. playVoice: function (e) {
  283. k("playVoice", { localId: e.localId }, e);
  284. },
  285. pauseVoice: function (e) {
  286. k("pauseVoice", { localId: e.localId }, e);
  287. },
  288. stopVoice: function (e) {
  289. k("stopVoice", { localId: e.localId }, e);
  290. },
  291. onVoicePlayEnd: function (e) {
  292. M("onVoicePlayEnd", e);
  293. },
  294. uploadVoice: function (e) {
  295. k(
  296. "uploadVoice",
  297. {
  298. localId: e.localId,
  299. isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
  300. },
  301. e
  302. );
  303. },
  304. downloadVoice: function (e) {
  305. k(
  306. "downloadVoice",
  307. {
  308. serverId: e.serverId,
  309. isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
  310. },
  311. e
  312. );
  313. },
  314. translateVoice: function (e) {
  315. k(
  316. "translateVoice",
  317. {
  318. localId: e.localId,
  319. isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
  320. },
  321. e
  322. );
  323. },
  324. chooseImage: function (e) {
  325. k(
  326. "chooseImage",
  327. {
  328. scene: "1|2",
  329. count: e.count || 9,
  330. sizeType: e.sizeType || ["original", "compressed"],
  331. sourceType: e.sourceType || ["album", "camera"],
  332. },
  333. ((e._complete = function (e) {
  334. if (l) {
  335. var n = e.localIds;
  336. try {
  337. n && (e.localIds = JSON.parse(n));
  338. } catch (e) {}
  339. }
  340. }),
  341. e)
  342. );
  343. },
  344. getLocation: function (e) {
  345. (e = e || {}),
  346. k(
  347. a.getLocation,
  348. { type: e.type || "wgs84" },
  349. ((e._complete = function (e) {
  350. delete e.type;
  351. }),
  352. e)
  353. );
  354. },
  355. previewImage: function (e) {
  356. k(a.previewImage, { current: e.current, urls: e.urls }, e);
  357. },
  358. uploadImage: function (e) {
  359. k(
  360. "uploadImage",
  361. {
  362. localId: e.localId,
  363. isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
  364. },
  365. e
  366. );
  367. },
  368. downloadImage: function (e) {
  369. k(
  370. "downloadImage",
  371. {
  372. serverId: e.serverId,
  373. isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
  374. },
  375. e
  376. );
  377. },
  378. getLocalImgData: function (e) {
  379. !1 === I
  380. ? ((I = !0),
  381. k(
  382. "getLocalImgData",
  383. { localId: e.localId },
  384. ((e._complete = function (e) {
  385. var n;
  386. (I = !1),
  387. 0 < v.length && ((n = v.shift()), wx.getLocalImgData(n));
  388. }),
  389. e)
  390. ))
  391. : v.push(e);
  392. },
  393. getNetworkType: function (e) {
  394. k(
  395. "getNetworkType",
  396. {},
  397. ((e._complete = function (e) {
  398. var n = e,
  399. e = n.errMsg,
  400. i = ((n.errMsg = "getNetworkType:ok"), n.subtype);
  401. if ((delete n.subtype, i)) n.networkType = i;
  402. else {
  403. var i = e.indexOf(":"),
  404. t = e.substring(i + 1);
  405. switch (t) {
  406. case "wifi":
  407. case "edge":
  408. case "wwan":
  409. n.networkType = t;
  410. break;
  411. default:
  412. n.errMsg = "getNetworkType:fail";
  413. }
  414. }
  415. }),
  416. e)
  417. );
  418. },
  419. openLocation: function (e) {
  420. k(
  421. "openLocation",
  422. {
  423. latitude: e.latitude,
  424. longitude: e.longitude,
  425. name: e.name || "",
  426. address: e.address || "",
  427. scale: e.scale || 28,
  428. infoUrl: e.infoUrl || "",
  429. },
  430. e
  431. );
  432. },
  433. hideOptionMenu: function (e) {
  434. k("hideOptionMenu", {}, e);
  435. },
  436. showOptionMenu: function (e) {
  437. k("showOptionMenu", {}, e);
  438. },
  439. closeWindow: function (e) {
  440. k("closeWindow", {}, (e = e || {}));
  441. },
  442. hideMenuItems: function (e) {
  443. k("hideMenuItems", { menuList: e.menuList }, e);
  444. },
  445. showMenuItems: function (e) {
  446. k("showMenuItems", { menuList: e.menuList }, e);
  447. },
  448. hideAllNonBaseMenuItem: function (e) {
  449. k("hideAllNonBaseMenuItem", {}, e);
  450. },
  451. showAllNonBaseMenuItem: function (e) {
  452. k("showAllNonBaseMenuItem", {}, e);
  453. },
  454. scanQRCode: function (e) {
  455. k(
  456. "scanQRCode",
  457. {
  458. needResult: (e = e || {}).needResult || 0,
  459. scanType: e.scanType || ["qrCode", "barCode"],
  460. },
  461. ((e._complete = function (e) {
  462. var n;
  463. u &&
  464. (n = e.resultStr) &&
  465. ((n = JSON.parse(n)),
  466. (e.resultStr = n && n.scan_code && n.scan_code.scan_result));
  467. }),
  468. e)
  469. );
  470. },
  471. openAddress: function (e) {
  472. k(
  473. a.openAddress,
  474. {},
  475. ((e._complete = function (e) {
  476. ((e = e).postalCode = e.addressPostalCode),
  477. delete e.addressPostalCode,
  478. (e.provinceName = e.proviceFirstStageName),
  479. delete e.proviceFirstStageName,
  480. (e.cityName = e.addressCitySecondStageName),
  481. delete e.addressCitySecondStageName,
  482. (e.countryName = e.addressCountiesThirdStageName),
  483. delete e.addressCountiesThirdStageName,
  484. (e.detailInfo = e.addressDetailInfo),
  485. delete e.addressDetailInfo;
  486. }),
  487. e)
  488. );
  489. },
  490. openProductSpecificView: function (e) {
  491. k(
  492. a.openProductSpecificView,
  493. {
  494. pid: e.productId,
  495. view_type: e.viewType || 0,
  496. ext_info: e.extInfo,
  497. },
  498. e
  499. );
  500. },
  501. addCard: function (e) {
  502. for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
  503. var r = n[t],
  504. r = { card_id: r.cardId, card_ext: r.cardExt };
  505. i.push(r);
  506. }
  507. k(
  508. a.addCard,
  509. { card_list: i },
  510. ((e._complete = function (e) {
  511. if ((n = e.card_list)) {
  512. for (var n, i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
  513. var o = n[i];
  514. (o.cardId = o.card_id),
  515. (o.cardExt = o.card_ext),
  516. (o.isSuccess = !!o.is_succ),
  517. delete o.card_id,
  518. delete o.card_ext,
  519. delete o.is_succ;
  520. }
  521. (e.cardList = n), delete e.card_list;
  522. }
  523. }),
  524. e)
  525. );
  526. },
  527. chooseCard: function (e) {
  528. k(
  529. "chooseCard",
  530. {
  531. app_id: h.appId,
  532. location_id: e.shopId || "",
  533. sign_type: e.signType || "SHA1",
  534. card_id: e.cardId || "",
  535. card_type: e.cardType || "",
  536. card_sign: e.cardSign,
  537. time_stamp: e.timestamp + "",
  538. nonce_str: e.nonceStr,
  539. },
  540. ((e._complete = function (e) {
  541. (e.cardList = e.choose_card_info), delete e.choose_card_info;
  542. }),
  543. e)
  544. );
  545. },
  546. openCard: function (e) {
  547. for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
  548. var r = n[t],
  549. r = { card_id: r.cardId, code: r.code };
  550. i.push(r);
  551. }
  552. k(a.openCard, { card_list: i }, e);
  553. },
  554. consumeAndShareCard: function (e) {
  555. k(
  556. a.consumeAndShareCard,
  557. { consumedCardId: e.cardId, consumedCode: e.code },
  558. e
  559. );
  560. },
  561. chooseWXPay: function (e) {
  562. k(a.chooseWXPay, x(e), e), B({ jsApiName: "chooseWXPay" });
  563. },
  564. openEnterpriseRedPacket: function (e) {
  565. k(a.openEnterpriseRedPacket, x(e), e);
  566. },
  567. startSearchBeacons: function (e) {
  568. k(a.startSearchBeacons, { ticket: e.ticket }, e);
  569. },
  570. stopSearchBeacons: function (e) {
  571. k(a.stopSearchBeacons, {}, e);
  572. },
  573. onSearchBeacons: function (e) {
  574. M(a.onSearchBeacons, e);
  575. },
  576. openEnterpriseChat: function (e) {
  577. k(
  578. "openEnterpriseChat",
  579. { useridlist: e.userIds, chatname: e.groupName },
  580. e
  581. );
  582. },
  583. launchMiniProgram: function (e) {
  584. k(
  585. "launchMiniProgram",
  586. {
  587. targetAppId: e.targetAppId,
  588. path: (function (e) {
  589. var n;
  590. if ("string" == typeof e && 0 < e.length)
  591. return (
  592. (n = e.split("?")[0]),
  593. (n += ".html"),
  594. void 0 !== (e = e.split("?")[1]) ? n + "?" + e : n
  595. );
  596. })(e.path),
  597. envVersion: e.envVersion,
  598. },
  599. e
  600. );
  601. },
  602. openBusinessView: function (e) {
  603. k(
  604. "openBusinessView",
  605. {
  606. businessType: e.businessType,
  607. queryString: e.queryString || "",
  608. envVersion: e.envVersion,
  609. },
  610. ((e._complete = function (n) {
  611. if (l) {
  612. var e = n.extraData;
  613. if (e)
  614. try {
  615. n.extraData = JSON.parse(e);
  616. } catch (e) {
  617. n.extraData = {};
  618. }
  619. }
  620. }),
  621. e)
  622. );
  623. },
  624. miniProgram: {
  625. navigateBack: function (e) {
  626. (e = e || {}),
  627. O(function () {
  628. k(
  629. "invokeMiniProgramAPI",
  630. { name: "navigateBack", arg: { delta: e.delta || 1 } },
  631. e
  632. );
  633. });
  634. },
  635. navigateTo: function (e) {
  636. O(function () {
  637. k(
  638. "invokeMiniProgramAPI",
  639. { name: "navigateTo", arg: { url: e.url } },
  640. e
  641. );
  642. });
  643. },
  644. redirectTo: function (e) {
  645. O(function () {
  646. k(
  647. "invokeMiniProgramAPI",
  648. { name: "redirectTo", arg: { url: e.url } },
  649. e
  650. );
  651. });
  652. },
  653. switchTab: function (e) {
  654. O(function () {
  655. k(
  656. "invokeMiniProgramAPI",
  657. { name: "switchTab", arg: { url: e.url } },
  658. e
  659. );
  660. });
  661. },
  662. reLaunch: function (e) {
  663. O(function () {
  664. k(
  665. "invokeMiniProgramAPI",
  666. { name: "reLaunch", arg: { url: e.url } },
  667. e
  668. );
  669. });
  670. },
  671. postMessage: function (e) {
  672. O(function () {
  673. k(
  674. "invokeMiniProgramAPI",
  675. { name: "postMessage", arg: e.data || {} },
  676. e
  677. );
  678. });
  679. },
  680. getEnv: function (e) {
  681. O(function () {
  682. e({ miniprogram: "miniprogram" === r.__wxjs_environment });
  683. });
  684. },
  685. },
  686. }),
  687. (w = 1),
  688. (T = {}),
  689. n.addEventListener(
  690. "error",
  691. function (e) {
  692. var n, i, t;
  693. l ||
  694. ((t = (n = e.target).tagName),
  695. (i = n.src),
  696. "IMG" != t && "VIDEO" != t && "AUDIO" != t && "SOURCE" != t) ||
  697. (-1 != i.indexOf("wxlocalresource://") &&
  698. (e.preventDefault(),
  699. e.stopPropagation(),
  700. (t = n["wx-id"]) || ((t = w++), (n["wx-id"] = t)),
  701. T[t] ||
  702. ((T[t] = !0),
  703. wx.ready(function () {
  704. wx.getLocalImgData({
  705. localId: i,
  706. success: function (e) {
  707. n.src = e.localData;
  708. },
  709. });
  710. }))));
  711. },
  712. !0
  713. ),
  714. n.addEventListener(
  715. "load",
  716. function (e) {
  717. var n;
  718. l ||
  719. ((n = (e = e.target).tagName),
  720. e.src,
  721. "IMG" != n && "VIDEO" != n && "AUDIO" != n && "SOURCE" != n) ||
  722. ((n = e["wx-id"]) && (T[n] = !1));
  723. },
  724. !0
  725. ),
  726. e && (r.wx = r.jWeixin = _),
  727. _
  728. );
  729. else return r.jWeixin;
  730. function k(n, e, i) {
  731. r.WeixinJSBridge
  732. ? WeixinJSBridge.invoke(n, P(e), function (e) {
  733. V(n, e, i);
  734. })
  735. : C(n, i);
  736. }
  737. function M(n, i, t) {
  738. r.WeixinJSBridge
  739. ? WeixinJSBridge.on(n, function (e) {
  740. t && t.trigger && t.trigger(e), V(n, e, i);
  741. })
  742. : C(n, t || i);
  743. }
  744. function P(e) {
  745. return (
  746. ((e = e || {}).appId = h.appId),
  747. (e.verifyAppId = h.appId),
  748. (e.verifySignType = "sha1"),
  749. (e.verifyTimestamp = h.timestamp + ""),
  750. (e.verifyNonceStr = h.nonceStr),
  751. (e.verifySignature = h.signature),
  752. e
  753. );
  754. }
  755. function x(e) {
  756. return {
  757. timeStamp: e.timestamp + "",
  758. nonceStr: e.nonceStr,
  759. package: e.package,
  760. paySign: e.paySign,
  761. signType: e.signType || "SHA1",
  762. };
  763. }
  764. function V(e, n, i) {
  765. ("openEnterpriseChat" != e && "openBusinessView" !== e) ||
  766. (n.errCode = n.err_code),
  767. delete n.err_code,
  768. delete n.err_desc,
  769. delete n.err_detail;
  770. var t = n.errMsg,
  771. e =
  772. (t ||
  773. ((t = n.err_msg),
  774. delete n.err_msg,
  775. (t = (function (e, n) {
  776. var i = c[e];
  777. i && (e = i);
  778. i = "ok";
  779. {
  780. var t;
  781. n &&
  782. ((t = n.indexOf(":")),
  783. ("access denied" !=
  784. (i = (i = (i =
  785. -1 !=
  786. (i =
  787. -1 !=
  788. (i =
  789. "failed" ==
  790. (i = "confirm" == (i = n.substring(t + 1)) ? "ok" : i)
  791. ? "fail"
  792. : i).indexOf("failed_")
  793. ? i.substring(7)
  794. : i).indexOf("fail_")
  795. ? i.substring(5)
  796. : i).replace(/_/g, " ")).toLowerCase()) &&
  797. "no permission to execute" != i) ||
  798. (i = "permission denied"),
  799. "" ==
  800. (i =
  801. "config" == e && "function not exist" == i ? "ok" : i)) &&
  802. (i = "fail");
  803. }
  804. return (n = e + ":" + i);
  805. })(e, t)),
  806. (n.errMsg = t)),
  807. (i = i || {})._complete && (i._complete(n), delete i._complete),
  808. (t = n.errMsg || ""),
  809. h.debug && !i.isInnerInvoke && alert(JSON.stringify(n)),
  810. t.indexOf(":"));
  811. switch (t.substring(e + 1)) {
  812. case "ok":
  813. i.success && i.success(n);
  814. break;
  815. case "cancel":
  816. i.cancel && i.cancel(n);
  817. break;
  818. default:
  819. i.fail && i.fail(n);
  820. }
  821. i.complete && i.complete(n);
  822. }
  823. function A(e) {
  824. if (e) {
  825. for (var n = 0, i = e.length; n < i; ++n) {
  826. var t = e[n],
  827. t = a[t];
  828. t && (e[n] = t);
  829. }
  830. return e;
  831. }
  832. }
  833. function C(e, n) {
  834. var i;
  835. !h.debug ||
  836. (n && n.isInnerInvoke) ||
  837. ((i = c[e]) && (e = i),
  838. n && n._complete && delete n._complete,
  839. console.log('"' + e + '",', n || ""));
  840. }
  841. function B(n) {
  842. var i;
  843. o ||
  844. s ||
  845. h.debug ||
  846. p < "6.0.2" ||
  847. g.systemType < 0 ||
  848. ((i = new Image()),
  849. (g.appId = h.appId),
  850. (g.initTime = m.initEndTime - m.initStartTime),
  851. (g.preVerifyTime = m.preVerifyEndTime - m.preVerifyStartTime),
  852. _.getNetworkType({
  853. isInnerInvoke: !0,
  854. success: function (e) {
  855. g.networkType = e.networkType;
  856. e =
  857. "https://open.weixin.qq.com/sdk/report?v=" +
  858. g.version +
  859. "&o=" +
  860. g.isPreVerifyOk +
  861. "&s=" +
  862. g.systemType +
  863. "&c=" +
  864. g.clientVersion +
  865. "&a=" +
  866. g.appId +
  867. "&n=" +
  868. g.networkType +
  869. "&i=" +
  870. g.initTime +
  871. "&p=" +
  872. g.preVerifyTime +
  873. "&u=" +
  874. g.url +
  875. "&jsapi_name=" +
  876. (n ? n.jsApiName : "");
  877. i.src = e;
  878. },
  879. }));
  880. }
  881. function L() {
  882. return new Date().getTime();
  883. }
  884. function O(e) {
  885. d &&
  886. (r.WeixinJSBridge
  887. ? e()
  888. : n.addEventListener &&
  889. n.addEventListener("WeixinJSBridgeReady", e, !1));
  890. }
  891. });