diff --git a/pages/upload/camera_capture.nvue b/pages/upload/camera_capture.nvue index 610c600..3395d54 100644 --- a/pages/upload/camera_capture.nvue +++ b/pages/upload/camera_capture.nvue @@ -130,8 +130,30 @@ path = e.detail.path || '' } if (path) { - // takePhotoSnapshot截取预览区域=所见即所得,直接使用 - this.capturedList.push(path) + this.resizeAndAdd(path) + } + }, + // 等比例放大到 1080×1080 + resizeAndAdd(srcPath) { + var that = this + try { + uni.compressImage({ + src: srcPath, + width: 1080, + height: 1080, + quality: 95, + success: function(res) { + that.capturedList.push(res.tempFilePath) + that.$forceUpdate() + }, + fail: function() { + that.capturedList.push(srcPath) + that.$forceUpdate() + } + }) + } catch(e) { + this.capturedList.push(srcPath) + this.$forceUpdate() } }, flipCamera() {