优化代码格式,调整变量声明和条件判断的空格,增加用户退出登录功能

This commit is contained in:
Phoenix 2025-04-22 09:17:51 +08:00
parent 0a3028e9f8
commit 3b015f3e9c

View File

@ -66,19 +66,28 @@ const statusLabel={
2: t('payment.text2'),
4: t('payment.text6'),
}
const backLogin=()=>{
localStorage.clear()
router.replace('/login')
}
fetchData()
</script>
<template>
<div class="w-[100vw] bg-[url('@/static/images/3532@2x.png')] bg-cover pt-43px flex-grow-1 flex flex-col">
<!-- 用户信息 -->
<div class="flex items-center px-16px mb-43px">
<div class="flex items-center justify-between">
<div class="flex items-center px-16px">
<img class="w-57px h-57px mr-23px" src="@/static/images/5514@2x.png" alt="">
<div class="flex flex-col">
<div class="text-18px text-#181818">{{ userInfo.realName }}</div>
<div class="text-#575757 text-14px">{{ userInfo.telNum }}</div>
</div>
</div>
<div class=" px-16px">
<van-button plain @click="backLogin" type="primary" size="small" class="w-50px !h-30px">退出</van-button>
</div>
</div>
<!-- 设置选项 -->
<div class="px-16px mb-20px">
@ -93,12 +102,8 @@ fetchData()
<div class="text-#000 text-16px border-b-3 border-b-#2B53AC w-80px h-36px">{{ $t('home.my_lots') }}</div>
</div>
<van-pull-refresh
v-model="localState.refreshing"
:success-duration="700"
class="h-full grow-1"
@refresh="onRefresh"
>
<van-pull-refresh v-model="localState.refreshing" :success-duration="700" class="h-full grow-1"
@refresh="onRefresh">
<template #success>
<van-icon name="success" /> <span>{{ $t('home.refresh_show') }}</span>
</template>
@ -114,17 +119,9 @@ fetchData()
<template v-else>
<div v-for="group in showMyList" :key="group.userCreatedAt" class="px-16px pt-14px">
<div class="text-#575757 text-14px mb-3px">{{ group.userCreatedAt }}</div>
<div
v-for="item in group.list"
:key="item.uuid"
class="flex mb-22px"
@click="goDetail(item)"
>
<x-image
class="w-80px h-80px flex-shrink-0 mr-10px rounded-4px overflow-hidden"
:src="item?.auctionArtworkInfo?.artwork?.hdPic"
:preview="false"
/>
<div v-for="item in group.list" :key="item.uuid" class="flex mb-22px" @click="goDetail(item)">
<x-image class="w-80px h-80px flex-shrink-0 mr-10px rounded-4px overflow-hidden"
:src="item?.auctionArtworkInfo?.artwork?.hdPic" :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">
@ -139,18 +136,15 @@ fetchData()
<div class="flex justify-between">
<div>
<div class="text-#575757 text-14px line-height-none mb-5px">
{{ $t('home.start_price') }}{{item.auctionArtworkInfo?.startPriceCurrency}} {{item.auctionArtworkInfo?.startPrice}}
{{ $t('home.start_price') }}{{ item.auctionArtworkInfo?.startPriceCurrency }}
{{ item.auctionArtworkInfo?.startPrice }}
</div>
<div class="text-#B58047 text-14px line-height-none">
{{ $t('home.close_price') }}{{ item.baseCurrency }} {{ item.baseMoney }}
</div>
</div>
<van-button
v-if="[1,3,4].includes(item.status)"
class="w-73px !h-30px"
type="primary"
@click.stop="goPay(item)"
>
<van-button v-if="[1, 3, 4].includes(item.status)" class="w-73px !h-30px" type="primary"
@click.stop="goPay(item)">
<span class="text-12px">{{ $t('art_detail_page.button') }}</span>
</van-button>
</div>