You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
duoji-frontend/src/views/realTimeMonitoring/index.vue

130 lines
4.0 KiB
Vue

6 years ago
<template>
<div class="realTime bg-white">
<a-tabs default-active-key="1" slot="headerContent" v-model="tabKey" @change="tabsChange">
4 years ago
<a-tab-pane :key="item.streetId.toString()" :tab="item.streetName" v-for="item in realTimeListData"></a-tab-pane>
</a-tabs>
4 years ago
<!-- {{cameras.length}} {{ selectTab.videoStyleRow }} * {{ selectTab.videoStyleColumn }}-->
<a-row :gutter="20">
<a-col
v-for="(item, index) in cameras.slice(0, selectTab.videoStyleRow * selectTab.videoStyleColumn)"
:span="24 / selectTab.videoStyleColumn"
:key="index"
:style="{
height: videoHeight,
marginBottom: ((selectTab.videoStyleRow * selectTab.videoStyleColumn - index - 1) >= selectTab.videoStyleColumn) ? '20px': 0
}"
>
4 years ago
<video :id=item.id autoplay controls muted ></video>
<!-- <video-player
4 years ago
v-if="showVideo"
@showModel="showModel(item)"
:src="item.m3u8">
4 years ago
</video-player> -->
4 years ago
</a-col>
</a-row>
</div>
6 years ago
</template>
6 years ago
<script>
4 years ago
import WebRtcPlayer from "./webrtcplayer"
6 years ago
export default {
name: "historyMonitoring",
4 years ago
components: {
4 years ago
//VideoPlayer
4 years ago
},
data() {
return {
realTimeListData: [],
url: "722e6f04-bb3c-34b1-bcc7-ae9f6cd72e68",
tabKey: "0",
path: [],
player: "",
visible: false,
4 years ago
modelData: [],
clientHeight: 0,
showVideo: false,
};
},
4 years ago
computed: {
selectTab() {
return (this.realTimeListData.filter(item=> item.streetId == this.tabKey)[0] || {})
},
cameras() {
return this.selectTab.cameras || [];
},
videoHeight() {
return (( this.clientHeight - this.selectTab.videoStyleRow * 20 )/ this.selectTab.videoStyleRow ) + 'px'
},
},
inject: ['reload'],
mounted() {
this.getRealTimeList()
if (sessionStorage.getItem('tabKey') == null) {
sessionStorage.setItem('tabKey', 0)
}
4 years ago
this.tabKey = sessionStorage.getItem('tabKey');
this.getClientHeight();
4 years ago
4 years ago
// 监听界面尺寸变化
// window.onresize = () => {
// this.getClientHeight();
// }
},
4 years ago
destroyed() {
// window.onresize = null;
},
methods: {
4 years ago
getClientHeight() {
this.clientHeight = this.$el.clientHeight - 80;
},
getRealTimeList(){
4 years ago
this.showVideo = false;
this.$api.httpApi.getRealTimeList({
data: {}
}).then(res => {
if(res.code == 200) {
4 years ago
this.realTimeListData = res.data.reverse();
this.showVideo = true;
4 years ago
this.autoPlay()
}
}).catch(err => {
console.log(err)
})
},
4 years ago
5 years ago
tabsChange(key) {
sessionStorage.setItem('tabKey', key)
this.reload()
},
5 years ago
showModel(item) {
this.$nextTick(() => {
this.$router.push({name: "realTimeMonitoringModel", query: {modelData: item}});
})
},
4 years ago
autoPlay(){
//WebRtcPlayer.setServer('localhost:8083');
console.log("here")
console.log(this.realTimeListData)
for(var a of this.realTimeListData){
console.log(a)
for (let b of a.cameras){
console.log("www")
console.log(b.id)
let player = new WebRtcPlayer(b.id.toString(),'H264_AAC');
player.load('H264_AAC');
}
}
}
},
6 years ago
};
</script>
4 years ago
<style lang='scss' scoped>
.realTime {
padding: 24px;
}
</style>