From 86ab589429863c199cd1d3b57b55f6c9fbb21e84 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: Thu, 4 Dec 2025 10:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E5=88=9B=E5=BB=BA=E6=96=B0=E8=B4=A7?= =?UTF-8?q?=E6=BA=90=E5=8A=9F=E8=83=BD=E7=9A=84=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=8C=E5=87=BB=E9=80=89=E6=8B=A9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/seller/index.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/pages/seller/index.js b/pages/seller/index.js index f4ed25e..f581ad8 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -2903,6 +2903,29 @@ Page({ }); }, + // 双击检测变量 + lastTapTime: {}, + tapCount: {}, + + // 通用双击检测函数 + handleDoubleTap: function(e, type, callback) { + const currentTime = Date.now(); + const tapKey = `${type}-${e.currentTarget.dataset.index}`; + const lastTap = this.lastTapTime[tapKey] || 0; + const tapInterval = currentTime - lastTap; + + if (tapInterval < 300 && tapInterval > 0) { + // 双击事件触发,执行确认选择 + callback(); + } else { + // 单击事件触发,执行选择操作 + this.lastTapTime[tapKey] = currentTime; + setTimeout(() => { + delete this.lastTapTime[tapKey]; + }, 300); + } + }, + // 弹窗中选择规格 onModalSpecSelect: function (e) { const index = e.currentTarget.dataset.index; @@ -2911,6 +2934,11 @@ Page({ selectedModalSpecIndex: index, modalSpecSearchKeyword: selectedSpec // 自动填充搜索框为当前选择的规格 }); + + // 检测双击 + this.handleDoubleTap(e, 'spec', () => { + this.confirmSpecSelection(); + }); }, // 确认规格选择 @@ -3401,6 +3429,11 @@ Page({ this.setData({ selectedNameIndex: index }); + + // 检测双击 + this.handleDoubleTap(e, 'name', () => { + this.confirmNameSelection(); + }); }, confirmNameSelection() { @@ -3477,6 +3510,11 @@ Page({ this.setData({ selectedYolkIndex: index }); + + // 检测双击 + this.handleDoubleTap(e, 'yolk', () => { + this.confirmYolkSelection(); + }); }, confirmYolkSelection() {