feat(data): 体重差值按 weightDiff/weightTrend 动态渲染并区分增减颜色
- 差值图标与数值改用后端 weightDiff/weightTrend - 首次测量/持平不显示差值块 - 增加红色、减少绿色 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
e0f201f15c
commit
8284bf107b
@@ -38,6 +38,10 @@ interface MeasureRecord {
|
||||
weight: number
|
||||
bmi: number
|
||||
fatRate: number
|
||||
/** 相比上次体重差值绝对值(kg),首次测量为 null */
|
||||
weightDiff: number | null
|
||||
/** 变化方向:1增加 -1减少 0持平 null首次 */
|
||||
weightTrend: number | null
|
||||
}
|
||||
|
||||
/** GET /weighingScale/v3/getMeasureHistoryPage 返回结构 */
|
||||
@@ -150,6 +154,8 @@ Page({
|
||||
weight: r.weight ?? 0,
|
||||
bmi: r.bmi ?? 0,
|
||||
fatRate: r.fatRate ?? 0,
|
||||
weightDiff: r.weightDiff == null ? null : Math.abs(r.weightDiff),
|
||||
weightTrend: r.weightTrend ?? null,
|
||||
}))
|
||||
const total = page.total ?? 0
|
||||
|
||||
@@ -191,6 +197,8 @@ Page({
|
||||
weight: r.weight ?? 0,
|
||||
bmi: r.bmi ?? 0,
|
||||
fatRate: r.fatRate ?? 0,
|
||||
weightDiff: r.weightDiff == null ? null : Math.abs(r.weightDiff),
|
||||
weightTrend: r.weightTrend ?? null,
|
||||
}))
|
||||
const allRecords = [...this.data.records, ...newRecords]
|
||||
this.setData({
|
||||
|
||||
Reference in New Issue
Block a user