张文飞 hace 3 años
padre
commit
cedb6aa4ec

+ 21 - 0
node_modules/weixin-js-sdk/README.md

@@ -0,0 +1,21 @@
+微信官方 js-sdk
+----
+
+说明: 仅将官方 js-sdk 发布到 npm,支持 CommonJS,便于 browserify, webpack 等直接使用
+
+js源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
+
+官方使用说明: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115
+
+安装:
+    
+    npm install weixin-js-sdk
+    
+使用:
+    
+    var wx = require('weixin-js-sdk');
+
+### Old versions
+
+* [1.0.0](https://github.com/yanxi-me/weixin-js-sdk/tree/1.0.0)
+* [1.2.0](https://github.com/yanxi-me/weixin-js-sdk/tree/1.2.0)

+ 898 - 0
node_modules/weixin-js-sdk/index.js

@@ -0,0 +1,898 @@
+!(function(e, n) {
+  module.exports = n(e);
+})(window, function(o, e) {
+  if (!o.jWeixin) {
+    var n,
+      c = {
+        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",
+        openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
+        startSearchBeacons: "startMonitoringBeacons",
+        stopSearchBeacons: "stopMonitoringBeacons",
+        onSearchBeacons: "onBeaconsInRange",
+        consumeAndShareCard: "consumedShareCard",
+        openAddress: "editAddress"
+      },
+      a = (function() {
+        var e = {};
+        for (var n in c) e[c[n]] = n;
+        return e;
+      })(),
+      i = o.document,
+      t = i.title,
+      r = navigator.userAgent.toLowerCase(),
+      s = navigator.platform.toLowerCase(),
+      d = !(!s.match("mac") && !s.match("win")),
+      u = -1 != r.indexOf("wxdebugger"),
+      l = -1 != r.indexOf("micromessenger"),
+      p = -1 != r.indexOf("android"),
+      f = -1 != r.indexOf("iphone") || -1 != r.indexOf("ipad"),
+      m = (n =
+        r.match(/micromessenger\/(\d+\.\d+\.\d+)/) ||
+        r.match(/micromessenger\/(\d+\.\d+)/))
+        ? n[1]
+        : "",
+      g = {
+        initStartTime: L(),
+        initEndTime: 0,
+        preVerifyStartTime: 0,
+        preVerifyEndTime: 0
+      },
+      h = {
+        version: 1,
+        appId: "",
+        initTime: 0,
+        preVerifyTime: 0,
+        networkType: "",
+        isPreVerifyOk: 1,
+        systemType: f ? 1 : p ? 2 : -1,
+        clientVersion: m,
+        url: encodeURIComponent(location.href)
+      },
+      v = {},
+      S = { _completes: [] },
+      y = { state: 0, data: {} };
+    O(function() {
+      g.initEndTime = L();
+    });
+    var I = !1,
+      _ = [],
+      w = {
+        config: function(e) {
+          B("config", (v = e));
+          var t = !1 !== v.check;
+          O(function() {
+            if (t)
+              M(
+                c.config,
+                {
+                  verifyJsApiList: C(v.jsApiList),
+                  verifyOpenTagList: C(v.openTagList)
+                },
+                (function() {
+                  (S._complete = function(e) {
+                    (g.preVerifyEndTime = L()), (y.state = 1), (y.data = e);
+                  }),
+                    (S.success = function(e) {
+                      h.isPreVerifyOk = 0;
+                    }),
+                    (S.fail = function(e) {
+                      S._fail ? S._fail(e) : (y.state = -1);
+                    });
+                  var t = S._completes;
+                  return (
+                    t.push(function() {
+                      !(function() {
+                        if (
+                          !(
+                            d ||
+                            u ||
+                            v.debug ||
+                            m < "6.0.2" ||
+                            h.systemType < 0
+                          )
+                        ) {
+                          var i = new Image();
+                          (h.appId = v.appId),
+                            (h.initTime = g.initEndTime - g.initStartTime),
+                            (h.preVerifyTime =
+                              g.preVerifyEndTime - g.preVerifyStartTime),
+                            w.getNetworkType({
+                              isInnerInvoke: !0,
+                              success: function(e) {
+                                h.networkType = e.networkType;
+                                var n =
+                                  "https://open.weixin.qq.com/sdk/report?v=" +
+                                  h.version +
+                                  "&o=" +
+                                  h.isPreVerifyOk +
+                                  "&s=" +
+                                  h.systemType +
+                                  "&c=" +
+                                  h.clientVersion +
+                                  "&a=" +
+                                  h.appId +
+                                  "&n=" +
+                                  h.networkType +
+                                  "&i=" +
+                                  h.initTime +
+                                  "&p=" +
+                                  h.preVerifyTime +
+                                  "&u=" +
+                                  h.url;
+                                i.src = n;
+                              }
+                            });
+                        }
+                      })();
+                    }),
+                    (S.complete = function(e) {
+                      for (var n = 0, i = t.length; n < i; ++n) t[n]();
+                      S._completes = [];
+                    }),
+                    S
+                  );
+                })()
+              ),
+                (g.preVerifyStartTime = L());
+            else {
+              y.state = 1;
+              for (var e = S._completes, n = 0, i = e.length; n < i; ++n)
+                e[n]();
+              S._completes = [];
+            }
+          }),
+            w.invoke ||
+              ((w.invoke = function(e, n, i) {
+                o.WeixinJSBridge && WeixinJSBridge.invoke(e, x(n), i);
+              }),
+              (w.on = function(e, n) {
+                o.WeixinJSBridge && WeixinJSBridge.on(e, n);
+              }));
+        },
+        ready: function(e) {
+          0 != y.state ? e() : (S._completes.push(e), !l && v.debug && e());
+        },
+        error: function(e) {
+          m < "6.0.2" || (-1 == y.state ? e(y.data) : (S._fail = e));
+        },
+        checkJsApi: function(e) {
+          M(
+            "checkJsApi",
+            { jsApiList: C(e.jsApiList) },
+            ((e._complete = function(e) {
+              if (p) {
+                var n = e.checkResult;
+                n && (e.checkResult = JSON.parse(n));
+              }
+              e = (function(e) {
+                var n = e.checkResult;
+                for (var i in n) {
+                  var t = a[i];
+                  t && ((n[t] = n[i]), delete n[i]);
+                }
+                return e;
+              })(e);
+            }),
+            e)
+          );
+        },
+        onMenuShareTimeline: function(e) {
+          P(
+            c.onMenuShareTimeline,
+            {
+              complete: function() {
+                M(
+                  "shareTimeline",
+                  {
+                    title: e.title || t,
+                    desc: e.title || t,
+                    img_url: e.imgUrl || "",
+                    link: e.link || location.href,
+                    type: e.type || "link",
+                    data_url: e.dataUrl || ""
+                  },
+                  e
+                );
+              }
+            },
+            e
+          );
+        },
+        onMenuShareAppMessage: function(n) {
+          P(
+            c.onMenuShareAppMessage,
+            {
+              complete: function(e) {
+                "favorite" === e.scene
+                  ? M("sendAppMessage", {
+                      title: n.title || t,
+                      desc: n.desc || "",
+                      link: n.link || location.href,
+                      img_url: n.imgUrl || "",
+                      type: n.type || "link",
+                      data_url: n.dataUrl || ""
+                    })
+                  : M(
+                      "sendAppMessage",
+                      {
+                        title: n.title || t,
+                        desc: n.desc || "",
+                        link: n.link || location.href,
+                        img_url: n.imgUrl || "",
+                        type: n.type || "link",
+                        data_url: n.dataUrl || ""
+                      },
+                      n
+                    );
+              }
+            },
+            n
+          );
+        },
+        onMenuShareQQ: function(e) {
+          P(
+            c.onMenuShareQQ,
+            {
+              complete: function() {
+                M(
+                  "shareQQ",
+                  {
+                    title: e.title || t,
+                    desc: e.desc || "",
+                    img_url: e.imgUrl || "",
+                    link: e.link || location.href
+                  },
+                  e
+                );
+              }
+            },
+            e
+          );
+        },
+        onMenuShareWeibo: function(e) {
+          P(
+            c.onMenuShareWeibo,
+            {
+              complete: function() {
+                M(
+                  "shareWeiboApp",
+                  {
+                    title: e.title || t,
+                    desc: e.desc || "",
+                    img_url: e.imgUrl || "",
+                    link: e.link || location.href
+                  },
+                  e
+                );
+              }
+            },
+            e
+          );
+        },
+        onMenuShareQZone: function(e) {
+          P(
+            c.onMenuShareQZone,
+            {
+              complete: function() {
+                M(
+                  "shareQZone",
+                  {
+                    title: e.title || t,
+                    desc: e.desc || "",
+                    img_url: e.imgUrl || "",
+                    link: e.link || location.href
+                  },
+                  e
+                );
+              }
+            },
+            e
+          );
+        },
+        updateTimelineShareData: function(e) {
+          M(
+            "updateTimelineShareData",
+            { title: e.title, link: e.link, imgUrl: e.imgUrl },
+            e
+          );
+        },
+        updateAppMessageShareData: function(e) {
+          M(
+            "updateAppMessageShareData",
+            { title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl },
+            e
+          );
+        },
+        startRecord: function(e) {
+          M("startRecord", {}, e);
+        },
+        stopRecord: function(e) {
+          M("stopRecord", {}, e);
+        },
+        onVoiceRecordEnd: function(e) {
+          P("onVoiceRecordEnd", e);
+        },
+        playVoice: function(e) {
+          M("playVoice", { localId: e.localId }, e);
+        },
+        pauseVoice: function(e) {
+          M("pauseVoice", { localId: e.localId }, e);
+        },
+        stopVoice: function(e) {
+          M("stopVoice", { localId: e.localId }, e);
+        },
+        onVoicePlayEnd: function(e) {
+          P("onVoicePlayEnd", e);
+        },
+        uploadVoice: function(e) {
+          M(
+            "uploadVoice",
+            {
+              localId: e.localId,
+              isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1
+            },
+            e
+          );
+        },
+        downloadVoice: function(e) {
+          M(
+            "downloadVoice",
+            {
+              serverId: e.serverId,
+              isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1
+            },
+            e
+          );
+        },
+        translateVoice: function(e) {
+          M(
+            "translateVoice",
+            {
+              localId: e.localId,
+              isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1
+            },
+            e
+          );
+        },
+        chooseImage: function(e) {
+          M(
+            "chooseImage",
+            {
+              scene: "1|2",
+              count: e.count || 9,
+              sizeType: e.sizeType || ["original", "compressed"],
+              sourceType: e.sourceType || ["album", "camera"]
+            },
+            ((e._complete = function(e) {
+              if (p) {
+                var n = e.localIds;
+                try {
+                  n && (e.localIds = JSON.parse(n));
+                } catch (e) {}
+              }
+            }),
+            e)
+          );
+        },
+        getLocation: function(e) {},
+        previewImage: function(e) {
+          M(c.previewImage, { current: e.current, urls: e.urls }, e);
+        },
+        uploadImage: function(e) {
+          M(
+            "uploadImage",
+            {
+              localId: e.localId,
+              isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1
+            },
+            e
+          );
+        },
+        downloadImage: function(e) {
+          M(
+            "downloadImage",
+            {
+              serverId: e.serverId,
+              isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1
+            },
+            e
+          );
+        },
+        getLocalImgData: function(e) {
+          !1 === I
+            ? ((I = !0),
+              M(
+                "getLocalImgData",
+                { localId: e.localId },
+                ((e._complete = function(e) {
+                  if (((I = !1), 0 < _.length)) {
+                    var n = _.shift();
+                    wx.getLocalImgData(n);
+                  }
+                }),
+                e)
+              ))
+            : _.push(e);
+        },
+        getNetworkType: function(e) {
+          M(
+            "getNetworkType",
+            {},
+            ((e._complete = function(e) {
+              e = (function(e) {
+                var n = e.errMsg;
+                e.errMsg = "getNetworkType:ok";
+                var i = e.subtype;
+                if ((delete e.subtype, i)) e.networkType = i;
+                else {
+                  var t = n.indexOf(":"),
+                    o = n.substring(t + 1);
+                  switch (o) {
+                    case "wifi":
+                    case "edge":
+                    case "wwan":
+                      e.networkType = o;
+                      break;
+                    default:
+                      e.errMsg = "getNetworkType:fail";
+                  }
+                }
+                return e;
+              })(e);
+            }),
+            e)
+          );
+        },
+        openLocation: function(e) {
+          M(
+            "openLocation",
+            {
+              latitude: e.latitude,
+              longitude: e.longitude,
+              name: e.name || "",
+              address: e.address || "",
+              scale: e.scale || 28,
+              infoUrl: e.infoUrl || ""
+            },
+            e
+          );
+        },
+        getLocation: function(e) {
+          M(
+            c.getLocation,
+            { type: (e = e || {}).type || "wgs84" },
+            ((e._complete = function(e) {
+              delete e.type;
+            }),
+            e)
+          );
+        },
+        hideOptionMenu: function(e) {
+          M("hideOptionMenu", {}, e);
+        },
+        showOptionMenu: function(e) {
+          M("showOptionMenu", {}, e);
+        },
+        closeWindow: function(e) {
+          M("closeWindow", {}, (e = e || {}));
+        },
+        hideMenuItems: function(e) {
+          M("hideMenuItems", { menuList: e.menuList }, e);
+        },
+        showMenuItems: function(e) {
+          M("showMenuItems", { menuList: e.menuList }, e);
+        },
+        hideAllNonBaseMenuItem: function(e) {
+          M("hideAllNonBaseMenuItem", {}, e);
+        },
+        showAllNonBaseMenuItem: function(e) {
+          M("showAllNonBaseMenuItem", {}, e);
+        },
+        scanQRCode: function(e) {
+          M(
+            "scanQRCode",
+            {
+              needResult: (e = e || {}).needResult || 0,
+              scanType: e.scanType || ["qrCode", "barCode"]
+            },
+            ((e._complete = function(e) {
+              if (f) {
+                var n = e.resultStr;
+                if (n) {
+                  var i = JSON.parse(n);
+                  e.resultStr = i && i.scan_code && i.scan_code.scan_result;
+                }
+              }
+            }),
+            e)
+          );
+        },
+        openAddress: function(e) {
+          M(
+            c.openAddress,
+            {},
+            ((e._complete = function(e) {
+              e = (function(e) {
+                return (
+                  (e.postalCode = e.addressPostalCode),
+                  delete e.addressPostalCode,
+                  (e.provinceName = e.proviceFirstStageName),
+                  delete e.proviceFirstStageName,
+                  (e.cityName = e.addressCitySecondStageName),
+                  delete e.addressCitySecondStageName,
+                  (e.countryName = e.addressCountiesThirdStageName),
+                  delete e.addressCountiesThirdStageName,
+                  (e.detailInfo = e.addressDetailInfo),
+                  delete e.addressDetailInfo,
+                  e
+                );
+              })(e);
+            }),
+            e)
+          );
+        },
+        openProductSpecificView: function(e) {
+          M(
+            c.openProductSpecificView,
+            {
+              pid: e.productId,
+              view_type: e.viewType || 0,
+              ext_info: e.extInfo
+            },
+            e
+          );
+        },
+        addCard: function(e) {
+          for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
+            var r = n[t],
+              a = { card_id: r.cardId, card_ext: r.cardExt };
+            i.push(a);
+          }
+          M(
+            c.addCard,
+            { card_list: i },
+            ((e._complete = function(e) {
+              var n = e.card_list;
+              if (n) {
+                for (var i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
+                  var o = n[i];
+                  (o.cardId = o.card_id),
+                    (o.cardExt = o.card_ext),
+                    (o.isSuccess = !!o.is_succ),
+                    delete o.card_id,
+                    delete o.card_ext,
+                    delete o.is_succ;
+                }
+                (e.cardList = n), delete e.card_list;
+              }
+            }),
+            e)
+          );
+        },
+        chooseCard: function(e) {
+          M(
+            "chooseCard",
+            {
+              app_id: v.appId,
+              location_id: e.shopId || "",
+              sign_type: e.signType || "SHA1",
+              card_id: e.cardId || "",
+              card_type: e.cardType || "",
+              card_sign: e.cardSign,
+              time_stamp: e.timestamp + "",
+              nonce_str: e.nonceStr
+            },
+            ((e._complete = function(e) {
+              (e.cardList = e.choose_card_info), delete e.choose_card_info;
+            }),
+            e)
+          );
+        },
+        openCard: function(e) {
+          for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
+            var r = n[t],
+              a = { card_id: r.cardId, code: r.code };
+            i.push(a);
+          }
+          M(c.openCard, { card_list: i }, e);
+        },
+        consumeAndShareCard: function(e) {
+          M(
+            c.consumeAndShareCard,
+            { consumedCardId: e.cardId, consumedCode: e.code },
+            e
+          );
+        },
+        chooseWXPay: function(e) {
+          M(c.chooseWXPay, V(e), e);
+        },
+        openEnterpriseRedPacket: function(e) {
+          M(c.openEnterpriseRedPacket, V(e), e);
+        },
+        startSearchBeacons: function(e) {
+          M(c.startSearchBeacons, { ticket: e.ticket }, e);
+        },
+        stopSearchBeacons: function(e) {
+          M(c.stopSearchBeacons, {}, e);
+        },
+        onSearchBeacons: function(e) {
+          P(c.onSearchBeacons, e);
+        },
+        openEnterpriseChat: function(e) {
+          M(
+            "openEnterpriseChat",
+            { useridlist: e.userIds, chatname: e.groupName },
+            e
+          );
+        },
+        launchMiniProgram: function(e) {
+          M(
+            "launchMiniProgram",
+            {
+              targetAppId: e.targetAppId,
+              path: (function(e) {
+                if ("string" == typeof e && 0 < e.length) {
+                  var n = e.split("?")[0],
+                    i = e.split("?")[1];
+                  return (n += ".html"), void 0 !== i ? n + "?" + i : n;
+                }
+              })(e.path),
+              envVersion: e.envVersion
+            },
+            e
+          );
+        },
+        openBusinessView: function(e) {
+          M(
+            "openBusinessView",
+            {
+              businessType: e.businessType,
+              queryString: e.queryString || "",
+              envVersion: e.envVersion
+            },
+            ((e._complete = function(n) {
+              if (p) {
+                var e = n.extraData;
+                if (e)
+                  try {
+                    n.extraData = JSON.parse(e);
+                  } catch (e) {
+                    n.extraData = {};
+                  }
+              }
+            }),
+            e)
+          );
+        },
+        miniProgram: {
+          navigateBack: function(e) {
+            (e = e || {}),
+              O(function() {
+                M(
+                  "invokeMiniProgramAPI",
+                  { name: "navigateBack", arg: { delta: e.delta || 1 } },
+                  e
+                );
+              });
+          },
+          navigateTo: function(e) {
+            O(function() {
+              M(
+                "invokeMiniProgramAPI",
+                { name: "navigateTo", arg: { url: e.url } },
+                e
+              );
+            });
+          },
+          redirectTo: function(e) {
+            O(function() {
+              M(
+                "invokeMiniProgramAPI",
+                { name: "redirectTo", arg: { url: e.url } },
+                e
+              );
+            });
+          },
+          switchTab: function(e) {
+            O(function() {
+              M(
+                "invokeMiniProgramAPI",
+                { name: "switchTab", arg: { url: e.url } },
+                e
+              );
+            });
+          },
+          reLaunch: function(e) {
+            O(function() {
+              M(
+                "invokeMiniProgramAPI",
+                { name: "reLaunch", arg: { url: e.url } },
+                e
+              );
+            });
+          },
+          postMessage: function(e) {
+            O(function() {
+              M(
+                "invokeMiniProgramAPI",
+                { name: "postMessage", arg: e.data || {} },
+                e
+              );
+            });
+          },
+          getEnv: function(e) {
+            O(function() {
+              e({ miniprogram: "miniprogram" === o.__wxjs_environment });
+            });
+          }
+        }
+      },
+      T = 1,
+      k = {};
+    return (
+      i.addEventListener(
+        "error",
+        function(e) {
+          if (!p) {
+            var n = e.target,
+              i = n.tagName,
+              t = n.src;
+            if ("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i)
+              if (-1 != t.indexOf("wxlocalresource://")) {
+                e.preventDefault(), e.stopPropagation();
+                var o = n["wx-id"];
+                if ((o || ((o = T++), (n["wx-id"] = o)), k[o])) return;
+                (k[o] = !0),
+                  wx.ready(function() {
+                    wx.getLocalImgData({
+                      localId: t,
+                      success: function(e) {
+                        n.src = e.localData;
+                      }
+                    });
+                  });
+              }
+          }
+        },
+        !0
+      ),
+      i.addEventListener(
+        "load",
+        function(e) {
+          if (!p) {
+            var n = e.target,
+              i = n.tagName;
+            n.src;
+            if ("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) {
+              var t = n["wx-id"];
+              t && (k[t] = !1);
+            }
+          }
+        },
+        !0
+      ),
+      e && (o.wx = o.jWeixin = w),
+      w
+    );
+  }
+  function M(n, e, i) {
+    o.WeixinJSBridge
+      ? WeixinJSBridge.invoke(n, x(e), function(e) {
+          A(n, e, i);
+        })
+      : B(n, i);
+  }
+  function P(n, i, t) {
+    o.WeixinJSBridge
+      ? WeixinJSBridge.on(n, function(e) {
+          t && t.trigger && t.trigger(e), A(n, e, i);
+        })
+      : B(n, t || i);
+  }
+  function x(e) {
+    return (
+      ((e = e || {}).appId = v.appId),
+      (e.verifyAppId = v.appId),
+      (e.verifySignType = "sha1"),
+      (e.verifyTimestamp = v.timestamp + ""),
+      (e.verifyNonceStr = v.nonceStr),
+      (e.verifySignature = v.signature),
+      e
+    );
+  }
+  function V(e) {
+    return {
+      timeStamp: e.timestamp + "",
+      nonceStr: e.nonceStr,
+      package: e.package,
+      paySign: e.paySign,
+      signType: e.signType || "SHA1"
+    };
+  }
+  function A(e, n, i) {
+    ("openEnterpriseChat" != e && "openBusinessView" !== e) ||
+      (n.errCode = n.err_code),
+      delete n.err_code,
+      delete n.err_desc,
+      delete n.err_detail;
+    var t = n.errMsg;
+    t ||
+      ((t = n.err_msg),
+      delete n.err_msg,
+      (t = (function(e, n) {
+        var i = e,
+          t = a[i];
+        t && (i = t);
+        var o = "ok";
+        if (n) {
+          var r = n.indexOf(":");
+          "confirm" == (o = n.substring(r + 1)) && (o = "ok"),
+            "failed" == o && (o = "fail"),
+            -1 != o.indexOf("failed_") && (o = o.substring(7)),
+            -1 != o.indexOf("fail_") && (o = o.substring(5)),
+            ("access denied" !=
+              (o = (o = o.replace(/_/g, " ")).toLowerCase()) &&
+              "no permission to execute" != o) ||
+              (o = "permission denied"),
+            "config" == i && "function not exist" == o && (o = "ok"),
+            "" == o && (o = "fail");
+        }
+        return (n = i + ":" + o);
+      })(e, t)),
+      (n.errMsg = t)),
+      (i = i || {})._complete && (i._complete(n), delete i._complete),
+      (t = n.errMsg || ""),
+      v.debug && !i.isInnerInvoke && alert(JSON.stringify(n));
+    var o = t.indexOf(":");
+    switch (t.substring(o + 1)) {
+      case "ok":
+        i.success && i.success(n);
+        break;
+      case "cancel":
+        i.cancel && i.cancel(n);
+        break;
+      default:
+        i.fail && i.fail(n);
+    }
+    i.complete && i.complete(n);
+  }
+  function C(e) {
+    if (e) {
+      for (var n = 0, i = e.length; n < i; ++n) {
+        var t = e[n],
+          o = c[t];
+        o && (e[n] = o);
+      }
+      return e;
+    }
+  }
+  function B(e, n) {
+    if (!(!v.debug || (n && n.isInnerInvoke))) {
+      var i = a[e];
+      i && (e = i),
+        n && n._complete && delete n._complete,
+        console.log('"' + e + '",', n || "");
+    }
+  }
+  function L() {
+    return new Date().getTime();
+  }
+  function O(e) {
+    l &&
+      (o.WeixinJSBridge
+        ? e()
+        : i.addEventListener &&
+          i.addEventListener("WeixinJSBridgeReady", e, !1));
+  }
+});

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 2 - 0
node_modules/weixin-js-sdk/index.original.js


+ 40 - 0
node_modules/weixin-js-sdk/package.json

@@ -0,0 +1,40 @@
+{
+  "_from": "weixin-js-sdk",
+  "_id": "weixin-js-sdk@1.6.0",
+  "_inBundle": false,
+  "_integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ==",
+  "_location": "/weixin-js-sdk",
+  "_phantomChildren": {},
+  "_requested": {
+    "type": "tag",
+    "registry": true,
+    "raw": "weixin-js-sdk",
+    "name": "weixin-js-sdk",
+    "escapedName": "weixin-js-sdk",
+    "rawSpec": "",
+    "saveSpec": null,
+    "fetchSpec": "latest"
+  },
+  "_requiredBy": [
+    "#USER",
+    "/"
+  ],
+  "_resolved": "https://registry.npmjs.org/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
+  "_shasum": "ff50484d8118ce1208f11248cf4a1c0831577514",
+  "_spec": "weixin-js-sdk",
+  "_where": "D:\\workSpace\\h5-elab-open-ownerUnion",
+  "bugs": {
+    "url": "https://github.com/yanxi-com/weixin-js-sdk/issues"
+  },
+  "bundleDependencies": false,
+  "deprecated": false,
+  "description": "微信官方 js-sdk CommonJS 版",
+  "homepage": "https://github.com/yanxi-com/weixin-js-sdk#readme",
+  "main": "index.js",
+  "name": "weixin-js-sdk",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/yanxi-com/weixin-js-sdk.git"
+  },
+  "version": "1.6.0"
+}

