From 767e05209c41871fd7e1237755d455f046d76fbc Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Mon, 17 Feb 2025 15:18:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(live):=20=E4=BC=98=E5=8C=96=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E5=8A=9F=E8=83=BD=E5=92=8C=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改返回逻辑,仅在首页时退出全屏- 优化国际化处理,使用 t 函数替代 $t -调整直播室错误和成功提示信息的显示 - 修复签名面板的确认功能 - --- app/components/AppHeader.vue | 2 +- .../liveRoom/components/SideButton/index.vue | 40 +++++++++++++++++-- app/pages/liveRoom/index.client.vue | 24 +++++------ app/pages/signature/panel/index.vue | 5 ++- app/stores/live/index.js | 2 +- 5 files changed, 54 insertions(+), 19 deletions(-) diff --git a/app/components/AppHeader.vue b/app/components/AppHeader.vue index 598c472..86c38dc 100644 --- a/app/components/AppHeader.vue +++ b/app/components/AppHeader.vue @@ -7,7 +7,7 @@ const route = useRoute() const router = useRouter() const {auctionDetail} = goodStore(); function onBack() { - if (fullLive.value){ + if (fullLive.value&&route.name==='index'){ fullLive.value=false return } diff --git a/app/pages/liveRoom/components/SideButton/index.vue b/app/pages/liveRoom/components/SideButton/index.vue index 142dc27..7ddd79f 100644 --- a/app/pages/liveRoom/components/SideButton/index.vue +++ b/app/pages/liveRoom/components/SideButton/index.vue @@ -7,12 +7,13 @@ import xButton from '@/components/x-button/index.vue' import tangPopup from './tangPopup.vue' import { goodStore } from "@/stores/goods/index.js" import { authStore } from "~/stores/auth/index.js" +import {showMinWindow} from "~/components/liveMinWindow/createMinWindow.js"; -const { quoteStatus, changeStatus, show, auctionData, getSocketData } = liveStore() +const { quoteStatus, changeStatus, show, auctionData, getSocketData ,lastSnapshot,fullLive} = liveStore() const { pageRef } = goodStore() const { userInfo } = authStore() const showTang = ref(false) - +const router = useRouter() // 拖动相关状态 const isDragging = ref(false) const startY = ref(0) @@ -74,7 +75,39 @@ const handleTouchMove = (e) => { const handleTouchEnd = () => { isDragging.value = false } +const captureVideoFrame = () => { + try { + const video = document.querySelector('#J_prismPlayer video') + if (!video) { + console.error('未找到视频元素') + return null + } + const canvas = document.createElement('canvas') + canvas.width = video.videoWidth + canvas.height = video.videoHeight + + const ctx = canvas.getContext('2d') + ctx.drawImage(video, 0, 0, canvas.width, canvas.height) + return canvas.toDataURL('image/jpeg', 0.9) + } catch (error) { + console.error('获取视频截图失败:', error) + return null + } +} +const handleCapture = () => { + const imageUrl = captureVideoFrame() + if (imageUrl) { + lastSnapshot.value=imageUrl + showMinWindow(lastSnapshot.value,{ + onClick:()=>{ + router.replace('/') + fullLive.value=true + console.log('执行') + } + }) + } +} // 组件挂载时添加事件监听 onMounted(() => { if (sidebarRef.value) { @@ -102,7 +135,8 @@ const paySide = computed(() => { }) const goPay = () => { - show.value = true + handleCapture() + router.push('/signature/protocol') } diff --git a/app/pages/liveRoom/index.client.vue b/app/pages/liveRoom/index.client.vue index 8a8ce89..b6e193a 100644 --- a/app/pages/liveRoom/index.client.vue +++ b/app/pages/liveRoom/index.client.vue @@ -14,7 +14,7 @@ import {artworkBuy} from "@/api/goods/index.js" import {useI18n} from 'vue-i18n' import gsap from 'gsap' import {CountUp} from 'countup.js' - +const { t } = useI18n() const countUpRef = ref(null) const nextPriceRef = ref(null) @@ -55,7 +55,7 @@ const initializePlayer = async () => { player.value.on('error', handlePlayerError) } catch (error) { showConfirmDialog({ - message: useI18n().t('live_room.error_mess'), + message: t('live_room.error_mess'), showCancelButton: true }).then(() => { @@ -118,12 +118,12 @@ const goBuy = async () => { buyMoney: String(auctionData.value?.nowAuctionPrice?.nextPrice ?? 0) }) if (res.status === 0) { - message.success(useI18n().t('live_room.success_mess')) + message.success(t('live_room.success_mess')) } } const tipOpen = () => { - message.warning(useI18n().t('live_room.warn_mess')) + message.warning(t('live_room.warn_mess')) } @@ -136,24 +136,24 @@ const tipOpen = () => {
-
{{ $t('live_room.now_price') }}:{{ auctionData?.nowAuctionPrice?.currency }}
+
{{ t('live_room.now_price') }}:{{ auctionData?.nowAuctionPrice?.currency }}
-
{{ $t('live_room.lower_price') }}:{{ auctionData?.nowAuctionPrice?.currency }}
+
{{ t('live_room.lower_price') }}:{{ auctionData?.nowAuctionPrice?.currency }}
{{ - $t('live_room.confirm')` ${auctionData?.nowAuctionPrice?.currency} ${auctionData?.nowAuctionPrice?.nextPrice ?? 0}` + `${t('live_room.confirm')} ${auctionData?.nowAuctionPrice?.currency} ${auctionData?.nowAuctionPrice?.nextPrice ?? 0}` }}
-
- -
{{ $t('live_room.button') }}
+
+ +
{{ t('live_room.button') }}
@@ -167,7 +167,7 @@ const tipOpen = () => { 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">
LOT{{ auctionData.artwork.index }}
{{ auctionData.artwork.name }}
-
{{ $t('live_room.start') }}
+
{{ t('live_room.start') }}
@@ -190,7 +190,7 @@ const tipOpen = () => { /* 定义过渡动画 */ .fade-enter-active { - transition: opacity 1.5s ease; + transition: opacity 1s ease; } .fade-leave-active { diff --git a/app/pages/signature/panel/index.vue b/app/pages/signature/panel/index.vue index 6420047..acbc9ab 100644 --- a/app/pages/signature/panel/index.vue +++ b/app/pages/signature/panel/index.vue @@ -58,10 +58,11 @@ const handleSignatureSubmit = async (data) => { }; const confirm = async () => { const res = await signOffline({ - signImgFileData: data.image + signImgFileData: imgUrl.value }) + if (res.status===0){ - console.log('res', res) + } } const goBack = () => { router.back() diff --git a/app/stores/live/index.js b/app/stores/live/index.js index 8a85533..7d327f1 100644 --- a/app/stores/live/index.js +++ b/app/stores/live/index.js @@ -234,7 +234,7 @@ export const liveStore = createGlobalState(() => { } const changeStatus = () => { if (auctionData.value.artwork.isSelling&&!auctionData.value.artwork.isSoled){ - quoteStatus.value = true + quoteStatus.value = !quoteStatus.value }else { if (quoteStatus.value){ quoteStatus.value = false