From 16ed98326de297dbe4f2f4f1a0f9b197ae7abd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Sat, 6 Dec 2025 16:02:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=EF=BC=8C=E4=B8=8E=E4=B9=B0=E8=9B=8B=E6=A0=87=E7=AD=BE=E9=A1=B5?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E4=BB=A5=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=BB=91=E5=8A=A8=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods-detail/goods-detail.js | 12 +----- pages/goods-detail/goods-detail.wxml | 57 +++++++++++++--------------- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/pages/goods-detail/goods-detail.js b/pages/goods-detail/goods-detail.js index fa07b9d..50fad16 100644 --- a/pages/goods-detail/goods-detail.js +++ b/pages/goods-detail/goods-detail.js @@ -209,7 +209,6 @@ Page({ // 预览图片 previewImage(e) { - console.log('预览图片事件:', e); const { urls, index } = e.currentTarget.dataset; if (!urls || urls.length === 0) { wx.showToast({ @@ -239,19 +238,15 @@ Page({ resetZoom() { this.setData({ scale: 1, + lastScale: 1, offsetX: 0, offsetY: 0, - lastScale: 1, - startDistance: 0, - isScaling: false, - initialTouch: null, - lastTapTime: 0 + initialTouch: null }); }, // 图片预览切换 onPreviewImageChange(e) { - console.log('图片预览切换:', e); this.setData({ previewImageIndex: e.detail.current }); @@ -261,7 +256,6 @@ Page({ // 处理图片点击事件(单击/双击判断) handleImageTap(e) { - console.log('图片点击事件:', e); const currentTime = Date.now(); const lastTapTime = this.data.lastTapTime || 0; @@ -330,7 +324,6 @@ Page({ // 处理触摸移动事件 handleTouchMove(e) { - console.log('触摸移动事件:', e); const touches = e.touches; if (touches.length === 1 && this.data.initialTouch && this.data.scale !== 1) { @@ -376,7 +369,6 @@ Page({ // 处理触摸结束事件 handleTouchEnd(e) { - console.log('触摸结束事件:', e); this.setData({ isScaling: false, lastScale: this.data.scale, diff --git a/pages/goods-detail/goods-detail.wxml b/pages/goods-detail/goods-detail.wxml index e852ffc..50afa26 100644 --- a/pages/goods-detail/goods-detail.wxml +++ b/pages/goods-detail/goods-detail.wxml @@ -145,38 +145,33 @@ - - - - × - - - {{previewImageIndex + 1}} / {{previewImageUrls.length}} - - - - - - + + + + + - - - - + mode="aspectFit" + style="width: 100%; height: 100%; transform: scale({{scale}}) translate({{offsetX}}px, {{offsetY}}px); transition: {{isScaling ? 'none' : 'transform 0.3s'}};" + bindtap="handleImageTap" + bindtouchstart="handleTouchStart" + bindtouchmove="handleTouchMove" + bindtouchend="handleTouchEnd" + bindtouchcancel="handleTouchEnd" + > + + + + + × + + \ No newline at end of file