jhprjv2/ruoyi-ui/src/views/video/videoConfig/videoPlayDrawer.vue

158 lines
4.1 KiB
Vue
Raw Normal View History

2023-08-26 18:08:05 +08:00
<template>
<div class="app-container">
<el-drawer
v-bind="$attrs"
v-if="onOpen"
v-on="$listeners"
@opened="onOpen"
@close="onClose"
style="padding-left: 20px"
>
2023-08-26 22:21:19 +08:00
<div class="videoView" v-if="showVideoView0">
<H265Player :url="url0" @on-error="handleOnError0" />
2023-08-26 18:08:05 +08:00
</div>
2023-08-26 22:21:19 +08:00
<div class="videoView videoViewError" v-if="showVideoView0 == false">
设备0通道链接失败请及时检查
2023-08-26 18:08:05 +08:00
</div>
2023-08-26 22:21:19 +08:00
<div class="videoView" v-if="showVideoView1">
<H265Player :url="url1" @on-error="handleOnError1" />
2023-08-26 18:08:05 +08:00
</div>
2023-08-26 22:21:19 +08:00
<div class="videoView videoViewError" v-if="showVideoView1 == false">
设备1通道链接失败请及时检查
</div>
<div class="videoView" v-if="showVideoView2">
<H265Player :url="url2" @on-error="handleOnError2" />
</div>
<div class="videoView videoViewError" v-if="showVideoView2 == false">
设备2通道链接失败请及时检查
</div>
<div class="videoView" v-if="showVideoView3">
<H265Player :url="url3" @on-error="handleOnError3" />
</div>
<div class="videoView videoViewError" v-if="showVideoView3 == false">
设备3通道链接失败请及时检查
2023-08-26 18:08:05 +08:00
</div>
</el-drawer>
</div>
</template>
<script>
2023-08-26 22:21:19 +08:00
import { getVideoPassage, editPassageState } from "@/api/video/videoConfig";
2023-08-26 18:08:05 +08:00
import H265Player from "vue-h265-player";
export default {
name: "videoPlay",
components: {
H265Player,
},
props: {
formData: {
videoDvrNumber: String,
},
},
data() {
return {
request:
"http://111.21.209.230:7086/live/cameraid/{{videoDvrNumber}}${{passage}}/substream/2.m3u8",
url0: "",
url1: "",
url2: "",
url3: "",
2023-08-26 22:21:19 +08:00
showVideoView0: true,
showVideoView1: true,
showVideoView2: true,
showVideoView3: true,
videoPassageList: [],
2023-08-26 18:08:05 +08:00
};
},
computed: {},
watch: {
formData: {
handler(value) {
this.formData = value;
this.request = this.request.replace(
"{{videoDvrNumber}}",
this.formData.videoDvrNumber
);
this.initVideo();
},
2023-08-26 22:21:19 +08:00
immediate: true,
2023-08-26 18:08:05 +08:00
},
},
created() {},
mounted() {},
beforeDestroy() {},
methods: {
onOpen() {},
onClose() {},
2023-08-26 22:21:19 +08:00
handleOnError0(error) {
this.showVideoView0 = false;
console.log("error: ", error);
this.updatePassageState(this.videoPassageList[0].id);
},
handleOnError1(error) {
this.showVideoView1 = false;
2023-08-26 18:08:05 +08:00
console.log("error: ", error);
2023-08-26 22:21:19 +08:00
this.updatePassageState(this.videoPassageList[1].id);
},
handleOnError2(error) {
this.showVideoView2 = false;
console.log("error: ", error);
this.updatePassageState(this.videoPassageList[2].id);
},
handleOnError3(error) {
this.showVideoView3 = false;
console.log("error: ", error);
this.updatePassageState(this.videoPassageList[3].id);
2023-08-26 18:08:05 +08:00
},
//查询视频通道
initVideo() {
getVideoPassage(this.formData.videoDvrNumber).then((response) => {
let data = response.data;
2023-08-26 22:21:19 +08:00
this.videoPassageList = data;
2023-08-26 18:08:05 +08:00
data.forEach((it, idx) => {
if (idx == 0) {
this.url0 = this.request.replace("{{passage}}", it.passageValue);
}
if (idx == 1) {
this.url1 = this.request.replace("{{passage}}", it.passageValue);
}
if (idx == 2) {
this.url2 = this.request.replace("{{passage}}", it.passageValue);
}
if (idx == 3) {
this.url3 = this.request.replace("{{passage}}", it.passageValue);
}
});
});
},
2023-08-26 22:21:19 +08:00
updatePassageState(id) {
let param = {
id: id,
videoDvrNumber: this.formData.videoDvrNumber,
passageState: "2",
};
2023-08-28 01:11:14 +08:00
//editPassageState(param);
2023-08-26 22:21:19 +08:00
},
2023-08-26 18:08:05 +08:00
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/mixin.scss";
::v-deep .el-drawer__header {
display: none;
}
.videoView {
color: aliceblue;
float: left;
width: 50%;
height: 50%;
}
2023-08-26 22:21:19 +08:00
.videoViewError {
background-color: #575e65;
text-align: center;
line-height: 324px;
}
2023-08-26 18:08:05 +08:00
</style>