fix: BUG修改

This commit is contained in:
kun 2023-07-19 17:20:15 +08:00
parent 0b579ce76f
commit 5f3eb41571
10 changed files with 99 additions and 225 deletions

View File

@ -9,12 +9,14 @@
<script setup lang="tsx" name="ProjectSupervisionRecord">
import { ref, reactive, nextTick, computed } from "vue";
import { useTheme } from "@/hooks/useTheme";
import { sendIframeMessage } from "@/utils/util";
const { changePrimary } = useTheme();
const changePrimaryVal = (val: string) => {
// const body = document.body as HTMLElement;
// body.setAttribute("style", `filter: opacity(0.7);background-color: ${val};`);
// body.setAttribute("style", "filter: invert(80%)");
changePrimary(val);
sendIframeMessage({ isTheme: val }, 2, undefined);
};
</script>
<style scoped lang="scss">

View File

@ -74,7 +74,7 @@ const getProjectList = async () => {
};
onMounted(async () => {
await getProjectList();
await sendIframeMessage({ path: globalStore.path, moduleId: globalStore.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: globalStore.path, moduleId: globalStore.moduleId } }, 2, undefined);
});
</script>

View File

@ -34,7 +34,7 @@ const changeScreen = async () => {
// screenValue.value = screenValue.value == 0 ? 1 : 0;
};
onMounted(async () => {
await sendIframeMessage({ path: globalStore.path, moduleId: globalStore.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: globalStore.path, moduleId: globalStore.moduleId } }, 2, undefined);
});
</script>
<style scoped lang="scss">

View File

@ -441,7 +441,7 @@ onMounted(async () => {
onSearch(records.value[0]);
searchSn.value = records.value[0].projectSn;
searchName.value = records.value[0].projectName;
await sendIframeMessage({ path: store.path, moduleId: store.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: store.path, moduleId: store.moduleId } }, 2, undefined);
});
</script>

View File

@ -411,7 +411,7 @@ onMounted(async () => {
onSearch(records.value[0]);
searchSn.value = (records.value as ResAiProjectPage[])[0].projectSn;
searchName.value = (records.value as ResAiProjectPage[])[0].projectName;
await sendIframeMessage({ path: store.path, moduleId: store.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: store.path, moduleId: store.moduleId } }, 2, undefined);
});
</script>

View File

@ -327,7 +327,7 @@ onMounted(async () => {
onSearch(records.value[0]);
searchSn.value = (records.value as ResAiProjectPage[])[0].projectSn;
searchName.value = (records.value as ResAiProjectPage[])[0].projectName;
await sendIframeMessage({ path: store.path, moduleId: store.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: store.path, moduleId: store.moduleId } }, 2, undefined);
});
</script>
<style scoped lang="scss">

View File

@ -295,7 +295,7 @@ onMounted(async () => {
onSearch(records.value[0]);
searchSn.value = (records.value as ResAiProjectPage[])[0].projectSn;
searchName.value = (records.value as ResAiProjectPage[])[0].projectName;
await sendIframeMessage({ path: store.path, moduleId: store.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: store.path, moduleId: store.moduleId } }, 2, undefined);
});
</script>
<style scoped lang="scss">

View File

@ -296,7 +296,7 @@ onMounted(async () => {
onSearch(records.value[0]);
searchSn.value = (records.value as ResAiProjectPage[])[0].projectSn;
searchName.value = (records.value as ResAiProjectPage[])[0].projectName;
await sendIframeMessage({ path: store.path, moduleId: store.moduleId }, 2, undefined);
await sendIframeMessage({ obj: { path: store.path, moduleId: store.moduleId } }, 2, undefined);
});
</script>

View File

