From 7a1e8942a9eaa4e702a55b1eb234a57dae2fd0db Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Wed, 2 Sep 2026 10:36:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(detailedReport):=20=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E5=AE=8C=E5=96=84=E8=AF=84=E5=88=86=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E3=80=81=E5=81=A5=E5=BA=B7=E8=AF=84=E4=BB=B7=E7=AD=89?= =?UTF-8?q?=E7=BA=A7=E4=B8=8EBMI=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 健康评分补"分"单位 - 健康评价展示等级文案(如"亚健康")替代数值 - BMI名称后跟体型状态胶囊,颜色取底部刻度色 Co-Authored-By: Claude Opus 4.7 --- .../pages/detailedReport/detailedReport.less | 22 +++++++++++++-- .../pages/detailedReport/detailedReport.ts | 28 +++++++++++++++++-- .../pages/detailedReport/detailedReport.wxml | 7 ++++- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/miniprogram/pages/detailedReport/detailedReport.less b/miniprogram/pages/detailedReport/detailedReport.less index db946d8..423538c 100644 --- a/miniprogram/pages/detailedReport/detailedReport.less +++ b/miniprogram/pages/detailedReport/detailedReport.less @@ -208,11 +208,27 @@ } .basicIndicatorsLabel { - color: #808080; + display: flex; + align-items: center; height: 30rpx; - font-size: 26rpx; - line-height: 30rpx; margin-bottom: 20rpx; + + .basicIndicatorsLabelText { + color: #808080; + height: 30rpx; + font-size: 26rpx; + line-height: 30rpx; + } + + .basicIndicatorsLabelExtra { + color: #FFFFFF; + height: 28rpx; + font-size: 20rpx; + line-height: 28rpx; + padding: 0 12rpx; + border-radius: 8rpx; + margin-left: 8rpx; + } } .basicIndicatorsValueRow { diff --git a/miniprogram/pages/detailedReport/detailedReport.ts b/miniprogram/pages/detailedReport/detailedReport.ts index 4267d58..3f6cb96 100644 --- a/miniprogram/pages/detailedReport/detailedReport.ts +++ b/miniprogram/pages/detailedReport/detailedReport.ts @@ -83,6 +83,10 @@ interface MetricRow { /** 基础指标网格单元 */ interface BasicCell { label: string + /** 名称后跟的状态文字(如 BMI 的"超重") */ + labelExtra: string + /** 状态文字背景色 */ + labelExtraColor: string value: string unit: string } @@ -108,10 +112,18 @@ interface BodyPartsCard { rows: BodyPart[][] } -const EMPTY_BASIC_CELL: BasicCell = { label: '', value: '', unit: '' } +const EMPTY_BASIC_CELL: BasicCell = { label: '', labelExtra: '', labelExtraColor: '', value: '', unit: '' } const DEFAULT_STATUS_COLOR = '#B6B6B6' +/** BMI 体型状态对应的刻度色 */ +const BMI_TYPE_COLOR: Record = { + 消瘦: '#1385FA', + 正常: '#2AC79F', + 超重: '#FFA151', + 肥胖: '#F24439', +} + /** 将 bodyDataList 转为 key -> 指标 的映射 */ const toMap = (list: LefuBodyDatum[] = []): Record => { const map: Record = {} @@ -252,7 +264,19 @@ Page({ const basicCells: BasicCell[] = basicKeys.map((k) => { const d = map[k] if (!d) return { ...EMPTY_BASIC_CELL } - return { label: d.bodyParamName || k, value: d.currentValue ?? '', unit: d.unit || '' } + const isScore = k === 'ppBodyScore' + const isHealth = k === 'ppBodyHealth' + const isBmi = k === 'ppBMI' + return { + label: d.bodyParamName || k, + // BMI 名称后跟体型状态(消瘦/正常/超重/肥胖) + labelExtra: isBmi ? data.bmiType || '' : '', + labelExtraColor: isBmi ? BMI_TYPE_COLOR[data.bmiType || ''] || DEFAULT_STATUS_COLOR : '', + // 健康评价展示等级文案(如"亚健康"),其余展示测量数值 + value: isHealth ? d.standardTitle || d.currentValue || '' : d.currentValue || '', + // 健康评分补"分" + unit: isScore ? d.unit || '分' : isHealth ? '' : d.unit || '', + } }) basicCells.push({ ...EMPTY_BASIC_CELL }) const basicRows = [basicCells.slice(0, 3), basicCells.slice(3, 6)] diff --git a/miniprogram/pages/detailedReport/detailedReport.wxml b/miniprogram/pages/detailedReport/detailedReport.wxml index 8a898d9..22ccf12 100644 --- a/miniprogram/pages/detailedReport/detailedReport.wxml +++ b/miniprogram/pages/detailedReport/detailedReport.wxml @@ -48,7 +48,12 @@ - {{ cell.label }} + + {{ cell.label }} + + {{ cell.labelExtra }} + + {{ cell.value }}