From 50b919f5c8c49573ab3314976434afb01ed79fd6 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 04 十一月 2021 16:45:38 +0800
Subject: [PATCH] video close btn desk
---
src/pages/cameraVideo/index/Video.vue | 357 ++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 204 insertions(+), 153 deletions(-)
diff --git a/src/pages/cameraVideo/index/Video.vue b/src/pages/cameraVideo/index/Video.vue
index 278fa15..c8077e2 100644
--- a/src/pages/cameraVideo/index/Video.vue
+++ b/src/pages/cameraVideo/index/Video.vue
@@ -1,120 +1,71 @@
<template>
- <div style="height: 100%;">
+ <div style="width:100%; height: 100%;">
<div class="monitoring-right" ref="videoRight">
- <div class="monitoring-video" ref="monitorVideo">
- <div class="monitoring-video-guid">
- <span
- :class="guid === 1 ? 'iconfont icongongge1 activegongge':'iconfont icongongge1'"
- @click="setGuid(1)"
- ></span>
- <span
- :class="guid === 2 ? 'iconfont icongongge activegongge':'iconfont icongongge'"
- @click="setGuid(2)"
- ></span>
- <span
- :class="guid === 3 ? 'iconfont icongongge2 activegongge':'iconfont icongongge2'"
- @click="setGuid(3)"
- ></span>
- <el-tooltip
- v-show="true"
- :content="`${track ? '鍏抽棴杩借釜': '寮�鍚拷韪�'}`"
- placement="bottom"
- popper-class="atooltip"
- >
+ <div class="main-top">
+ <div class="monitoring-video" ref="monitorVideo">
+ <div class="monitoring-video-guid">
<span
- :class="track ? 'iconfont iconintruder-alarm activegongge':'iconfont iconintruder-alarm'"
- @click="handleTrack"
+ :class="guid === 1 ? 'iconfont icongongge1 activegongge':'iconfont icongongge1'"
+ @click="setGuid(1)"
></span>
- </el-tooltip>
+ <span
+ :class="guid === 2 ? 'iconfont icongongge activegongge':'iconfont icongongge'"
+ @click="setGuid(2)"
+ ></span>
+ <span
+ :class="guid === 3 ? 'iconfont icongongge2 activegongge':'iconfont icongongge2'"
+ @click="setGuid(3)"
+ ></span>
+ <el-tooltip v-if="TreeDataPool.selectedNode.id" :content="`${showArea?'闅愯棌鍖哄煙':'鏌ョ湅鍖哄煙'}`" placement="bottom" popper-class="atooltip">
+ <span :class="showArea?'activegongge':''" class="iconfont iconquyu" @click="toggleShowArea"></span>
+ </el-tooltip>
+ <!-- <span
+ v-if="TreeDataPool.selectedNode.id"
+ class="area-trigger"
+ @click="toggleShowArea"
+ >{{showArea?'闅愯棌鍖哄煙':'鏌ョ湅鍖哄煙'}}</span> -->
+ <!-- <el-tooltip
+ v-show="true"
+ :content="`${track ? '鍏抽棴杩借釜': '寮�鍚拷韪�'}`"
+ placement="bottom"
+ popper-class="atooltip"
+ >
+ <span
+ :class="track ? 'iconfont iconintruder-alarm activegongge':'iconfont iconintruder-alarm'"
+ @click="handleTrack"
+ ></span>
+ </el-tooltip>-->
+ </div>
+ <div class="fixedRatioBox">
+ <div
+ :class="guid === 1 ? 'video-main-box' : 'video-main-box-side'"
+ v-if="visibilityState"
+ >
+ <video-item
+ v-for="(item, index) in TreeDataPool.videoArr"
+ :key="index"
+ :videoGuid="guid"
+ :videoIndex="index"
+ :videoItem="item"
+ :showArea="showArea"
+ :class="[
+ TreeDataPool.activeVideoIndex === index ? 'activeItem' : '',
+ guid === 1 ? 'onlyActiveItem' : ''
+ ]"
+ @click="videoItemClick(index)"
+ ></video-item>
+ </div>
+ </div>
</div>
- <div
- :class="guid === 1 ? 'video-main-box' : 'video-main-box-side'"
- style="width: 100%; height: calc(100% - 52px);"
- v-if="visibilityState"
- >
- <video-item
- v-for="(item, index) in TreeDataPool.videoArr"
- :key="index"
- :videoGuid="guid"
- :videoIndex="index"
- :videoItem="item"
- :class="[
- TreeDataPool.activeVideoIndex === index ? 'activeItem' : '',
- guid === 1 ? 'onlyActiveItem' : ''
- ]"
- @click="videoItemClick(index)"
- ></video-item>
+ <div class="monitoring-task" ref="monitorTask">
+ <video-task ref="taskview" @addToBase="toAdd"></video-task>
</div>
- </div>
- <div class="monitoring-task" ref="monitorTask">
- <video-task ref="taskview" @addToBase="toAdd"></video-task>
</div>
<div class="monitoring-photo">
<video-photo ref="photoview" @addToBase="toAdd"></video-photo>
</div>
</div>
- <hsc-window-style-metal class="windown-model">
- <hsc-window
- v-for="(item, index) in CardList.addBaseList"
- :closeButton="true"
- @closebuttonclick="closeWindow(index)"
- :key="index"
- @update:height="resizeHeight"
- @update:width="resizeWidth"
- style="background:white; height:475px"
- :left="center.x + index * 10"
- :top="center.y + index * 10"
- :resizable="true"
- positionHint="center"
- :isScrollable="true"
- :minWidth="662"
- :minHeight="479"
- :maxWidth="10000"
- :maxHeight="7000"
- :height="defaultHeight"
- :width="defaultWidth"
- >
- <div class="addToBase">
- <div class="topLabel">鍔犲叆搴曞簱</div>
- <div class="items">
- <div class="lable">
- <p>榛戝悕鍗� ></p>
- </div>
- <div class="baseList">
- <el-checkbox-group v-model="VideoPhotoData.selectBlacks" @change="blackAngWhite">
- <div class="base" v-for="(item, index) in VideoPhotoData.blackList" :key="index">
- <el-checkbox
- :label="item.value"
- :title="item.title"
- :disabled="item.disabled"
- >{{item.title}}</el-checkbox>
- </div>
- </el-checkbox-group>
- </div>
- </div>
- <div class="items">
- <div class="lable">
- <p>鐧藉悕鍗� ></p>
- </div>
- <div class="baseList">
- <el-checkbox-group v-model="VideoPhotoData.selectWhites" @change="blackAngWhite">
- <div class="base" v-for="(item, index) in VideoPhotoData.whiteList" :key="index">
- <el-checkbox
- :label="item.value"
- :title="item.title"
- :disabled="item.disabled"
- >{{item.title}}</el-checkbox>
- </div>
- </el-checkbox-group>
- </div>
- </div>
- <div class="buttons">
- <el-button type="primary" @click="saveAddBase(item, index)">淇濆瓨</el-button>
- <el-button type="default" @click="closeWindow(index)">鍙栨秷</el-button>
- </div>
- </div>
- </hsc-window>
- </hsc-window-style-metal>
+
</div>
</template>
@@ -131,7 +82,7 @@
VideoTask,
VideoPhoto
},
- data() {
+ data () {
return {
guid: 1,
center: "",
@@ -142,12 +93,12 @@
traceTimer: null,
tracePubUrl: `${location.protocol === "https" ? "wss" : "ws"}://${location.host}/track`,
websocket: null,
- visibilityState: true
+ visibilityState: true,
+ showArea: false,
};
},
- created() {
+ created () {
console.log("befor created")
- debugger
// this.TreeDataPool.clean();
// this.TreeDataPool.fetchTreeData();
// this.guid = sessionStorage.guid ? Number(sessionStorage.guid) : this.guid;
@@ -161,11 +112,12 @@
console.log("created")
},
- mounted() {
+ mounted () {
document.addEventListener("visibilitychange", this.visibilitychange, false);
this.$nextTick(() => {
- window.addEventListener("resize", this.getRightWidth);
- this.getRightWidth();
+ window.addEventListener("resize", this.resizeMonitorTask);
+ //this.getRightWidth();
+ this.resizeMonitorTask();
})
this.getCenter();
this.blackAngWhite();
@@ -177,7 +129,7 @@
// console.log(list, '宸插畬鎴愮殑鏈湴瑙嗛', this.TreeDataPool.localVedioList)
this.TreeDataPool.localVedioList = list;
},
- beforeDestroy() {
+ beforeDestroy () {
window.removeEventListener("resize", this.getRightWidth);
this.CardList.details = [];
window.clearInterval(this.trackTimer);
@@ -187,7 +139,7 @@
},
watch: {
"TreeDataPool.videoArr": function (newArry) {
- console.log('newArry',newArry)
+ console.log('newArry', newArry)
const cameras = this.filterNodes(newArry);
this.getActiveIndex();
this.$refs.taskview.showTasks(cameras);
@@ -199,12 +151,12 @@
"VideoPhotoData.selectWhites": function (value) {
this.blackAngWhite();
},
- "TreeDataPool.showTreeBox"(value) {
+ "TreeDataPool.showTreeBox" (value) {
this.getRightWidth();
}
},
methods: {
- handleTrack() {
+ handleTrack () {
this.track = !this.track;
if (!this.track) {
window.clearInterval(this.trackTimer);
@@ -231,7 +183,7 @@
}, 1 * 1000);
}
},
- videoItemMonitor() {
+ videoItemMonitor () {
this.websocket.send("ping");
let cache = this.traceCache
@@ -254,7 +206,7 @@
}
}
},
- initTrackWebsocket() {
+ initTrackWebsocket () {
if (typeof (WebSocket) === "undefined") {
alert("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔socket")
} else {
@@ -265,10 +217,10 @@
this.websocket.onmessage = this.recvieTrackMessage
}
},
- websocketonopen() { //杩炴帴寤虹珛涔嬪悗鎵цsend鏂规硶鍙戦�佹暟鎹�
+ websocketonopen () { //杩炴帴寤虹珛涔嬪悗鎵цsend鏂规硶鍙戦�佹暟鎹�
this.websocket.send("sub")
},
- tracking() {
+ tracking () {
getCameraPlayList().then(data => {
if (data && data.length) {
data.forEach(ins => {
@@ -287,7 +239,7 @@
}
})
},
- recvieTrackMessage(e) {
+ recvieTrackMessage (e) {
let dataJson = JSON.parse(e.data)
let cache = this.traceCache
let camera = dataJson.camera
@@ -327,7 +279,7 @@
// 鏈彂鐜版挱鏀捐褰�
this.newPlayerInViewBox(camera)
},
- newPlayerInViewBox(id) {
+ newPlayerInViewBox (id) {
// 鏂板鎾斁绐楀彛
let camera = this.TreeDataPool.getCameraInfoById(id)
let emptyIndex = -1;
@@ -351,7 +303,7 @@
this.TreeDataPool.setVideoArr(emptyIndex, camera, this);
}
},
- replacePlayer(id, oldCameraId) {
+ replacePlayer (id, oldCameraId) {
let camera = this.TreeDataPool.getCameraInfoById(id)
// console.log("update:", camera.name)
// 鏇挎崲鎾斁鍣�
@@ -370,7 +322,7 @@
return false
},
- closePlayer(id) {
+ closePlayer (id) {
for (let i = 0; i < this.TreeDataPool.videoArr.length; i++) {
// eslint-disable-next-line
if (
@@ -384,7 +336,7 @@
}
}
},
- visibilitychange() {
+ visibilitychange () {
switch (document.visibilityState) {
case "hidden":
this.visibilityState = false;
@@ -394,7 +346,7 @@
break;
}
},
- blackAngWhite() {
+ blackAngWhite () {
if (this.VideoPhotoData.selectBlacks.length > 0) {
for (let i = 0; i < this.VideoPhotoData.whiteList.length; i++) {
//this.VideoPhotoData.whiteList[i].disabled = true
@@ -420,16 +372,24 @@
}
}
},
- closeWindow(index) {
+ closeWindow (index) {
this.CardList.addBaseList.splice(index, 1);
},
- getRightWidth() {
+ getVideoHeight () {
+ let h = this.$refs.monitorVideo.offsetHeight;
+ this.$refs.monitorTask.style.height = h + 'px';
+ },
+ resizeMonitorTask () {
+ this.getRightWidth();
+ this.getVideoHeight();
+ },
+ getRightWidth () {
let w = this.$refs.videoRight.offsetWidth;
// console.log("w鏄細", w,this.$refs.monitorVideo.offsetWidth);
this.$refs.monitorTask.style.width = (w - this.$refs.monitorVideo.offsetWidth - 40) + 'px'
// console.log("鍙充晶浠诲姟鐨勫搴︼細", this.$refs.monitorTask.style.width)
},
- filterNodes(selectArry) {
+ filterNodes (selectArry) {
let nodes = [];
selectArry.forEach(i => {
if (i && nodes.indexOf(i.id) < 0) {
@@ -438,26 +398,26 @@
});
return nodes;
},
- videoItemClick(index) {
+ videoItemClick (index) {
this.TreeDataPool.activeVideoIndex = index;
this.TreeDataPool.activeForceChoose = true;
},
- toAdd(item) {
+ toAdd (item) {
this.CardList.addBaseList.push(item)
},
- getCenter() {
+ getCenter () {
this.center = {
x: document.documentElement.clientWidth / 2 - 250,
y: document.documentElement.clientHeight / 2 - 200
};
},
- resizeWidth(w) {
+ resizeWidth (w) {
this.defaultWidth = w;
},
- resizeHeight(h) {
+ resizeHeight (h) {
this.defaultHeight = h;
},
- saveAddBase(item, index) {
+ saveAddBase (item, index) {
if (this.VideoPhotoData.selectBlacks.length === 0 && this.VideoPhotoData.selectWhites.length === 0) {
this.$notify({
title: "娉ㄦ剰",
@@ -487,7 +447,7 @@
this.VideoPhotoData.selectWhites = []
})
},
- getActiveIndex() {
+ getActiveIndex () {
this.TreeDataPool.videoArr.length = Math.pow(this.guid, 2);
let nullVideoIndex = "";
for (let i = 0; i < this.TreeDataPool.videoArr.length; i++) {
@@ -516,7 +476,7 @@
}
}
},
- setGuid(value) {
+ setGuid (value) {
clearTimeout(this.trackTimer);
if (value < this.guid && this.TreeDataPool.activeVideoIndex > value) {
@@ -539,9 +499,12 @@
sessionStorage.guid = this.guid;
sessionStorage.activeIndex = this.TreeDataPool.activeVideoIndex;
this.getActiveIndex();
+ },
+ toggleShowArea () {
+ this.showArea = !this.showArea;
}
},
- destroyed() {
+ destroyed () {
window.removeEventListener("resize", this.getRightWidth);
this.CardList.details = [];
this.CardList.addBaseList = [];
@@ -556,20 +519,23 @@
.monitoring-right {
width: 100%;
height: 100%;
- float: right;
+ min-width: 981px;
+ //float: right;
box-sizing: border-box;
padding: 10px;
background-color: #e9ebf2;
+ .main-top {
+ margin-bottom: 14px;
+ display: flex;
+ justify-content: space-between;
+ }
.monitoring-video {
width: 70.5%;
- //min-width: 800px;
min-width: 740px;
max-width: 1208px;
- height: 75%;
- float: left;
- padding: 0px, 10px 10px 10px;
+ height: 98%;
+ //float: left;
box-sizing: border-box;
- border: 1px solid #e4e7ed;
// box-shadow: #e4e7ed 0px 0px 9px inset;
border-radius: 5px;
.activeItem {
@@ -607,16 +573,26 @@
padding-left: 12px;
cursor: pointer;
}
+ .area-trigger {
+ font-size: 16px;
+ }
+ }
+ .fixedRatioBox {
+ padding-top: 56.3%;
+ box-sizing: border-box;
+ position: relative;
+ > div {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ }
}
}
.monitoring-task {
- // @media screen and (max-width: 1700px){
-
- // }
- width: calc(29.5% - 10px);
+ //width: calc(29.5% - 10px);
+ width: calc(34% - 10px);
//width: auto;
- // width: 23%;
- height: 73%;
background-color: #fff;
float: left;
margin: 0px 0px 0px 10px;
@@ -629,15 +605,90 @@
.monitoring-photo {
width: 100%;
- height: calc(25% + 10px);
+ height: calc(25% + 32px);
background-color: #fff;
float: left;
padding: 10px;
- margin-top: -10px;
+ //margin-top: -10px;
box-sizing: border-box;
border: 1px solid #e4e7ed;
// box-shadow: #e4e7ed 0px 0px 9px inset;
border-radius: 5px;
}
}
+.titlebar {
+ height: 10px !important;
+ background: #fff !important;
+ .button {
+ position: absolute;
+ font-size: 25px !important;
+ right: 10px;
+ top: 10px;
+ z-index: 3;
+ }
+}
+.addToBase {
+ width: 98%;
+ height: 430px;
+ position: relative;
+ .topLabel {
+ margin-top: 20px;
+ height: 40px;
+ border-bottom: 1px solid #eee;
+ font-family: PingFangSC-Medium;
+ font-size: 20px;
+ font-weight: 600;
+ line-height: 1rem;
+ color: #222222;
+ text-align: left;
+ margin-left: 15px;
+ }
+ .items {
+ width: 100%;
+ height: auto;
+ max-height: 35%;
+ overflow-y: auto;
+ margin: 20px 0px;
+ .lable {
+ width: 15%;
+ margin-top: 10px;
+ float: left;
+ //font-family: PingFangSC-Medium;
+ font-size: 14px;
+ font-weight: 600;
+ }
+ .baseList {
+ width: 85%;
+ height: 100%;
+ float: left;
+
+ // display: flex;
+ // justify-content: flex-start;
+ .base {
+ //flex-wrap: wrap;
+ width: calc(33% - 10px);
+ padding: 0px 5px;
+ line-height: 30px;
+ float: left;
+ text-align: left;
+ font-size: 12px !important;
+ .el-checkbox {
+ width: 100%;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ .el-checkbox__label {
+ display: inline !important;
+ }
+ }
+ }
+ }
+ }
+ .buttons {
+ position: absolute;
+ right: 0px;
+ bottom: 15px;
+ }
+}
</style>
--
Gitblit v1.8.0