fix: BUG修改

This commit is contained in:
kun 2023-10-27 15:57:41 +08:00
parent f4a494e58a
commit d9ffb26540
2 changed files with 15 additions and 277 deletions

View File

@ -65,14 +65,14 @@
src="@/assets/images/AIwaring/抓拍.png"
alt=""
/>
<img
<!-- <img
id="btnCapture"
title="电子放大"
class="btn"
@click="imageLarge(videoData)"
src="@/assets/images/AIwaring/电子放大.png"
alt=""
/>
/> -->
</div>
</div>
<div class="video-relative-right">
@ -155,19 +155,19 @@ const adjust = async (params: any) => {
}
};
//
const imageLarge = (item: any) => {
let Plugin = item.dialogPlugin;
Plugin.JS_EnableZoom(0).then(
() => {
console.info("JS_EnableZoom success");
// do you want...
},
err => {
console.info("JS_EnableZoom failed");
// do you want...
}
);
};
// const imageLarge = (item: any) => {
// let Plugin = item.dialogPlugin;
// Plugin.JS_EnableZoom(0).then(
// () => {
// console.info("JS_EnableZoom success");
// // do you want...
// },
// err => {
// console.info("JS_EnableZoom failed");
// // do you want...
// }
// );
// };
//
const imageGet = async (item: any) => {
let Plugin = item.dialogPlugin;

View File

@ -1,262 +0,0 @@
<template>
<div class="video-box">
<div class="plr-20" style="display: flex; height: 100%">
<el-tabs class="demo-tabs" v-model="active">
<el-tab-pane label="项目名称" name="first">
<TreeFilter
ref="proTree"
:checkStrictly="true"
label="title"
:requestApi="proApi"
@change="changeTreeFilter"
class="treefilter"
>
</TreeFilter>
</el-tab-pane>
<el-tab-pane label="工程名称" name="two">
<TreeFilter ref="engTree" label="title" :requestApi="engApi" @change="changeTreeFilter" class="treefilter">
</TreeFilter>
</el-tab-pane>
</el-tabs>
<div class="middle-video">
<div class="title-video flx-justify-between">
<h3>实时视频</h3>
<!-- <span>-</span>
<h3>{{ childTitle }}</h3> -->
<img id="btnCapture" title="图片抓拍" class="btn" @click="imageGet" src="@/assets/images/AIwaring/抓拍.png" alt="" />
</div>
<!-- 视频数据站位 -->
<div id="player" ref="playWndBox" class="main" style="width: 100%; height: calc(100% - 76px)"></div>
</div>
</div>
</div>
</template>
<script setup lang="ts" name="governVideo">
import { ref, reactive, onMounted, getCurrentInstance } from "vue";
import { ElMessage } from "element-plus";
import { getVideoQuestionPage, getvideoProTreeList, getvideoEngTreeList } from "@/api/modules/goverment";
import { getpreviewURL, getmanualCaptureL } from "@/api/modules/common";
import TreeFilter from "@/components/TreeFilter/index.vue";
const videoList = ref<any>([]);
interface rightFormList {
createTime: string;
projectName: string;
engineeringName: string;
monitorId: string;
questionDesc: string;
showForm: boolean;
}
const pageable = reactive({
pageNo: 1,
pageSize: 9,
total: 0
});
const active = ref("two");
const parentTitle = ref<string>("");
const rightForm = ref<rightFormList>({
createTime: "",
projectName: "",
engineeringName: "",
monitorId: "",
questionDesc: "",
showForm: false
});
const proTree = ref();
const engTree = ref();
const playWndBox = ref(null);
let playWndHeight = ref("");
let playWndWidth = ref("");
let myPlugin = ref("");
let cameraIndexCode = ref<string>("");
let playUrl = ref("");
let playIndex = ref(0);
let dataIndex = ref(0);
//
const imageGet = async (item: any) => {
let fileName = "img";
let fileType = "JPEG";
let curIndex = 0;
myPlugin.value.JS_CapturePicture(curIndex, fileName, fileType).then(
() => {
console.log("capture success", "JPEG");
},
e => {
console.error(e);
}
);
// 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 playVideo = async () => {
let url = playUrl.value;
let newMyplugin = myPlugin.value;
newMyplugin
.JS_Play(
url,
{
playURL: url, //
mode: 1 // 0=; 1= 0
//
// ...
},
playIndex.value //
)
.then(
() => {
console.info("JS_Play success");
playIndex.value += 1;
// do you want...
},
() => {
console.info("JS_Play failed:");
// playIndex.value += 1;
// do you want...
}
);
dataIndex.value = dataIndex.value + 1;
};
//
const getVideo = async () => {
const res = await getpreviewURL({ cameraIndexCode: cameraIndexCode.value, protocol: "ws" });
playUrl.value = res.result;
console.log(res);
await playVideo();
};
const BeginPlayer = () => {
//
myPlugin.value = new JSPlugin({
szId: "player", //
// 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
});
videoList.value[videoList.value.length - 1].pluginValue = myPlugin.value;
};
const changeTreeFilter = async (item: {
data: { code: string | null; title: any; children: any[] };
parent: { data: { title: any } };
}) => {
console.log("我是你要的数据", item);
//
cameraIndexCode.value = item.data.code;
parentTitle.value = item.parent.data.title || item.data.title;
if (item.data.code === null) {
cameraIndexCode.value = item.data.children.map(item => {
return item.code;
});
cameraIndexCode.value.forEach(element => {
getVideo(element);
});
//
if (active.value === "first") {
const { result } = await getVideoQuestionPage({
...pageable,
projectSn: item.data.sn
});
rightForm.value = result.records;
pageable.total = +result.total;
} else {
const { result } = await getVideoQuestionPage({
...pageable,
engineeringSn: item.data.sn
});
rightForm.value = result.records;
pageable.total = +result.total;
}
} else {
// childTitle.value = item.data.title;
getVideo();
const { result } = await getVideoQuestionPage({
...pageable,
deviceCode: item.data.code
});
rightForm.value = result.records;
pageable.total = +result.total;
}
};
const proApi = async () => {
const { result } = await getvideoProTreeList({});
proTree.value.treeAllData = result;
// cameraIndexCode.value = proTree.value.treeAllData[5].children[0].code;
// console.log(cameraIndexCode.value);
};
const engApi = async () => {
const { result } = await getvideoEngTreeList({});
engTree.value.treeAllData = result;
};
onMounted(async () => {
await BeginPlayer();
const pageInstance = getCurrentInstance();
// dom
const tagDomObj = pageInstance?.refs.playWndBox;
playWndHeight.value = tagDomObj?.clientHeight;
playWndWidth.value = tagDomObj?.clientWidth;
// scroll使DIV
window.addEventListener("scroll", () => {
if (myPlugin.value == undefined) {
setTimeout(function () {
myPlugin.value.JS_Resize(tagDomObj?.clientWidth, tagDomObj?.clientHeight);
}, 500);
// setWndCover();
}
});
// resize使DIV
window.addEventListener("resize", e => {
if (myPlugin.value == undefined) {
// console.log("wwwww", e);
setTimeout(function () {
myPlugin.value.JS_Resize(tagDomObj?.clientWidth, tagDomObj?.clientHeight);
}, 500);
// oWebControl.JS_Resize(playWndHeight.value, playWndWidth.value);
// setWndCover();
}
});
});
</script>
<style lang="scss" scoped>
@import "./index.scss";
:deep(.btn-prev) {
border: 1px solid #e5e5e5;
}
:deep(.btn-next) {
border: 1px solid #e5e5e5;
}
:deep() {
.el-tabs__header {
display: none;
}
.el-tabs__content {
margin-top: 15px;
}
}
</style>