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
@@ -325,6 +325,14 @@
|
||||
height: 26rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
|
||||
&.diff-up {
|
||||
background-color: #FEF0F0;
|
||||
|
||||
> view:nth-of-type(2) {
|
||||
color: #F24439;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.arrow::after {
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -73,12 +73,14 @@
|
||||
<view class="list-examTime">{{ item.examTime }}</view>
|
||||
<view class="list-weight arrow">
|
||||
<view>{{ item.weight }}<text>kg</text></view>
|
||||
<block wx:if="{{ item.weightTrend === 1 || item.weightTrend === -1 }}">
|
||||
<view class="{{ item.weightTrend === 1 ? 'diff-up' : '' }}">
|
||||
<view>
|
||||
<view>
|
||||
<image src="/images/data/sub.png" mode="aspectFit" />
|
||||
<image src="{{ item.weightTrend === 1 ? '/images/data/add.png' : '/images/data/sub.png' }}" mode="aspectFit" />
|
||||
</view>
|
||||
<view>0.3</view>
|
||||
<view>{{ item.weightDiff }}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="list-bmi">
|
||||
<view>
|
||||
|
||||
Reference in New Issue
Block a user