Sfoglia il codice sorgente

登录按钮加载状态修改

duy 1 anno fa
parent
commit
baa76871c4
2 ha cambiato i file con 11 aggiunte e 1 eliminazioni
  1. 4 0
      src/store/modules/user.js
  2. 7 1
      src/views/login/index.vue

+ 4 - 0
src/store/modules/user.js

@@ -24,8 +24,12 @@ export const useAppLogin = async (form) => {
     if (!error && status === 200) {
         const info = await setUserAppInfo(res)
         return { error: info.error, msg: info.msg }
+    } else if (status === 401) {
+        const info = await setUserAppInfo(res)
+        return { error: info.error, msg: info.msg, status:status }
     } else {
         return Promise.reject({ error, status, res })
+    
     }
 }
 

+ 7 - 1
src/views/login/index.vue

@@ -150,7 +150,11 @@ const formValidateClick = async () => {
     if (!formRes) return false
     //登录请求
     loading.value = true
-    const { error, msg } = await useAppLogin(formValue.value)
+    const { error, msg, status } = await useAppLogin(formValue.value)
+    if (status === 401) {
+        loading.value = false
+    }
+
     //登录失败
     if (error) {
         loading.value = false
@@ -168,6 +172,8 @@ const formValidateClick = async () => {
             router.push({ path: '/home/index/static' })
         }
     }, 1500)
+
+    loading.value = false
 }
 
 //游客登录