feat(timer): 训练中轮换姿势要领 + hint 字号调大

- 训练中 hint 每 12 秒轮换一条平板支撑姿势要领(收紧核心/肩膀放松/
  别塌腰/别憋气等 10 条),替代固定文案,帮助持续纠正姿势
- 姿势文案与间隔移入 config.js(postureTips/tipInterval),统一管理
- hint 字号 28rpx -> 34rpx,图标 32rpx -> 36rpx,更易看清

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-09 11:04:37 +08:00
parent ed16ac5efd
commit 885db8c18b
4 changed files with 48 additions and 6 deletions
+23 -1
View File
@@ -5,7 +5,7 @@ const themeMod = require('../../utils/theme')
const iconsMod = require('../../utils/icons')
const voice = require('../../utils/voice')
const { countUp } = require('../../utils/countUp')
const config = require('../../config')
Page({
data: {
theme: { primary: '#FF6B35', primaryLight: '#FF8C5A', primaryBg: '#FFF3ED', primaryRgb: '255,107,53' },
@@ -18,6 +18,7 @@ Page({
isCompleted: false,
overtime: 0,
goalReached: false,
hintTip: (config.postureTips && config.postureTips[0]) || '',
todayTarget: 0,
planDay: 1,
isFreeMode: false,
@@ -96,6 +97,7 @@ Page({
this._lastMinuteAt = 0
this._lastCountdown = 0
this._saving = false
this._lastTipIndex = -1
this._clearVibrateTimers()
this._timer = new Timer({
@@ -104,6 +106,7 @@ Page({
remaining: tick.remaining > 0 ? tick.remaining : 0,
overtime: tick.remaining <= 0 ? tick.elapsed - this.data.duration : 0
})
this._updateHintTip(tick)
this._remind(tick)
},
onGoalReached: () => {
@@ -118,6 +121,24 @@ Page({
})
},
/**
* Rotate the posture cue in the hint area every config.tipInterval seconds.
* Only runs while still under the target (after goalReached the hint
* switches to the "goal reached" line). Skips setData when the index
* hasn't changed to avoid per-second re-renders.
*/
_updateHintTip(tick) {
if (tick.remaining <= 0) return
const tips = config.postureTips || []
if (tips.length === 0) return
const interval = config.tipInterval || 12
const idx = Math.floor(tick.elapsed / interval) % tips.length
if (idx !== this._lastTipIndex) {
this._lastTipIndex = idx
this.setData({ hintTip: tips[idx] })
}
},
/**
* Per-tick reminders: vibration + voice prompts at 4 fixed points.
* - halfway: once when elapsed reaches half of duration
@@ -431,6 +452,7 @@ Page({
this._last10Signaled = false
this._lastMinuteAt = 0
this._lastCountdown = 0
this._lastTipIndex = -1
this._clearVibrateTimers()
this.setData({
showCompletion: false,