Fix:2876 【管理后台】地标好物资讯增加上传视频功能,前端地标好物资讯也需要调整为可以显示视频

This commit is contained in:
modendeveloper
2024-12-19 00:26:18 +08:00
parent ffa827c137
commit 020bdadcae
2 changed files with 40 additions and 2 deletions
+39 -1
View File
@@ -20,13 +20,25 @@
</view>
</view>
<view class="info-item-body">
<video
v-if="item.type === 2"
@play="infoItemViewClick(item, index)"
play-btn-position="center"
:show-fullscreen-btn="false"
class="video-item v12-mt-0"
:src="item.video"
controls
:id="'video-item' + index"
:poster="item.video + '?vframe/jpg/offset/1'"></video>
<img-box
v-else
:imgList="item.images"
:num="item.images.length"
:img-radius="10"
style="width: 100%"
@click="infoItemViewClick(item)"
/>
</view>
<view class="info-item-bottom">
<view class="time">
@@ -101,7 +113,8 @@ export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
infoArray: []
infoArray: [],
videoPlayers:[]
}
},
watch: {
@@ -138,6 +151,26 @@ export default {
})
},
infoItemViewClick(item) {
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()
})
}
this.$emit('video')
}
uni.$u.debounce(() => {
hadView({ landmarkNewsId: item.id }).finally(() => {
this.infoArray.map(info => {
@@ -152,6 +185,11 @@ export default {
};
</script>
<style lang="scss" scoped>
.video-item {
width: 100%;
height: 400rpx;
border-radius: 10rpx;
}
.info-wrapper{
padding: 20px 10px;
}
+1 -1
View File
@@ -34,7 +34,7 @@
@play="infoItemViewClick(item, index)"
play-btn-position="center"
:show-fullscreen-btn="false"
class="kd-cover v12-mt-0"
class="video-item v12-mt-0"
:src="item.images[0]"
controls
:id="'video-item' + index"