| | |
| | | this.preImgW = w; |
| | | // 设置蒙层 |
| | | this.setBgBox(); |
| | | setTimeout(() => { |
| | | // 图像预览 |
| | | this.previewCanvas({ |
| | | w, |
| | | h, |
| | | path |
| | | }); |
| | | }, 500) |
| | | } |
| | | } |
| | | }); |
| | |
| | | h, |
| | | path |
| | | }) { |
| | | console.log(path, w, h) |
| | | const ctx = uni.createCanvasContext('mycanvas'); |
| | | ctx.drawImage(path, 0, 0, w, h); |
| | | ctx.draw(); |
| | |
| | | destHeight: maxH, |
| | | canvasId: 'mycanvas', |
| | | success: fileRes => { |
| | | console.log(fileRes); |
| | | uni.previewImage({ |
| | | count: 1, |
| | | urls: [fileRes.tempFilePath] |
| | | }); |
| | | uni.$emit('update', fileRes) |
| | | uni.navigateBack({ delta: 1 }); |
| | | }, |
| | | fail: function(err) { |
| | | console.log(err); |
| | | uni.showToast({ |
| | | title: '上传失败:图片生成过程中遇到错误', |
| | | icon: 'none' |