2025-01-13 07:28:22 +00:00
|
|
|
|
<script setup>
|
2025-02-11 03:34:24 +00:00
|
|
|
|
import {ref, onMounted, onBeforeUnmount, computed, watch} from 'vue'
|
2025-01-13 08:52:59 +00:00
|
|
|
|
import Aliplayer from 'aliyun-aliplayer'
|
|
|
|
|
import 'aliyun-aliplayer/build/skins/default/aliplayer-min.css'
|
2025-01-23 11:43:45 +00:00
|
|
|
|
import sideButton from '@/pages/liveRoom/components/SideButton/index.vue'
|
|
|
|
|
import broadcast from '@/pages/liveRoom/components/Broadcast/index.vue'
|
2025-02-11 03:34:24 +00:00
|
|
|
|
import {liveStore} from "@/stores/live/index.js"
|
2025-01-23 11:43:45 +00:00
|
|
|
|
import paymentResults from '@/pages/liveRoom/components/PaymentResults/index.vue'
|
|
|
|
|
import paymentInput from '@/pages/liveRoom/components/PaymentInput/index.vue'
|
2025-01-22 07:44:50 +00:00
|
|
|
|
import xButton from '@/components/x-button/index.vue'
|
2025-02-11 03:34:24 +00:00
|
|
|
|
import {goodStore} from "@/stores/goods/index.js"
|
|
|
|
|
import {message} from "~/components/x-message/useMessage.js"
|
|
|
|
|
import {artworkBuy} from "@/api/goods/index.js"
|
|
|
|
|
import CryptoJS from 'crypto-js'
|
|
|
|
|
|
|
|
|
|
const {auctionDetail, getAuctionDetail} = goodStore()
|
2025-01-13 08:52:59 +00:00
|
|
|
|
const player = ref(null)
|
2025-02-11 03:34:24 +00:00
|
|
|
|
const {quoteStatus, changeStatus, show, playerId, show1, auctionData, getSocketData,getLiveLink} = liveStore()
|
2025-01-13 08:52:59 +00:00
|
|
|
|
const isPlayerReady = ref(false)
|
2025-02-11 03:34:24 +00:00
|
|
|
|
const pullLink=ref('')
|
2025-01-13 12:59:25 +00:00
|
|
|
|
const props = defineProps({
|
|
|
|
|
fullLive: {
|
|
|
|
|
type: Boolean,
|
2025-01-15 03:45:46 +00:00
|
|
|
|
default: true,
|
2025-01-13 12:59:25 +00:00
|
|
|
|
},
|
|
|
|
|
})
|
2025-02-11 03:34:24 +00:00
|
|
|
|
const isPiPActive = ref(false)
|
|
|
|
|
const videoRef = ref(null)
|
|
|
|
|
|
|
|
|
|
// 检查浏览器是否支持画中画
|
|
|
|
|
const isPiPSupported = computed(() => {
|
|
|
|
|
return document.pictureInPictureEnabled ||
|
|
|
|
|
document.webkitPictureInPictureEnabled
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 进入画中画模式
|
|
|
|
|
const enterPiP = async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (!videoRef.value) return
|
|
|
|
|
|
|
|
|
|
if (document.pictureInPictureElement) {
|
|
|
|
|
await document.exitPictureInPicture()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await videoRef.value.requestPictureInPicture()
|
|
|
|
|
isPiPActive.value = true
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('进入画中画模式失败:', error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 退出画中画模式
|
|
|
|
|
const exitPiP = async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (document.pictureInPictureElement) {
|
|
|
|
|
await document.exitPictureInPicture()
|
|
|
|
|
isPiPActive.value = false
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('退出画中画模式失败:', error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-16 03:07:38 +00:00
|
|
|
|
definePageMeta({
|
|
|
|
|
title: '主页',
|
|
|
|
|
i18n: 'login.title',
|
|
|
|
|
})
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-16 03:07:38 +00:00
|
|
|
|
const config = useRuntimeConfig()
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
|
|
|
|
|
2025-01-13 08:52:59 +00:00
|
|
|
|
const handlePlayerError = (error) => {
|
|
|
|
|
console.error('播放器错误:', error)
|
|
|
|
|
if (player.value) {
|
|
|
|
|
player.value?.play()
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-13 08:52:59 +00:00
|
|
|
|
const initializePlayer = () => {
|
|
|
|
|
try {
|
|
|
|
|
if (player.value) {
|
|
|
|
|
player.value?.dispose()
|
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
const playerConfig = {
|
|
|
|
|
id: playerId.value,
|
|
|
|
|
source:pullLink.value,
|
|
|
|
|
isLive: true,
|
|
|
|
|
preload: true,
|
|
|
|
|
autoplayPolicy: {fallbackToMute: true},
|
|
|
|
|
controlBarVisibility: 'never',
|
|
|
|
|
}
|
2025-01-13 08:52:59 +00:00
|
|
|
|
player.value = new Aliplayer(playerConfig, (playerInstance) => {
|
|
|
|
|
isPlayerReady.value = true
|
|
|
|
|
playerInstance?.play()
|
|
|
|
|
})
|
|
|
|
|
player.value?.on('error', handlePlayerError)
|
2025-01-15 03:45:46 +00:00
|
|
|
|
player.value?.on('rtsTraceId', (event) => {
|
|
|
|
|
})
|
|
|
|
|
player.value?.on('rtsFallback', (event) => {
|
|
|
|
|
})
|
2025-01-13 08:52:59 +00:00
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('播放器初始化失败:', error)
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-01-13 07:28:22 +00:00
|
|
|
|
|
2025-01-23 08:34:34 +00:00
|
|
|
|
onMounted(async () => {
|
2025-02-11 03:34:24 +00:00
|
|
|
|
pullLink.value= await getLiveLink()
|
|
|
|
|
initializePlayer()
|
2025-01-13 08:52:59 +00:00
|
|
|
|
})
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-13 07:28:22 +00:00
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
if (player.value) {
|
2025-01-13 08:52:59 +00:00
|
|
|
|
player.value?.dispose()
|
|
|
|
|
player.value = null
|
2025-01-13 07:28:22 +00:00
|
|
|
|
}
|
2025-01-13 08:52:59 +00:00
|
|
|
|
})
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-16 03:12:52 +00:00
|
|
|
|
const goPay = () => {
|
|
|
|
|
show.value = true
|
2025-01-15 08:10:28 +00:00
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-21 07:11:26 +00:00
|
|
|
|
const fullLive1 = ref(false)
|
2025-02-11 03:34:24 +00:00
|
|
|
|
watch(() => {
|
2025-01-21 07:11:26 +00:00
|
|
|
|
return props.fullLive
|
|
|
|
|
}, (newVal) => {
|
|
|
|
|
if (newVal) {
|
2025-02-08 02:06:21 +00:00
|
|
|
|
getSocketData()
|
2025-01-21 07:11:26 +00:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
fullLive1.value = true
|
|
|
|
|
}, 400)
|
2025-02-11 03:34:24 +00:00
|
|
|
|
} else {
|
2025-01-21 07:11:26 +00:00
|
|
|
|
fullLive1.value = false
|
|
|
|
|
}
|
|
|
|
|
})
|
2025-02-08 08:24:26 +00:00
|
|
|
|
|
2025-02-11 03:34:24 +00:00
|
|
|
|
const goBuy = async () => {
|
|
|
|
|
const res = await artworkBuy({
|
|
|
|
|
auctionArtworkUuid: auctionData.value?.artwork?.uuid,
|
|
|
|
|
buyMoney: String(auctionData.value?.nowAuctionPrice?.nextPrice ?? 0)
|
2025-02-08 07:21:00 +00:00
|
|
|
|
})
|
2025-02-11 03:34:24 +00:00
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
message.success('出价成功')
|
2025-02-08 07:21:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
|
|
|
|
const tipOpen = () => {
|
2025-02-10 07:47:26 +00:00
|
|
|
|
message.warning('出价状态未开启')
|
|
|
|
|
}
|
2025-01-13 07:28:22 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-02-06 07:43:23 +00:00
|
|
|
|
<div class="relative h-full ">
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<div :id="playerId" class="w-full h-full"></div>
|
2025-01-21 07:11:26 +00:00
|
|
|
|
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<transition>
|
2025-01-21 07:11:26 +00:00
|
|
|
|
<div v-if="fullLive1">
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<sideButton class="absolute top-196px right-0 z-999"></sideButton>
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<div class="absolute left-1/2 transform -translate-x-1/2 flex flex-col items-center"
|
|
|
|
|
style="bottom:calc(var(--safe-area-inset-bottom) + 26px)">
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<div class="text-16px text-#FFB25F font-600">
|
2025-02-11 03:34:24 +00:00
|
|
|
|
当前价:{{ auctionData?.nowAuctionPrice?.currency }}
|
|
|
|
|
<van-rolling-text class="my-rolling-text" :start-num="0" :duration="0.5"
|
|
|
|
|
:target-num="auctionData?.nowAuctionPrice?.nowPrice??0" direction="up"/>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="text-16px text-#fff font-600">
|
2025-02-11 03:34:24 +00:00
|
|
|
|
下口价:{{ auctionData?.nowAuctionPrice?.currency }}
|
|
|
|
|
<van-rolling-text class="my-rolling-text1" :start-num="0" :duration="0.5"
|
|
|
|
|
:target-num="auctionData?.nowAuctionPrice?.nextPrice??0" direction="up"/>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
</div>
|
2025-02-10 07:47:26 +00:00
|
|
|
|
<div v-if="quoteStatus" class="mt-10px mb-10px">
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<van-button @click="goBuy" color="#FFB25F" class="w-344px !h-[40px]">
|
|
|
|
|
<div>{{
|
|
|
|
|
`确认出价 ${auctionData?.nowAuctionPrice?.currency} ${auctionData?.nowAuctionPrice?.nextPrice ?? 0}`
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
2025-02-10 07:47:26 +00:00
|
|
|
|
</van-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="mt-10px mb-10px">
|
|
|
|
|
<van-button @click="tipOpen" color="#D6D6D8" class=" w-344px !h-[40px]" v-if="!quoteStatus">
|
|
|
|
|
<div class="text-#7D7D7F text-14px">点击"开启出价",即刻参与竞拍</div>
|
|
|
|
|
</van-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<broadcast></broadcast>
|
2025-01-13 12:59:25 +00:00
|
|
|
|
</div>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<paymentInput v-model:show="show"/>
|
|
|
|
|
<div>
|
2025-01-13 12:59:25 +00:00
|
|
|
|
</div>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<paymentResults v-model:show="show1" type="error"/>
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<div v-if="auctionData?.wsType==='newArtwork'"
|
|
|
|
|
class="w-344px h-31px rounded-4px absolute top-9px bg-[#151824]/45 backdrop-blur-[10px] backdrop-saturate-[180%] left-1/2 transform translate-x--1/2 flex text-#fff text-14px items-center px-12px line-height-none">
|
|
|
|
|
<div class="mr-11px whitespace-nowrap">LOT{{ auctionData.artwork.index }}</div>
|
|
|
|
|
<div class="mr-10px truncate">{{ auctionData.artwork.name }}</div>
|
2025-02-06 07:43:23 +00:00
|
|
|
|
<div class="whitespace-nowrap">开始拍卖</div>
|
|
|
|
|
</div>
|
2025-01-16 03:07:38 +00:00
|
|
|
|
</div>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
</transition>
|
2025-01-13 07:28:22 +00:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
#J_prismPlayer{
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%!important;
|
|
|
|
|
&>video{
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2025-01-15 08:10:28 +00:00
|
|
|
|
<style scoped>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
.v-enter-active,
|
|
|
|
|
.v-leave-active {
|
2025-01-21 07:11:26 +00:00
|
|
|
|
transition: opacity 0.3s ease;
|
2025-01-21 06:16:54 +00:00
|
|
|
|
}
|
2025-01-16 03:07:38 +00:00
|
|
|
|
|
2025-01-21 06:16:54 +00:00
|
|
|
|
.v-enter-from,
|
|
|
|
|
.v-leave-to {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-13 07:28:22 +00:00
|
|
|
|
.my-rolling-text {
|
|
|
|
|
--van-rolling-text-item-width: 10px;
|
|
|
|
|
--van-rolling-text-font-size: 16px;
|
|
|
|
|
--van-rolling-text-color: #FFB25F;
|
|
|
|
|
}
|
2025-01-13 08:52:59 +00:00
|
|
|
|
|
2025-01-13 07:28:22 +00:00
|
|
|
|
.my-rolling-text1 {
|
|
|
|
|
--van-rolling-text-item-width: 10px;
|
|
|
|
|
--van-rolling-text-font-size: 16px;
|
|
|
|
|
--van-rolling-text-color: #FFF;
|
|
|
|
|
}
|
2025-01-15 03:45:46 +00:00
|
|
|
|
|
|
|
|
|
:deep(.prism-license-watermark) {
|
|
|
|
|
display: none !important;
|
2025-01-13 12:59:25 +00:00
|
|
|
|
}
|
2025-01-13 07:28:22 +00:00
|
|
|
|
</style>
|