From 8284bf107b25f580f8dd3b6f8b57ea1d8f35c0e6 Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Thu, 3 Sep 2026 08:50:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(data):=20=E4=BD=93=E9=87=8D=E5=B7=AE?= =?UTF-8?q?=E5=80=BC=E6=8C=89=20weightDiff/weightTrend=20=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=B8=B2=E6=9F=93=E5=B9=B6=E5=8C=BA=E5=88=86=E5=A2=9E?= =?UTF-8?q?=E5=87=8F=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 差值图标与数值改用后端 weightDiff/weightTrend - 首次测量/持平不显示差值块 - 增加红色、减少绿色 Co-Authored-By: Claude Opus 4.7 --- miniprogram/pages/data/data.less | 8 ++++++++ miniprogram/pages/data/data.ts | 8 ++++++++ miniprogram/pages/data/data.wxml | 12 +++++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/miniprogram/pages/data/data.less b/miniprogram/pages/data/data.less index ab61ca9..c04c616 100644 --- a/miniprogram/pages/data/data.less +++ b/miniprogram/pages/data/data.less @@ -325,6 +325,14 @@ height: 26rpx; line-height: 26rpx; } + + &.diff-up { + background-color: #FEF0F0; + + > view:nth-of-type(2) { + color: #F24439; + } + } } &.arrow::after { diff --git a/miniprogram/pages/data/data.ts b/miniprogram/pages/data/data.ts index 364a27c..a9cecc4 100644 --- a/miniprogram/pages/data/data.ts +++ b/miniprogram/pages/data/data.ts @@ -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({ diff --git a/miniprogram/pages/data/data.wxml b/miniprogram/pages/data/data.wxml index df9f911..97b616e 100644 --- a/miniprogram/pages/data/data.wxml +++ b/miniprogram/pages/data/data.wxml @@ -73,12 +73,14 @@ {{ item.examTime }} {{ item.weight }}kg - - - + + + + + + {{ item.weightDiff }} - 0.3 - +