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 }}