This commit is contained in:
aihe 2024-06-23 21:13:25 +08:00
parent 1242118a62
commit 6ea8e5ddef
2 changed files with 19 additions and 3 deletions

View File

@ -14,7 +14,7 @@
<u-row custom-style="width: 500rpx;min-height: 150rpx;padding: 10rpx;">
<view>
<u-line-progress :percentage="percentage" activeColor="#B12D29" height="30"></u-line-progress>
<view class="pt-20">正在打印, 请勿退出页面, 如果卡住了请重连打印机重试</view>
<view class="pt-20">正在发送数据, 请勿退出页面, 如果卡住了请重连打印机重试</view>
</view>
</u-row>
</tpx-dialog>
@ -71,11 +71,27 @@ export default {
let commond = prtInstance.getPrintCmd()
console.log("打印命令组装完成,开始打印=====", commond)
printModule.print(commond)
await that.loadPrintProcess()
// printModule.printTestSimple(deviceId)
})
},
// 模拟打印进度, 用于加载进度条
async loadPrintProcess(){
let that = this
this.percentage = 0
let addLen = 10
for(let i=0; i<100; i = i + addLen) {
await new Promise((resolve)=> {
setTimeout(()=> {
that.percentage = i
resolve()
}, 3000/addLen)
})
}
that.percentage = 0
that.showToast('数据发送完毕')
},
renderCanvasImg(filePath) {
let that = this
showLoading()

View File

@ -15,7 +15,7 @@
<u-row custom-style="width: 500rpx;min-height: 150rpx;padding: 10rpx;">
<view>
<u-line-progress :percentage="percentage" activeColor="#B12D29" height="30"></u-line-progress>
<view class="pt-20">正在打印, 请勿退出页面, 如果卡住了请重连打印机重试</view>
<view class="pt-20">正在发送数据, 请勿退出页面, 如果卡住了请重连打印机重试</view>
</view>
</u-row>
</tpx-dialog>