From 6af09e43245c7abd74768d66323bcfb65d09675e Mon Sep 17 00:00:00 2001 From: cnliucheng Date: Wed, 24 Jun 2026 13:20:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=98=B2=E8=BF=9E=E7=82=B9=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E9=87=8D=E5=A4=8D=E8=AE=AD=E7=BB=83=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=20+=20=E8=A1=A5=E5=85=85=E9=81=97=E6=BC=8F=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - finishTraining 添加 _saving 防重入,避免1.5秒延迟期间连点 - _init 补充 _last30Signaled/_last10Signaled 重置,修复 多次训练时语音提示丢失的bug Co-Authored-By: Claude --- pages/timer/timer.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pages/timer/timer.js b/pages/timer/timer.js index 7edbd32..1ed775a 100644 --- a/pages/timer/timer.js +++ b/pages/timer/timer.js @@ -66,8 +66,11 @@ Page({ // Reset reminder state this._halfwaySignaled = false + this._last30Signaled = false + this._last10Signaled = false this._lastMinuteAt = 0 this._lastCountdown = 0 + this._saving = false this._timer = new Timer({ onTick: (tick) => { @@ -188,8 +191,14 @@ Page({ }, finishTraining() { + // Guard against double-tap: stop button is still visible during the + // 1.5s navigateBack delay, so a second tap would create a duplicate. + if (this._saving) return + this._saving = true + const elapsed = this._timer.stop() if (elapsed < 3) { + this._saving = false wx.showToast({ title: '训练时间太短', icon: 'none', duration: 1500 }) setTimeout(() => { wx.navigateBack() }, 1500) return