This commit is contained in:
duanliang
2025-04-22 22:05:44 +08:00
parent d8a7a0f53e
commit 3bff33bf03
21 changed files with 318 additions and 119 deletions

View File

@@ -112,6 +112,10 @@
<source type="application/x-mpegURL" />
</video>
<div class="action-box">
<div class="action-item">
<span class="item-sc" @click="handleCollect(thisVideo.cameraIndexCode, thisVideo.isCollect, index)" v-if="thisVideo.isCollect==0">关注</span>
<span class="item-sc" @click="handleCollect(thisVideo.cameraIndexCode, thisVideo.isCollect, index)" v-else="thisVideo.isCollect==1">取消关注</span>
</div>
<div class="action-item">
<img src="@/assets/images/plus.png" title="焦距变大" @click="handleAction(Z00M_IN)" />
<span>聚焦</span>
@@ -170,7 +174,7 @@
</div>
</div>
</div>
<VideoDialog v-model="show" :cameraIndexCode="cameraIndexCode" :isCollect="isCollect" :src="videoSrc" />
<VideoDialog v-model="show" :cameraIndexCode="cameraIndexCode" :isDiy="isDiy" :isCollect="isCollect" :src="videoSrc" />
</template>
<script setup>
@@ -202,6 +206,7 @@
children: 'children'
}
let isCollect = ref(0)
let isDiy = ref(0)
let command = ref('')
let videoList = ref([])
let navList = ref([])
@@ -346,6 +351,7 @@
regionList.value[e].show = !regionList.value[e].show
}
const handleCamera = async (itemCode,resource) => {
console.log(resource,'resourceresourceresourceresourceresourceresource')
show.value = true
let res = await getPreviewUrlApi({
type: 'hls',
@@ -353,6 +359,7 @@
})
cameraIndexCode.value = itemCode;
isCollect.value = resource.isCollect
isDiy.value = resource.isDiy
videoSrc.value = res.data.url
}
const handleCollect = async (id, status, index) => {
@@ -361,8 +368,10 @@
isCollect: status == 0 ? 1 : 0
})
if (status == 0) {
thisVideo.value.isCollect=1
videoList.value[index].isCollect = 1
} else {
thisVideo.value.isCollect=0
videoList.value[index].isCollect = 0
}
pubSub.publish('videoCollect', id)
@@ -426,9 +435,9 @@
hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play()
})
console.log(7778888)
hls.on(Hls.Events.ERROR, (event, data) => {
console.error('HLS 播放器遇到错误:', data);
// console.error('HLS 播放器遇到错误:', data);
// hls.startLoad();
// initVideo()
// 根据错误类型进行处理
if (data.fatal) {
@@ -444,7 +453,7 @@
default:
console.log('无法恢复的错误,销毁播放器');
hls.destroy();
// hls.destroy();
break;
}
}
@@ -478,14 +487,16 @@
cameraName: cameraName.value,
businessScenicArea: params.businessScenicArea
})
console.log(params.businessScenicArea,'测收拾收拾')
regionList.value = res.data
regionList.value.videoResources = res.data.videoResources
regionList.value[0].show = true
if(search=='search'){
regionList.value.forEach((item,index)=>{
item.show = true
})
}
console.log(regionList.value, ' regionList.value')
}
const onMonitorChange = () => {
@@ -506,6 +517,20 @@
getVideoType()
getVideoRegions()
onMonitorChange()
pubSub.subscribe('videoIsDiy', (msg, data) => {
console.log(data,'收藏 ++++++++++++++')
if(data.isDiy){
if(current.value==navList.value.length){
getColletList()
}
}else{
videoList.value.forEach((item,index)=>{
if(item.cameraIndexCode==data.cameraIndexCode){
videoList.value.splice(index,1)
}
})
}
})
})
onUnmounted(() => {
clearHlsRefs()