sunchengjie 8 months ago
parent
commit
2f7c67eb90
1 changed files with 30 additions and 0 deletions
  1. 30 0
      src/pages/express.vue

+ 30 - 0
src/pages/express.vue

@@ -225,6 +225,7 @@
 </template>
 
 <script>
+import wx from "weixin-jsapi";
 import areaList from "@/script/areas.js"
 import { Toast } from 'vant';
 import { saveMailDo, getSendInfo, geLogisticsList, getListOfPrinters, } from '../api/index'
@@ -301,6 +302,35 @@ export default {
 		}
 	},
 	created: function () {
+        if (this.$route.path !== "/Login") {
+            const res = await checkIsLogin();
+            if (res.msg !== "success") {
+                this.$router.push({ path: '/Login' })
+            }
+        }
+        window.localStorage.setItem('scanUrl', location.href.split('#')[0])
+        const res = await getWxConfig({
+            url: window.location.href
+        })
+        //发送成功
+        var timestamp = res.wxConfig.timestamp;
+        var noncestr = res.wxConfig.nonceStr;
+        var signature = res.wxConfig.signature;
+        var appId = res.wxConfig.appId;
+        var url = window.location.href
+        wx.config({
+            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+            // debug : true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+            appId: appId, // 必填,公众号的唯一标识
+            timestamp: timestamp, // 必填,生成签名的时间戳
+            nonceStr: noncestr, // 必填,生成签名的随机串
+            signature: signature, // 必填,签名,见附录1
+            url,
+            jsApiList: [
+                "scanQRCode",
+            ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
+        });
+
 		this.accountType = localStorage.getItem("accountType")
 		this.geLogisticsListAPIList()
 	},