liveh5-nuxt/app/stores/goods/index.js
xingyy bad45f8d82 refactor(goods): 重构商品相关功能
- 修改测试环境配置
- 重命名 homeStore为 goodStore
- 优化直播房间组件导入路径
- 重构商品列表和详情功能
- 新增 ItemList 组件
-调整首页布局和功能
2025-01-20 16:17:49 +08:00

34 lines
924 B
JavaScript

import {createGlobalState} from '@vueuse/core'
import {artworkList, defaultDetail} from "~/api/goods/index.js";
export const goodStore = createGlobalState(() => {
const actionDetails = ref({})
const fullLive = ref(false)
const liveRef = ref(null);
const pageRef = ref({
page: 1,
pageSize: 5,
itemCount: 0
})
const itemList = ref([])
const auctionDetail = ref({})
const getAuctionDetail = async () => {
const res = await defaultDetail({})
if (res.status === 0) {
auctionDetail.value = res.data
}
}
const getArtworkList = async (page = pageRef.value) => {
return artworkList({auctionUuid: auctionDetail.value.uuid, ...page})
}
return {
liveRef,
pageRef,
getArtworkList,
auctionDetail,
getAuctionDetail,
actionDetails,
itemList,
fullLive
}
})