From 2526592bcec6d5c31056c260fb96f60a9b3ae2fa Mon Sep 17 00:00:00 2001
From: zhaoxiaoqiang <287285524@qq.com>
Date: Fri, 05 Aug 2022 09:58:34 +0800
Subject: [PATCH] node

---
 src/views/user/login.vue |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/views/user/login.vue b/src/views/user/login.vue
index 360c46c..e8a71df 100644
--- a/src/views/user/login.vue
+++ b/src/views/user/login.vue
@@ -2,7 +2,7 @@
  * @Author: 小明丶
  * @Date: 2019-08-15 10:20:56
  * @LastEditors: zxq
- * @LastEditTime: 2022-08-04 10:42:08
+ * @LastEditTime: 2022-08-05 09:42:48
  * @Description: 登录页面
  -->
 <template>
@@ -48,6 +48,9 @@
     <div class="btn-box">
       <button @click="loginBut">登录</button>
     </div>
+    <!-- <div class="idcard-box">
+      <upLoadIdCard :cardBack="idCardMation.idBackUrl" :cardFont="idCardMation.idFrontUrl"></upLoadIdCard>
+    </div> -->
   </div>
 </template>
 
@@ -105,9 +108,30 @@
     if(sessionStorage.verCode){
       this.verCode = sessionStorage.verCode
     }
+   
+    this.code = this.getUrlCode("code");
+    console.log('this.code:',this.code)
+    console.log('this.$route.query.whichPage:',this.$route.query.whichPage)
+    if (this.code && !this.$route.query.whichPage) {
+      this.$api.wechatUserInfo({ code: this.code}).then(res => {
+          console.log('res.body.openid:',res.body.openid)
+          localStorage.axx_ins_client_openId = res.body.openid;
+          localStorage.edu_ins_client_userMation = JSON.stringify(res.body);
+      });
+    }
   },
   methods: {
-    ...mapActions(["login", "getVercode"]),
+    ...mapActions(["login", "getVercode", "openIdLogin"]),
+    //截取code值
+    getUrlCode(name) {
+      return (
+        decodeURIComponent(
+          (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
+            location.href
+          ) || [, ""])[1].replace(/\+/g, "%20")
+        ) || null
+      );
+    },
     //登录验证
     loginBut() {
       let v = this.$tool;
@@ -131,7 +155,7 @@
         vm: this,
         mblNo: this.mblNo,
         verCode: this.verCode,
-        // openId: localStorage.axx_ins_client_openId
+        openId: localStorage.axx_ins_client_openId
       });
     },
     sendCode() {
@@ -151,6 +175,12 @@
         sessionStorage.beforeDate = new Date().getTime()
         this.getSecond(60);
       })
+      // this.$store.dispatch("getVercode", {
+      //   vm: this,
+      //   mblNo: this.mblNo,
+      //   verCodeType: 1
+      // });
+     
     },
     //发送验证码计时函数
     getSecond(wait) {
@@ -199,6 +229,7 @@
   
   beforeRouteLeave (to, from, next) {
     // ...
+    
     clearTimeout(this.timer)
     next()
   }

--
Gitblit v1.8.0