From fdd38a72d0b0b87724aa94f7f9b5b0885f34cff5 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 12 十二月 2024 16:51:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 screen/src/views/SecurityControl.vue |  176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 169 insertions(+), 7 deletions(-)

diff --git a/screen/src/views/SecurityControl.vue b/screen/src/views/SecurityControl.vue
index 1ace36c..0703983 100644
--- a/screen/src/views/SecurityControl.vue
+++ b/screen/src/views/SecurityControl.vue
@@ -108,10 +108,10 @@
           </div>
         </div>
         <div class="center_box">
-          <div v-if="showJk" class="jiankong">
+          <div v-show="showJk" class="jiankong">
             <img class="jk_bg" src="@/assets/images/SecurityControl/jiankong_bg@2x.png" alt="">
             <div class="content">
-              <video :src="activeVideo" class="video"></video>
+              <div class="player_bg" style="width: 100%;height: 100%;" id="playWnd"> </div>
             </div>
             <div class="right_wrap">
               <div class="menus">
@@ -144,7 +144,7 @@
             </div>
 
           </div>
-          <div v-else class="center_box_one">
+          <div v-show="!showJk" class="center_box_one">
             <div class="list">
               <div class="item">
                 <div class="name_wrap">
@@ -476,7 +476,7 @@
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, nextTick } from 'vue'
 import VScaleScreen from 'v-scale-screen'
 import Percent from '@/components/percent.vue'
 import dayjs from 'dayjs'
@@ -508,6 +508,143 @@
 
 }, 1000)
 
