wtt
2025-12-31 96973dca40a1815e9727160e6b2e6dee839b9f8d
components/blueToothConnector/blueToothConnector.vue
@@ -32,6 +32,7 @@
</template>
<script>
    import printerMeta from "../../static/json/printerMeta.json";
   import {
      CommonUtils
   } from '../../utils/common';
@@ -189,7 +190,7 @@
                     that.clock.stop();
                     reject(new Error('读取超时'));
                  }
               }, 2000);
               }, printerMeta['timeoutPerMillSecond']);
               // 启动时钟
               that.clock.start();
@@ -201,31 +202,22 @@
               title: "发送中..."
            })
            // console.log("msg: " + cmd);
            let toast = (msg) => {
                    uni.hideLoading()
               uni.showToast({
                  icon: 'none',
                  title: msg,
                  duration: 2000
               })
            }
            let that = this
            return new Promise((resolve, reject) => {
               const result = blueToothTool.sendByteData(cmd);
               if (!result) {
                  toast("发送失败,请重试...")
                  reject(false)
                        this.clock.stop();
                  reject("发送失败,请重试...")
               }
               that.checkReadSuccess(5)
               that.checkReadSuccess(printerMeta['timeoutCount'])
                  .then((res) => {
                     if (res === true) {
                        toast('发送成功!!!')
                        resolve(true)
                     }
                  })
                  .catch((err) => {
                     toast('设备异常,请检查设备状态...')
                     reject(false)
                     this.clock.stop();
                     reject('设备异常,请检查设备状态...')
                  })
                  .finally(() => {
                     that.readSuccess = false