liveh5-nuxt/app/pages/LiveRoom/index.client.vue

123 lines
3.8 KiB
Vue
Raw Normal View History

<script setup>
import {ref, onMounted, onBeforeUnmount} from 'vue'
import Aliplayer from 'aliyun-aliplayer'
import 'aliyun-aliplayer/build/skins/default/aliplayer-min.css'
import lock4 from '@/static/images/lock4@2x.png'
import sideButton from './components/sideButton/index.vue'
import broadcast from './components/broadcast/index.vue'
import lockdfd from '@/static/images/lockdfd@2x.png'
import {liveStore} from "~/stores/live/index.js";
const player = ref(null)
const {quoteStatus,changeStatus,show}= liveStore()
const isPlayerReady = ref(false)
const props = defineProps({
fullLive: {
type: Boolean,
default: true,
},
})
const playerConfig = {
id: 'J_prismPlayer',
source: 'artc://live-pull-sh-01.szjixun.cn/live/live?auth_key=1736748343-0-0-feef65166e5cc62957c35b6e3eec82a1',
isLive: true,
preload: true,
autoplayPolicy: {fallbackToMute: true},
controlBarVisibility: 'never',
}
const handlePlayerError = (error) => {
console.error('播放器错误:', error)
if (player.value) {
player.value?.play()
}
}
const initializePlayer = () => {
try {
if (player.value) {
player.value?.dispose()
}
player.value = new Aliplayer(playerConfig, (playerInstance) => {
isPlayerReady.value = true
playerInstance?.play()
})
player.value?.on('error', handlePlayerError)
player.value?.on('rtsTraceId', (event) => {
})
player.value?.on('rtsFallback', (event) => {
})
} catch (error) {
console.error('播放器初始化失败:', error)
}
}
onMounted(() => {
initializePlayer()
})
onBeforeUnmount(() => {
if (player.value) {
player.value?.dispose()
player.value = null
}
})
const goPay=()=>{
show.value=true
}
</script>
<template>
<div class="relative h-full">
<div id="J_prismPlayer" class="w-screen"
:style="fullLive?'height: calc(100vh - var(--van-nav-bar-height))':'height:100%'"></div>
<template v-if="fullLive">
<sideButton class="absolute top-196px right-0 z-999"></sideButton>
<div class="absolute top-505px left-1/2 transform -translate-x-1/2 flex flex-col items-center">
<div class="text-16px text-#FFB25F font-600">
当前价RMB
<van-rolling-text class="my-rolling-text" :start-num="0" :target-num="3000" direction="up"/>
</div>
<div class="text-16px text-#fff font-600">
下口价RMB
<van-rolling-text class="my-rolling-text1" :start-num="0" :target-num="3500" direction="up"/>
</div>
<div
:class="`w-344px h-[40px] ${quoteStatus ? 'bg-#FFB25F' : 'bg-#D6D6D8'} rounded-4px ${quoteStatus ? 'text-#fff' : 'text-#7D7D7F'} text-14px flex justify-center items-center mt-10px mb-10px`">
{{ quoteStatus ? '确认出价 RMB 3,000' : '点击"开启出价",即刻参与竞拍 ' }}
</div>
<broadcast></broadcast>
</div>
<van-dialog v-model:show="show" show-cancel-button>
<div class="flex flex-col pt-18px pb-13px justify-between items-center h-144px">
<!-- <div class="text-#000 text-16px font-600 ">支付全部</div>
<div class="text-#000 text-16px ">RMB 5,000</div>-->
<div class="text-#000 text-16px font-600 ">支付部分</div>
<input class="w-272px h-48px bg-#F3F3F3 px-11px text-16px" type="text" placeholder="最多RMB5,000">
<div class="text-#2B53AC text-14px">支付部分</div>
</div>
</van-dialog>
</template>
</div>
</template>
<style>
:root:root{
--van-dialog-radius:8px
}
</style>
<style scoped>
.my-rolling-text {
--van-rolling-text-item-width: 10px;
--van-rolling-text-font-size: 16px;
--van-rolling-text-color: #FFB25F;
}
.my-rolling-text1 {
--van-rolling-text-item-width: 10px;
--van-rolling-text-font-size: 16px;
--van-rolling-text-color: #FFF;
}
:deep(.prism-license-watermark) {
display: none !important;
}
</style>