@ -68,8 +68,9 @@
</div>
<div class="blockContent" style="height: 260px">
<!-- <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>
<!-- <video style="width: 100%; height: 100%; object-fit: fill" controls :src="videoData.videoUrl"></video> -->
<!-- <div id="playWnd" class="playWnd"></div> -->
<div id="play_window" ref="playWndBox" class="main" style="width: 100%; height: 100%"></div>
</div>
</div>
</div>
@ -169,58 +170,23 @@ import { getpreviewURL, getConfigInfo } from "@/api/modules/common";
import { GlobalStore } from "@/stores";
const store = GlobalStore();
const playWndBox = ref(null);
//
const projectData = ref({
latitude: "",
longitude: "",
totalDay: ""
});
const playWndBox = ref(null);
let playWndHeight = ref("");
let playWndWidth = ref("");
let oWebControl = ref(null);
let pubKey = ref("");
let objData = ref({
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>>([]);
let myPlugin = ref("");
let cameraIndexCode = ref<string>("");
let playUrl = ref("");
let playIndex = ref(0);
const getProjectData = (data: any) => {
projectData.value = data;
};
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 });
const res = await getConfigInfo({});
objData.value = reactive({
appkey: res.result.appKey, //appkey
ip: res.result.ip + ":" + res.result.port, //ip
secret: res.result.appSecret, //secret
port: 18443,
playMode: 0, // 0 1
layout: "4x6" //16
});
console.log(objData.value);
};
const getPayMentData = async () => {
const res = await screenPayment({});
console.log(res);
@ -307,190 +273,93 @@ const getInspect = async () => {
// oWebControl.JS_Disconnect();
// }
// });
//
const playVideo = async () => {
let url = playUrl.value;
let newMyplugin = myPlugin.value;
console.log(url);
console.log(playIndex.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...
}
);
};
//
const getVideo = async () => {
// await sendRequest({ code: cameraIndexCode.value });
const res = await getpreviewURL({ cameraIndexCode: "a4badb0f00d2443d9bcf270654c8efc1", protocol: "ws" });
playUrl.value = res.result;
playVideo();
console.log(res);
};
const BeginPlayer = () => {
console.log(666, "-----------------");
//
myPlugin.value = new JSPlugin({
szId: "play_window", //
szBasePath: "/public/h5player", // ,H5player.min.jsjs
// szBasePath: "/h5player", //
// szBasePath: "./", // ,H5player.min.jsjs
iWidth: playWndWidth.value + "px",
iHeight: playWndHeight.value + "px",
iMaxSplit: 4,
iCurrentSplit: 1,
openDebug: true
});
};
onMounted(async () => {
await getInspect();
await getPayMentData();
//
await getVideoConfig();
//
nextTick(() => {
initPlugin();
});
});
const initPlugin = () => {
console.log(666);
oWebControl = new WebControl({
szPluginContainer: "playWnd", // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15900,
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // IE10使ActiveXclsid
cbConnectSuccess: () => {
console.log(666, "=======成功");
// WebControl
oWebControl
.JS_StartService("window", {
// WebControl
// "./VideoPluginConnect.dll"
dllPath: "./VideoPluginConnect.dll"
})
.then(
function () {
//
oWebControl.JS_SetWindowControlCallback({
// cbIntegrationCallBack: cbIntegrationCallBack,
});
//JS_CreateWnd
oWebControl
.JS_CreateWnd("playWnd", 1000, 600, { bEmbed: true }) //bEmbed: true
.then(function () {
//
init();
});
},
function () {
//
}
);
},
// WebControl
cbConnectError: function () {
console.log(666, "=======失败");
// console.log(0);
// oWebControl.value = null;
// // errorwakeup
// window.WebControl.JS_WakeUp("VideoWebPlugin://");
// initCount++;
// if (initCount < 3) {
// setTimeout(function () {
// initPlugin();
// }, 3000);
// } else {
// setTimeout(function () {
// setTimeout(function () {
// $router.push('/home/PlugDown')
// }, 4000)
// }, 4000)
// }
// if (initCount.value < 2) {
// oWebControl.value = null;
// ElMessage.warning("...");
// // errorwakeup
// window.WebControl.JS_WakeUp("VideoWebPlugin://");
// setTimeout(() => {
// initPlugin();
// }, 3000);
// initCount.value++;
// } else {
// window.location.href = this.videoWebPluginUrl;
// }
},
cbConnectClose: () => {
console.log(666, "=======断开");
// bNormalClose = false
// JS_DisconnectbNormalClose = true
// console.log("cbConnectClose");
oWebControl.value = null;
await BeginPlayer();
// ee
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();
}
});
oWebControl.JS_ShowWnd();
console.log(777);
// oWebControl.JS_CuttingPartWindow(500, 500, 500, 500);
};
//
const init = (callback: (() => void) | undefined) => {
console.log(objData.value, "6666666");
getPubKey(() => {
let appkey = objData.value.appkey; //appkey
let secret = setEncrypt(objData.value.secret); //secret
let ip = objData.value.ip; //IP
let playMode = objData.value.playMode; //0-1-
let port = objData.value.port; //HTTPS443
let snapDir = "D:\\SnapDir"; //
let videoDir = "D:\\VideoDir"; //
let layout = objData.value.layout; //playMode
let enableHTTPS = 1; //HTTPS1
let encryptedFields = "secret"; //secret
let showToolbar = 1; //0-0-
let showSmart = 0; //线0-0-
let buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //
// var toolBarButtonIDs = "2049,2304" //
oWebControl
.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
playMode: playMode, //
port: port, //
snapDir: snapDir, //
videoDir: videoDir, //
layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, //
showToolbar: showToolbar, //
showSmart: showSmart, //
buttonIDs //
})
})
.then(function (oData: any) {
oWebControl.JS_Resize(playWndWidth.value, playWndHeight.value); // resizefirefoxDIV
if (callback) {
callback();
}
//
// oWebControl.JS_HideWnd()
});
// 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();
}
});
};
// RSA
let setEncrypt = (value: string) => {
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(pubKey);
return encrypt.encrypt(value);
};
//
const getPubKey = (callback: { (): void; (): void }) => {
oWebControl
.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024
})
})
.then(function (oData: { responseMsg: { data: Ref<string> } }) {
if (oData.responseMsg.data) {
pubKey = oData.responseMsg.data;
callback();
}
});
};
//
//
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({});
});
};
getVideo();
});
</script>
<style scoped lang="scss">
@import url("./style.scss");

View File

@ -367,6 +367,9 @@ const handleOpen = (index: any) => {
} else {
openedIndex.value = index;
}
setTimeout(function () {
setGantts();
}, 300);
};
const handleScroll = (e: any) => {