Explorar o código

fix:微信扫码登入

Tang %!s(int64=3) %!d(string=hai) anos
pai
achega
08246cebea
Modificáronse 2 ficheiros con 15 adicións e 16 borrados
  1. 2 2
      src/axios.js
  2. 13 14
      src/components/wxLogin/index.vue

+ 2 - 2
src/axios.js

@@ -2,8 +2,8 @@ import axios from 'axios'
 import store from './store'
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
-// export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-export const BASE_URL = 'http://192.168.1.222:5055'    //dev
+export const BASE_URL = 'https://test.xyyxt.net'   //预发布
+// export const BASE_URL = 'http://192.168.1.222:5055'    //dev
 export const tenantId = '867735392558919680'
 
 

+ 13 - 14
src/components/wxLogin/index.vue

@@ -11,7 +11,7 @@
     >
       <div class="dis_flex">
         <img :src="imgUrl ? imgUrl : require('@/assets/qrcode.png')" alt="" />
-        <p v-if="scanningStatus" style="color:red">小程序已扫码</p>
+        <p v-if="scanningStatus" style="color: red">小程序已扫码</p>
         <p class="headerTitle">使用微信扫一扫快捷登录</p>
         <p class="clickFuncStyle">
           扫描即表示同意<br /><span @click="innerVisibleOpenFunc(1)"
@@ -560,20 +560,19 @@ export default {
           scanCode: this.scanCode,
         })
         .then((res) => {
-          if (res.code === 200) {
-            this.backData(res);
+          this.backData(res);
+          this.scanningStatus = false;
+        })
+        .catch((err) => {
+          if (err.msg === "小程序已扫码" && this.interValTime !== null) {
+            clearInterval(this.interValTime);
+            this.interValTime = null;
+            this.scanningStatus = true;
+          } else if (err.msg === "暂未登录" && !this.interValTime) {
+            this.interValTime = setInterval(() => {
+              this.updateQRcode();
+            }, 60000);
             this.scanningStatus = false;
-          } else {
-            if (res.msg === "小程序已扫码" && this.interValTime !== null) {
-              clearInterval(this.interValTime);
-              this.interValTime = null;
-              this.scanningStatus = true;
-            } else if (res.msg === "暂未登录" && !this.interValTime) {
-              this.interValTime = setInterval(() => {
-                this.updateQRcode();
-              }, 60000);
-              this.scanningStatus = false;
-            }
           }
         });
     },