From 4d37e5d57bdd448cfffe0542eb95febb743669cb Mon Sep 17 00:00:00 2001 From: ShenQiLun <97694732@qq.com> Date: Thu, 25 Jun 2026 17:48:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=87=AA=E5=AE=9A=E4=B9=89=E6=AD=A3?= =?UTF-8?q?=E6=96=B9=E5=BD=A2=E9=A2=84=E8=A7=88=E5=8F=96=E4=BB=A3uni.previ?= =?UTF-8?q?ewImage,=E7=82=B9=E5=87=BB=E5=8D=8A=E9=80=8F=E6=98=8E=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/camera_capture.nvue | 55 ++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/pages/upload/camera_capture.nvue b/pages/upload/camera_capture.nvue index 9db24b1..f22cc0b 100644 --- a/pages/upload/camera_capture.nvue +++ b/pages/upload/camera_capture.nvue @@ -68,6 +68,14 @@ + + + + + + + + @@ -82,7 +90,11 @@ winHeight: 1334, camSize: 750, frameTop: 110, - frameLeft: 0 + frameLeft: 0, + // 自定义预览 + previewVisible: false, + previewSrc: '', + previewSize: 600 } }, onLoad() { @@ -91,6 +103,7 @@ success: function(res) { that.winWidth = res.windowWidth that.winHeight = res.windowHeight + that.previewSize = Math.floor(res.windowWidth * 0.85) // 取景框放在中间偏上一点 var barH = 110 var bottomArea = 240 @@ -159,13 +172,11 @@ } uni.navigateBack() }, - // 放大预览指定图片 + // 放大预览指定图片(正方形显示) previewPhoto(idx) { - if (this.capturedList.length > 0) { - uni.previewImage({ - current: this.capturedList[idx], - urls: this.capturedList - }) + if (this.capturedList.length > 0 && idx >= 0 && idx < this.capturedList.length) { + this.previewSrc = this.capturedList[idx] + this.previewVisible = true } }, // 放大预览最新一张 @@ -180,6 +191,7 @@ .cc-page { flex: 1; background-color: #000000; + position: relative; } /* 取景框(白色边框,视觉引导) */ @@ -376,4 +388,33 @@ color: #ffffff; font-size: 22rpx; } + + /* ═══ 自定义正方形预览 ═══ */ + .cc-preview-overlay { + position: absolute; + top: 0; left: 0; right: 0; bottom: 0; + background-color: rgba(0,0,0,0.9); + z-index: 20; + align-items: center; + justify-content: center; + } + .cc-preview-close { + position: absolute; + top: 60px; right: 30rpx; + width: 60rpx; height: 60rpx; + border-radius: 60rpx; + background-color: rgba(255,255,255,0.2); + align-items: center; justify-content: center; + z-index: 21; + } + .cc-preview-close-icon { + color: #ffffff; + font-size: 36rpx; + } + .cc-preview-img { + border-radius: 8rpx; + border-width: 2rpx; + border-color: rgba(255,255,255,0.2); + border-style: solid; + }