Fix:2886 【商城小程序】农民店铺-多个视频资讯可同时播放(优化为点击下一个视频播放时,上一个视频自动停止)
This commit is contained in:
@@ -163,7 +163,7 @@ export default {
|
||||
name: '',
|
||||
page: 1,
|
||||
typeList: [],
|
||||
typeIndex: 0,
|
||||
typeIndex: -1,
|
||||
// 当前选中的类型
|
||||
currType: {},
|
||||
cityName: '',
|
||||
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
posterUrl: '',
|
||||
activeties: [],
|
||||
id: '',
|
||||
actived: -1,
|
||||
actived: 1,
|
||||
tabs: [
|
||||
{name: '项目', value: 1},
|
||||
{name: '文化', value: 2},
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
:loop="false"
|
||||
object-fit="contain"
|
||||
play-btn-position="center"
|
||||
id="coverVideo"
|
||||
class="video"
|
||||
/>
|
||||
</view>
|
||||
@@ -230,7 +231,8 @@
|
||||
play-btn-position="center"
|
||||
:show-fullscreen-btn="false"
|
||||
class="video-item"
|
||||
@play="infoItemViewClick(item)"
|
||||
:id="'video-item' + index"
|
||||
@play="infoItemViewClick(item, index)"
|
||||
/>
|
||||
</view>
|
||||
<view v-else>
|
||||
@@ -363,7 +365,8 @@ export default {
|
||||
activeIndex: 0,
|
||||
isLoadInfoListSuccess: false,
|
||||
picColumnWidth: '325rpx',
|
||||
infoArray: []
|
||||
infoArray: [],
|
||||
videoPlayers: []
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
@@ -440,7 +443,26 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
infoItemViewClick(item) {
|
||||
infoItemViewClick(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()
|
||||
})
|
||||
}
|
||||
}
|
||||
const params = {
|
||||
countyFamousNewsId: item.id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user