qx
qx
2025-02-10 fd338a4272404e6b9d1f0c12abd70d284e9de217
qx
1个文件已修改
60 ■■■■■ 已修改文件
src/views/reservation/reservations/index.vue 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reservation/reservations/index.vue
@@ -1921,6 +1921,7 @@
      },
      discount: 10,
      taocan: false,
      webSocket: null,
      defaultKeys: [],
      value1: "",
      pacName: "",
@@ -1933,7 +1934,7 @@
      url: "",
      open2: false,
      forms: {
        tjCategory:null
        tjCategory:"12"
      },
      dialogVisible: false,
      /** 照相机弹窗模块-start */
@@ -2127,6 +2128,7 @@
      reservationList: [],
      // 弹出层标题
      title: "",
      valueUrls: "ws://127.0.0.1:6789/websocket",
      drawer: false,
      drawer1: false,
      // 查询参数
@@ -2694,7 +2696,6 @@
        this.open2 = false;
        this.$modal.msgSuccess("签到成功");
        if (res.file) {
          let base64 = res.file;
          this.base64ToBlob({
            b64data: base64,
@@ -2708,6 +2709,61 @@
              this.url = window.webkitURL.createObjectURL(res.preview);
            }
          });
        }else{
          let _this = this;
        var websocket = null;
        var url = _this.valueUrls;
        if ("WebSocket" in window) {
          websocket = new WebSocket(url);
        } else if ("MozWebSocket" in window) {
          websocket = new MozWebSocket(url);
        } else {
        }
        if (websocket == null) {
          alert("11111");
        }
        websocket.onopen = function () {
          try {
            // 连接设备
            var jsonObjs = {
              type: 4,
              data: res,
            };
            var jStrs = JSON.stringify(jsonObjs);
            websocket.send(jStrs);
          } catch (err) {
            var tryTime = 0;
            // 重试10次,每次之间间隔3秒
            if (tryTime < 1) {
              var t1 = setTimeout(function () {
                tryTime++;
                var jsonObjs = {
                  type: 4,
                  data: res,
                };
                var jStrs = JSON.stringify(jsonObjs);
                websocket.send(jStrs);
              }, 1 * 1000);
            } else {
              console.error("重连失败.");
            }
          }
        };
        websocket.onclose = function () {
          alert("连接关闭");
        };
        websocket.onmessage = function (event) {
          var resultObj = JSON.parse(event.data);
          _this.cardreader = false;
        };
        //连接发生错误的回调方法
        websocket.onerror = function () {
          alert("请检查连接是否正常");
        };
          this.getList()
        }
      });
    },