فهرست منبع

fix:修复管理员通过邮件登录,第一次登录无效

liyangbin 2 سال پیش
والد
کامیت
718a12dc36
1فایلهای تغییر یافته به همراه27 افزوده شده و 25 حذف شده
  1. 27 25
      src/views/Login.vue

+ 27 - 25
src/views/Login.vue

@@ -82,32 +82,12 @@ export default {
                       post(
                         '/pdf-tech/vppTeam/enterTeam',
                         urlencoded
-                      ).then((res) => {})
+                      ).then((res) => {
+                        this.getMemberInfo()
+                      })
+                    } else {
+                      this.getMemberInfo()
                     }
-                    get(
-                      '/pdf-tech/vppMember/getMemberInfo'
-                    ).then((res) => {
-                      if (res.data.code === 200 && res.data.msg == 'success') {
-                        userStore().setUserInfo(res.data.result)
-                        get(
-                          '/pdf-tech/vppLicenseCode/checkCompanyLicense?companyId='+res.data.result.companyId
-                        ).then((res)=>{
-                          if(!res.data.result){
-                            this.$router.push('/noadmin')
-                            return
-                          }
-                        })
-                      }
-                      if (
-                        // parseInt(res.data.result.role) === 1 ||
-                        // parseInt(res.data.result.role) === 2
-                        res.data.result.role?.indexOf("2") !== -1 || res.data.result.role?.indexOf("1") !== -1
-                      ) {
-                        this.$router.push('/dashboard')
-                      } else {
-                        this.$router.push('/noadmin')
-                      }
-                    })
                   })
                 })
                 localStorage.setItem('username', this.ruleForm.email)
@@ -166,6 +146,28 @@ export default {
       if (this.ruleForm.password.trim() !== '') {
         this.passwordError = false
       }
+    },
+    getMemberInfo () {
+      get('/pdf-tech/vppMember/getMemberInfo').then((res) => {
+        if (res.data.code === 200 && res.data.msg == 'success') {
+          userStore().setUserInfo(res.data.result)
+          get(
+            '/pdf-tech/vppLicenseCode/checkCompanyLicense?companyId='+res.data.result.companyId
+          ).then((res)=>{
+            if(!res.data.result){
+              this.$router.push('/noadmin')
+              return
+            }
+          })
+        }
+        if (
+          res.data.result.role?.indexOf("2") !== -1 || res.data.result.role?.indexOf("1") !== -1
+        ) {
+          this.$router.push('/dashboard')
+        } else {
+          this.$router.push('/noadmin')
+        }
+      })
     }
   }
 }