|
|
@ -39,7 +39,7 @@ |
|
|
|
</view> |
|
|
|
<view class="right"> |
|
|
|
<view class="image"> |
|
|
|
<l-qrcode ref="qrcodeRef" useCanvasToTempFilePath @success="success" :value="item.barcodeString" |
|
|
|
<l-qrcode ref="qrcodeRef" useCanvasToTempFilePath @success="success($event,item)" :value="item.barcodeString" |
|
|
|
size="300rpx"></l-qrcode> |
|
|
|
</view> |
|
|
|
<view class="left-item"> |
|
|
@ -93,13 +93,25 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
success(img) { |
|
|
|
this.picUrl.push(img) |
|
|
|
this.picIndex++ |
|
|
|
if (this.picIndex == this.data.length) { |
|
|
|
this.isLoadFinish = true; |
|
|
|
success(img,item) { |
|
|
|
item.barcodeBase641 = img |
|
|
|
uni.hideLoading() |
|
|
|
this.isLoadFinish = true |
|
|
|
// #ifdef APP |
|
|
|
plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => { |
|
|
|
// 可通过entry对象操作test.html文件 |
|
|
|
entry.file((file) => { |
|
|
|
let fileReader = new plus.io.FileReader(); |
|
|
|
fileReader.onloadend = (evt) => { |
|
|
|
console.log("文件路径" + evt.target.result) |
|
|
|
item.barcodeBase64 = evt.target.result |
|
|
|
} |
|
|
|
fileReader.readAsDataURL(file); |
|
|
|
}); |
|
|
|
}, (e) => { |
|
|
|
console.log("失败" + e) |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
}, |
|
|
|
setHtmlData() { |
|
|
|
let str = '' |
|
|
@ -182,11 +194,11 @@ |
|
|
|
"mainBody", str); //替换物品代码 |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
generateBase64(index) { |
|
|
|
|
|
|
|
//完成,调用打印 |
|
|
|
if (index == this.picUrl.length) { |
|
|
|
printImage() { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
this.setHtmlData() |
|
|
|
let clearInt = setInterval(() => { |
|
|
|
if (!this.newHtmlContent.mainBody) { |
|
|
@ -197,35 +209,6 @@ |
|
|
|
uni.hideLoading() |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
} else { |
|
|
|
let i = this.picUrl.length - 1 - index |
|
|
|
var url = this.picUrl[i] |
|
|
|
// #ifdef APP |
|
|
|
plus.io.resolveLocalFileSystemURL(url, (entry) => { |
|
|
|
// 可通过entry对象操作test.html文件 |
|
|
|
entry.file((file) => { |
|
|
|
let fileReader = new plus.io.FileReader(); |
|
|
|
fileReader.onloadend = (evt) => { |
|
|
|
console.log("文件路径" + evt.target.result) |
|
|
|
let i = this.data.length - 1 - index |
|
|
|
this.data[i].barcodeBase64 = evt.target.result |
|
|
|
this.generateBase64(index + 1) |
|
|
|
} |
|
|
|
fileReader.readAsDataURL(file); |
|
|
|
}); |
|
|
|
}, (e) => { |
|
|
|
console.log("失败" + e) |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
} |
|
|
|
}, |
|
|
|
printImage() { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
this.generateBase64(0) |
|
|
|
}, |
|
|
|
|
|
|
|
// #ifdef APP |
|
|
|