From efc47a27fddabfa7b8dbee06a88f93aa19cf494d Mon Sep 17 00:00:00 2001
From: xingyy <64720302+Concur-max@users.noreply.github.com>
Date: Mon, 20 Jan 2025 13:59:50 +0800
Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E4=BC=98=E5=8C=96=E7=99=BB?=
=?UTF-8?q?=E5=BD=95=E5=8A=9F=E8=83=BD=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=96=B0?=
=?UTF-8?q?=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 Column 组件中使用可选链操作符,提高代码健壮性- 添加 ItemList 组件,但未提供具体实现
- 在 login 组件中:
- 引入消息提示功能
-优化登录流程,添加 loading 状态
- 修复登录后的页面跳转
- 为登录按钮添加 loading 状态和文本
---
app/pages/home/components/Column/index.vue | 2 +-
app/pages/home/components/ItemList/index.vue | 11 +++++++++++
app/pages/login/index.vue | 13 +++++++++----
3 files changed, 21 insertions(+), 5 deletions(-)
create mode 100644 app/pages/home/components/ItemList/index.vue
diff --git a/app/pages/home/components/Column/index.vue b/app/pages/home/components/Column/index.vue
index bc09d13..b5d8706 100644
--- a/app/pages/home/components/Column/index.vue
+++ b/app/pages/home/components/Column/index.vue
@@ -8,7 +8,7 @@
>
diff --git a/app/pages/home/components/ItemList/index.vue b/app/pages/home/components/ItemList/index.vue
new file mode 100644
index 0000000..96c0baf
--- /dev/null
+++ b/app/pages/home/components/ItemList/index.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/pages/login/index.vue b/app/pages/login/index.vue
index 83aac0e..1c0aff3 100644
--- a/app/pages/login/index.vue
+++ b/app/pages/login/index.vue
@@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'
import countryCode from '../countryRegion/data/index.js'
import {senCode, userLogin} from "@/api/auth/index.js";
import {authStore} from "~/stores/auth/index.js";
+import {message} from '@/components/x-message/useMessage.js'
const {userInfo,token}= authStore()
const router = useRouter();
const route = useRoute();
@@ -13,7 +14,8 @@ definePageMeta({
i18n: 'login.title',
})
const loadingRef=ref({
- loading1:false
+ loading1:false,
+ loading2:false,
})
const isExist=ref(false)//帐号是否存在 true存在
const isReal=ref(false) //isReal 是否实名过
@@ -108,6 +110,7 @@ const goBack = () => {
vanSwipeRef.value?.swipeTo(pane.value)
}
const goLogin =async () => {
+ loadingRef.value.loading2=true
const res=await userLogin({
telNum:phoneNum.value,
zone:selectedZone.value,
@@ -116,12 +119,14 @@ const goLogin =async () => {
if (res.status===0){
userInfo.value=res.data.accountInfo
token.value=res.data.token
+
if (!res.data.isReal){
- router.push('/realAuth');
+ await router.push('/realAuth');
}else {
- router.push('/');
+ await router.push('/');
}
}
+ loadingRef.value.loading2=false
}
@@ -170,7 +175,7 @@ const goLogin =async () => {
{{ $t('login.reSend') }}({{countdown}})
- {{
+ {{
$t('login.login')
}}
{{ $t('login.login') }}