feat(auth): 实现登录和实名认证的跳转逻辑

- 在登录页面添加对 fddCheck 的调用,处理特定的跳转逻辑
- 在实名认证页面添加路由查询参数处理,优化页面加载
- 优化直播室页面的代码结构,提高可读性
This commit is contained in:
xingyy 2025-02-17 13:33:31 +08:00
parent 71e7f4223a
commit 2f2f2e1294
3 changed files with 26 additions and 14 deletions

View File

@ -9,11 +9,12 @@ import paymentResults from '@/pages/liveRoom/components/PaymentResults/index.vue
import paymentInput from '@/pages/liveRoom/components/PaymentInput/index.vue'
import {goodStore} from "@/stores/goods/index.js"
import {message} from "~/components/x-message/useMessage.js"
import { showConfirmDialog } from 'vant';
import {showConfirmDialog} from 'vant';
import {artworkBuy} from "@/api/goods/index.js"
import {useI18n} from 'vue-i18n'
const player = ref(null)
const {quoteStatus, show, playerId, show1, auctionData, getSocketData, getLiveLink,fullLive} = liveStore()
const {quoteStatus, show, playerId, show1, auctionData, getSocketData, getLiveLink, fullLive} = liveStore()
const pullLink = ref('')
@ -51,12 +52,12 @@ const initializePlayer = async () => {
} catch (error) {
showConfirmDialog({
message: useI18n().t('live_room.error_mess'),
showCancelButton:true
showCancelButton: true
}).then(() => {
location.reload()
// on close
}) .catch(() => {
}).catch(() => {
// on cancel
})
console.error('播放器初始化失败:', error)
@ -72,7 +73,7 @@ onBeforeUnmount(() => {
player.value?.dispose()
player.value = null
})
watch(()=>fullLive.value, (newVal) => {
watch(() => fullLive.value, (newVal) => {
if (newVal) {
getSocketData()
}
@ -91,7 +92,7 @@ const goBuy = async () => {
const tipOpen = () => {
message.warning(useI18n().t('live_room.warn_mess'))
}
const updateShow=()=>{
const updateShow = () => {
}
</script>
@ -118,7 +119,8 @@ const updateShow=()=>{
<van-button @click="goBuy" color="#FFB25F" class="w-344px !h-[40px]">
<div>{{
$t('live_room.confirm')` ${auctionData?.nowAuctionPrice?.currency} ${auctionData?.nowAuctionPrice?.nextPrice ?? 0}`
}}</div>
}}
</div>
</van-button>
</div>
<div v-else class="mt-10px mb-10px">

View File

@ -5,6 +5,7 @@ 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'
import {fddCheck} from "~/api/goods/index.js";
const {userInfo,token}= authStore()
const router = useRouter();
const route = useRoute();
@ -126,7 +127,13 @@ const goLogin =async () => {
query:{
statusCode:0
}
});
})
}else if (res.data.isJumpFdd){
const res1=await fddCheck()
if (res1.status===0){
window.location.href=res1.data.h5Url
}
console.log('123')
}else {
await router.push('/');
}

View File

@ -8,7 +8,11 @@ import {authStore} from "@/stores/auth/index.js";
import XVanDate from '@/components/x-van-date/index.vue'
import XVanSelect from '@/components/x-van-select/index.vue'
import {fddCheck} from "~/api/goods/index.js";
definePageMeta({
i18n: 'realAuth.title',
})
const router = useRouter();
const route = useRoute();
const { locale } = useI18n()
const {userInfo}= authStore()
const active=ref(locale.value==='zh-CN'?0:1)
@ -45,7 +49,7 @@ function isFormComplete(obj) {
return true;
}
const statusCode=ref(0)
const statusCode=ref(Number(route.query.statusCode))
const confirm=async ()=>{
const thatForm=active.value===0?form1.value:form.value
thatForm.userExtend.isMainland=active.value===0?1:0
@ -54,10 +58,11 @@ const confirm=async ()=>{
if (res.status===0){
userInfo.value=res.data
message.success(t('realAuth.success_mess'))
/*statusCode.value=1*/
const res1=await fddCheck()
if (res1.status===0){
console.log('res1',res1)
if (!res1.data.isNeedJump){
window.open(res1.data.h5Url)
}
}
}
}else {
@ -71,9 +76,7 @@ const goHome=()=>{
const goLogin=()=>{
router.back()
}
definePageMeta({
i18n: 'realAuth.title',
})
</script>
<template>