+
-
- {{ text }}
+
+
+
+ {{ message }}
+
+
+
+
+ {{ title.text }}
+
+
+ {{ subTitle.text }}
+
+
diff --git a/app/components/x-message/useMessage.js b/app/components/x-message/useMessage.js
index 10eed19..da23492 100644
--- a/app/components/x-message/useMessage.js
+++ b/app/components/x-message/useMessage.js
@@ -2,22 +2,46 @@ import { createApp, nextTick } from 'vue'
import MessagePopup from './index.vue'
const message = {
- success(text, duration = 2000) {
+ success(options, duration = 2000) {
if (process.client) {
- this.show({ type: 'success', message: text, duration })
+ if (typeof options === 'string') {
+ this.show({ type: 'success', message: options, duration })
+ } else {
+ this.show({
+ type: 'success',
+ ...options,
+ duration
+ })
+ }
}
},
- error(text, duration = 2000) {
+ error(options, duration = 2000) {
if (process.client) {
- this.show({ type: 'error', message: text, duration })
+ if (typeof options === 'string') {
+ this.show({ type: 'error', message: options, duration })
+ } else {
+ this.show({
+ type: 'error',
+ ...options,
+ duration
+ })
+ }
}
},
- warning(text, duration = 2000) {
+ warning(options, duration = 2000) {
if (process.client) {
- this.show({ type: 'warning', message: text, duration })
+ if (typeof options === 'string') {
+ this.show({ type: 'warning', message: options, duration })
+ } else {
+ this.show({
+ type: 'warning',
+ ...options,
+ duration
+ })
+ }
}
},
- show({ type = 'success', message, duration = 2000 }) {
+ show(options) {
if (!process.client) return
const container = document.createElement('div')
@@ -32,11 +56,7 @@ const message = {
const instance = app.mount(container)
nextTick(() => {
- instance.showMessage?.({
- type,
- message,
- duration
- })
+ instance.showMessage?.(options)
})
}
}
diff --git a/app/pages/artDetail/index.vue b/app/pages/artDetail/index.vue
new file mode 100644
index 0000000..266f7fd
--- /dev/null
+++ b/app/pages/artDetail/index.vue
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+ 去支付 RMB10,000
+
+
+
+

+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/pages/home/index.vue b/app/pages/home/index.vue
index 117ba2e..aa35bef 100644
--- a/app/pages/home/index.vue
+++ b/app/pages/home/index.vue
@@ -3,6 +3,7 @@ import liveRoom from '@/pages/liveRoom/index.client.vue';
import {goodStore} from "@/stores/goods/index.js";
import ItemList from './components/ItemList/index.vue'
import Cescribe from './components/Cescribe/index.vue'
+import {message} from '@/components/x-message/useMessage.js'
const {fullLive,getAuctionDetail,auctionDetail} = goodStore();
const changeLive = () => {
fullLive.value = true;
diff --git a/app/pages/liveRoom/components/Broadcast/index.vue b/app/pages/liveRoom/components/Broadcast/index.vue
index 0b8e46b..7c04913 100644
--- a/app/pages/liveRoom/components/Broadcast/index.vue
+++ b/app/pages/liveRoom/components/Broadcast/index.vue
@@ -65,10 +65,10 @@ onUnmounted(() => {
{{ item.statusCode==='head'?'领先':'出局' }}
-
{{ item.auctionType==='local'?'现场竞价':'网络竞价' }}
-
{{ item.createdAt }}
-
{{ item.baseMoney }}
-
{{ item.userId===userInfo.ID?'我':'' }}
+
{{ item.auctionType==='local'?'现场竞价':'网络竞价' }}
+
{{ item.createdAt }}
+
{{ item.baseMoney }}
+
{{ item.userId===userInfo.ID?'我':'' }}
diff --git a/app/pages/liveRoom/components/SideButton/index.vue b/app/pages/liveRoom/components/SideButton/index.vue
index a991e0e..67810e1 100644
--- a/app/pages/liveRoom/components/SideButton/index.vue
+++ b/app/pages/liveRoom/components/SideButton/index.vue
@@ -13,7 +13,7 @@ const showTang=ref(false)
const openOne=()=>{
showTang.value=true
}
-getSocketData()
+
diff --git a/app/pages/liveRoom/index.client.vue b/app/pages/liveRoom/index.client.vue
index 2752618..6f659af 100644
--- a/app/pages/liveRoom/index.client.vue
+++ b/app/pages/liveRoom/index.client.vue
@@ -9,9 +9,10 @@ import paymentResults from '@/pages/liveRoom/components/PaymentResults/index.vue
import paymentInput from '@/pages/liveRoom/components/PaymentInput/index.vue'
import xButton from '@/components/x-button/index.vue'
import {goodStore} from "@/stores/goods/index.js";
+import {message} from "~/components/x-message/useMessage.js";
const {auctionDetail,getAuctionDetail} = goodStore();
const player = ref(null)
-const {quoteStatus, changeStatus, show, playerId, show1,auctionData} = liveStore()
+const {quoteStatus, changeStatus, show, playerId, show1,auctionData,getSocketData} = liveStore()
const isPlayerReady = ref(false)
const props = defineProps({
fullLive: {
@@ -70,11 +71,11 @@ const goPay = () => {
show.value = true
}
const fullLive1 = ref(false)
-
watch(()=>{
return props.fullLive
}, (newVal) => {
if (newVal) {
+ getSocketData()
setTimeout(() => {
fullLive1.value = true
}, 400)
@@ -82,6 +83,7 @@ watch(()=>{
fullLive1.value = false
}
})
+
diff --git a/app/pages/profile/index.vue b/app/pages/profile/index.vue
index 2a2fbbf..8e7dbff 100644
--- a/app/pages/profile/index.vue
+++ b/app/pages/profile/index.vue
@@ -2,11 +2,13 @@
import {userArtworks} from "@/api/goods/index.js";
import {authStore} from "@/stores/auth/index.js";
import xImage from '@/components/x-image/index.vue'
+import {goodStore} from "~/stores/goods/index.js";
definePageMeta({
layout: 'default',
title: '我的',
i18n: 'menu.profile',
})
+const {artWorkDetail} = goodStore()
const myList=ref([])
const showMyList=ref([])
const {userInfo}= authStore()
@@ -33,7 +35,17 @@ const initData=async ()=>{
showMyList.value=groupAndSortByDate(myList.value)
}
}
+const router = useRouter()
+
initData()
+const goPay=()=>{
+
+}
+const goDetail=(item)=>{
+ artWorkDetail.value=item.auctionArtworkInfo
+ console.log(' artWorkDetail.value', artWorkDetail.value)
+ router.push('/artDetail')
+}
@@ -55,16 +67,23 @@ initData()
-
+
{{item.userCreatedAt}}
-
+
-
-
{{item1?.auctionArtworkInfo?.artworkTitle}}
-
起拍价:RMB 1,000
-
成交价:RMB 10,000
+
+
{{item1?.auctionArtworkInfo?.artworkTitle}}{{item1?.auctionArtworkInfo?.artworkTitle}}{{item1?.auctionArtworkInfo?.artworkTitle}}
+
+
+
起拍价:RMB 1,000
+
成交价:RMB 10,000
+
+
+ 去支付
+
+
diff --git a/app/plugins/websocket.ts b/app/plugins/websocket.ts
index 6e03402..79da92e 100644
--- a/app/plugins/websocket.ts
+++ b/app/plugins/websocket.ts
@@ -1,5 +1,8 @@
+import {authStore} from "~/stores/auth";
+
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig()
+ const { token } = authStore()
const ws = reactive({
instance: null as WebSocket | null,
isConnected: false,
@@ -11,8 +14,8 @@ export default defineNuxtPlugin(() => {
}
// 构建查询字符串
- const queryString = data
- ? '?' + Object.entries(data)
+ const queryString =data
+ ? '?' + Object.entries({ token: token.value,...data})
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join('&')
: ''
diff --git a/app/static/images/zd5530@2x.png b/app/static/images/zd5530@2x.png
new file mode 100644
index 0000000..36c6f3f
Binary files /dev/null and b/app/static/images/zd5530@2x.png differ
diff --git a/app/stores/goods/index.js b/app/stores/goods/index.js
index 520d965..ec8163c 100644
--- a/app/stores/goods/index.js
+++ b/app/stores/goods/index.js
@@ -1,4 +1,4 @@
-import { createGlobalState } from '@vueuse/core'
+import { createGlobalState,useLocalStorage } from '@vueuse/core'
import { ref } from 'vue'
import { artworkList, defaultDetail, artworkDetail } from "@/api/goods/index.js"
@@ -13,7 +13,7 @@ export const goodStore = createGlobalState(() => {
pageSize: 5,
itemCount: 0
})
- const artWorkDetail = ref(null)
+ const artWorkDetail = useLocalStorage('artWorkDetail',{})
const itemList = ref([])
const auctionDetail = ref({})
const loading = ref(false)
diff --git a/app/stores/live/index.js b/app/stores/live/index.js
index 52c3031..4de9cda 100644
--- a/app/stores/live/index.js
+++ b/app/stores/live/index.js
@@ -2,34 +2,58 @@ import { createGlobalState } from '@vueuse/core'
import {ref} from "vue";
import {goodStore} from "@/stores/goods/index.js";
import {authStore} from "@/stores/auth/index.js";
+import {message} from "~/components/x-message/useMessage.js";
export const liveStore = createGlobalState(() => {
const {auctionDetail,getAuctionDetail} = goodStore();
- const { token } = authStore()
+
const quoteStatus = ref(false)
const show = ref(false)
+ const cleanup = ref(null)
const show1=ref(true)
const playerId=ref('J_prismPlayer')
const auctionData=ref({})
- const getSocketData=async ()=>{
- if (!auctionDetail.value.uuid){
+ const getSocketData = async () => {
+ if (!auctionDetail.value.uuid) {
await getAuctionDetail()
}
- const { ws, messages, onMessage } = useWebSocket()
-// 连接
- ws.connect('/api/v1/m/auction/live',{auctionUuid: auctionDetail.value.uuid,token:token.value})
+ const { ws, onMessage } = useWebSocket()
+ // 建立新连接
+ ws.connect('/api/v1/m/auction/live', {
+ auctionUuid: auctionDetail.value.uuid,
- /*// 发送消息
- ws.send({ type: 'chat', content: 'Hello!' })*/
-// 监听消息
- onMessage((data) => {
+ })
+ // 保存清理函数
+ cleanup.value = onMessage((data) => {
auctionData.value = data.data
- console.log('auctionData.value',auctionData.value)
+ if (auctionData.value.wsType === 'tip') {
+ if (auctionData.value.tip?.tipType === 'falling') {
+ message.warning({
+ title: {
+ text: '即将落槌',
+ color: '#F09F1F',
+ align: 'center',
+ },
+ style: {
+ width: '151px',
+ bottom: '230px'
+ },
+ }, 500000)
+ }
+ }
+ console.log('auctionData.value', auctionData.value)
})
}
const changeStatus = () => {
- quoteStatus.value = !quoteStatus.value
+ if (auctionData.value.artwork.isSelling){
+ quoteStatus.value = !quoteStatus.value
+ }else {
+ if (quoteStatus.value){
+ quoteStatus.value = false
+ }
+ }
+
}
return{
auctionData,