+
+const oWebControl = ref(null)
+const initCount = ref()
+const pubKey = ref('')
+const initPlugin = () => {
+  oWebControl.value = new WebControl({
+    szPluginContainer: "playWnd",                       // 鎸囧畾瀹瑰櫒id
+    iServicePortStart: 15900,                           // 鎸囧畾璧锋绔彛鍙凤紝寤鸿浣跨敤璇ュ��
+    iServicePortEnd: 15900,
+    szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11",   // 鐢ㄤ簬IE10浣跨敤ActiveX鐨刢lsid
+    cbConnectSuccess: function () {
+      // 鍒涘缓WebControl瀹炰緥鎴愬姛
+      console.log('鍒涘缓WebControl瀹炰緥鎴愬姛');
+      
+      oWebControl.value.JS_StartService("window", {         // WebControl瀹炰緥鍒涘缓鎴愬姛鍚庨渶瑕佸惎鍔ㄦ湇鍔�
+        dllPath: "./VideoPluginConnect.dll"         // 鍊�"./VideoPluginConnect.dll"鍐欐
+      }).then(function () {
+        oWebControl.value.JS_SetWindowControlCallback({   // 璁剧疆娑堟伅鍥炶皟
+          cbIntegrationCallBack: cbIntegrationCallBack
+        })// 鍚姩鎻掍欢鏈嶅姟鎴愬姛
+        oWebControl.value.JS_CreateWnd("playWnd", '300', '200').then(function () { //JS_CreateWnd鍒涘缓瑙嗛鎾斁绐楀彛锛屽楂樺彲璁惧畾锛宐oxWidth, boxHeight瀹瑰櫒
+        // oWebControl.value.JS_CreateWnd("playWnd").then(function () { //JS_CreateWnd鍒涘缓瑙嗛鎾斁绐楀彛锛屽楂樺彲璁惧畾锛宐oxWidth, boxHeight瀹瑰櫒
+          init()  // 鍒涘缓鎾斁瀹炰緥鎴愬姛鍚庡垵濮嬪寲
+        })
+      }, function () { // 鍚姩鎻掍欢鏈嶅姟澶辫触
+      })
+    },
+    cbConnectError: function () { // 鍒涘缓WebControl瀹炰緥澶辫触
+      console.log('鍒涘缓WebControl瀹炰緥澶辫触');
+      oWebControl.value = null
+      $("#playWnd").html("鎻掍欢鏈惎鍔紝姝e湪灏濊瘯鍚姩锛岃绋嶅��...")
+      WebControl.JS_WakeUp("VideoWebPlugin://") // 绋嬪簭鏈惎鍔ㄦ椂鎵цerror鍑芥暟锛岄噰鐢╳akeup鏉ュ惎鍔ㄧ▼搴�
+      initCount.value++
+      if (initCount.value < 3) {
+        setTimeout(function () {
+          initPlugin()
+        }, 3000)
+      } else {
+        $("#playWnd").html("鎻掍欢鍚姩澶辫触锛岃妫�鏌ユ彃浠舵槸鍚﹀畨瑁咃紒鎴栭噸鏂颁笅杞� <a href='./videoUrl/VideoWebPlugin.exe' target='_blank'>涓嬭浇a<a>")
+      }
+    },
+    cbConnectClose: function (bNormalClose) {
+      // 寮傚父鏂紑锛歜NormalClose = false
+      // JS_Disconnect姝e父鏂紑锛歜NormalClose = true
+      console.log('寮傚父鏂紑锛歜NormalClose');
+      oWebControl.value = null
+      $("#playWnd").html("鎻掍欢鏈惎鍔紝姝e湪灏濊瘯鍚姩锛岃绋嶅��...")
+      WebControl.JS_WakeUp("VideoWebPlugin://")
+      initCount.value++
+      if (initCount.value < 3) {
+        setTimeout(function () {
+          initPlugin()
+        }, 3000)
+      } else {
+        $("#playWnd").html("鎻掍欢鍚姩澶辫触锛岃妫�鏌ユ彃浠舵槸鍚﹀畨瑁咃紒鎴栭噸鏂颁笅杞� <a href='https://img0.baidu.com/it/u=3867022436,608124672&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1422' target='_blank'>涓嬭浇b<a>")
+      }
+    }
+  })
+}
+function fileDown() {
+  window.open('./videoUrl/VideoWebPlugin.exe')
+}
+// 娑堟伅鍥炶皟
+const cbIntegrationCallBack = (oData) => {
+  let response = oData.responseMsg
+  // response.type=1  閫変腑绐楀彛娑堟伅  type=2 鎾斁娑堟伅
+}
+// 鐩戞帶
+
+
+
+
+// 鍒濆鍖�
+const init = () => {
+  getPubKey(function () {
+    ////////////////////////////////// 璇疯嚜琛屼慨鏀逛互涓嬪彉閲忓��   ////////////////////////////////////
+    let appkey = "23154099"                           //缁煎悎瀹夐槻绠$悊骞冲彴鎻愪緵鐨刟ppkey锛屽繀濉�
+    let secret = '88wFsg3xfn7o8QMsWEO2'   //缁煎悎瀹夐槻绠$悊骞冲彴鎻愪緵鐨剆ecret锛屽繀濉�
+    // let secret = setEncrypt("88wFsg3xfn7o8QMsWEO2")   //缁煎悎瀹夐槻绠$悊骞冲彴鎻愪緵鐨剆ecret锛屽繀濉�
+    let ip = "10.50.250.253"                           //缁煎悎瀹夐槻绠$悊骞冲彴IP鍦板潃锛屽繀濉�
+    let playMode = 0                                  //鍒濆鎾斁妯″紡锛�0-棰勮(瀹炴椂娴�)锛�1-鍥炴斁(瑙嗛)
+    let port = 443                                    //缁煎悎瀹夐槻绠$悊骞冲彴绔彛锛岃嫢鍚敤HTTPS鍗忚锛岄粯璁�443
+    let snapDir = "D:\\SnapDir"                       //鎶撳浘瀛樺偍璺緞
+    let videoDir = "D:\\VideoDir"                     //绱ф�ュ綍鍍忔垨褰曞儚鍓緫瀛樺偍璺緞
+    let layout = "1x1"                                //playMode鎸囧畾妯″紡鐨勫竷灞�
+    let enableHTTPS = 1                               //鏄惁鍚敤HTTPS鍗忚涓庣患鍚堝畨闃茬鐞嗗钩鍙颁氦浜掞紝杩欓噷鎬绘槸濉�1
+    let encryptedFields = 'secret'                    //鍔犲瘑瀛楁锛岄粯璁ゅ姞瀵嗛鍩熶负secret
+    let showToolbar = 1                               //鏄惁鏄剧ず宸ュ叿鏍忥紝0-涓嶆樉绀猴紝闈�0-鏄剧ず
+    let showSmart = 1                                 //鏄惁鏄剧ず鏅鸿兘淇℃伅锛堝閰嶇疆绉诲姩渚︽祴鍚庣敾闈笂鐨勭嚎妗嗭級锛�0-涓嶆樉绀猴紝闈�0-鏄剧ず
+    let buttonIDs = "0,16,256,257,258,259,260,513,514,515,516,517,768"  //鑷畾涔夊伐鍏锋潯鎸夐挳
+    oWebControl.value.JS_RequestInterface({
+      funcName: "init",
+      argument: JSON.stringify({
+        appkey: appkey,                            //API缃戝叧鎻愪緵鐨刟ppkey
+        secret: secret,                            //API缃戝叧鎻愪緵鐨剆ecret
+        ip: ip,                                    //API缃戝叧IP鍦板潃
+        playMode: playMode,                        //鎾斁妯″紡锛堝喅瀹氭樉绀洪瑙堣繕鏄洖鏀剧晫闈級
+        port: port,                                //绔彛
+        snapDir: snapDir,                          //鎶撳浘瀛樺偍璺緞
+        videoDir: videoDir,                        //绱ф�ュ綍鍍忔垨褰曞儚鍓緫瀛樺偍璺緞
+        layout: layout,                            //甯冨眬
+        enableHTTPS: enableHTTPS,                  //鏄惁鍚敤HTTPS鍗忚
+        encryptedFields: encryptedFields,          //鍔犲瘑瀛楁
+        showToolbar: showToolbar,                  //鏄惁鏄剧ず宸ュ叿鏍�
+        showSmart: showSmart,                      //鏄惁鏄剧ず鏅鸿兘淇℃伅
+        buttonIDs: buttonIDs                       //鑷畾涔夊伐鍏锋潯鎸夐挳
+      })
+    }).then(function (oData) {
+      console.log('鍒濆鍖栨垚鍔�');
+      
+      // oWebControl.value.JS_Resize(that.boxWidth, that.boxHeight)  // 鍒濆鍖栧悗resize涓�娆★紝瑙勯伩firefox涓嬮娆℃樉绀虹獥鍙e悗鎻掍欢绐楀彛鏈笌DIV绐楀彛閲嶅悎闂
+    })
+  })
+}
+
+// 鑾峰彇鍏挜
+function getPubKey(callback) {
+  oWebControl.value.JS_RequestInterface({
+    funcName: 'getRSAPubKey',
+    argument: JSON.stringify({
+      keyLength: 1024,
+    }),
+  }).then((oData) => {
+    if (oData.responseMsg.data) {
+      pubKey.value = oData.responseMsg.data
+      callback()
+    }
+  })
+}
+
+// RSA鍔犲瘑
+function setEncrypt(value) {
+  let that = this
+  let encrypt = new JSEncrypt()
+  encrypt.setPublicKey(pubKey.value)
+  return encrypt.encrypt(value)
+}
 
 
 const arr = ['#68e2e3', '#50afd3', '#377cdb', '#d5ae3a']
