feat(detailedReport): 基础指标完善评分单位、健康评价等级与BMI状态
- 健康评分补"分"单位 - 健康评价展示等级文案(如"亚健康")替代数值 - BMI名称后跟体型状态胶囊,颜色取底部刻度色 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
680794702e
commit
7a1e8942a9
@@ -208,11 +208,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.basicIndicatorsLabel {
|
.basicIndicatorsLabel {
|
||||||
color: #808080;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
font-size: 26rpx;
|
|
||||||
line-height: 30rpx;
|
|
||||||
margin-bottom: 20rpx;
|
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 {
|
.basicIndicatorsValueRow {
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ interface MetricRow {
|
|||||||
/** 基础指标网格单元 */
|
/** 基础指标网格单元 */
|
||||||
interface BasicCell {
|
interface BasicCell {
|
||||||
label: string
|
label: string
|
||||||
|
/** 名称后跟的状态文字(如 BMI 的"超重") */
|
||||||
|
labelExtra: string
|
||||||
|
/** 状态文字背景色 */
|
||||||
|
labelExtraColor: string
|
||||||
value: string
|
value: string
|
||||||
unit: string
|
unit: string
|
||||||
}
|
}
|
||||||
@@ -108,10 +112,18 @@ interface BodyPartsCard {
|
|||||||
rows: BodyPart[][]
|
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'
|
const DEFAULT_STATUS_COLOR = '#B6B6B6'
|
||||||
|
|
||||||
|
/** BMI 体型状态对应的刻度色 */
|
||||||
|
const BMI_TYPE_COLOR: Record<string, string> = {
|
||||||
|
消瘦: '#1385FA',
|
||||||
|
正常: '#2AC79F',
|
||||||
|
超重: '#FFA151',
|
||||||
|
肥胖: '#F24439',
|
||||||
|
}
|
||||||
|
|
||||||
/** 将 bodyDataList 转为 key -> 指标 的映射 */
|
/** 将 bodyDataList 转为 key -> 指标 的映射 */
|
||||||
const toMap = (list: LefuBodyDatum[] = []): Record<string, LefuBodyDatum> => {
|
const toMap = (list: LefuBodyDatum[] = []): Record<string, LefuBodyDatum> => {
|
||||||
const map: Record<string, LefuBodyDatum> = {}
|
const map: Record<string, LefuBodyDatum> = {}
|
||||||
@@ -252,7 +264,19 @@ Page({
|
|||||||
const basicCells: BasicCell[] = basicKeys.map((k) => {
|
const basicCells: BasicCell[] = basicKeys.map((k) => {
|
||||||
const d = map[k]
|
const d = map[k]
|
||||||
if (!d) return { ...EMPTY_BASIC_CELL }
|
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 })
|
basicCells.push({ ...EMPTY_BASIC_CELL })
|
||||||
const basicRows = [basicCells.slice(0, 3), basicCells.slice(3, 6)]
|
const basicRows = [basicCells.slice(0, 3), basicCells.slice(3, 6)]
|
||||||
|
|||||||
@@ -48,7 +48,12 @@
|
|||||||
<view class="basicIndicatorsRow" wx:for="{{ basicRows }}" wx:for-item="row" wx:key="index">
|
<view class="basicIndicatorsRow" wx:for="{{ basicRows }}" wx:for-item="row" wx:key="index">
|
||||||
<view class="basicIndicatorsCell" wx:for="{{ row }}" wx:for-item="cell" wx:key="label">
|
<view class="basicIndicatorsCell" wx:for="{{ row }}" wx:for-item="cell" wx:key="label">
|
||||||
<block wx:if="{{ cell.label }}">
|
<block wx:if="{{ cell.label }}">
|
||||||
<view class="basicIndicatorsLabel">{{ cell.label }}</view>
|
<view class="basicIndicatorsLabel">
|
||||||
|
<view class="basicIndicatorsLabelText">{{ cell.label }}</view>
|
||||||
|
<block wx:if="{{ cell.labelExtra }}">
|
||||||
|
<view class="basicIndicatorsLabelExtra" style="background-color: {{ cell.labelExtraColor }};">{{ cell.labelExtra }}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
<view class="basicIndicatorsValueRow">
|
<view class="basicIndicatorsValueRow">
|
||||||
<view class="basicIndicatorsValue">{{ cell.value }}</view>
|
<view class="basicIndicatorsValue">{{ cell.value }}</view>
|
||||||
<block wx:if="{{ cell.unit }}">
|
<block wx:if="{{ cell.unit }}">
|
||||||
|
|||||||
Reference in New Issue
Block a user