diff --git a/src/api/modules/goverment.ts b/src/api/modules/goverment.ts
index b1f6e90..5114f77 100644
--- a/src/api/modules/goverment.ts
+++ b/src/api/modules/goverment.ts
@@ -416,3 +416,8 @@ export const getDevicePage = (params: {}) => {
export const bigEntItemAll = (params: any) => {
return http.post(BASEURL + `/ent/projectSubItem/list`, params);
};
+
+// 视频监控摄像头调整方向
+export const cameraAdjust = (params: any) => {
+ return http.post(BASEURL + `/xmgl/video/controlling`, params);
+};
diff --git a/src/layouts/LayoutClassic/index.vue b/src/layouts/LayoutClassic/index.vue
index 20a7899..714cd6c 100644
--- a/src/layouts/LayoutClassic/index.vue
+++ b/src/layouts/LayoutClassic/index.vue
@@ -1,10 +1,10 @@
-
+
+
+
+
+
+
@@ -37,10 +70,12 @@
import { ref, reactive, onMounted, getCurrentInstance } from "vue";
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 TreeFilter from "@/components/TreeFilter/index.vue";
-
+import { ArrowUpBold, ArrowLeftBold, ArrowRightBold, ArrowDownBold } from "@element-plus/icons-vue";
+const videoVisible = ref(false);
+const videoList = ref([]);
interface rightFormList {
createTime: string;
projectName: string;
@@ -66,13 +101,6 @@ const rightForm = ref({
questionDesc: "",
showForm: false
});
-const photoList = ref({
- url: "",
- questionDesc: "",
- createBy: "",
- image: ""
-});
-const showInitiate = ref(false);
const proTree = ref();
const engTree = ref();
const playWndBox = ref(null);
@@ -82,12 +110,130 @@ let myPlugin = ref("");
let cameraIndexCode = ref("");
let playUrl = ref("");
let playIndex = ref(0);
+let dataIndex = ref(0);
+const videoData = ref({});
+const directionValue = ref("");
+// 关闭弹框时
+const clearData = () => {
+ videoData.value = {}; // 清空一下videoData数据,因为里面携带着播放plugin
+};
+// 方向调整
+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.js的js相对路径
+ szBasePath: "/h5player", // 打包后的地址
+ // szBasePath: "./", // 必填,引用H5player.min.js的js相对路径
+ // 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 () => {
let url = playUrl.value;
let newMyplugin = myPlugin.value;
- console.log(url);
- console.log(playIndex.value);
newMyplugin
.JS_Play(
url,
@@ -115,24 +261,40 @@ const playVideo = async () => {
// 获取视频流
const getVideo = async () => {
// 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" });
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);
};
-const BeginPlayer = () => {
+const BeginPlayer = (id: any) => {
+ console.log(id);
// 初始化插件
myPlugin.value = new JSPlugin({
- szId: "play_window", //需要英文字母开头 必填
+ szId: id, //需要英文字母开头 必填
// szBasePath: "/public/h5player", // 必填,引用H5player.min.js的js相对路径
szBasePath: "/h5player", // 打包后的地址
// szBasePath: "./", // 必填,引用H5player.min.js的js相对路径
- iWidth: playWndWidth.value + "px",
- iHeight: playWndHeight.value + "px",
- iMaxSplit: 4,
- iCurrentSplit: 4,
+ // iWidth: playWndWidth.value + "px",
+ // iHeight: playWndHeight.value + "px",
+ // iWidth: "300px",
+ // iHeight: "300px",
+ iMaxSplit: 1,
+ iCurrentSplit: 1,
openDebug: true
});
+ videoList.value[dataIndex.value].pluginValue = myPlugin.value;
+ dataIndex.value++;
};
const changeTreeFilter = async (item: {
data: { code: string | null; title: any; children: any[] };
@@ -189,48 +351,34 @@ const engApi = async () => {
const { result } = await getvideoEngTreeList({});
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 () => {
- 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();
- }
- });
+ // 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();
+ // }
+ // });
});