feat(api): 添加 401 状态码处理逻辑
- 在 http.js 中添加了对 401 状态码的处理,重定向到登录页面 - 更新了 LiveRoom 组件,暂时注释掉了 initializePlayer 方法 - 在 goods store 中添加了 currentItem 和 artWorkDetail 两个状态 - 更新了 message 组件,添加了对错误信息的处理 -调整了首页布局,移除了多余的 transition 标签 - 更新了登录页面的默认验证码
This commit is contained in:
parent
1b996eafca
commit
7a968f1fe6
@ -14,6 +14,7 @@ export function setupHttp() {
|
|||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const baseURL = config.public.NUXT_PUBLIC_API_BASE
|
const baseURL = config.public.NUXT_PUBLIC_API_BASE
|
||||||
const {token}= authStore()
|
const {token}= authStore()
|
||||||
|
const router = useRouter()
|
||||||
http = ofetch.create({
|
http = ofetch.create({
|
||||||
baseURL,
|
baseURL,
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
@ -27,6 +28,9 @@ export function setupHttp() {
|
|||||||
if (response._data.status===1){
|
if (response._data.status===1){
|
||||||
message.error(response._data.msg)
|
message.error(response._data.msg)
|
||||||
}
|
}
|
||||||
|
if (response._data.status===401){
|
||||||
|
router.replace('/login')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async onResponseError({ response }) {
|
async onResponseError({ response }) {
|
||||||
const { message } = response._data
|
const { message } = response._data
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import error from '../images/error.png'
|
import error from '../images/error.png'
|
||||||
import success from '../images/success.png'
|
import success from '../images/success.png'
|
||||||
import warning from '../images/warning.png'
|
import warning from '../images/warning.png'
|
||||||
|
@ -59,7 +59,7 @@ const initializePlayer = () => {
|
|||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initializePlayer()
|
/* initializePlayer()*/
|
||||||
})
|
})
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (player.value) {
|
if (player.value) {
|
||||||
@ -74,8 +74,21 @@ const goPay = () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="relative h-full">
|
<div class="relative h-full">
|
||||||
<div :id="playerId" class="w-screen"
|
<div class="w-full h-full">
|
||||||
:style="fullLive?'height: calc(100vh - var(--van-nav-bar-height))':'height:100%'"></div>
|
<video
|
||||||
|
class="h-full w-full"
|
||||||
|
autoplay
|
||||||
|
loop
|
||||||
|
muted
|
||||||
|
playsinline
|
||||||
|
style=" object-fit: cover"
|
||||||
|
>
|
||||||
|
<source src="@/static/video/example.mp4" type="video/mp4" />
|
||||||
|
您的浏览器不支持 HTML5 视频。
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
<!-- <div :id="playerId" class="w-screen"
|
||||||
|
:style="fullLive?'height: calc(100vh - var(--van-nav-bar-height))':'height:100%'"></div>-->
|
||||||
<template v-if="fullLive">
|
<template v-if="fullLive">
|
||||||
<sideButton class="absolute top-196px right-0 z-999"></sideButton>
|
<sideButton class="absolute top-196px right-0 z-999"></sideButton>
|
||||||
<div class="absolute top-505px left-1/2 transform -translate-x-1/2 flex flex-col items-center">
|
<div class="absolute top-505px left-1/2 transform -translate-x-1/2 flex flex-col items-center">
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
v-for="(item, index) in items"
|
v-for="(item, index) in items"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
@click="openShow"
|
@click="openShow(item,index)"
|
||||||
>
|
>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<van-image
|
<van-image
|
||||||
@ -47,7 +47,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['openShow']);
|
const emit = defineEmits(['openShow']);
|
||||||
|
|
||||||
const openShow = () => {
|
const openShow = (item,index) => {
|
||||||
emit('openShow');
|
emit('openShow', item,index);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup>
|
||||||
import Column from "~/pages/home/components/Column/index.vue";
|
import Column from "~/pages/home/components/Column/index.vue";
|
||||||
import {goodStore} from "~/stores/goods";
|
import {goodStore} from "~/stores/goods";
|
||||||
import {artworkDetail, artworkList} from "~/api/goods";
|
import {artworkDetail, artworkList} from "~/api/goods";
|
||||||
import {useRect} from "@vant/use";
|
import {useRect} from "@vant/use";
|
||||||
const {itemList, pageRef,auctionDetail,liveRef} = goodStore();
|
const {itemList, pageRef,auctionDetail,liveRef,artWorkDetail,currentItem} = goodStore();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const showHeight = ref('');
|
const showHeight = ref('');
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
@ -41,10 +41,16 @@ const refreshData = async () => {
|
|||||||
}
|
}
|
||||||
loading1.value = false
|
loading1.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDetail=async ()=>{
|
const getDetail=async ()=>{
|
||||||
const res=await artworkDetail()
|
const res=await artworkDetail({uuid:currentItem.value.artworkUuid})
|
||||||
|
if (res.status===0){
|
||||||
|
artWorkDetail.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const openShow = () => {
|
const openShow = (item,index) => {
|
||||||
|
currentItem.value=item
|
||||||
|
getDetail()
|
||||||
const rect = useRect(liveRef.value.$el);
|
const rect = useRect(liveRef.value.$el);
|
||||||
showHeight.value = rect.height;
|
showHeight.value = rect.height;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@ -58,7 +64,7 @@ const openShow = () => {
|
|||||||
<van-list :immediate-check="false" v-model:loading="loading" :finished="finished" finished-text="没有更多了"
|
<van-list :immediate-check="false" v-model:loading="loading" :finished="finished" finished-text="没有更多了"
|
||||||
@load="loadData">
|
@load="loadData">
|
||||||
<div class="w-full flex gap-[16px]">
|
<div class="w-full flex gap-[16px]">
|
||||||
<Column v-for="(column, colIndex) in columns" :key="colIndex" :colIndex="colIndex" :items="column" @click="openShow" />
|
<Column v-for="(column, colIndex) in columns" :key="colIndex" :colIndex="colIndex" :items="column" @openShow="openShow" />
|
||||||
</div>
|
</div>
|
||||||
</van-list>
|
</van-list>
|
||||||
</van-pull-refresh>
|
</van-pull-refresh>
|
||||||
|
@ -28,19 +28,17 @@ initData()
|
|||||||
<client-only>
|
<client-only>
|
||||||
<LiveRoom @click="changeLive" :class="['changeLive', fullLive ? 'expanded' : 'collapsed']" ref="liveRef" :fullLive="fullLive"/>
|
<LiveRoom @click="changeLive" :class="['changeLive', fullLive ? 'expanded' : 'collapsed']" ref="liveRef" :fullLive="fullLive"/>
|
||||||
</client-only>
|
</client-only>
|
||||||
<transition name="fade">
|
<div v-show="!fullLive" class="bg-#fff">
|
||||||
<div v-show="!fullLive" class="bg-#fff">
|
<van-tabs sticky animated>
|
||||||
<van-tabs sticky animated>
|
<van-tab title="拍品列表">
|
||||||
<van-tab title="拍品列表">
|
<ItemList></ItemList>
|
||||||
<ItemList></ItemList>
|
</van-tab>
|
||||||
</van-tab>
|
<van-tab title="拍卖说明">
|
||||||
<van-tab title="拍卖说明">
|
<Cescribe></Cescribe>
|
||||||
<Cescribe></Cescribe>
|
</van-tab>
|
||||||
</van-tab>
|
</van-tabs>
|
||||||
</van-tabs>
|
<van-back-top right="15vw" bottom="10vh"/>
|
||||||
<van-back-top right="15vw" bottom="10vh"/>
|
</div>
|
||||||
</div>
|
|
||||||
</transition>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
<style>
|
||||||
|
@ -38,7 +38,7 @@ const startCountdown=()=> {
|
|||||||
}
|
}
|
||||||
const countdown = ref(0);
|
const countdown = ref(0);
|
||||||
const phoneNum = ref('17630920520')
|
const phoneNum = ref('17630920520')
|
||||||
const code = ref('132657')
|
const code = ref('123789')
|
||||||
const pane = ref(0)
|
const pane = ref(0)
|
||||||
const showKeyboard = ref(false);
|
const showKeyboard = ref(false);
|
||||||
// 根据语言获取默认国家
|
// 根据语言获取默认国家
|
||||||
|
BIN
app/static/video/example.mp4
Normal file
BIN
app/static/video/example.mp4
Normal file
Binary file not shown.
@ -5,11 +5,13 @@ export const goodStore = createGlobalState(() => {
|
|||||||
const actionDetails = ref({})
|
const actionDetails = ref({})
|
||||||
const fullLive = ref(false)
|
const fullLive = ref(false)
|
||||||
const liveRef = ref(null);
|
const liveRef = ref(null);
|
||||||
|
const currentItem=ref({})
|
||||||
const pageRef = ref({
|
const pageRef = ref({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
itemCount: 0
|
itemCount: 0
|
||||||
})
|
})
|
||||||
|
const artWorkDetail=ref(null)
|
||||||
const itemList = ref([])
|
const itemList = ref([])
|
||||||
const auctionDetail = ref({})
|
const auctionDetail = ref({})
|
||||||
const getAuctionDetail = async () => {
|
const getAuctionDetail = async () => {
|
||||||
@ -22,6 +24,8 @@ export const goodStore = createGlobalState(() => {
|
|||||||
return artworkList({auctionUuid: auctionDetail.value.uuid, ...page})
|
return artworkList({auctionUuid: auctionDetail.value.uuid, ...page})
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
currentItem,
|
||||||
|
artWorkDetail,
|
||||||
liveRef,
|
liveRef,
|
||||||
pageRef,
|
pageRef,
|
||||||
getArtworkList,
|
getArtworkList,
|
||||||
|
Loading…
Reference in New Issue
Block a user