From fe936486ee0023e4be8d17625471aad6e8e284ff Mon Sep 17 00:00:00 2001
From: longyvfengyun <496960745@qq.com>
Date: 星期四, 24 八月 2023 10:52:35 +0800
Subject: [PATCH] 内容调整

---
 src/views/video/components/js/hkVideo/hkModule.js |   43 +++++++++++++++++++++++++++++++++++--------
 1 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/src/views/video/components/js/hkVideo/hkModule.js b/src/views/video/components/js/hkVideo/hkModule.js
index 0ac7c79..7c43bd4 100644
--- a/src/views/video/components/js/hkVideo/hkModule.js
+++ b/src/views/video/components/js/hkVideo/hkModule.js
@@ -33,29 +33,50 @@
           setTimeout(()=>{
             cbComplete();
           }, 500);
-
         }
       }
     });
   }
 
   const clickLogin = (data, iWndIndex)=>{
+    WebVideoCtrl.I_GetDevicePort(data.ip).then(res=>{
+      console.log(res);
+    }).catch(error=>{
+      if(error.errorCode == 2000) {
+        login(data, iWndIndex);
+      }
+      console.log(error);
+    });
+  }
+
+  const login = (data, iWndIndex)=>{
     WebVideoCtrl.I_Login(data.ip, 1, data.port, data.username, data.password, {
       timeout: 3000,
       success: function () {
         console.log("寮�濮嬮瑙�");  //涓嶈兘鍒犻櫎
+        const szId = data.ip+"_"+data.port;
+
         // 妯℃嫙閫氶亾
-        WebVideoCtrl.I_GetAnalogChannelInfo(data.ip, {
+        const getAnalog = WebVideoCtrl.I_GetAnalogChannelInfo(szId, {
+          timeout: 3000,
           success: function (xmlDoc) {
-            setTimeout(()=>{
-              initPlay(data.ip, data.port, iWndIndex);
-            }, 1000);
+            console.log("妯℃嫙閫氶亾鎴愬姛");
           },
           error: function (oError) {
-            setTimeout(()=>{
-              initPlay(data.ip, data.port, iWndIndex);
-            }, 1000);
+            console.log("妯℃嫙閫氶亾澶辫触");
           }
+        });
+
+        Promise.all([getAnalog]).then(res=>{
+          console.log("鏁版嵁鎴愬姛");
+          setTimeout(()=>{
+            initPlay(data.ip, data.port, iWndIndex);
+          }, 3000);
+        }).catch(error=>{
+          console.log("鏁版嵁澶辫触");
+          setTimeout(()=>{
+            initPlay(data.ip, data.port, iWndIndex);
+          }, 3000);
         });
       },
       error: function () {
@@ -80,6 +101,9 @@
         iWndIndex,
         success: function () {
           startRealPlay(ip, port, iWndIndex);
+        },
+        error: function() {
+          startRealPlay(ip, port, iWndIndex);
         }
       });
     } else {
@@ -98,6 +122,9 @@
         console.log("寮�濮嬮瑙堟垚鍔燂紒");
       },
       error: function (oError) {
+        setTimeout(()=>{
+          initPlay(ip, port, iWndIndex);
+        }, 3000);
         console.log("寮�濮嬮瑙堝け璐ワ紒");
         console.log(oError);
       }

--
Gitblit v1.9.1