fix: BUG修改

This commit is contained in:
kun 2023-10-25 18:38:53 +08:00
parent 9d48df5482
commit cd7fd1eee7
4 changed files with 305 additions and 78 deletions

View File

@ -416,3 +416,8 @@ export const getDevicePage = (params: {}) => {
export const bigEntItemAll = (params: any) => { export const bigEntItemAll = (params: any) => {
return http.post(BASEURL + `/ent/projectSubItem/list`, params); return http.post(BASEURL + `/ent/projectSubItem/list`, params);
}; };
// 视频监控摄像头调整方向
export const cameraAdjust = (params: any) => {
return http.post(BASEURL + `/xmgl/video/controlling`, params);
};

View File

@ -1,10 +1,10 @@
<!-- 经典布局 --> <!-- 经典布局 -->
<template> <template>
<el-container class="layout"> <el-container class="layout">
<el-container class="classic-main"> <!-- <el-container class="classic-main">
<Main /> <Main />
</el-container> </el-container> -->
<!-- <el-header> <el-header>
<div class="header-lf"> <div class="header-lf">
<div @click="goHome" class="logo flx-center"> <div @click="goHome" class="logo flx-center">
<img src="@/assets/images/login/china.png" style="margin: 0 15px" alt="logo" /> <img src="@/assets/images/login/china.png" style="margin: 0 15px" alt="logo" />
@ -15,10 +15,10 @@
<ToolBarLeft /> <ToolBarLeft />
</div> </div>
<ToolBarRight /> <ToolBarRight />
</el-header> --> </el-header>
<!-- <el-container class="classic-content"> <el-container class="classic-content">
<el-aside> <el-aside>
<div class="menu" :style="{ width: isCollapse ? '65px' : '210px' }"> 根据屏幕自动收缩 <!-- <div class="menu" :style="{ width: isCollapse ? '65px' : '210px' }"> 根据屏幕自动收缩 -->
<div class="menu"> <div class="menu">
<el-scrollbar> <el-scrollbar>
<el-menu <el-menu
@ -39,7 +39,7 @@
<el-container class="classic-main"> <el-container class="classic-main">
<Main /> <Main />
</el-container> </el-container>
</el-container> --> </el-container>
</el-container> </el-container>
</template> </template>

View File

@ -28,17 +28,40 @@
margin-left: 10px; margin-left: 10px;
} }
} }
.main { .player-list {
// position: fixed; display: flex;
// top: 50%; // display: grid;
// left: 30%; // grid-template-columns: repeat(4, 1fr);
// transform: translateY(-50%); // grid-template-columns: repeat(auto-fit, minmax(530px, 0fr));
// margin: 0 20px; // grid-gap: 20px;
border-radius: 8px; .player-box {
flex: 1; width: 25%;
height: 80vh; max-width: 345px;
// margin: auto; height: 280px;
// background-color: rgba(255, 192, 203, 0.4); position: relative;
.main {
width: 100% !important;
height: 100% !important;
:deep() {
.sub-wnd {
width: 100% !important;
height: 100% !important;
}
}
}
.close-btn {
cursor: pointer;
position: absolute;
top: 0;
right: 0;
}
.full-btn {
cursor: pointer;
position: absolute;
bottom: 0;
right: 0;
}
}
} }
} }
// .right-form { // .right-form {
@ -217,3 +240,54 @@
background-color: #092945; background-color: #092945;
} }
} }
// 实时画面弹框
.video-relative {
display: flex;
&-left {
width: 170px;
margin-right: auto;
display: flex;
flex-direction: column;
.left-title {
background-image: -webkit-linear-gradient(bottom, #1dfcff, #189bff);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 22px;
}
.direction-control {
width: 170px;
margin-top: 40px;
.control-top,
.control-bottom {
display: flex;
justify-content: center;
}
.control-center {
display: flex;
justify-content: space-between;
margin: 10px 0px;
}
}
.img-photo {
display: flex;
justify-content: center;
margin-top: 40px;
}
}
&-right {
position: relative;
width: calc(100% - 200px);
margin-left: 30px;
.main {
width: 100%;
height: 300px;
}
.full-btn {
cursor: pointer;
position: absolute;
bottom: 0;
right: 0;
}
}
}

View File

@ -24,12 +24,45 @@
<h3>实时视频</h3> <h3>实时视频</h3>
<!-- <span>-</span> <!-- <span>-</span>
<h3>{{ childTitle }}</h3> --> <h3>{{ childTitle }}</h3> -->
<img @click="onPhoto" src="@/assets/images/AIwaring/抓拍.png" alt="" /> </div>
<div class="player-list">
<div class="player-box" v-for="(item, index) in videoList" :key="item.id">
<div :id="item.id" ref="playWndBox" class="main" @click="openDialog(item)"></div>
<el-icon class="close-btn" size="18" color="#fff" @click="closePlayer(index)"><CircleClose /></el-icon>
<el-icon class="full-btn" size="18" color="#fff" @click="fullPlayer(item)"><FullScreen /></el-icon>
</div>
</div> </div>
<!-- 视频数据站位 --> <!-- 视频数据站位 -->
<div id="play_window" ref="playWndBox" class="main" style="width: 100%; height: calc(100% - 76px)"></div> <!-- <div id="play_window" ref="playWndBox" class="main" style="width: 100%; height: calc(100% - 76px)"></div> -->
</div> </div>
</div> </div>
<!-- 实时画面弹框 -->
<el-dialog title="实时画面" width="40%" v-model="videoVisible" show-close @close="clearData">
<div class="video-relative">
<div class="video-relative-left">
<div class="left-title">视频操作</div>
<div class="direction-control">
<div class="control-top">
<el-button type="primary" :icon="ArrowUpBold" @click="adjust('UP')" />
</div>
<div class="control-center">
<el-button type="primary" :icon="ArrowLeftBold" @click="adjust('LEFT')" />
<el-button type="primary" :icon="ArrowRightBold" @click="adjust('RIGHT')" />
</div>
<div class="control-bottom">
<el-button type="primary" :icon="ArrowDownBold" @click="adjust('DOWN')" />
</div>
</div>
<!-- <div class="img-photo">
<el-button type="primary" @click="imageGet(videoData)">图片抓拍</el-button>
</div> -->
</div>
<div class="video-relative-right">
<div :id="videoData.id + '-0'" ref="playWndBox" class="main"></div>
<el-icon class="full-btn" size="18" color="#fff" @click="fullDialogPlayer(videoData)"><FullScreen /></el-icon>
</div>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -37,10 +70,12 @@
import { ref, reactive, onMounted, getCurrentInstance } from "vue"; import { ref, reactive, onMounted, getCurrentInstance } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { getVideoQuestionPage, getvideoProTreeList, getvideoEngTreeList } from "@/api/modules/goverment"; import { getVideoQuestionPage, getvideoProTreeList, getvideoEngTreeList, cameraAdjust } from "@/api/modules/goverment";
import { getpreviewURL, getmanualCaptureL } from "@/api/modules/common"; import { getpreviewURL, getmanualCaptureL } from "@/api/modules/common";
import TreeFilter from "@/components/TreeFilter/index.vue"; import TreeFilter from "@/components/TreeFilter/index.vue";
import { ArrowUpBold, ArrowLeftBold, ArrowRightBold, ArrowDownBold } from "@element-plus/icons-vue";
const videoVisible = ref(false);
const videoList = ref<any>([]);
interface rightFormList { interface rightFormList {
createTime: string; createTime: string;
projectName: string; projectName: string;
@ -66,13 +101,6 @@ const rightForm = ref<rightFormList>({
questionDesc: "", questionDesc: "",
showForm: false showForm: false
}); });
const photoList = ref({
url: "",
questionDesc: "",
createBy: "",
image: ""
});
const showInitiate = ref(false);
const proTree = ref(); const proTree = ref();
const engTree = ref(); const engTree = ref();
const playWndBox = ref(null); const playWndBox = ref(null);
@ -82,12 +110,130 @@ let myPlugin = ref("");
let cameraIndexCode = ref<string>(""); let cameraIndexCode = ref<string>("");
let playUrl = ref(""); let playUrl = ref("");
let playIndex = ref(0); let playIndex = ref(0);
let dataIndex = ref(0);
const videoData = ref<any>({});
const directionValue = ref("");
//
const clearData = () => {
videoData.value = {}; // videoDataplugin
};
//
const adjust = async (params: any) => {
let requestData = {
cameraIndexCode: cameraIndexCode.value,
action: directionValue.value == params ? 1 : 0,
command: params,
speed: 20
};
const { result } = await cameraAdjust(requestData);
console.log(result);
if (result && result.msg == "success") {
ElMessage.success("操作成功");
}
if (directionValue.value == params) {
directionValue.value = "";
} else {
directionValue.value = params;
}
};
//
const imageGet = async (item: any) => {
let Plugin = item.dialogPlugin;
if (!cameraIndexCode.value) {
ElMessage.error("请先选择要抓拍的监控");
} else {
const { result } = await getmanualCaptureL({ monitorCode: cameraIndexCode.value });
console.log(result);
window.open(result.url);
// let link = document.createElement("a");
// link.href = result.url;
// link.download = "";
// link.click();
// link.remove();
}
};
//
const fullDialogPlayer = (item: any) => {
let Plugin = item.dialogPlugin;
Plugin.JS_FullScreenDisplay(true).then(
() => {
console.info("JS_FullScreenDisplay success");
// do you want...
},
(err: any) => {
console.info("JS_FullScreenDisplay failed");
// do you want...
}
);
};
//
const openDialog = (item: any) => {
videoData.value = item;
console.log(item);
setTimeout(function () {
let url = item.videoUrl;
let newMyplugin = new JSPlugin({
szId: item.id + "-0", //
// szBasePath: "/public/h5player", // ,H5player.min.jsjs
szBasePath: "/h5player", //
// szBasePath: "./", // ,H5player.min.jsjs
// iWidth: playWndWidth.value + "px",
// iHeight: playWndHeight.value + "px",
// iWidth: "300px",
// iHeight: "300px",
iMaxSplit: 1,
iCurrentSplit: 1,
openDebug: true
});
newMyplugin
.JS_Play(
url,
{
playURL: url, //
mode: 1 // 0=; 1= 0
//
// ...
},
0 //
)
.then(
() => {
console.info("JS_Play success");
// do you want...
},
() => {
console.info("JS_Play failed:");
// playIndex.value += 1;
// do you want...
}
);
videoData.value.dialogPlugin = newMyplugin;
}, 200);
videoVisible.value = true;
};
//
const fullPlayer = (item: any) => {
let Plugin = item.pluginValue;
console.log(Plugin);
Plugin.JS_FullScreenDisplay(true).then(
() => {
console.info("JS_FullScreenDisplay success");
// do you want...
},
(err: any) => {
console.info("JS_FullScreenDisplay failed");
// do you want...
}
);
};
//
const closePlayer = (index: number) => {
videoList.value.splice(index, 1);
};
// //
const playVideo = async () => { const playVideo = async () => {
let url = playUrl.value; let url = playUrl.value;
let newMyplugin = myPlugin.value; let newMyplugin = myPlugin.value;
console.log(url);
console.log(playIndex.value);
newMyplugin newMyplugin
.JS_Play( .JS_Play(
url, url,
@ -115,24 +261,40 @@ const playVideo = async () => {
// //
const getVideo = async () => { const getVideo = async () => {
// await sendRequest({ code: cameraIndexCode.value }); // await sendRequest({ code: cameraIndexCode.value });
videoList.value.push({
id: "play_window-" + dataIndex.value,
ref: "playWndBox",
pluginValue: "",
videoUrl: ""
});
setTimeout(function () {
BeginPlayer("play_window-" + dataIndex.value);
}, 200);
const res = await getpreviewURL({ cameraIndexCode: cameraIndexCode.value, protocol: "ws" }); const res = await getpreviewURL({ cameraIndexCode: cameraIndexCode.value, protocol: "ws" });
playUrl.value = res.result; playUrl.value = res.result;
playVideo(); await playVideo();
let changeVal = dataIndex.value - 1; // dataIndex.value + 1-1
videoList.value[changeVal].videoUrl = res.result;
console.log(res); console.log(res);
}; };
const BeginPlayer = () => { const BeginPlayer = (id: any) => {
console.log(id);
// //
myPlugin.value = new JSPlugin({ myPlugin.value = new JSPlugin({
szId: "play_window", // szId: id, //
// szBasePath: "/public/h5player", // ,H5player.min.jsjs // szBasePath: "/public/h5player", // ,H5player.min.jsjs
szBasePath: "/h5player", // szBasePath: "/h5player", //
// szBasePath: "./", // ,H5player.min.jsjs // szBasePath: "./", // ,H5player.min.jsjs
iWidth: playWndWidth.value + "px", // iWidth: playWndWidth.value + "px",
iHeight: playWndHeight.value + "px", // iHeight: playWndHeight.value + "px",
iMaxSplit: 4, // iWidth: "300px",
iCurrentSplit: 4, // iHeight: "300px",
iMaxSplit: 1,
iCurrentSplit: 1,
openDebug: true openDebug: true
}); });
videoList.value[dataIndex.value].pluginValue = myPlugin.value;
dataIndex.value++;
}; };
const changeTreeFilter = async (item: { const changeTreeFilter = async (item: {
data: { code: string | null; title: any; children: any[] }; data: { code: string | null; title: any; children: any[] };
@ -189,48 +351,34 @@ const engApi = async () => {
const { result } = await getvideoEngTreeList({}); const { result } = await getvideoEngTreeList({});
engTree.value.treeAllData = result; engTree.value.treeAllData = result;
}; };
//
const onPhoto = async () => {
if (cameraIndexCode.value.length !== 1) {
ElMessage.error("请先选择要抓拍的监控");
} else {
console.log(cameraIndexCode.value.length);
const { result } = await getmanualCaptureL({ monitorCode: cameraIndexCode.value });
photoList.value.url = result.url;
photoList.value.image = photoList.value.url;
showInitiate.value = true;
}
};
onMounted(async () => { onMounted(async () => {
await BeginPlayer(); // await BeginPlayer();
const pageInstance = getCurrentInstance(); // const pageInstance = getCurrentInstance();
// dom // // dom
const tagDomObj = pageInstance?.refs.playWndBox; // const tagDomObj = pageInstance?.refs.playWndBox;
playWndHeight.value = tagDomObj?.clientHeight; // playWndHeight.value = tagDomObj?.clientHeight;
playWndWidth.value = tagDomObj?.clientWidth; // playWndWidth.value = tagDomObj?.clientWidth;
// scroll使DIV // // scroll使DIV
window.addEventListener("scroll", () => { // window.addEventListener("scroll", () => {
if (myPlugin.value == undefined) { // if (myPlugin.value == undefined) {
setTimeout(function () { // setTimeout(function () {
myPlugin.value.JS_Resize(tagDomObj?.clientWidth, tagDomObj?.clientHeight); // myPlugin.value.JS_Resize(tagDomObj?.clientWidth, tagDomObj?.clientHeight);
}, 500); // }, 500);
// setWndCover(); // // setWndCover();
} // }
}); // });
// // resize使DIV
// resize使DIV // window.addEventListener("resize", e => {
window.addEventListener("resize", e => { // if (myPlugin.value == undefined) {
if (myPlugin.value == undefined) { // // console.log("wwwww", e);
// console.log("wwwww", e); // setTimeout(function () {
setTimeout(function () { // myPlugin.value.JS_Resize(tagDomObj?.clientWidth, tagDomObj?.clientHeight);
myPlugin.value.JS_Resize(tagDomObj?.clientWidth, tagDomObj?.clientHeight); // }, 500);
}, 500); // // oWebControl.JS_Resize(playWndHeight.value, playWndWidth.value);
// oWebControl.JS_Resize(playWndHeight.value, playWndWidth.value); // // setWndCover();
// setWndCover(); // }
} // });
});
}); });
</script> </script>