安琪酵母(西藏)益生菌信息采集中心智能实验室
longyvfengyun
2023-08-24 fe936486ee0023e4be8d17625471aad6e8e284ff
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) {
            console.log("模拟通道失败");
          }
        });
        Promise.all([getAnalog]).then(res=>{
          console.log("数据成功");
            setTimeout(()=>{
              initPlay(data.ip, data.port, iWndIndex);
            }, 1000);
          }
          }, 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);
      }