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