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