| | |
| | | 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(); |
| | |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let sendSuccess = false |
| | | for(let binary of binarys){ |
| | | |
| | | try{ |
| | | let sendSuccess = await this.$refs.bt2.sendMessage(binary); |
| | | console.log("发送是否成功: ", sendSuccess) |
| | | if(sendSuccess === false) { |
| | | // 断开蓝牙连接 |
| | | this.$refs.bt2.closeBluetooth() |
| | | return |
| | | }else { |
| | | return uni.showToast({ |
| | | icon: 'none', |
| | | title: '打印成功' |
| | | }) |
| | | } |
| | | sendSuccess = await this.$refs.bt2.sendMessage(binary); |
| | | console.log("当前发送是否成功: ", sendSuccess) |
| | | |
| | | }catch(e) { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | if(sendSuccess === false) { |
| | | return |
| | | }else { |
| | | return uni.showToast({ |
| | | icon: 'none', |
| | | title: '打印成功' |
| | | }) |
| | | } |
| | | }, |
| | | async execPrint() { |
| | | // 检查蓝牙连接 |