refactor(auth): 优化实名认证逻辑和用户信息展示
- 在 detail.vue 中增加性别显示逻辑,将 sex 字段转换为对应的性别文字 - 在 auth store 中添加 selectedZone 属性,用于保存选择的区号 - 修改 login 页面,将 selectedZone 存入 store 并在组件挂载时初始化 - 更新 profile 页面,增加拍卖作品状态显示 - 优化 realAuth 页面,根据选择的区号决定是否进行法大大验证
This commit is contained in:
parent
977844dbc8
commit
29e8fb9cb7
@ -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) {
|
||||
|
@ -116,9 +116,16 @@ fetchData()
|
||||
:preview="false"
|
||||
/>
|
||||
<div class="flex flex-col justify-between grow-1">
|
||||
<div class="flex justify-between">
|
||||
<div class="text-#000 text-16px ellipsis line-height-21px">
|
||||
{{ item?.auctionArtworkInfo?.artworkTitle }}
|
||||
</div>
|
||||
<div class="text-14px text-right text-#3C55B2 ">
|
||||
{{statusLabel[item.status]}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<div class="text-#575757 text-14px line-height-none mb-5px">
|
||||
|
@ -20,7 +20,7 @@ const {userInfo}= authStore()
|
||||
</div>
|
||||
<div class="flex mb-20px">
|
||||
<div class="mr-10px">{{$t('realAuth.gender')}}:</div>
|
||||
<div>{{userInfo.sex}}</div>
|
||||
<div>{{userInfo.sex===1?'男':'女'}}</div>
|
||||
</div>
|
||||
<div class="flex mb-20px">
|
||||
<div class="mr-10px">{{$t('realAuth.birthday')}}:</div>
|
||||
@ -38,7 +38,7 @@ const {userInfo}= authStore()
|
||||
</div>
|
||||
<div class="flex mb-20px">
|
||||
<div class="mr-10px">{{$t('realAuth.gender')}}:</div>
|
||||
<div>{{userInfo.sex}}</div>
|
||||
<div>{{userInfo.sex===1?'男':'女'}}</div>
|
||||
</div>
|
||||
<div class="flex mb-20px">
|
||||
<div class="mr-10px">{{$t('realAuth.birthday')}}:</div>
|
||||
|
@ -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,12 +58,17 @@ const confirm=async ()=>{
|
||||
if (res.status===0){
|
||||
userInfo.value=res.data
|
||||
message.success(t('realAuth.success_mess'))
|
||||
//实名认证,选择的是大陆,并且手机区号选择的也是大陆就走法大大验证
|
||||
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 {
|
||||
message.error(t('realAuth.cnTabDesc'))
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user