Răsfoiți Sursa

Merge branch 'dev' into feat_map

zhouyuhao 11 luni în urmă
părinte
comite
f5468c93d8
1 a modificat fișierele cu 20 adăugiri și 7 ștergeri
  1. 20 7
      src/views/Login/src/loginView.vue

+ 20 - 7
src/views/Login/src/loginView.vue

@@ -32,6 +32,16 @@ const handleTokenRedirect = () => {
       })
       .then((res: any) => {
         handleResult(res)
+        if (res.code === 400) {
+          const { data } = res
+          if (data.msg === 'Invalid token') {
+            ElMessageBox.alert('Invalid token', 'Prompt', {
+              confirmButtonText: 'OK',
+              type: 'warning',
+              confirmButtonClass: 'el-button--dark'
+            })
+          }
+        }
       })
   }
 }
@@ -67,6 +77,8 @@ const saveCredentials = () => {
 // 验证当前用户是否存在
 const handleCheckUser = () => {
   if (!loginForm.value.username) {
+    loginError.value.username = true
+    isUserNameExit.value = false
     return
   }
   // 这里是验证用户是否存在的逻辑
@@ -200,13 +212,7 @@ const handleResult = (res: any) => {
     router.push('/')
   } else if (res.code === 400) {
     const { data } = res
-    if (data.msg === 'Invalid token') {
-      ElMessageBox.alert('Invalid token', 'Prompt', {
-        confirmButtonText: 'OK',
-        type: 'warning',
-        confirmButtonClass: 'el-button--dark'
-      })
-    } else if (data.msg === 'passwordExpires') {
+    if (data.msg === 'passwordExpires') {
       ElMessageBox.alert('Please change your password for security.', 'Prompt', {
         confirmButtonText: 'Change Password',
         type: 'warning',
@@ -238,6 +244,13 @@ const handleLoginAfterVerify = () => {
         } else {
           clearCredentials()
         }
+      } else if (res.code === 400) {
+        const { data } = res
+        if (data.msg === 'password_error') {
+          loginError.value.password = true
+        } else if (data.msg === 'error_times') {
+          errorTipsRef.value.openDialog()
+        }
       }
       handleResult(res)
     })