From 27c95042d48942a24c95d0b9c6cd8889046eed91 Mon Sep 17 00:00:00 2001 From: modendeveloper Date: Wed, 18 Dec 2024 23:23:47 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A2887=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E6=9D=91=E5=B1=8B=E8=B5=84?= =?UTF-8?q?=E8=AE=AF-=E5=A4=9A=E4=B8=AA=E8=A7=86=E9=A2=91=E8=B5=84?= =?UTF-8?q?=E8=AE=AF=E5=8F=AF=E5=90=8C=E6=97=B6=E6=92=AD=E6=94=BE=EF=BC=88?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BA=E7=82=B9=E5=87=BB=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E4=B8=AA=E8=A7=86=E9=A2=91=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagesInn/inn/innHome.vue | 3 ++- .../views/famousQianxianVillageShop.vue | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pagesInn/inn/innHome.vue b/pagesInn/inn/innHome.vue index 9010c98..b6dace8 100644 --- a/pagesInn/inn/innHome.vue +++ b/pagesInn/inn/innHome.vue @@ -484,7 +484,8 @@ export default { isLoadGoodListoSuccess: false, isLoadInfoListSuccess: false, pageKeyId: '', - shareImg: '' + shareImg: '', + videoPlayers: [] } }, // 必须在页面加 onPageScroll(e){} ,才能滑动显示背景 diff --git a/pkg_product/views/famousQianxianVillageShop.vue b/pkg_product/views/famousQianxianVillageShop.vue index f56a084..56a11ad 100644 --- a/pkg_product/views/famousQianxianVillageShop.vue +++ b/pkg_product/views/famousQianxianVillageShop.vue @@ -33,6 +33,7 @@ object-fit="contain" play-btn-position="center" class="video" + id="coverVideo" /> @@ -175,6 +176,8 @@ controls play-btn-position="center" class="video-item" + :id='"video-item" + index' + @play="handleVideo(item, index)" /> @@ -239,7 +242,8 @@ export default { // 资讯 infoArray: [], isLoadInfoListSuccess: false, - pageKeyId: '' + pageKeyId: '', + videoPlayers: [] } }, onPageScroll(e) { @@ -252,6 +256,27 @@ export default { this.getInfoReq() }, methods: { + handleVideo(item, index) { + if(item.type === 2) { + const coverCtx = uni.createVideoContext('coverVideo', this) + coverCtx.pause() + const playerId = 'video-item' + index + if(this.videoPlayers.includes(playerId)) { + this.videoPlayers.forEach(player => { + if(player === playerId) return + const playerCtx = uni.createVideoContext(player, this) + playerCtx.pause() + }) + } { + this.videoPlayers.push(playerId) + this.videoPlayers.forEach(player => { + if(player === playerId) return + const playerCtx = uni.createVideoContext(player, this) + playerCtx.pause() + }) + } + } + }, getShopDetailReq() { const _this = this getCountyFamousVillageDetail(_this.id).then((res) => {