Browse Source

添加视频标签弹窗放大按钮,修改popup样式

master
chendingwei 2 years ago
parent
commit
dfe65ef35f
  1. 26
      src/utils/popup.ts
  2. 7
      src/views/page/Aside/cameraRightMenu.vue
  3. 2
      src/views/page/Model/LabelEditModel.vue
  4. 41
      src/views/page/cameraCenter.vue
  5. 171
      src/views/page/cameraWindow.vue
  6. 2553
      yarn.lock

26
src/utils/popup.ts

@ -56,31 +56,7 @@ export default function popup(
color: "white",
position: 'fixed',
},
btn: h("div", null, [
btnAText == "" ? null : h(
Button,
{
type: "primary",
size: "small",
danger: true,
onClick: btnAEvent,
},
btnAText
),
btnBText == "" ? null : h(
Button,
{
type: "primary",
size: "small",
style: {
marginLeft: "7px",
},
danger: true,
onClick: btnBEvent,
},
btnBText
),
]),
closeIcon: h(CloseOutlined, {
style: {
color:"#fff",

7
src/views/page/Aside/cameraRightMenu.vue

@ -20,7 +20,7 @@
<div class="buttomItem" :title="recordText" @click="clickRecord">
<div class="buttomName">{{ recordText }}</div>
</div>
<div class="buttomItem" title="3D缩放">
<!-- <div class="buttomItem" title="3D缩放">
<div class="buttomName">3D缩放</div>
</div>
<div class="buttomItem" title="设备标记">
@ -28,7 +28,7 @@
</div>
<div class="buttomItem" title="工具箱">
<div class="buttomName">工具箱</div>
</div>
</div> -->
<!-- <div class="buttomItem" @click="openUserEdit">
<div class="buttomName">设置</div>
</div> -->
@ -107,8 +107,9 @@ onMounted(() => {
.buttomList {
position: absolute;
right: 1%;
top: 15%;
top: 50%;
width: 80px;
transform: translateY(-50%);
}
@keyframes rounte {

2
src/views/page/Model/LabelEditModel.vue

@ -207,7 +207,7 @@ function confirm() {
<style scoped lang='less'>
.label-edit-model {
position: relative;
padding: 20px;
.model-head {
text-align: center;
}

41
src/views/page/cameraCenter.vue

@ -10,7 +10,7 @@
:key="item.id" :id="item.id"
:style="`top:${canvasHeight * item.canvasTopRatio}px;left:${canvasWidth * item.canvasLeftRatio}px`"
@click="itemClick(item)">
<a-dropdown :trigger="['contextmenu']">
<a-dropdown :trigger="['contextmenu']" v-if="item.inFlag">
<div class="labels-item" v-if="item.groupName == '视频标签'">
<!-- <div class="labels-item" v-if="item.inFlag"> -->
<div>
@ -32,18 +32,6 @@
</a-menu>
</template>
</a-dropdown>
<a-popconfirm
placement="bottomRight"
ok-text="Yes"
cancel-text="No"
:visible="item.windowVisible"
@cancel="windowCancel(item)"
>
<template #title>
<cameraWindow :itemData="item"></cameraWindow>
</template>
<!-- <a-button>TL</a-button> -->
</a-popconfirm>
</div>
<div class="labels lavels-build" v-if="addLabel.isAddLabel && addLabel.labelType == '建筑标签'"
:style="` pointer-events: none;top:${addLabelTop}px;left:${addLabelLeft}px`">
@ -137,6 +125,7 @@ watch(addLabel, (newVal, oldVal) => {
}
}
})
//
watch(screenshot, (newVal, oldVal) => {
if (newVal) {
//jessibuca.value.isPlaying()
@ -150,6 +139,7 @@ watch(screenshot, (newVal, oldVal) => {
}
})
//
watch(record, (newVal, oldVal) => {
if (!jessibuca.value.isPlaying()) {
Msg.info("请先选择监控画面")
@ -189,13 +179,7 @@ function deleteLabel(id: number) {
//
function itemClick(item: any) {
// console.log("",item);
// popup("", [h(cameraWindow, { windowData: item })], "cameraWindow");
//
item.windowVisible = true
}
//
function windowCancel(item: any){
item.windowVisible = false
popup("监控画面", [h(cameraWindow, { windowData: item })], "cameraWindow");
}
function loadVideoPlayer() {
@ -374,10 +358,11 @@ function switchCamera(cameraId: string) {
// step3, connect stream.
// closeVideo();
let connInfo = res.data.data;
let app = connInfo.app;
let stream = connInfo.stream;
let wsStreamUrl = apiUrl.ZlmWsStreamUrl;
wsStreamUrl = `${wsStreamUrl}/${app}/${stream}.live.flv`;
// let app = connInfo.app;
// let stream = connInfo.stream;
let wsStreamUrl = "ws://localhost:8080/jessica/live/test.flv";
// let wsStreamUrl = apiUrl.ZlmWsStreamUrl;
// wsStreamUrl = `${wsStreamUrl}/${app}/${stream}.live.flv`;
jessibuca.value.play(wsStreamUrl);
}
);
@ -441,7 +426,6 @@ function loadMarkLabelsByLoop(cameraObj: any, ms: number = 1000) {
let timer = setTimeout(() => {
loadMarkLabelsByLoop(cameraObj, ms);
clearTimeout(timer)
console.log(new Date());
}, ms);
}
@ -452,7 +436,6 @@ function loadMarkLabels(cameraObj: any) {
}).then((res: any) => {
if (judgeResponse(res)) return;
let list: Array<any> = res.data.data;
console.log(list);
list.forEach((element: any) => {
labelList.value.forEach((item: any, index: number) => {
if (element.id == item.id) {
@ -477,12 +460,17 @@ function promptError() {
//
window.onbeforeunload = () => {
if (jessibuca.value) {
jessibuca.value.destroy()
}
};
onUnmounted(() => {
{
if (jessibuca.value) {
jessibuca.value.destroy()
}
}
})
</script>
@ -492,7 +480,6 @@ onUnmounted(() => {
position: relative;
overflow: hidden;
#videoPlayer {
height: 100%;
width: 100%;

171
src/views/page/cameraWindow.vue

@ -1,76 +1,34 @@
<template>
<div id="videoWrapper">
<div id="videoWrapper" :style="`height: 300px;`">
<Draggable></Draggable>
<BorderOutlined class="enlarge" @click="clickEnlarge" />
<div id="windowVideoPlayer"></div>
<CameraLeftMenu></CameraLeftMenu>
<!-- 云台控制 -->
<VideoControlSimple></VideoControlSimple>
<!-- <VideoControlSimple></VideoControlSimple> -->
</div>
</template>
<script setup lang='ts'>
////@ts-nocheck
import { ref, h, onMounted, getCurrentInstance, ComponentInternalInstance, onUnmounted, watch } from "vue";
import * as markSearchApi from '@/axios/core/markSearchApi';
import Draggable from '@/components/Draggable.vue';
import { BorderOutlined } from '@ant-design/icons-vue';
import { useStore } from '@/store/index';
import { apiUrl } from "@/axios";
import { storeToRefs } from 'pinia';
import Msg from "@/utils/message";
import CameraLeftMenu from '@/views/page/Aside/cameraLeftMenu.vue'
import VideoControlSimple from './VideoControl/VideoControlSimple.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
let piniaStore = useStore();
let player = <HTMLVideoElement>document.querySelector('#windowVideoPlayer')
let canvasWidth = ref(0)
let canvasHeight = ref(0)
let curSelectKey = storeToRefs(piniaStore).curSelectKey
let closeVideoKey = storeToRefs(piniaStore).closeVideoKey
let cameraMap = storeToRefs(piniaStore).cameraMap
let isActiveChoose = ref(false)
let labelList = ref<any[]>([])
let addLabel = storeToRefs(piniaStore).addLabel
let addLabelLeft = ref(0);
let addLabelTop = ref(0);
const isEnlarge=ref(false);
var jessibuca = ref();
const curVideoKey = ref()
onMounted(() => {
{
player = <HTMLVideoElement>document.querySelector('#windowVideoPlayer');
loadVideoCanvas();
changeVideoCanvasSize();
create()
}
})
watch(curSelectKey, (newVal, oldVal) => {
switchCamera(newVal)
})
watch(closeVideoKey, (newVal, oldVal) => {
if (curVideoKey.value == newVal) {
destroyVideo()
piniaStore.updateCloseVideoKey("")
piniaStore.updateCurSelectKey("")
}
})
watch(addLabel, (newVal, oldVal) => {
if (newVal.isAddLabel) {
isActiveChoose.value = true
document.body.onmousemove = (e) => {
addLabelTop.value = e.clientY
addLabelLeft.value = e.clientX
}
}
})
function destroyVideo() {
jessibuca.value.destroy();
create()
labelList.value = []
}
//
function create() {
var showOperateBtns = false; //
@ -78,12 +36,12 @@ function create() {
jessibuca.value = new Jessibuca({
container: player,
videoBuffer: 0.5, //
videoBuffer: 0.2, //
isResize: false,
text: "",
loadingText: "",
useMSE: false,
debug: true,
debug: false,
showBandwidth: showOperateBtns, //
operateBtns: {
fullscreen: showOperateBtns,
@ -105,60 +63,14 @@ function create() {
jessibuca.value.play("ws://192.168.1.117:8080/jessica/live/test.flv")
}
function clickEnlarge() {
function loadVideoCanvas() {
window.addEventListener('resize', () => {
changeVideoCanvasSize();
});
}
function changeVideoCanvasSize() {
canvasWidth.value = player.clientWidth;
canvasHeight.value = player.clientHeight;
}
function switchCamera(cameraId: string) {
console.log('camera switch.', cameraId, typeof cameraId);
// step1, get camera obj.
console.log('get camera obj.', cameraMap.value);
let cameraObj = cameraMap.value.get(cameraId);
console.log(cameraObj, 'cameraObj');
if (!cameraObj) {
console.log('camera obj not found.');
return;
}
destroyVideo()
console.log('connect webrtc-steamer.');
jessibuca.value.play("ws://192.168.1.117:8080/jessica/live/test.flv")
curVideoKey.value = cameraId
// step4, active camera searcher.
markSearchApi.IsExistsSearcher({
'cameraId': cameraObj.id
}).then((res: any) => {
let flag: boolean = res.data.data;
if (!flag) {
console.log('not exist searcher.');
markSearchApi.ActiveSearcher({
'cameraId': cameraObj.id
}).then((res: any) => {
let flag: boolean = res.data.data;
console.log('activate searcher : ', flag);
if (flag) {
console.log('load camera labels');
}
});
} else {
console.log('load camera labels');
}
})
// step5, load camera labels.
}
//
@ -174,10 +86,20 @@ onUnmounted(() => {
<style scoped lang='less'>
#videoWrapper {
// height: 100vh;
width: 100%;
position: relative;
overflow: hidden;
// overflow: hidden;
.enlarge {
position: absolute;
z-index: 3;
top: -26px;
right: 40px;
transform: translate(-50%, -50%);
cursor: pointer;
font-size: 14px;
color: "#fff",
}
#windowVideoPlayer {
height: 100%;
@ -186,47 +108,6 @@ onUnmounted(() => {
}
.labels {
position: absolute;
top: 0;
left: 0;
z-index: 2;
.labels-item {
position: relative;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
>div {
position: relative;
}
.label-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -55%);
}
img {
width: 120px;
height: 50px;
}
}
}
.lavels-video {
position: fixed;
transform: translate(-50%, -100%);
}
.lavels-build {
transform: translate(-10px, -10px);
position: fixed;
}
}
@ -234,3 +115,11 @@ onUnmounted(() => {
color: #000 !important;
}
</style>
<style>
.ant-notification-notice {
margin-bottom: 0 !important;
padding-left: 0 !important;
padding-right: 0 !important;
padding-bottom: 0 !important;
}
</style>

2553
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save