feat(timer): 训练超时与完成展示优化 (v3.0)
- 超时后圆环底环变绿,中心改显总训练时长(MM:SS 实时涨),移除 +Xs 小徽章 - 完成弹窗成绩由纯秒数改为分秒(如 1分23秒),>=60s 时缩字号防撑破卡片 - 修复结束确认弹窗停留期间计时器未暂停导致训练时长虚增:onStop 暂停、取消恢复、确认取暂停值 - progress-ring 新增 elapsed prop,remaining=0 时中心切显总时长 - 清理废弃的 overtime 字段与 .overtime-badge 样式 - 版本号 v2.9 -> v3.0,更新日期 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,10 @@ Component({
|
||||
primaryLightColor: { type: String, value: '#FF8C5A' },
|
||||
// Track (background ring) color. Caller passes a darker shade in dark mode
|
||||
// so the ring isn't an eye-searing light circle on a dark background.
|
||||
trackColor: { type: String, value: '#EEEEEE' }
|
||||
trackColor: { type: String, value: '#EEEEEE' },
|
||||
// Total elapsed seconds (since start). Shown in the ring center once the
|
||||
// countdown hits 0 (overtime mode) - replaces the old +Xs badge.
|
||||
elapsed: { type: Number, value: 0 }
|
||||
},
|
||||
|
||||
data: {
|
||||
@@ -20,10 +23,12 @@ Component({
|
||||
},
|
||||
|
||||
observers: {
|
||||
'remaining, status, duration'() {
|
||||
'remaining, status, duration, elapsed'() {
|
||||
const texts = { idle: '准备开始', running: '坚持住', paused: '已暂停', completed: '完成!' }
|
||||
// 倒计时阶段显示剩余;达标后 remaining 归零,改显总训练时长(overtime 模式)
|
||||
const shown = this.data.remaining > 0 ? this.data.remaining : (this.data.elapsed || 0)
|
||||
this.setData({
|
||||
displayTime: util.formatTime(this.data.remaining),
|
||||
displayTime: util.formatTime(shown),
|
||||
statusText: texts[this.data.status] || ''
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user