fix: BUG修改

This commit is contained in:
kun 2023-07-10 13:33:46 +08:00
parent c8ac1c7b1c
commit 2a00f3362d
2 changed files with 66 additions and 10 deletions

View File

@ -63,13 +63,22 @@
</div>
</div>
<div class="blockBox">
<div class="blockTitle">
<div class="blockTitle" @click="videoPlay">
<img src="@/assets/images/hzImg/xm/gdxcsp.png" alt="" class="title" />
</div>
<div class="blockContent">
<!-- <img src="@/assets/images/hzImg/xm/video.png" alt="" width="100%" height="100%" /> -->
<video style="width: 100%; height: 100%; object-fit: fill" controls :src="videoData.videoUrl"></video>
<!-- <div id="playWnd" class="playWnd" style="width: 300px;height: 300px;"></div> -->
<!-- <video style="width: 100%; height: 100%; object-fit: fill" controls :src="videoData.videoUrl"></video> -->
<div ref="playWndBox" class="main" style="width: 300px; height: 300px">
<div
id="playWnd"
class="playWnd"
:style="{
height: playWndHeight + 'px',
width: playWndWidth + 'px'
}"
></div>
</div>
</div>
</div>
</div>
@ -177,13 +186,14 @@ let playWndWidth = ref("");
let oWebControl = ref(null);
let pubKey = ref("");
let objData = ref({
appkey: "", //appkey
ip: "", //ip
secret: "", //secret
appkey: "29560841", //appkey
ip: "120.236.122.37:442", //ip
secret: "8RPzFJX4h0POasG5v9AU", //secret
port: 18443,
playMode: 0, // 0 1
layout: "4x6" //16
});
let cameraIndexCode = ref<Array<string>>([]);
const getProjectData = (data: any) => {
projectData.value = data;
};
@ -191,6 +201,17 @@ const videoData = ref({
videoUrl: ""
});
const dataObj = ref({});
const videoPlay = () => {
console.log(666);
//
getVideo();
previewVideo("33ab35b2724b49b4936060c39858d795");
};
//
const getVideo = async () => {
// await sendRequest({ code: cameraIndexCode.value });
await getpreviewURL({ cameraIndexCode: cameraIndexCode.value });
};
//
const getVideoConfig = async () => {
// await sendRequest({ code: cameraIndexCode.value });
@ -292,10 +313,10 @@ onBeforeUnmount(() => {
}
});
onMounted(async () => {
//
getVideoConfig();
await getInspect();
await getPayMentData();
//
getVideoConfig();
// ee
const pageInstance = getCurrentInstance();
// dom
@ -476,6 +497,30 @@ const getPubKey = (callback: { (): void; (): void }) => {
}
});
};
//
//
const previewVideo = (data: string | null) => {
let cameraIndexCode = data; //
let streamMode = 0; // 0-1-
let transMode = 1; // 0-UDP1-TCP
let gpuMode = 0; // GPU0-1-
let wndId = -1; // 2x2
oWebControl
.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, // GPU
wndId: wndId //
})
})
.then(function () {
oWebControl.JS_SetWindowControlCallback({});
});
};
</script>
<style scoped lang="scss">
@import url("./style.scss");

View File

@ -43,11 +43,12 @@ const tokenIdentify = async () => {
keepAlive.setKeepAliveName();
if (responseData.accountType === 2) {
await sendMessage({ isSuccess: true }, 2);
globalStore.setPath("/goverment/huizhou/largeScreen/largeScreenOne/index");
await initDynamicRouter({ moduleId: "1670639811581595650" });
globalStore.moduleId = "1670639811581595650";
// globalStore.moduleName = val.moduleName;
} else if (responseData.accountType == 4) {
await sendMessage({ isSuccess: true }, 2);
globalStore.setPath("/hz-project/largeScreen/largeScreenOne/index");
await initDynamicRouter({ moduleId: "1670603312504918018" });
globalStore.moduleId = "1670603312504918018";
@ -56,7 +57,17 @@ const tokenIdentify = async () => {
// ElMessage.error("");
return;
}
console.log(res);
};
const sendMessage = (msg, type, iframeEle) => {
console.log(666);
if (type === 1) {
// =>
iframeEle.contentWindow.postMessage(msg, "*");
} else if (type === 2) {
// =>
window.parent.postMessage(msg, "*");
}
console.log(777);
};
</script>
<style scoped lang="scss">