diff --git a/src/pages/Home/components/LoginForm.vue b/src/pages/Home/components/LoginForm.vue index b574c98..e7cbccf 100644 --- a/src/pages/Home/components/LoginForm.vue +++ b/src/pages/Home/components/LoginForm.vue @@ -77,9 +77,13 @@ @@ -216,6 +220,8 @@ const handleGetCode = async () => { } } const router = useRouter() +const isLoggingIn = ref(false) + const handleLogin = () => { if (!code.value) { toast('请输入验证码') @@ -224,6 +230,8 @@ const handleLogin = () => { if (!validateEmail(email.value)) { return toast.error('邮箱格式无效,请检查') } + + isLoggingIn.value = true request .post('/api/v1/auth/login/email', { email: email.value, @@ -234,6 +242,12 @@ const handleLogin = () => { localStorage.setItem('UserEmail', email.value) router.push({ path: '/user-center' }) }) + .catch((error) => { + console.error('登录失败', error) + }) + .finally(() => { + isLoggingIn.value = false + }) }