chenhaozhe
3 小时以前 f5287b188f882f8d4bc2c6d0e3ca2638c50159c8
components/labelPrinterComponent/labelPrinterComponent.vue
@@ -73,6 +73,7 @@
            let vm = this;
            let binarys = [];
            for (let command of commandList) {
                    console.log('command: ',command);
               switch (vm.printMode) {
                  case "tspl":
                     let tspl = await vm.$printer.tspl().clear();
@@ -99,14 +100,34 @@
                     })
               }
            }
            let sendSuccess = false
            for(let binary of binarys){
               let sendSuccess = await this.$refs.bt2.sendMessage(binary);
               console.log("发送是否成功: ", sendSuccess)
               if(sendSuccess === false) {
                  return
               }
                    try{
                        sendSuccess = await this.$refs.bt2.sendMessage(binary);
                        console.log("当前发送是否成功: ", sendSuccess)
                    }catch(e) {
                        uni.showToast({
                            icon: 'none',
                            title: e
                        })
                        // 断开蓝牙连接
                        this.$refs.bt2.closeBluetooth()
                        // 停止传输
                        return
                    }
            }
                if(sendSuccess === false) {
                   return
                }else {
                    return uni.showToast({
                        icon: 'none',
                        title: '打印成功'
                    })
                }
         },
         async execPrint() {
            // 检查蓝牙连接