Pārlūkot izejas kodu

websocket bug修复

王通 1 gadu atpakaļ
vecāks
revīzija
9c5281e51c
1 mainītis faili ar 54 papildinājumiem un 51 dzēšanām
  1. 54 51
      src/components/TVWall.vue

+ 54 - 51
src/components/TVWall.vue

@@ -286,6 +286,7 @@ export default {
     },
     //火点联动电视墙调用
     showTVWall1(longitude,latitude,tvListJson) {
+
       selectConfigKey("DssVersion").then(res => {
         if(this.ws.getLocalDssVersion()!=res.data){
           this.$modal.confirm('系统检测到新客户端版本,请更新后使用', '系统提示', {
@@ -300,6 +301,7 @@ export default {
           });
           return
         }else{
+
           // let that=this;
           /** ----------------------------------大华摄像头预览开始------------------------------------- */
           this.ws.addEventListener('connectStateChange', data => {
@@ -376,7 +378,6 @@ export default {
         }
       })
 
-
     },
     create1(longitude,latitude,tvListJson,array,array1) { // 调用创建控件接口
       let _this = this
@@ -386,7 +387,7 @@ export default {
           'ctrlCode': 'ctrl1',
           'ctrlProperty': {
             'displayMode': 1,
-            'splitNum': (array.length==1?1:4),
+            'splitNum': 1,
             'channelList': [
               {
                 'channelId': ''
@@ -467,59 +468,61 @@ export default {
           // }, 5000)
           // /** ----------------------------------海康摄像头预览结束------------------------------------- */
           this.TVWallVisible = true
-        },
-        /** ----------------------------------大华摄像头预览开始------------------------------------- */
-        alertLogin: function() {
-          this.$modal.msg('登录中....')
-        },
-        alertLoginSuccess: function() {
-          this.$modal.msgSuccess('登录成功!')
-        },
-        alertLoginFailed: function() {
-          this.$modal.msgError('登陆失败!')
-        },
-        alertReinstall: function() {
-          this.$modal.msgWarning('请重新安装客户端')
-        },
-        /** 预览按钮操作 */
-        preview(tvListJson,bfArray) {
-          getTVWallList().then(newres => {
-            getDahuaVideoServer().then(newResponse => {
-              this.ws.detectConnectQt().then(res => {
-                if (res) { // 连接客户端成功
-                  this.alertLogin()
-                  this.ws.login({
-                    loginIp: newResponse.loginIp,
-                    loginPort: newResponse.loginPort,
-                    userName: newResponse.userName,
-                    userPwd: newResponse.userPwd,
-                    // loginIp: '192.168.100.100',
-                    // loginPort: 8314,
-                    // userName: 'system',
-                    // userPwd: 'Admin@123',
-                    token: '',
-                    https: 1
-                  })
-                  this.ws.on('loginState', (res) => {
-                    this.isLogin = res
-                    console.log('---res-----', res)
-                    if (res) {
-                      this.alertLoginSuccess()
-                      this.activePanel = 'key2'
-                      this.create(tvListJson?tvListJson:newres.data,bfArray)
-                    } else {
-                      this.alertLoginFailed()
-                    }
-                  })
-                } else { // 连接客户端失败
-                  this.alertReinstall()
+        }
+      })
+
+    },
+    /** ----------------------------------大华摄像头预览开始------------------------------------- */
+    alertLogin: function() {
+      this.$modal.msg('登录中....')
+    },
+    alertLoginSuccess: function() {
+      this.$modal.msgSuccess('登录成功!')
+    },
+    alertLoginFailed: function() {
+      this.$modal.msgError('登陆失败!')
+    },
+    alertReinstall: function() {
+      this.$modal.msgWarning('请重新安装客户端')
+    },
+    /** 预览按钮操作 */
+    preview(tvListJson,bfArray) {
+      getTVWallList().then(newres => {
+        getDahuaVideoServer().then(newResponse => {
+          this.ws.detectConnectQt().then(res => {
+            if (res) { // 连接客户端成功
+              this.alertLogin()
+              this.ws.login({
+                loginIp: newResponse.loginIp,
+                loginPort: newResponse.loginPort,
+                userName: newResponse.userName,
+                userPwd: newResponse.userPwd,
+                // loginIp: '192.168.100.100',
+                // loginPort: 8314,
+                // userName: 'system',
+                // userPwd: 'Admin@123',
+                token: '',
+                https: 1
+              })
+              this.ws.on('loginState', (res) => {
+                this.isLogin = res
+                console.log('---res-----', res)
+                if (res) {
+                  this.alertLoginSuccess()
+                  this.activePanel = 'key2'
+                  this.create(tvListJson?tvListJson:newres.data,bfArray)
+                } else {
+                  this.alertLoginFailed()
                 }
               })
-            })
+            } else { // 连接客户端失败
+              this.alertReinstall()
+            }
           })
-        }
+        })
       })
     },
+
     create(tvListJson,bfArray) { // 调用创建控件接口
       // debugger
       let _this = this
@@ -529,7 +532,7 @@ export default {
           'ctrlCode': 'ctrl1',
           'ctrlProperty': {
             'displayMode': 1,
-            'splitNum': (bfArray.length==1?1:4),
+            'splitNum': 1,
             'channelList': [
               {
                 'channelId': ''