@@ -839,7 +976,7 @@
     data4.value = res.data || {}
     let obj = data4.value
     data4.value.total = obj.levelNum + obj.retentionNum + obj.registerVisitNum + obj.waitVisitNum
-    const result = res.data.visitRetentionDataList || []
+    const result = res.data?.visitRetentionDataList || []
     dataList3.value = result.map(i => {
       if (i.timeOutMinute) {
         i.timeOutMinute = Math.abs(i.timeOutMinute)
@@ -916,10 +1053,33 @@
   }
 }
 const menuItemClick = (val) => {
+  initPlugin()
   activeMenu.value = val
-  afgetCarmeraPreviemUrl({ indexCode: val.indexCode }).then(res => {
-    activeVideo.value = res.data
+  nextTick(() => {
+    console.log('indexCode', val.indexCode);
+    
+    oWebControl.value.JS_RequestInterface({
+      funcName: "startPreview",
+      argument: JSON.stringify({
+        cameraIndexCode: val.indexCode,            //鐩戞帶鐐圭紪鍙�
+        streamMode: 0,                   //涓诲瓙鐮佹祦鏍囪瘑锛�0-涓荤爜娴侊紝1-瀛愮爜娴�
+        transMode: 1,                    //浼犺緭鍗忚锛�0-UDP锛�1-TCP
+        gpuMode: 0,                      //鏄惁鍚敤GPU纭В锛�0-涓嶅惎鐢紝1-鍚敤
+        wndId: -1                         //鎾斁绐楀彛搴忓彿锛堝湪2x2浠ヤ笂甯冨眬涓嬪彲鎸囧畾鎾斁绐楀彛锛�
+      })
+    }).then((oData) => {
+      if (oData.responseMsg.code === 1) {
+        console.log('success', oData)
+      }
+    }, err => {
+      console.log('err', err)
+
+    })
   })
+
+  // afgetCarmeraPreviemUrl({ indexCode: val.indexCode }).then(res => {
+  //   activeVideo.value = res.data
+  // })
 }
 
 const autoplayFlag = (list = [], leng = 4, time = 2000) => {
@@ -962,6 +1122,7 @@
 
 
 
+
 onMounted(() => {
   getData1()
   getData2()
@@ -969,6 +1130,7 @@
   getData5()
   getWarning()
 
+
   setInterval(() => {
     getData1()
     getData2()

--
Gitblit v1.9.3