+ 13 - 0
package-lock.json

@@ -0,0 +1,13 @@
+{
+  "name": "h5-elab-open-ownerUnion",
+  "version": "1.0.0",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "weixin-js-sdk": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
+      "integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ=="
+    }
+  }
+}

+ 17 - 0
package.json

@@ -2,5 +2,22 @@
   "devDependencies": {
     "node-sass": "^4.14.1",
     "sass-loader": "^7.3.1"
+  },
+  "name": "h5-elab-open-ownerUnion",
+  "version": "1.0.0",
+  "main": "main.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://192.168.4.246:3000/elab-damai-h5/h5-elab-open-ownerUnion.git"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "ISC",
+  "description": "",
+  "dependencies": {
+    "weixin-js-sdk": "^1.6.0"
   }
 }

+ 167 - 109
pages/houseDetail/houseDetail.vue

@@ -5,11 +5,12 @@
 			<view class="topSection">
 				<view class="title">{{dataInfo.name}}</view>
 				<view class="tags">
-					<view class="item" v-for="(item, idx) in dataInfo.categoryList" :key="idx"
-					:style="`color: ${color2}; background-color: ${color6};`">{{item.categoryName}}</view>
+					<view class="item" v-for="(item, idx) in dataInfo.categoryList" :key="idx"
+						:style="`color: ${color2}; background-color: ${color6};`">{{item.categoryName}}</view>
 				</view>
 				<view class="shareBtn" :style="`background-color: ${color1};`" @click="toShareCard(2)">
