jiangping
2024-02-28 300d75d257dbe60401dfb97123ae39e32f37380e
h5/pages/cropping/cropping.vue
@@ -104,12 +104,14 @@
                     this.preImgW = w;
                     // 设置蒙层
                     this.setBgBox();
                     setTimeout(() => {
                     // 图像预览
                     this.previewCanvas({
                        w,
                        h,
                        path
                     });
                     }, 500)
                  }
               }
            });
@@ -148,6 +150,7 @@
            h,
            path
         }) {
            console.log(path, w, h)
            const ctx = uni.createCanvasContext('mycanvas');
            ctx.drawImage(path, 0, 0, w, h);
            ctx.draw();
@@ -228,14 +231,10 @@
                  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'