2025-01-13 07:28:22 +00:00
|
|
|
|
<script setup>
|
2025-02-11 06:55:25 +00:00
|
|
|
|
import {ref, onMounted, onBeforeUnmount, 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-02-11 03:34:24 +00:00
|
|
|
|
import {goodStore} from "@/stores/goods/index.js"
|
|
|
|
|
import {message} from "~/components/x-message/useMessage.js"
|
2025-02-17 05:33:31 +00:00
|
|
|
|
import {showConfirmDialog} from 'vant';
|
2025-02-11 03:34:24 +00:00
|
|
|
|
import {artworkBuy} from "@/api/goods/index.js"
|
2025-02-12 06:34:05 +00:00
|
|
|
|
import {useI18n} from 'vue-i18n'
|
2025-02-17 05:33:31 +00:00
|
|
|
|
|
2025-01-13 08:52:59 +00:00
|
|
|
|
const player = ref(null)
|
2025-02-17 05:33:31 +00:00
|
|
|
|
const {quoteStatus, show, playerId, show1, auctionData, getSocketData, getLiveLink, fullLive} = liveStore()
|
2025-02-11 06:55:25 +00:00
|
|
|
|
const pullLink = ref('')
|
|
|
|
|
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-01-16 03:07:38 +00:00
|
|
|
|
definePageMeta({
|
|
|
|
|
i18n: 'login.title',
|
|
|
|
|
})
|
2025-01-13 08:52:59 +00:00
|
|
|
|
const handlePlayerError = (error) => {
|
|
|
|
|
console.error('播放器错误:', error)
|
2025-02-11 06:55:25 +00:00
|
|
|
|
player.value?.play()
|
2025-01-13 08:52:59 +00:00
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-02-11 06:55:25 +00:00
|
|
|
|
const initializePlayer = async () => {
|
2025-01-13 08:52:59 +00:00
|
|
|
|
try {
|
|
|
|
|
if (player.value) {
|
2025-02-11 06:55:25 +00:00
|
|
|
|
player.value.dispose()
|
2025-01-13 08:52:59 +00:00
|
|
|
|
}
|
2025-02-11 06:55:25 +00:00
|
|
|
|
|
2025-02-11 03:34:24 +00:00
|
|
|
|
const playerConfig = {
|
|
|
|
|
id: playerId.value,
|
2025-02-11 06:55:25 +00:00
|
|
|
|
source: pullLink.value,
|
2025-02-11 03:34:24 +00:00
|
|
|
|
isLive: true,
|
|
|
|
|
preload: true,
|
2025-02-13 07:23:50 +00:00
|
|
|
|
autoplay: false,
|
|
|
|
|
autoplayPolicy: {
|
|
|
|
|
fallbackToMute: true, // 有声自动播放失败后,是否降级为静音自动播放,默认为false
|
|
|
|
|
showUnmuteBtn: true, // 静音自动播放时,是否居中显示静音大按钮,默认为true
|
|
|
|
|
},
|
2025-02-11 03:34:24 +00:00
|
|
|
|
controlBarVisibility: 'never',
|
|
|
|
|
}
|
2025-01-13 08:52:59 +00:00
|
|
|
|
player.value = new Aliplayer(playerConfig, (playerInstance) => {
|
|
|
|
|
playerInstance?.play()
|
|
|
|
|
})
|
2025-02-11 06:55:25 +00:00
|
|
|
|
|
|
|
|
|
player.value.on('error', handlePlayerError)
|
2025-01-13 08:52:59 +00:00
|
|
|
|
} catch (error) {
|
2025-02-12 02:58:47 +00:00
|
|
|
|
showConfirmDialog({
|
2025-02-12 06:34:05 +00:00
|
|
|
|
message: useI18n().t('live_room.error_mess'),
|
2025-02-17 05:33:31 +00:00
|
|
|
|
showCancelButton: true
|
2025-02-12 06:38:53 +00:00
|
|
|
|
|
2025-02-11 07:58:35 +00:00
|
|
|
|
}).then(() => {
|
|
|
|
|
location.reload()
|
|
|
|
|
// on close
|
2025-02-17 05:33:31 +00:00
|
|
|
|
}).catch(() => {
|
2025-02-11 07:58:35 +00:00
|
|
|
|
// on cancel
|
2025-02-12 03:06:53 +00:00
|
|
|
|
})
|
2025-01-13 08:52:59 +00:00
|
|
|
|
console.error('播放器初始化失败:', error)
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-01-13 07:28:22 +00:00
|
|
|
|
|
2025-01-23 08:34:34 +00:00
|
|
|
|
onMounted(async () => {
|
2025-02-11 06:55:25 +00:00
|
|
|
|
pullLink.value = await getLiveLink()
|
2025-02-11 03:34:24 +00:00
|
|
|
|
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(() => {
|
2025-02-11 06:55:25 +00:00
|
|
|
|
player.value?.dispose()
|
|
|
|
|
player.value = null
|
2025-01-13 08:52:59 +00:00
|
|
|
|
})
|
2025-02-17 05:33:31 +00:00
|
|
|
|
watch(() => fullLive.value, (newVal) => {
|
2025-01-21 07:11:26 +00:00
|
|
|
|
if (newVal) {
|
2025-02-08 02:06:21 +00:00
|
|
|
|
getSocketData()
|
2025-01-21 07:11:26 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
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) {
|
2025-02-12 06:34:05 +00:00
|
|
|
|
message.success(useI18n().t('live_room.success_mess'))
|
2025-02-08 07:21:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
|
|
|
|
const tipOpen = () => {
|
2025-02-12 06:34:05 +00:00
|
|
|
|
message.warning(useI18n().t('live_room.warn_mess'))
|
2025-02-11 06:55:25 +00:00
|
|
|
|
}
|
2025-02-17 05:33:31 +00:00
|
|
|
|
const updateShow = () => {
|
2025-02-11 06:55:25 +00:00
|
|
|
|
|
2025-02-10 07:47:26 +00:00
|
|
|
|
}
|
2025-01-13 07:28:22 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-02-11 06:55:25 +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-02-17 05:48:24 +00:00
|
|
|
|
<transition name="fade">
|
2025-02-11 07:27:31 +00:00
|
|
|
|
<div v-if="fullLive">
|
2025-02-11 06:55:25 +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-12 06:34:05 +00:00
|
|
|
|
{{ $t('live_room.now_price') }}:{{ auctionData?.nowAuctionPrice?.currency }}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<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-12 06:34:05 +00:00
|
|
|
|
{{ $t('live_room.lower_price') }}:{{ auctionData?.nowAuctionPrice?.currency }}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<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>{{
|
2025-02-12 06:34:05 +00:00
|
|
|
|
$t('live_room.confirm')` ${auctionData?.nowAuctionPrice?.currency} ${auctionData?.nowAuctionPrice?.nextPrice ?? 0}`
|
2025-02-17 05:33:31 +00:00
|
|
|
|
}}
|
|
|
|
|
</div>
|
2025-02-10 07:47:26 +00:00
|
|
|
|
</van-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="mt-10px mb-10px">
|
2025-02-11 06:55:25 +00:00
|
|
|
|
<van-button @click="tipOpen" color="#D6D6D8" class="w-344px !h-[40px]" v-if="!quoteStatus">
|
2025-02-12 06:34:05 +00:00
|
|
|
|
<div class="text-#7D7D7F text-14px">{{ $t('live_room.button') }}</div>
|
2025-02-10 07:47:26 +00:00
|
|
|
|
</van-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<broadcast></broadcast>
|
2025-01-13 12:59:25 +00:00
|
|
|
|
</div>
|
2025-02-11 07:39:22 +00:00
|
|
|
|
<paymentInput v-model:show="show"/>
|
2025-01-21 06:16:54 +00:00
|
|
|
|
<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-12 06:34:05 +00:00
|
|
|
|
<div class="whitespace-nowrap">{{ $t('live_room.start') }}</div>
|
2025-02-06 07:43:23 +00:00
|
|
|
|
</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 06:55:25 +00:00
|
|
|
|
|
2025-02-11 03:34:24 +00:00
|
|
|
|
<style lang="scss">
|
2025-02-11 06:55:25 +00:00
|
|
|
|
#J_prismPlayer {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100% !important;
|
|
|
|
|
|
|
|
|
|
& > video {
|
2025-02-11 03:34:24 +00:00
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2025-02-11 06:55:25 +00:00
|
|
|
|
|
2025-01-15 08:10:28 +00:00
|
|
|
|
<style scoped>
|
2025-02-17 05:48:24 +00:00
|
|
|
|
|
|
|
|
|
/* 定义过渡动画 */
|
|
|
|
|
.fade-enter-active{
|
|
|
|
|
transition: opacity 1s ease;
|
2025-01-21 06:16:54 +00:00
|
|
|
|
}
|
2025-01-16 03:07:38 +00:00
|
|
|
|
|
2025-02-17 05:48:24 +00:00
|
|
|
|
.fade-leave-active {
|
|
|
|
|
transition: opacity 0.2s ease;
|
|
|
|
|
}
|
|
|
|
|
/* 定义进入和离开的状态 */
|
|
|
|
|
.fade-enter-from,
|
|
|
|
|
.fade-leave-to {
|
2025-01-21 06:16:54 +00:00
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
2025-02-11 03:34:24 +00:00
|
|
|
|
|
2025-02-17 05:48:24 +00:00
|
|
|
|
.fade-enter-to,
|
|
|
|
|
.fade-leave-from {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
|
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>
|