async drawSaveImage() {
console.log("drawImage", this.data.resultData.shareImage,this.data.resultData._qcCodeImage_)
const { globalData } = getApp()
const shareImage = await globalData.__saveImage
const imageQc = await publicMethods.getQcImage(this.data.resultData)
console.log("shareImage",shareImage,imageQc)
const [$bgImgInfo, $imageQc] = await Promise.all([
publicMethods.getImageInfo(shareImage),
publicMethods.getImageInfo(imageQc)
])
const imageBg = globalData.localSaveImageUrl
console.log('imageQc', imageQc)
console.log('imageBg', imageBg)
const canvasContent = wx.createCanvasContext('myCanvas')
if (!($imageQc.height && $imageQc.width)) {
throw new Error('load qc image fail')
}
let pox = 1
let imagHeight = $bgImgInfo.height / pox
let imageWidth = $bgImgInfo.width / pox
console.log("imagHeightaaa", imagHeight, "imageWidth", imageWidth, $bgImgInfo)
await this.setCanvasRect(imageWidth, imagHeight)
canvasContent.drawImage(imageBg, 0, 0, imageWidth, imagHeight)
await canvasContent.draw(true,()=>{})
let poxImage = imageWidth / 1500
let qcSize = 235 / pox * poxImage
let qcX = imageWidth - qcSize - 40
let qcY = imagHeight - qcSize - 120
const roundRectPadding = 4
qcX = Math.ceil(qcX)
qcY = Math.ceil(qcY)
qcSize = Math.ceil(qcSize)
publicMethods.roundRect(canvasContent, qcX - roundRectPadding, qcY - roundRectPadding, qcSize + roundRectPadding * 2, qcSize + roundRectPadding * 2)
canvasContent.drawImage($imageQc.path, qcX, qcY, qcSize, qcSize)
await canvasContent.draw(true,()=>{})
await publicMethods.sleep(200)
return new Promise((resolve, reject) => {
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
success: (res) => {
resolve(res)
},
fail(err) {
console.log(err)
reject(err)
},
complete: (res)=>{
console.log("complete",res)
}
})
})
},
你是不是用苹果手机上传的?我也遇到这个问题
在页面上,显示一下,看图片是不是空白的