feat(records): 训练勋章 UI 改造
- 勋章图标从 emoji 改为矢量 SVG 线性图标(utils/icons.js 新增 bolt/moon/diamond 路径及 white 变体) - 命名改为累计语义(一周累计/半月累计/月度累计/双月累计/百日累计),并标注"非连续打卡" - 进度条改回等距节点,解锁时填充正好抵达节点、满级满格 - 新增单枚解锁庆祝:持久化已见解锁集合,进入页面弹 toast + 节点 pop 动画 - 已解锁节点常驻显示勋章名 + 右上角 ✓ 角标,直观体现"已拥有" - utils/storage.js 新增 totalDays(累计去重训练日),为勋章统计提供数据源
This commit is contained in:
+5
-1
@@ -154,15 +154,19 @@ const getTotalStats = () => {
|
||||
let totalDuration = 0
|
||||
let totalSessions = 0
|
||||
let maxDuration = 0
|
||||
// 累计训练天数:有训练记录的不同日期数(一天多次只算 1 天)。
|
||||
// 用于记录页里程碑勋章,只增不减(删记录才会减)。
|
||||
const days = new Set()
|
||||
Object.keys(records).forEach((key) => {
|
||||
records[key].forEach((r) => {
|
||||
const d = Number(r && r.duration) || 0
|
||||
totalDuration += d
|
||||
totalSessions++
|
||||
if (d > maxDuration) maxDuration = d
|
||||
if (r && r.date) days.add(dateOnly(r.date))
|
||||
})
|
||||
})
|
||||
return { totalDuration, totalSessions, maxDuration }
|
||||
return { totalDuration, totalSessions, maxDuration, totalDays: days.size }
|
||||
}
|
||||
|
||||
const getSettings = () => {
|
||||
|
||||
Reference in New Issue
Block a user