liveh5-nuxt/app/stores/goods/index.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

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 currentItem=ref({})
const myArtWorks=ref([])
const pageRef = ref({
page: 1,
pageSize: 5,
itemCount: 0
})
const artWorkDetail=ref(null)
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 {
myArtWorks,
currentItem,
artWorkDetail,
liveRef,
pageRef,
getArtworkList,
auctionDetail,
getAuctionDetail,
actionDetails,
itemList,
fullLive
}
})