chenhaozhe
2025-09-28 4fd63776b1abe5c0097f4b4e070e9a4c3a0dc35c
修复 上个提交时 出现的 超过10个条码打印出现的 蓝牙提前断连的问题
3个文件已修改
40 ■■■■ 已修改文件
components/labelPrinterComponent/labelPrinterComponent.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/shouliaotongzhi/table.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,21 +100,13 @@
                            })
                    }
                }
                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',
@@ -126,6 +119,15 @@
                    }
                    
                }
                if(sendSuccess === false) {
                    return
                }else {
                    return uni.showToast({
                        icon: 'none',
                        title: '打印成功'
                    })
                }
            },
            async execPrint() {
                // 检查蓝牙连接
manifest.json
@@ -2,8 +2,8 @@
    "name" : "智云LMES",
    "appid" : "__UNI__B002F49",
    "description" : "",
    "versionName" : "1.0.90",
    "versionCode" : 190,
    "versionName" : "1.0.91",
    "versionCode" : 191,
    "transformPx" : false,
    /* 5+App特有相关 */
    "app-plus" : {
pages/shouliaotongzhi/table.vue
@@ -42,9 +42,9 @@
                <button @click="changePrintMode" type="default" class="btn-c">
                    {{ MultiCodePrint ? "单条码打印" : "多条码打印" }}
                </button>
                <!-- <button @click="getPrintCodeTest()" type="default" class="btn-c">
                    打印测试
                </button> -->
                <!-- <button @click="getPrintCodeTest()" type="default" class="btn-c"> -->
                    <!-- 打印测试 -->
                <!-- </button> -->
            </view>
        </view>
        <view style="width: 100%; height: 16rpx; background-color: #e5e5e5"></view>
@@ -348,7 +348,7 @@
                    this.$refs.labelPrinter.openPopup()
                    return
                }
                let testArray = new Array(10)
                let testArray = new Array(17)
                let printContent = []
                let printInfoBuffer = []
                let count = 0