From 29e8fb9cb7d5adeeb71d7b0f83c55fe44f304dcc Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Thu, 20 Feb 2025 20:40:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor(auth):=20=E4=BC=98=E5=8C=96=E5=AE=9E?= =?UTF-8?q?=E5=90=8D=E8=AE=A4=E8=AF=81=E9=80=BB=E8=BE=91=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 detail.vue 中增加性别显示逻辑,将 sex 字段转换为对应的性别文字 - 在 auth store 中添加 selectedZone 属性,用于保存选择的区号 - 修改 login 页面,将 selectedZone 存入 store 并在组件挂载时初始化 - 更新 profile 页面,增加拍卖作品状态显示 - 优化 realAuth 页面,根据选择的区号决定是否进行法大大验证 --- app/pages/login/index.vue | 9 +++++---- app/pages/profile/index.vue | 11 +++++++++-- app/pages/realAuth/components/detail.vue | 4 ++-- app/pages/realAuth/index.vue | 15 ++++++++++----- app/stores/auth/index.js | 2 ++ 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/app/pages/login/index.vue b/app/pages/login/index.vue index a2c4c43..7b17d78 100644 --- a/app/pages/login/index.vue +++ b/app/pages/login/index.vue @@ -6,7 +6,7 @@ import {senCode, userLogin} from "@/api/auth/index.js"; import {authStore} from "@/stores/auth/index.js"; import {message} from '@/components/x-message/useMessage.js' import {fddCheck} from "~/api/goods/index.js"; -const {userInfo,token}= authStore() +const {userInfo,token,selectedZone}= authStore() const router = useRouter(); const route = useRoute(); const { locale } = useI18n() @@ -71,10 +71,11 @@ const getDefaultCountry = () => { const defaultCountry = getDefaultCountry() -// 获取选择的国家信息 -const selectedZone = ref(route.query.zone || defaultCountry.zone) -const selectedCountry = ref(route.query.countryName || defaultCountry.name) +const selectedCountry = ref(route.query.countryName || defaultCountry.name) +onMounted(()=>{ + selectedZone.value=route.query.zone || defaultCountry.zone +}) // 监听语言变化,更新默认国家 watch(locale, () => { if (!route.query.zone) { diff --git a/app/pages/profile/index.vue b/app/pages/profile/index.vue index f9e4c57..2f17a85 100644 --- a/app/pages/profile/index.vue +++ b/app/pages/profile/index.vue @@ -116,9 +116,16 @@ fetchData() :preview="false" />
-
- {{ item?.auctionArtworkInfo?.artworkTitle }} +
+
+ {{ item?.auctionArtworkInfo?.artworkTitle }} +
+
+ {{statusLabel[item.status]}} +
+ +
diff --git a/app/pages/realAuth/components/detail.vue b/app/pages/realAuth/components/detail.vue index 336a218..39d4a26 100644 --- a/app/pages/realAuth/components/detail.vue +++ b/app/pages/realAuth/components/detail.vue @@ -20,7 +20,7 @@ const {userInfo}= authStore()
{{$t('realAuth.gender')}}:
-
{{userInfo.sex}}
+
{{userInfo.sex===1?'男':'女'}}
{{$t('realAuth.birthday')}}:
@@ -38,7 +38,7 @@ const {userInfo}= authStore()
{{$t('realAuth.gender')}}:
-
{{userInfo.sex}}
+
{{userInfo.sex===1?'男':'女'}}
{{$t('realAuth.birthday')}}:
diff --git a/app/pages/realAuth/index.vue b/app/pages/realAuth/index.vue index 03e96bf..a304d51 100644 --- a/app/pages/realAuth/index.vue +++ b/app/pages/realAuth/index.vue @@ -14,7 +14,7 @@ definePageMeta({ const router = useRouter(); const route = useRoute(); const { locale } = useI18n() -const {userInfo}= authStore() +const {userInfo,selectedZone}= authStore() const active=ref(locale.value==='zh-CN'?0:1) const { t } = useI18n() const form=ref({ @@ -58,11 +58,16 @@ const confirm=async ()=>{ if (res.status===0){ userInfo.value=res.data message.success(t('realAuth.success_mess')) - const res1=await fddCheck() - if (res1.status===0){ - if (res1.data.isNeedJump){ - window.location.href=res1.data.h5Url + //实名认证,选择的是大陆,并且手机区号选择的也是大陆就走法大大验证 + if (active.value===0){ + const res1=await fddCheck() + if (res1.status===0){ + if (res1.data.isNeedJump){ + window.location.href=res1.data.h5Url + } } + }else { + statusCode.value=1 } } }else { diff --git a/app/stores/auth/index.js b/app/stores/auth/index.js index cbaa972..e6a7cee 100644 --- a/app/stores/auth/index.js +++ b/app/stores/auth/index.js @@ -5,6 +5,7 @@ export const authStore = createGlobalState(() => { const userInfo=useLocalStorage('userInfo',{}) const fingerprint=useLocalStorage('fingerprint','') const checkoutSessionUrl=useLocalStorage('checkoutSessionUrl','') + const selectedZone=useLocalStorage('selectedZone','') const payment=useLocalStorage('payment',{ leftPrice:'', leftCurrency:'', @@ -13,6 +14,7 @@ export const authStore = createGlobalState(() => { }) return{ + selectedZone, payment, checkoutSessionUrl, userInfo,