-					<image class="icon" src="https://dm.static.elab-plus.com/yezhu/h5/icon_share.png" mode="aspectFit"></image>
+					<image class="icon" src="https://dm.static.elab-plus.com/yezhu/h5/icon_share.png" mode="aspectFit">
+					</image>
 					<text>分享项目</text>
 				</view>
 			</view>
@@ -42,27 +43,29 @@
 			</view>
 			<view class="invitationBtn" @click="toShareCard(1)">邀请好友</view>
 		</view>
-		
-		<backHome></backHome>
+
+		<backHome></backHome>
 		<login-notice></login-notice>
-		<login></login>
+		<login></login>
 	</view>
 </template>
 
-<script>
-	import moment from '../../static/moment.min.js'
-	import {
-		displayDateFormatChi
-	} from '../../static/format.js'
-	
+<script>
+	import moment from '../../static/moment.min.js'
+	import {
+		displayDateFormatChi
+	} from '../../static/format.js'
+
 	let app = getApp();
-	import backHome from "@/components/backHome/backHome.vue"
+	const config = require('@/static/config.js');
+	import backHome from "@/components/backHome/backHome.vue";
+	const wx = require('weixin-js-sdk');
 	export default {
 		data() {
 			return {
 				color1: '',
-				color2: '',
-				color3: '',
+				color2: '',
+				color3: '',
 				color6: '',
 				infos: [{
 						title: '开盘时间',
@@ -118,33 +121,84 @@
 					"shareRemark": "",
 					"xcxPage": ""
 				},
-				
+
 				categoryList: [],
-				registAmount:null,
+				registAmount: null,
 			}
 		},
 		onLoad(param) {
 			this.projectId = param.projectId;
 		},
-		components:{
+		onShow() {
+			this.signJsapiTicket();
+		},
+		components: {
 			backHome
 		},
 		mounted() {
 			this.color1 = app.globalData.color1;
-			this.color2 = app.globalData.color2;
-			this.color3 = app.globalData.color3;
+			this.color2 = app.globalData.color2;
+			this.color3 = app.globalData.color3;
 			this.color6 = app.globalData.color6;
 			this.detailDatahandle()
-			uni.$on("request",()=>{
+			uni.$on("request", () => {
 				this.detailDatahandle()
 			})
 		},
 		methods: {
+			async signJsapiTicket(){
+				let parmas = {
+					url:location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+getApp().globalData.shareToken,
+				}
+				let self = this;
+				let res = await this.$myRequest({
+					url: '/wechat/signJsapiTicket',
+					data: parmas,
+					method:"GET",
+				});
+				if(res.data.success){
+				   let single =	res.data.single;
+				   wx.config({
+				   	debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+				   	appId: config.appid, // 必填,公众号的唯一标识
+				   	timestamp: single.timestamp, // 必填,生成签名的时间戳
+				   	nonceStr: single.nonceStr, // 必填,生成签名的随机串
+				   	signature: single.signature, // 必填,签名
+				       jsApiList: ["updateAppMessageShareData","updateTimelineShareData"] // 必填,需要使用的JS接口列表
+				   });
+				   wx.showMenuItems({
+				     menuList: [ "menuItem:share:appMessage","menuItem:share:timeline"] // 要显示的菜单项,所有menu项见附录3
+				   });
+				   wx.ready(function() {
+				   	// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
+				   	wx.updateAppMessageShareData({ //分享给朋友
+				   		title: '项目详情', // 分享标题
+				   		desc: self.dataInfo.shareRemark, // 分享描述
+				   		link: location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+				   		imgUrl: self.dataInfo.shareImg, // 分享图标
+				   		success: function() {
+				   			// 设置成功
+				   		}
+				   	});
+				   	wx.updateTimelineShareData({ //分享到朋友圈
+				   		title: '项目详情', // 分享标题
+				   		link: location.origin+location.pathname + "?projectId="+this.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+				   		imgUrl: self.dataInfo.shareImg, // 分享图标
+				   		success: function() {
+				   			// 设置成功
+				   		}
+				   	})
+				   });
+				   wx.error(function(res) {
+				   	// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
+				   });
+				}
+			},
 			async detailDatahandle() {
-				if(getApp().globalData.userId){
+				if (getApp().globalData.userId) {
 					var parmas = {
 						projectId: this.projectId,
-						userId:getApp().globalData.userId
+						userId: getApp().globalData.userId
 					}
 					this.createUserProjectRlat();
 					this.getRegistTask();
@@ -160,105 +214,108 @@
 					}
 				}
 			},
-			
-			async getRegistTask(){
-				if(app.globalData.userId){
+
+			async getRegistTask() {
+				if (app.globalData.userId) {
 					let res = await this.$myRequest({
 						url: "/task/registTask",
-						method:"GET",
+						method: "GET",
 						data: {
-							userId:getApp().globalData.userId
+							userId: getApp().globalData.userId
 						}
 					})
-					if(res.data.success){
-						this.registAmount = res.data.single.amount||null
-					}else{
+					if (res.data.success) {
+						this.registAmount = res.data.single.amount || null
+					} else {
 						this.registAmount = null;
 					}
 				}
 			},
-			
+
 			async createUserProjectRlat() {
-				if(getApp().globalData.userId){
+				if (getApp().globalData.userId) {
 					var parmas = {
 						projectId: this.projectId,
-						shareToken:getApp().globalData.shareToken
+						shareToken: getApp().globalData.shareToken
 					}
 					let res = await this.$myRequest({
 						url: '/user/createUserProjectRlat',
 						data: parmas
 					})
 					if (res && res.data.success) {
-						
+
 					}
 				}
-			},
-			
-			reloadCategoryList() {
-				var tempList = JSON.parse(JSON.stringify(this.dataInfo.categoryList || []))
-				tempList.forEach((item, idx) => {
-					item.value = '¥' + (parseFloat(item.amount || 0.00).toFixed(2)) + '/个'
-				})
-				this.categoryList = tempList
-				this.categoryList.push({categoryName: '可获收益', value: this.dataInfo.availableIncome + '元'})
-			},
-			
-			reloadInfos() {
-				this.infos[0].value = this.timeFilterAction(this.dataInfo.openTime)
-				this.infos[1].value = this.dataInfo.bizFormat
-				if (this.dataInfo.maxPrice > 0) {
-					this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '~' + this.priceReload(this.dataInfo.maxPrice) + '/m²'
-				}
-				else {
-					this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '/m²'
-				}
-				if (this.dataInfo.maxTotalPrice > 0) {
-					this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '~' + this.priceReload(this.dataInfo.maxTotalPrice) + '/套'
-				}
-				else {
-					this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '/套'
-				}
-				this.infos[4].value = this.dataInfo.mainHouseType
-				// this.infos[5].value = this.dataInfo.cusGroup
-				
-				this.infos.forEach((item, idx) => {
-					if (!item.value) {
-						item.value = '暂无'
-					}
-				})
-			},
-			timeFilterAction(val) {
-				if (val) {
-					return displayDateFormatChi(val * 1000)
-				}
-				else {
-					return ''
-				}
-			},
-			priceReload(val) {
-				return parseFloat(val / 10000).toFixed(2) + '万'
-			},
-			
-			toShareCard(type){
-				if(getApp().globalData.userId){
-					let href = location.origin+location.pathname;
+			},
+
+			reloadCategoryList() {
+				var tempList = JSON.parse(JSON.stringify(this.dataInfo.categoryList || []))
+				tempList.forEach((item, idx) => {
+					item.value = '¥' + (parseFloat(item.amount || 0.00).toFixed(2)) + '/个'
+				})
+				this.categoryList = tempList
+				this.categoryList.push({
+					categoryName: '可获收益',
+					value: this.dataInfo.availableIncome + '元'
+				})
+			},
+
+			reloadInfos() {
+				this.infos[0].value = this.timeFilterAction(this.dataInfo.openTime)
+				this.infos[1].value = this.dataInfo.bizFormat
+				if (this.dataInfo.maxPrice > 0) {
+					this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '~' + this.priceReload(this.dataInfo
+						.maxPrice) + '/m²'
+				} else {
+					this.infos[2].value = this.priceReload(this.dataInfo.minPrice) + '/m²'
+				}
+				if (this.dataInfo.maxTotalPrice > 0) {
+					this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '~' + this.priceReload(this
+						.dataInfo.maxTotalPrice) + '/套'
+				} else {
+					this.infos[3].value = this.priceReload(this.dataInfo.minTotalPrice) + '/套'
+				}
+				this.infos[4].value = this.dataInfo.mainHouseType
+				// this.infos[5].value = this.dataInfo.cusGroup
+
+				this.infos.forEach((item, idx) => {
+					if (!item.value) {
+						item.value = '暂无'
+					}
+				})
+			},
+			timeFilterAction(val) {
+				if (val) {
+					return displayDateFormatChi(val * 1000)
+				} else {
+					return ''
+				}
+			},
+			priceReload(val) {
+				return parseFloat(val / 10000).toFixed(2) + '万'
+			},
+
+			toShareCard(type) {
+				if (getApp().globalData.userId) {
+					let href = location.origin + location.pathname;
 					uni.navigateTo({
-						url:'../shareCardPage/shareCardPage?page='+href+"&projectId="+this.projectId+"&type="+type
+						url: '../shareCardPage/shareCardPage?page=' + href + "&projectId=" + this.projectId +
+							"&type=" + type
 					})
-				}else{
+				} else {
 					uni.$emit('unLogin')
 				}
 			},
-			
-			backAction() {
+
+			backAction() {
 				uni.navigateBack({
-					delta:1
-				})
-			}
-			
+					delta: 1
+				})
+			}
+
 		},
 		watch: {
-			
+
 		},
 		onPullDownRefresh() {
 			this.detailDatahandle();
@@ -275,18 +332,18 @@
 
 	.content {
 		width: 100%;
-		height: 100%;
+		height: 100%;
 		overflow-y: scroll;
-		position: relative;
-		padding-bottom: 60rpx;
+		position: relative;
+		padding-bottom: 60rpx;
 		box-sizing: border-box;
 
 		.topImg {
 			width: 100%;
-			height: 480rpx;
-			background-color: rgba($color: #000000, $alpha: 0.5);
-			// 滤镜效果
-			// -webkit-filter: grayscale(30%); /* Chrome, Safari, Opera */
+			height: 480rpx;
+			background-color: rgba($color: #000000, $alpha: 0.5);
+			// 滤镜效果
+			// -webkit-filter: grayscale(30%); /* Chrome, Safari, Opera */
 			// filter: grayscale(30%);
 		}
 
@@ -308,8 +365,8 @@
 					font-family: Verdana, Verdana-Bold;
 					font-weight: 700;
 					text-align: left;
-					color: #262626;
-					white-space: pre-wrap;
+					color: #262626;
+					white-space: pre-wrap;
 					max-width: 50%;
 				}
 
@@ -317,7 +374,7 @@
 					margin-left: 8rpx;
 					display: flex;
 					justify-content: flex-start;
-					align-items: center;
+					align-items: center;
 					flex-wrap: wrap;
 					flex-grow: 1;
 
@@ -389,13 +446,14 @@
 			display: flex;
 			align-items: center;
 			padding: 40rpx 36rpx;
-			box-sizing: border-box;
+			box-sizing: border-box;
 			flex-wrap: wrap;
 
-			.item {
-				width: calc((100% - 12rpx) / 3);
-				min-width: calc((100% - 12rpx) / 3);
+			.item {
+				width: calc((100% - 12rpx) / 3);
+				min-width: calc((100% - 12rpx) / 3);
 				max-width: calc((100% - 12rpx) / 3);
+
 				.name {
 					font-size: 24rpx;
 					font-family: Verdana, Verdana-Regular;
@@ -408,7 +466,7 @@
 					font-size: 32rpx;
 					font-family: DIN Alternate, DIN Alternate-Bold;
 					font-weight: 700;
-					text-align: left;
+					text-align: left;
 					white-space: nowrap;
 					color: #fd8f3c;
 				}