From 9f092fdb4b039e47126205f6127300f2729d661f Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 21 十月 2022 14:37:41 +0800
Subject: [PATCH] lonin

---
 src/views/login/index.vue |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 6316327..bd98772 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -34,6 +34,12 @@
     const asyncValidator = (val:any) =>{
         return val===ruleForm2.value.pass
     }
+    const getUserinfo=()=>{
+        ajaxPost('/patient/info/getPatientInfo','').then((re:any)=>{
+            console.log(re)
+            router.push('/')
+        })
+    }
     const onSubmit = (values:any) => {
         console.log('submit', values)
         loadingBUt.value=true
@@ -45,7 +51,7 @@
                 console.log('得到tokeng')
                 Session.set('token', re)
                 Toast('登录成功。。。。。')
-                router.push('/')
+                getUserinfo()
             }
         }).finally(()=>{
             loadingBUt.value=false
@@ -75,7 +81,7 @@
             } else {
                 Session.set('token', re)
                 Toast('登录成功。。。。。')
-                router.push('/')
+                getUserinfo()
             }
         })
     }
@@ -123,7 +129,7 @@
             if (code){ // 得到code换取openid
                 ajaxGet('wechat/code',{code}).then((re:any)=>{
                     console.log(re,'获取openid')
-                    userInfo.setUserInfo({openid:re.openid,nickname:re.nickname,headimgurl:re.headimgurl})
+                    userInfo.setInfo({openid:re.openid,nickname:re.nickname,headimgurl:re.headimgurl})
                     const openId = re.openid
                     if (openId) { // 检查登录
                         ajaxPost('patient/info/wechatLogin','openId='+openId,config).then((re:any)=>{
@@ -134,7 +140,7 @@
                                 console.log()
                                 Session.set('token', re)
                                 Toast('登录成功。。。。。')
-                                router.push('/')
+                                getUserinfo()
                             }
                         })
                     }

--
Gitblit v1.8.0