zk пре 1 година
родитељ
комит
543f977470

Разлика између датотеке није приказан због своје велике величине
+ 11687 - 2036
package-lock.json


+ 1 - 18
package.json

@@ -15,36 +15,19 @@
     "echarts-gl": "^2.0.9",
     "echarts-liquidfill": "^3.1.0",
     "element-plus": "^2.2.29",
+    "jquery": "^1.12.4",
     "mitt": "^3.0.0",
     "vue": "^3.2.13",
     "vue-router": "^4.1.5"
   },
   "devDependencies": {
     "@babel/core": "^7.12.16",
-    "@babel/eslint-parser": "^7.12.16",
     "@vue/cli-plugin-babel": "~5.0.0",
-    "@vue/cli-plugin-eslint": "~5.0.0",
     "@vue/cli-service": "~5.0.0",
-    "eslint": "^7.32.0",
-    "eslint-plugin-vue": "^8.0.3",
     "postcss-px-to-viewport": "^1.1.1",
     "sass": "^1.55.0",
     "sass-loader": "^13.1.0"
   },
-  "eslintConfig": {
-    "root": true,
-    "env": {
-      "node": true
-    },
-    "extends": [
-      "plugin:vue/vue3-essential",
-      "eslint:recommended"
-    ],
-    "parserOptions": {
-      "parser": "@babel/eslint-parser"
-    },
-    "rules": {}
-  },
   "browserslist": [
     "> 1%",
     "last 2 versions",

+ 9 - 3
public/index.html

@@ -4,14 +4,20 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <meta http-equiv="Pragma" content="no-cache" />
+    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
+    <meta http-equiv="Expires" content="0" />
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title>黄浦江数字孪生系统</title>
   </head>
   <body>
-    <noscript>
-      <strong>启用JavaScript以运行该页面</strong>
-    </noscript>
+<!--    <noscript>-->
+<!--      <strong>启用JavaScript以运行该页面</strong>-->
+<!--    </noscript>-->
     <div id="app"></div>
+    <script src="jquery-1.12.4.min.js"></script>
+    <script src="jsencrypt.min.js"></script>
+    <script src="jsWebControl-1.0.0.min.js"></script>
     <!-- built files will be auto injected -->
   </body>
 </html>

Разлика између датотеке није приказан због своје велике величине
+ 74 - 0
public/jquery-1.12.4.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 0
public/jsWebControl-1.0.0.min.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 0
public/jsencrypt.min.js


+ 4 - 1
src/main.js

@@ -3,6 +3,9 @@ import App from './App.vue'
 import router from "@/router/index.js";
 import '@/assets/styles/index.scss'
 
+import $ from 'jquery';
+import jquery from 'jquery';
+
 createApp(App)
-.use(router)
+.use(router,$,jquery)
 .mount('#app')

+ 6 - 1
src/request/index.js

@@ -25,7 +25,12 @@ service.interceptors.request.use(
 service.interceptors.response.use(
 	(response) => {
 		const res = response.data;
-		return res;
+		if (res!==null && res!=undefined)
+		{
+			return res;
+		}else {
+			console.log("请求出现错误")
+		}
 	},
 	(error) => {
 		return Promise.reject(error);

+ 292 - 0
src/views/home/cpns/VideoForHK.vue

@@ -0,0 +1,292 @@
+<!-- 视频播放组件 -->
+<template>
+    <div class="VideoForHk" ref="playWndBox">
+        <div id="playWnd" class="playWnd" :style="{ height: playWndHeight + 'px', width: playWndWidth + 'px',
+      }"
+        >{{backMsg}}</div>
+    </div>
+</template>
+<script setup>
+    import {ref,  onMounted, onBeforeUnmount,onBeforeMount, getCurrentInstance,  nextTick, watch} from 'vue'
+    const props = defineProps(['cameraIndexCode'])
+
+    const playWndBox = ref(null)
+    let backMsg = ref('')
+    let playWndHeight = ref('')
+    let playWndWidth = ref('')
+    let pubKey = ref('')
+    let oWebControl = ref(null)
+    let objData = ref({
+        appkey: "29125464",                 //海康提供的appkey
+        ip: "172.16.58.60",                     //海康提供的ip
+        secret: "0E0mA8uF5T9cVNvE5CxX",                 //海康提供的secret
+        port: 4443,
+        playMode: 0,        // 0 预览 1回放
+        layout: "1x1",      //页面展示的模块数【16】
+    })
+    onBeforeMount(() => {
+        // 初始化播放器插件
+        nextTick(() => {
+            initPlugin();
+        },{immediate: true})
+
+    })
+
+    onMounted(() => {
+        // 获取页面的实例对象
+        const pageInstance = getCurrentInstance();
+        // 获取dom节点对象
+        const tagDomObj = pageInstance.refs.playWndBox;
+        playWndHeight.value = tagDomObj.clientHeight;
+        playWndWidth.value = tagDomObj.clientWidth;
+        // 监听scroll事件,使插件窗口尺寸跟随DIV窗口变化
+        window.addEventListener("scroll", () => {
+            console.log(5);
+            // return
+            if (oWebControl.value != null) {
+                oWebControl.JS_Resize(
+                    tagDomObj.clientWidth,
+                    tagDomObj.clientHeight
+                );
+                this.setWndCover();
+            }
+        });
+        // 监听resize事件,使插件窗口尺寸跟随DIV窗口变化
+        window.addEventListener("resize", (e) => {
+            console.log(0);
+            if (oWebControl.value != null) {
+                oWebControl.JS_Resize(
+                    tagDomObj.clientWidth,
+                    tagDomObj.clientHeight
+                );
+                this.setWndCover();
+            }
+        });
+        // 初始化播放器插件
+    })
+
+   function onCancelVideo(){
+       if (oWebControl.value != null) {
+           // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
+           oWebControl.JS_HideWnd();
+           // 销毁当前播放的视频
+           oWebControl.JS_RequestInterface({ funcName: "destroyWnd" });
+           // 断开与插件服务连接
+           oWebControl.JS_Disconnect();
+       }
+    }
+
+    onBeforeUnmount(() => {
+        if (oWebControl.value != null) {
+            // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
+            oWebControl.JS_HideWnd();
+            // 销毁当前播放的视频
+            oWebControl.JS_RequestInterface({ funcName: "destroyWnd" });
+            // 断开与插件服务连接
+            oWebControl.JS_Disconnect();
+        }
+    })
+    // 设置窗口控制回调
+    function setCallbacks() {
+        oWebControl.JS_SetWindowControlCallback({
+            cbIntegrationCallBack: cbIntegrationCallBack
+        });
+    }
+    // 推送消息
+    function cbIntegrationCallBack(oData) {
+        if (oData.msg.result && oData.msg.result==816)
+        {
+            onCancelVideo()
+        }
+        backMsg.value=JSON.stringify(oData.responseMsg);
+        console.log(JSON.stringify(oData.responseMsg))
+    }
+
+    const  initCount=ref(0)
+
+    const initPlugin = () => {
+        oWebControl = new WebControl({
+            szPluginContainer: "playWnd", // 指定容器id
+            iServicePortStart: 15900, // 指定起止端口号,建议使用该值
+            iServicePortEnd: 15900,
+            szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // 用于IE10使用ActiveX的clsid
+            cbConnectSuccess: () => {
+                // 创建WebControl实例成功
+                setCallbacks()
+                oWebControl.JS_StartService("window", {
+                        // WebControl实例创建成功后需要启动服务
+                        // 值"./VideoPluginConnect.dll"写死
+                        dllPath: "./VideoPluginConnect.dll",
+                    })
+                    .then(function () {
+                            //JS_CreateWnd创建视频播放窗口,宽高可设定
+                            oWebControl.JS_CreateWnd("playWnd", playWndWidth.value, playWndHeight.value)//这一部分很重要,两个参数为你盒子的宽高,这样是写死是防止组件加载之前出现白屏;bEmbed: true 防止窗口闪烁
+                                .then(function () {
+                                    init(()=>{
+                                        nextTick(() => {
+                                            console.log("开始加载视频")
+                                            previewVideo(props.cameraIndexCode)
+                                        },{immediate: true})
+
+                                    });
+                                });},
+                        function () {
+                            // 启动插件服务失败
+                            console.log("启动插件服务失败!")
+                            // 这里写创建WebControl实例失败时的处理步骤,下面的代码仅做参看,具体实现步骤根据个人需求进行编写!!!!!!!!
+                            // console.log(0);
+                            oWebControl.value = null;
+                            // // 程序未启动时执行error函数,采用wakeup来启动程序
+                            window.WebControl.JS_WakeUp("VideoWebPlugin://");
+                            initCount.value++;
+                            if (initCount.value< 3) {
+                                setTimeout(function () {
+                                    initPlugin();
+                                }, 3000);
+                            } else {
+                                initCount.value=0
+                                $("#playWnd").html("插件启动失败,请检查插件是否安装!");
+                            }
+                        }
+                    );
+                setCallbacks()
+            },
+            // 创建WebControl实例失败
+            cbConnectError: function () {
+                console.log("创建WebControl实例失败!")
+                // 这里写创建WebControl实例失败时的处理步骤,下面的代码仅做参看,具体实现步骤根据个人需求进行编写!!!!!!!!
+                // console.log(0);
+                oWebControl.value = null;
+                // // 程序未启动时执行error函数,采用wakeup来启动程序
+                window.WebControl.JS_WakeUp("VideoWebPlugin://");
+                initCount.value++;
+                if (initCount.value< 3) {
+                  setTimeout(function () {
+                    initPlugin();
+                  }, 3000);
+                } else {
+                    initCount.value=0
+                    $("#playWnd").html("插件启动失败,请检查插件是否安装!");
+                }
+            },
+            cbConnectClose: () => {
+                console.log("创建WebControl异常断开!")
+                // 异常断开:bNormalClose = false
+                // JS_Disconnect正常断开:bNormalClose = true
+                // console.log("cbConnectClose");
+                oWebControl.value = null;
+            },
+        });
+        // oWebControl.JS_CuttingPartWindow(500, 500, 500, 500);
+    }
+    // 初始化
+    const init = (callback) => {
+        getPubKey(() => {
+            let appkey = objData.value.appkey;                   //综合安防管理平台提供的appkey,必填
+            let secret = setEncrypt(objData.value.secret); //综合安防管理平台提供的secret,必填
+            let ip = objData.value.ip;                           //综合安防管理平台IP地址,必填
+            console.log(ip)
+            let playMode = objData.value.playMode;                //初始播放模式:0-预览,1-回放
+            let port = objData.value.port;                        //综合安防管理平台端口,若启用HTTPS协议,默认443
+            let snapDir = "D:\\SnapDir";                        //抓图存储路径
+            let videoDir = "D:\\VideoDir";                      //紧急录像或录像剪辑存储路径
+            let layout = objData.value.layout;                   //playMode指定模式的布局
+            let enableHTTPS = 1;                                //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
+            let encryptedFields = "secret";                     //加密字段,默认加密领域为secret
+            let showToolbar = 1;                                //是否显示工具栏,0-不显示,非0-显示
+            let showSmart = 0;                                  //是否显示移动框线框,0-不显示,非0-显示
+            oWebControl.JS_RequestInterface({
+                    funcName: "init",
+                    argument: JSON.stringify({
+                        appkey: appkey,         //API网关提供的appkey
+                        secret: secret,         //API网关提供的secret
+                        ip: ip,                 //API网关IP地址
+                        playMode: playMode,      //播放模式(决定显示预览还是回放界面)
+                        port: port,             //端口
+                        snapDir: snapDir,       //抓图存储路径
+                        videoDir: videoDir,     //紧急录像或录像剪辑存储路径
+                        layout: layout,         //布局
+                        enableHTTPS: enableHTTPS,   //是否启用HTTPS协议
+                        encryptedFields: encryptedFields, //加密字段
+                        showToolbar: showToolbar, //是否显示工具栏
+                        showSmart: showSmart,   //是否显示智能信息
+                        toolBarButtonIDs: "2048,2049,2050,2304,2306,2305,2307,2308,2309,4096,4608,4097,4099,4098,4609,4100",
+                        reconnectDuration: 5,
+                        reconnectTimes: 5,
+                    }),
+                })
+                .then(function (oData) {
+                    oWebControl.JS_Resize(playWndWidth.value, playWndHeight.value); // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
+                    if (callback) {
+                        callback();
+                    }
+                    // // 隐藏
+                    // oWebControl.JS_HideWnd()
+                });
+        });
+        console.log("初始化完成")
+    }
+
+    // RSA 加密
+    let setEncrypt = (value) => {
+        let encrypt = new window.JSEncrypt();
+        encrypt.setPublicKey(pubKey);
+        return encrypt.encrypt(value);
+    }
+    // 获取公钥
+    const getPubKey = (callback) => {
+        oWebControl
+            .JS_RequestInterface({
+                funcName: "getRSAPubKey",
+                argument: JSON.stringify({
+                    keyLength: 1024,
+                }),
+            })
+            .then(function (oData) {
+                if (oData.responseMsg.data) {
+                    pubKey = oData.responseMsg.data;
+                    console.log("获取公钥:"+pubKey)
+                    callback();
+                }
+            });
+    }
+    // 调用这个函数可进行视频播放
+    // 视频预览功能
+    const previewVideo = (data) => {
+        console.log("接收到视频ID:开始播放"+data)
+        let cameraIndexCode = data;  // 获取输入的监控点编号值,必填
+        let streamMode = 0;          // 主子码流标识:0-主码流,1-子码流
+        let transMode = 1;           // 传输协议:0-UDP,1-TCP
+        let gpuMode = 0;             // 是否启用GPU硬解,0-不启用,1-启用
+        let wndId = -1;              // 播放窗口序号(在2x2以上布局下可指定播放窗口)
+        oWebControl.JS_RequestInterface({
+            funcName: "startPreview",
+            argument: JSON.stringify({
+                authUuid: "",
+                ezvizDirect: 0,
+                cameraIndexCode: cameraIndexCode, // 监控点编号
+                streamMode: streamMode,                 // 主子码流标识
+                transMode: transMode,                   // 传输协议
+                gpuMode: gpuMode,                       // 是否开启GPU硬解
+                wndId: wndId,                           // 可指定播放窗口
+                cascade: 1
+            }),
+        }).then(function (oData) {
+            cbIntegrationCallBack(oData)
+        })
+    }
+</script>
+<style lang="scss" scoped>
+    .VideoForHk {
+        position: fixed;
+        top: 50%;
+        left: 20%;
+        transform: translateY(-50%);
+        width: 30vw;
+        height: 20vh;
+        margin: auto;
+        background-color: #ccc;
+        /*color: #021434;*/
+        z-index: -1;
+    }
+</style>

+ 11 - 2
src/views/yyjg/cpns/EntInfo.vue

@@ -96,13 +96,17 @@
 
 
       <PicViewerForOine v-if="imageShow" :picImg="imagesUrl"  @closePicViewerOne="closePicViewerOne"/>
+
+       <VideoForHK  v-if="vidoShow" :cameraIndexCode="cameraIndexCode" />
     </div>
   </div>
 </template>
 
 <script>
+import Video from "@/views/home/cpns/VideoForHK";
 export default {
   name: 'EntInfo',
+  components: {Video},
 }
 </script>
 
@@ -116,7 +120,7 @@ export default {
   import 'element-plus/es/components/table-column/style/css'
   import 'element-plus/es/components/pagination/style/css'
   import PicViewerForOine from "@/views/home/cpns/PicViewerForOine";
-
+  import VideoForHK from "@/views/home/cpns/VideoForHK";
   import { ueCallOpenUnitVideo } from '@/utils/UIInteractions'
 
   const props = defineProps(['ent-data'])
@@ -133,6 +137,8 @@ export default {
 
   const imageShow = ref(false)
 
+  const vidoShow = ref(false)
+  const  cameraIndexCode= ref("")
   const imagesUrl=ref({url:"#"})
 
   // 关闭图片
@@ -226,7 +232,7 @@ export default {
     })
   }
   const tableData_video = reactive({value:
-            [{name:"主厂区视频",id:"123123123"},{name:"主厂区视频",id:"123"},{name:"主厂区视频",id:"123"},{name:"主厂区视频",id:"123"},{name:"主厂区视频",id:"123"}]})
+            [{name:"主厂区视频",id:"d5d1fbbf5c4e41b798473d1db8d29aac"},{name:"主厂区视频",id:"60180dd3a85646e397a348b5f5aa8eb6"},{name:"主厂区视频",id:"ace1a0a9320246d2b9c760a05fe7697a"},{name:"主厂区视频",id:"123"},{name:"主厂区视频",id:"123"}]})
   const tableData_goods = reactive({value: []})
 
   const tableData_yun = reactive({value:
@@ -258,6 +264,9 @@ export default {
   // 点击查看视频
   function clickVideo(id) {
     console.log(id);
+    vidoShow.value=true
+    cameraIndexCode.value=id
+
   }
   // 解析index
   function  indexCreate(row, column, cellValue, index) {

+ 15 - 0
vue.config.js

@@ -5,3 +5,18 @@ module.exports = defineConfig({
   lintOnSave:false,
   publicPath: './'
 })
+
+const webpack = require("webpack");
+
+
+module.exports = {
+  configureWebpack: {
+    plugins: [
+      new webpack.ProvidePlugin({
+        $: "jquery",
+        jQuery: "jquery",
+        "windows.jQuery": "jquery",
+      }),
+    ],
+  }
+}