refactor(home): 优化首页艺术品列表功能
- 移除了 x-image 组件中的多余属性 - 更新了 ItemList 组件中的 LOT 编号显示逻辑 -将 home 页面中的 v-show 改为 v-if - 重构了 tangPopup 组件,添加了下拉刷新和上拉加载更多功能
This commit is contained in:
parent
510b839a1b
commit
5d645a8106
@ -41,11 +41,6 @@ const showImage = () => {
|
|||||||
style="object-fit: cover"
|
style="object-fit: cover"
|
||||||
@click="showImage"
|
@click="showImage"
|
||||||
:src="src"
|
:src="src"
|
||||||
:modifiers="{ format: 'webp' }"
|
|
||||||
:sizes="sizes"
|
|
||||||
:format="format"
|
|
||||||
:quality="quality"
|
|
||||||
placeholder
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ const openShow = async (item) => {
|
|||||||
finished-text="没有更多了"
|
finished-text="没有更多了"
|
||||||
@load="loadMore"
|
@load="loadMore"
|
||||||
>
|
>
|
||||||
<div class="w-full flex gap-[16px]" v-memo="[itemList]">
|
<div class="w-full flex gap-[16px]">
|
||||||
<masonry-wall :items="itemList" :ssr-columns="2" :maxColumns="2" :minColumns="2" :gap="5">
|
<masonry-wall :items="itemList" :ssr-columns="2" :maxColumns="2" :minColumns="2" :gap="5">
|
||||||
<template #default="{ item, index }">
|
<template #default="{ item, index }">
|
||||||
<div
|
<div
|
||||||
@ -81,7 +81,7 @@ const openShow = async (item) => {
|
|||||||
<div
|
<div
|
||||||
class="absolute rounded-2px overflow-hidden line-height-12px left-[8px] top-[8px] h-[17px] w-[45px] flex items-center justify-center bg-[#2b53ac] text-[12px] text-[#fff]"
|
class="absolute rounded-2px overflow-hidden line-height-12px left-[8px] top-[8px] h-[17px] w-[45px] flex items-center justify-center bg-[#2b53ac] text-[12px] text-[#fff]"
|
||||||
>
|
>
|
||||||
LOT{{ index+1 }}
|
LOT{{ item.index }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-[8px]">
|
<div class="pt-[8px]">
|
||||||
|
@ -17,7 +17,7 @@ if (!auctionDetail.value.uuid){
|
|||||||
<liveRoom @click="changeLive" :class="['changeLive', fullLive ? 'expanded' : 'collapsed']"
|
<liveRoom @click="changeLive" :class="['changeLive', fullLive ? 'expanded' : 'collapsed']"
|
||||||
:fullLive="fullLive"/>
|
:fullLive="fullLive"/>
|
||||||
</client-only>
|
</client-only>
|
||||||
<div v-show="!fullLive" class="bg-#fff">
|
<div v-if="!fullLive" class="bg-#fff">
|
||||||
<van-tabs sticky animated>
|
<van-tabs sticky animated>
|
||||||
<van-tab title="拍品列表">
|
<van-tab title="拍品列表">
|
||||||
<ItemList></ItemList>
|
<ItemList></ItemList>
|
||||||
|
@ -4,9 +4,26 @@ import {goodStore} from "@/stores/goods/index.js";
|
|||||||
import xImage from '@/components/x-image/index.vue'
|
import xImage from '@/components/x-image/index.vue'
|
||||||
import DetailPopup from '@/pages/home/components/DetailPopup/index.vue'
|
import DetailPopup from '@/pages/home/components/DetailPopup/index.vue'
|
||||||
import {liveStore} from "~/stores/live/index.js";
|
import {liveStore} from "~/stores/live/index.js";
|
||||||
const {pageRef,itemList} = goodStore();
|
import {ref} from "vue";
|
||||||
|
const {pageRef,itemList,getArtworkList, loading: storeLoading,} = goodStore();
|
||||||
const {auctionData} = liveStore()
|
const {auctionData} = liveStore()
|
||||||
const showDetail=ref(false)
|
const showDetail=ref(false)
|
||||||
|
const localState = ref({
|
||||||
|
finished: false,
|
||||||
|
refreshing: false,
|
||||||
|
showDetail: false,
|
||||||
|
showHeight: ''
|
||||||
|
})
|
||||||
|
const onRefresh = async () => {
|
||||||
|
try {
|
||||||
|
localState.value.refreshing = true
|
||||||
|
localState.value.finished = false
|
||||||
|
const { finished } = await getArtworkList(true)
|
||||||
|
localState.value.finished = finished
|
||||||
|
} finally {
|
||||||
|
localState.value.refreshing = false
|
||||||
|
}
|
||||||
|
}
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: Boolean,
|
show: Boolean,
|
||||||
title: {
|
title: {
|
||||||
@ -22,6 +39,11 @@ const openShow=(item)=>{
|
|||||||
showDetail.value=true
|
showDetail.value=true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const loadMore = async () => {
|
||||||
|
pageRef.value.page++
|
||||||
|
const { finished } = await getArtworkList()
|
||||||
|
localState.value.finished = finished
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -32,33 +54,51 @@ const openShow=(item)=>{
|
|||||||
<div class="text-#939393 text-16px ml-14px">共{{ pageRef.itemCount }}个拍品</div>
|
<div class="text-#939393 text-16px ml-14px">共{{ pageRef.itemCount }}个拍品</div>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<van-pull-refresh
|
||||||
v-for="(item,index) of itemList"
|
v-model="localState.refreshing"
|
||||||
:key="item.uuid"
|
success-text="刷新成功"
|
||||||
class="flex mb-21px"
|
:success-duration="700"
|
||||||
@click="openShow(item)"
|
@refresh="onRefresh"
|
||||||
>
|
>
|
||||||
<div
|
<template #success>
|
||||||
class="mr-10px flex-shrink-0 rounded-4px overflow-hidden cursor-pointer relative"
|
<van-icon name="success" /> <span>刷新成功</span>
|
||||||
|
</template>
|
||||||
|
<van-list
|
||||||
|
v-model:loading="storeLoading"
|
||||||
|
:finished="localState.finished"
|
||||||
|
finished-text="没有更多了"
|
||||||
|
@load="loadMore"
|
||||||
>
|
>
|
||||||
<xImage
|
<div
|
||||||
:preview="false"
|
v-for="(item,index) of itemList"
|
||||||
class="w-80px h-80px"
|
:key="item.uuid"
|
||||||
:src="item.artwork?.hdPic"
|
class="flex mb-21px"
|
||||||
:alt="item?.artworkTitle"
|
@click="openShow(item)"
|
||||||
loading="lazy"
|
>
|
||||||
/>
|
<div
|
||||||
<div class="w-45px h-17px bg-#2B53AC text-12px line-height-none flex justify-center items-center absolute top-2px left-2px text-#fff">LOT{{item.index}}</div>
|
class="mr-10px flex-shrink-0 rounded-4px overflow-hidden cursor-pointer relative"
|
||||||
<div v-if="auctionData.artwork.index===item?.index" class="w-80px h-20px bg-#B58047 flex line-height-none justify-center items-center text-#fff text-12px">竞拍中</div>
|
>
|
||||||
</div>
|
<xImage
|
||||||
<div>
|
:preview="false"
|
||||||
<div class="ellipsis line-height-20px text-16px font-600 min-h-40px">
|
class="w-80px h-80px"
|
||||||
{{ item.artworkTitle }}
|
:src="item.artwork?.hdPic"
|
||||||
|
:alt="item?.artworkTitle"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
<div class="w-45px h-17px bg-#2B53AC text-12px line-height-none flex justify-center items-center absolute top-2px left-2px text-#fff">LOT{{item.index}}</div>
|
||||||
|
<div v-if="auctionData.artwork.index===item?.index" class="w-80px h-20px bg-#B58047 flex line-height-none justify-center items-center text-#fff text-12px bottom-0 absolute">竞拍中</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="ellipsis line-height-20px text-16px font-600 min-h-40px">
|
||||||
|
{{ item.artworkTitle }}
|
||||||
|
</div>
|
||||||
|
<div class="text-14px text-#575757">起拍价:RMB 1,000</div>
|
||||||
|
<div class="text-14px text-#B58047">成交价:等待更新</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-14px text-#575757">起拍价:RMB 1,000</div>
|
</van-list>
|
||||||
<div class="text-14px text-#B58047">成交价:等待更新</div>
|
</van-pull-refresh>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</x-popup>
|
</x-popup>
|
||||||
<DetailPopup v-model:show="showDetail" :detail-info="showDetailInfo"></DetailPopup>
|
<DetailPopup v-model:show="showDetail" :detail-info="showDetailInfo"></DetailPopup>
|
||||||
|
Loading…
Reference in New Issue
Block a user