ソースを参照

Merge branch 'dev' into feat_theme_zyh

zhouyuhao 11 ヶ月 前
コミット
7b9bda25e2
1 ファイル変更20 行追加7 行削除
  1. 20 7
      src/views/Login/src/loginView.vue

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

@@ -53,6 +53,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'
+            })
+          }
+        }
       })
   }
 }
@@ -88,6 +98,8 @@ const saveCredentials = () => {
 // 验证当前用户是否存在
 const handleCheckUser = () => {
   if (!loginForm.value.username) {
+    loginError.value.username = true
+    isUserNameExit.value = false
     return
   }
   // 这里是验证用户是否存在的逻辑
@@ -221,13 +233,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',
@@ -259,6 +265,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)
     })