2025-01-21 03:43:27 +00:00
|
|
|
<script setup>
|
2025-01-22 02:44:43 +00:00
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
import { useRect } from "@vant/use"
|
|
|
|
import { goodStore } from "@/stores/goods"
|
|
|
|
import Column from "../Column/index.vue"
|
2025-01-22 08:56:44 +00:00
|
|
|
import DetailPopup from '../DetailPopup/index.vue'
|
2025-01-22 02:44:43 +00:00
|
|
|
|
|
|
|
const {
|
|
|
|
itemList,
|
|
|
|
pageRef,
|
|
|
|
auctionDetail,
|
|
|
|
liveRef,
|
|
|
|
artWorkDetail,
|
|
|
|
currentItem,
|
|
|
|
loading: storeLoading,
|
|
|
|
getArtworkList,
|
|
|
|
getArtworkDetail
|
|
|
|
} = goodStore()
|
|
|
|
|
|
|
|
const localState = ref({
|
|
|
|
finished: false,
|
|
|
|
refreshing: false,
|
|
|
|
showDetail: false,
|
|
|
|
showHeight: ''
|
|
|
|
})
|
2025-01-22 01:44:44 +00:00
|
|
|
|
|
|
|
// 计算列数据
|
2025-01-20 08:17:49 +00:00
|
|
|
const columns = computed(() => {
|
2025-01-22 02:44:43 +00:00
|
|
|
const result = [[], []]
|
2025-01-20 08:17:49 +00:00
|
|
|
itemList.value.forEach((item, index) => {
|
2025-01-22 02:44:43 +00:00
|
|
|
result[index % 2].push({ ...item, index })
|
|
|
|
})
|
|
|
|
return result
|
|
|
|
})
|
|
|
|
|
|
|
|
// 加载更多
|
|
|
|
const loadMore = async () => {
|
|
|
|
pageRef.value.page++
|
|
|
|
const { finished } = await getArtworkList()
|
|
|
|
localState.value.finished = finished
|
|
|
|
}
|
|
|
|
|
|
|
|
// 刷新
|
|
|
|
const onRefresh = async () => {
|
2025-01-22 01:44:44 +00:00
|
|
|
try {
|
2025-01-22 02:44:43 +00:00
|
|
|
localState.value.refreshing = true
|
|
|
|
localState.value.finished = false
|
|
|
|
const { finished } = await getArtworkList(true)
|
|
|
|
localState.value.finished = finished
|
2025-01-22 01:44:44 +00:00
|
|
|
} finally {
|
2025-01-22 02:44:43 +00:00
|
|
|
localState.value.refreshing = false
|
2025-01-20 08:17:49 +00:00
|
|
|
}
|
2025-01-22 02:44:43 +00:00
|
|
|
}
|
2025-01-21 03:43:27 +00:00
|
|
|
|
2025-01-22 02:44:43 +00:00
|
|
|
// 打开详情
|
|
|
|
const openShow = async (item) => {
|
|
|
|
currentItem.value = item
|
|
|
|
await getArtworkDetail(item.uuid)
|
2025-01-22 01:44:44 +00:00
|
|
|
|
2025-01-22 02:44:43 +00:00
|
|
|
const rect = useRect(liveRef.value.$el)
|
|
|
|
localState.value.showHeight = rect.height
|
2025-01-22 01:44:44 +00:00
|
|
|
|
2025-01-20 08:17:49 +00:00
|
|
|
nextTick(() => {
|
2025-01-22 02:44:43 +00:00
|
|
|
localState.value.showDetail = true
|
|
|
|
})
|
|
|
|
}
|
2025-01-20 05:59:50 +00:00
|
|
|
</script>
|
2025-01-22 01:44:44 +00:00
|
|
|
|
2025-01-20 05:59:50 +00:00
|
|
|
<template>
|
2025-01-20 08:17:49 +00:00
|
|
|
<div class="px-[16px] pt-[16px]">
|
2025-01-22 01:44:44 +00:00
|
|
|
<van-pull-refresh
|
2025-01-22 02:44:43 +00:00
|
|
|
v-model="localState.refreshing"
|
2025-01-22 01:44:44 +00:00
|
|
|
success-text="刷新成功"
|
2025-01-22 02:44:43 +00:00
|
|
|
@refresh="onRefresh"
|
2025-01-22 01:44:44 +00:00
|
|
|
>
|
|
|
|
<van-list
|
2025-01-22 02:44:43 +00:00
|
|
|
v-model:loading="storeLoading"
|
|
|
|
:finished="localState.finished"
|
2025-01-22 01:44:44 +00:00
|
|
|
finished-text="没有更多了"
|
2025-01-22 02:44:43 +00:00
|
|
|
@load="loadMore"
|
2025-01-22 01:44:44 +00:00
|
|
|
>
|
2025-01-20 08:17:49 +00:00
|
|
|
<div class="w-full flex gap-[16px]">
|
2025-01-22 01:44:44 +00:00
|
|
|
<Column
|
|
|
|
v-for="(column, colIndex) in columns"
|
|
|
|
:key="colIndex"
|
|
|
|
:colIndex="colIndex"
|
|
|
|
:items="column"
|
|
|
|
@openShow="openShow"
|
|
|
|
/>
|
2025-01-20 08:17:49 +00:00
|
|
|
</div>
|
|
|
|
</van-list>
|
|
|
|
</van-pull-refresh>
|
2025-01-22 08:56:44 +00:00
|
|
|
<DetailPopup v-model:show="localState.showDetail"></DetailPopup>
|
2025-01-20 08:17:49 +00:00
|
|
|
</div>
|
2025-01-22 02:44:43 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.content {
|
|
|
|
overflow-y: auto;
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
}
|
|
|
|
</style>
|