From 78e0937fca2bda9516e80559f10a6963a9b845b6 Mon Sep 17 00:00:00 2001 From: modendeveloper Date: Wed, 18 Dec 2024 23:34:57 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E5=A4=9A=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=92=AD=E6=94=BE=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/town/components/information.vue | 35 ++++++++++++++++++++++++--- pages/town/index.vue | 7 +++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/pages/town/components/information.vue b/pages/town/components/information.vue index c2967d5..50dc03f 100644 --- a/pages/town/components/information.vue +++ b/pages/town/components/information.vue @@ -29,7 +29,15 @@ /> - + @@ -83,7 +91,8 @@ export default { data() { return { webUrl: this.$VUE_APP_RESOURCES_URL, - actives: this.infoArray + actives: this.infoArray, + videoPlayers: [] } }, watch: { @@ -92,7 +101,27 @@ export default { } }, methods: { - infoItemViewClick(item) { + infoItemViewClick(item, index) { + if(item.contentType === 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() + }) + } + this.$emit('video') + } uni.$u.debounce(() => { watchTownActive({ id: item.id }).finally(() => { this.actives.forEach(info => { diff --git a/pages/town/index.vue b/pages/town/index.vue index a68f076..22931b8 100644 --- a/pages/town/index.vue +++ b/pages/town/index.vue @@ -5,6 +5,7 @@ - + @@ -115,6 +116,10 @@ export default { this.getActive() }, methods: { + handleVideo() { + const videoCtx = uni.createVideoContext('videoCover', this) + videoCtx.pause() + }, shareImg() { uni.showLoading() shareTown(this.id).then(res => {