diff --git a/components/tpx-bluetooth-print/render-template-native.vue b/components/tpx-bluetooth-print/render-template-native.vue
index 9a3f294..5cd1edb 100644
--- a/components/tpx-bluetooth-print/render-template-native.vue
+++ b/components/tpx-bluetooth-print/render-template-native.vue
@@ -68,9 +68,8 @@ export default {
}
prtInstance.setPagePrint()
let commond = prtInstance.getPrintCmd()
- console.log("打印命令组装完成,开始打印=====", commond)
+ console.log("打印命令组装完成,开始打印=====")
printModule.print(commond)
- that.showToast('数据发送成功,如果无法打印请重连设备重试')
resolve(true)
// await that.loadPrintProcess()
// printModule.printTestSimple(deviceId)
@@ -97,12 +96,20 @@ export default {
if(!Array.isArray(imgsRes)) {
imgsRes = [imgsRes]
}
+ let cBl = false
if(conSta) {
- await this.handlePrint(imgsRes)
- return true
- } else {
- return false
+ showLoading('正在发送打印数据..')
+ try{
+ await this.handlePrint(imgsRes)
+ showToast('数据发送成功,如果无法打印请重连设备重试')
+ cBl = true
+ }catch(e){
+ console.log('callPrint 打印异常=======')
+ console.error(e)
+ }
+ hideLoading()
}
+ return cBl
}
}
}
diff --git a/components/tpx-bluetooth-print/tpx-bluetooth-print.vue b/components/tpx-bluetooth-print/tpx-bluetooth-print.vue
index a54cbfa..7b31000 100644
--- a/components/tpx-bluetooth-print/tpx-bluetooth-print.vue
+++ b/components/tpx-bluetooth-print/tpx-bluetooth-print.vue
@@ -19,7 +19,7 @@
- 确认打印
@@ -72,6 +72,7 @@ export default {
imageUrl: [],
paperWidth: 600,
show: false,
+ allImgRes: []
}
},
mounted () {
@@ -92,7 +93,7 @@ export default {
},
async startPrint({ imageUrl, paperWidth } = {}, preview = true) {
this.imageUrl = [] // 每次打印前,清空历史数据
-
+ this.allImgRes = []
// 默认先做预览
if(imageUrl.length > 0) {
if(!Array.isArray(imageUrl)){
@@ -102,24 +103,30 @@ export default {
this.paperWidth = paperWidth || this.paperWidth
if(preview) {
this.previewModel.show = true
- } else {
- this.confirmPrint()
}
+ await promiseTimeout(450) // 保证页面节点渲染出来
+ await this.setAllImgRes()
+ !preview && this.confirmPrint()
} else {
this.showToast('缺少打印内容')
}
},
- async confirmPrint(){
+ setAllImgRes(){
+ let that = this
let allRes = this.imageUrl.map((url, index)=> {
// !!!注意:必须修改。 canvas渲染的图必须修改url,否则渲染不出来
url = `${url}?t=${new Date().valueOf()}`
return this.$refs[`curCanvas${index}`][0].renderCanvasImg(url, this.paperWidth)
})
- Promise.all(allRes).then(async (imgsRes)=> {
- let res = await this.$refs.curPrint.callPrint({
- imgsRes,
- paperWidth: this.paperWidth
- })
+ return Promise.all(allRes).then((imgsRes)=> {
+ that.allImgRes = imgsRes
+ return imgsRes
+ })
+ },
+ async confirmPrint(){
+ let res = await this.$refs.curPrint.callPrint({
+ imgsRes: this.allImgRes,
+ paperWidth: this.paperWidth
})
},
autoConnectCallback(bl){
diff --git a/manifest.json b/manifest.json
index f412b06..f8ab4df 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,7 +3,7 @@
"appid" : "__UNI__BCB0FB5",
"description" : "探路国际速运",
"versionName" : "1.0.0",
- "versionCode" : "109",
+ "versionCode" : "1010",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
diff --git a/pages/login/login.vue b/pages/login/login.vue
index fbffa9c..d177032 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -46,7 +46,7 @@