From 50ee885b7498008980b2ee8673e8d54085b32c82 Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Wed, 25 Mar 2026 14:44:25 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=AE=9E=E7=8E=B0=E7=AB=96=E5=B1=8F=E6=98=AF?= =?UTF-8?q?=E7=AB=96=E5=B1=8F=EF=BC=8C=E6=A8=AA=E5=B1=8F=E6=98=AF=E6=A8=AA?= =?UTF-8?q?=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components-diy/diy-video-list.vue | 75 ++++++++++++++++++++++- components-diy/diy-video.vue | 84 +++++++++++++++++++++----- pages_tool/ai-chat/ai-chat-message.vue | 38 ++++++++++++ 3 files changed, 180 insertions(+), 17 deletions(-) diff --git a/components-diy/diy-video-list.vue b/components-diy/diy-video-list.vue index c60f3b1..687588a 100644 --- a/components-diy/diy-video-list.vue +++ b/components-diy/diy-video-list.vue @@ -53,9 +53,19 @@ - - + + @@ -126,12 +136,38 @@ export default { isIndicatorDots() { return this.value.carousel.type != 'hide' && 1 != Math.ceil(this.value.list.length / (this.value.pageCount * this.value.rowCount)); + }, + + // 弹窗视频容器样式 + popupVideoStyle() { + let style = 'position:fixed;width:100%;left:0;'; + + if (this.popupVideoRatio) { + // 根据视频比例设置位置 + if (this.popupVideoRatio === 'portrait') { + // 竖屏视频:居中显示,使用9/16比例 + style += 'top:50%;transform:translateY(-50%);'; + style += 'aspect-ratio: 9 / 16;'; + } else { + // 横屏视频:靠近顶部显示,使用16/9比例 + style += 'top:20%;'; + style += 'aspect-ratio: 16 / 9;'; + } + } else { + // 默认:居中显示,使用竖屏比例 + style += 'top:50%;transform:translateY(-50%);'; + style += 'aspect-ratio: 9 / 16;'; + } + + return style; } }, methods: { // 显示视频播放弹窗 showVideo(item) { this.video_url = item.videoUrl; + // 重置视频比例为null,等待新的检测结果 + this.popupVideoRatio = null; this.$refs.videoPopup.open(); }, @@ -139,6 +175,39 @@ export default { imgError(index) { // 图片加载失败的处理逻辑 console.log('图片加载失败:', index); + }, + + // 弹窗视频加载完成事件 + onPopupVideoLoaded(event) { + this.$nextTick(() => { + let width = 0; + let height = 0; + + // H5 端:获取真实视频宽高 + // #ifdef H5 + const video = this.$refs.popupVideoRef; + if (video) { + width = video.videoWidth || 0; + height = video.videoHeight || 0; + } + // #endif + + // 微信小程序端:通过事件对象获取视频宽高 + // #ifdef MP-WEIXIN + if (event && event.detail) { + width = event.detail.width || 0; + height = event.detail.height || 0; + } + // #endif + + if (width && height) { + this.popupVideoRatio = width >= height ? 'landscape' : 'portrait'; + console.log(`弹窗视频宽高比检测: ${width}x${height}, 比例: ${this.popupVideoRatio}`); + } else { + // 获取失败,默认竖屏 + this.popupVideoRatio = 'portrait'; + } + }); } } } diff --git a/components-diy/diy-video.vue b/components-diy/diy-video.vue index ecb8f61..da4d5a8 100644 --- a/components-diy/diy-video.vue +++ b/components-diy/diy-video.vue @@ -1,8 +1,9 @@