[AI Generated]: refactor(Views): 优化测量报告页面结构与样式
This commit is contained in:
@@ -6,65 +6,67 @@
|
||||
/* ===== 测量信息卡片 ===== */
|
||||
.info-card {
|
||||
width: 100%;
|
||||
padding: 40rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 36rpx 30rpx;
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #FFFFFF;
|
||||
//background-color: #FFFFFF;
|
||||
background: linear-gradient(180deg, #D3E9FF 0%, #FCFBFD 100%);
|
||||
|
||||
.info-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.info-avatar {
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 24rpx;
|
||||
margin-right: 24rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #C6E6FF;
|
||||
border: 3rpx solid #50A6FF;
|
||||
}
|
||||
|
||||
.info-avatar {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 24rpx;
|
||||
background-color: #C6E6FF;
|
||||
border: 3rpx solid #50A6FF;
|
||||
.info-meta {
|
||||
flex: 1;
|
||||
|
||||
.info-name {
|
||||
color: #333333;
|
||||
height: 32rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 32rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.info-meta {
|
||||
flex: 1;
|
||||
|
||||
.info-time {
|
||||
color: #77849E;
|
||||
font-size: 26rpx;
|
||||
line-height: 34rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.info-name {
|
||||
color: #333333;
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
.info-time {
|
||||
color: #77849E;
|
||||
height: 26rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 体重卡片 ===== */
|
||||
/* ===== 最近测量卡 ===== */
|
||||
.weight-card {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 2rpx 2rpx 50rpx;
|
||||
border-radius: 24rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #FFFFFF;
|
||||
|
||||
/* 卡头 */
|
||||
/* 卡头(带渐变背景) */
|
||||
.card-header {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-right: 10rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 18rpx;
|
||||
justify-content: space-between;
|
||||
background: linear-gradient(180deg, rgba(211, 233, 255, 0.6) 0%, rgba(252, 251, 253, 0.6) 100%);
|
||||
|
||||
.card-header-left {
|
||||
display: flex;
|
||||
@@ -92,7 +94,7 @@
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
/* 体重主数据行 */
|
||||
/* ===== 最近测量:体重主数据行 ===== */
|
||||
.weight-row {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
@@ -169,7 +171,7 @@
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
|
||||
.diff-arrow {
|
||||
text {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 42rpx;
|
||||
@@ -253,6 +255,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* BMI 行(标签 + badge 并排) */
|
||||
.metric-label-row {
|
||||
height: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.metric-label {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* BMI 标准/偏高 badge */
|
||||
.bmi-badge {
|
||||
height: 30rpx;
|
||||
padding: 0 10rpx;
|
||||
margin-left: 10rpx;
|
||||
font-size: 18rpx;
|
||||
line-height: 30rpx;
|
||||
border-radius: 8rpx;
|
||||
color: #FFFFFF;
|
||||
background-color: #2AC79F;
|
||||
}
|
||||
}
|
||||
|
||||
.metric-value-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
@@ -270,13 +296,21 @@
|
||||
color: #252535;
|
||||
height: 26rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
font-weight: bold;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-lianjie {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
width: 32rpx;
|
||||
height: 84rpx;
|
||||
bottom: -55rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 详细数据卡 ===== */
|
||||
@@ -288,12 +322,12 @@
|
||||
box-sizing: border-box;
|
||||
background-color: #FFFFFF;
|
||||
|
||||
/* 卡头 */
|
||||
/* 卡头(带渐变背景) */
|
||||
.card-header {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-right: 50rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -318,16 +352,28 @@
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.link-text {
|
||||
color: #77849E;
|
||||
height: 24rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 详细数据:三格 */
|
||||
/* ===== 详细数据:三格 ===== */
|
||||
.detail-grid {
|
||||
display: flex;
|
||||
padding: 0 30rpx;
|
||||
justify-content: space-between;
|
||||
|
||||
.detail-item {
|
||||
width: 194rpx;
|
||||
width: 195rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx;
|
||||
@@ -350,7 +396,7 @@
|
||||
color: #252535;
|
||||
height: 44rpx;
|
||||
font-size: 44rpx;
|
||||
font-weight: 500;
|
||||
font-weight: bold;
|
||||
line-height: 44rpx;
|
||||
margin-right: 2rpx;
|
||||
}
|
||||
@@ -359,7 +405,6 @@
|
||||
color: #252535;
|
||||
height: 26rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
/** 测量报告数据 */
|
||||
interface ReportData {
|
||||
/** 测量时间 */
|
||||
measureTime: string
|
||||
/** 用户姓名 */
|
||||
userName: string
|
||||
interface WeightRecord {
|
||||
/** 体重整数部分 */
|
||||
weight: number
|
||||
/** 体重小数部分,如 ".20" */
|
||||
/** 体重小数部分,含小数点,如 ".20" */
|
||||
weightDecimal: string
|
||||
/** 测量时间显示,如 "05-06 09:30" */
|
||||
weightDate: string
|
||||
/** 测量时间显示,如 "今日 07:30" */
|
||||
date: string
|
||||
/** 与上次相比差值(负=减轻,正=增重) */
|
||||
diff: number
|
||||
/** 身高(cm) */
|
||||
@@ -35,13 +31,11 @@ interface ReportData {
|
||||
Page({
|
||||
data: {
|
||||
// 报告数据
|
||||
report: {
|
||||
measureTime: '2026-05-06 09:30',
|
||||
userName: '陈万宁',
|
||||
record: {
|
||||
weight: 68,
|
||||
weightDecimal: '.20',
|
||||
weightDate: '05-06 09:30',
|
||||
diff: -2.6,
|
||||
date: '今日 07:30',
|
||||
diff: -0.3,
|
||||
height: 176,
|
||||
bmi: 22.4,
|
||||
bmiLabel: '标准',
|
||||
@@ -49,7 +43,7 @@ Page({
|
||||
bodyFat: 22.3,
|
||||
bodyFatMass: 52.1,
|
||||
bmr: 1652
|
||||
} as ReportData
|
||||
} as WeightRecord
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
<view class="scrollViewContent">
|
||||
<!-- 测量信息卡片 -->
|
||||
<view class="info-card">
|
||||
<view class="info-header">
|
||||
<view class="info-avatar"></view>
|
||||
<view class="info-meta">
|
||||
<view class="info-time">{{ report.measureTime }}</view>
|
||||
<view class="info-name">{{ report.userName }}</view>
|
||||
</view>
|
||||
<view class="info-avatar"></view>
|
||||
<view class="info-meta">
|
||||
<view class="info-name">陈万宁</view>
|
||||
<view class="info-time">2026-05-06 09:30</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 体重卡片 -->
|
||||
<!-- 最近测量卡 -->
|
||||
<view class="weight-card">
|
||||
<!-- 卡头 -->
|
||||
<view class="card-header">
|
||||
@@ -26,21 +24,21 @@
|
||||
<view class="weight-row">
|
||||
<view class="weight-main">
|
||||
<view class="weight-num-wrap">
|
||||
<text class="weight-int">{{ report.weight }}</text>
|
||||
<text class="weight-dec">{{ report.weightDecimal }}</text>
|
||||
<text class="weight-int">{{ record.weight }}</text>
|
||||
<text class="weight-dec">{{ record.weightDecimal }}</text>
|
||||
<text class="weight-unit">kg</text>
|
||||
</view>
|
||||
<view class="weight-date">{{ report.weightDate }}</view>
|
||||
<view class="weight-date">{{ record.date }}</view>
|
||||
</view>
|
||||
<view class="weight-diff">
|
||||
<view class="diff-num-wrap">
|
||||
<view class="diff-num {{ report.diff < 0 ? 'diff-down' : 'diff-up' }}">{{ report.diff < 0 ? -report.diff : report.diff }}</view>
|
||||
<view class="diff-num {{ record.diff < 0 ? 'diff-down' : 'diff-up' }}">{{ record.diff < 0 ? -record.diff : record.diff }}</view>
|
||||
<view class="diff-unit">
|
||||
kg
|
||||
<text class="diff-arrow {{ report.diff < 0 ? 'arrow-down' : 'arrow-up' }}"></text>
|
||||
<text class="diff-arrow {{ record.diff < 0 ? 'arrow-down' : 'arrow-up' }}"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="diff-label">{{ report.diff < 0 ? '体重较上次减轻' : '体重较上次增加' }}</view>
|
||||
<view class="diff-label">{{ record.diff < 0 ? '体重较上次减轻' : '体重较上次增加' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -54,17 +52,17 @@
|
||||
<view class="metric-label-text">身高</view>
|
||||
</view>
|
||||
<view class="metric-value-row">
|
||||
<text class="metric-value">{{ report.height }}</text>
|
||||
<text class="metric-value">{{ record.height }}</text>
|
||||
<text class="metric-unit">cm</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="metric-col">
|
||||
<view class="metric-label">
|
||||
<view class="metric-label-text">BMI</view>
|
||||
<view class="metric-label-value">{{ report.bmiLabel }}</view>
|
||||
<view class="metric-label-value">{{ record.bmiLabel }}</view>
|
||||
</view>
|
||||
<view class="metric-value-row">
|
||||
<text class="metric-value">{{ report.bmi }}</text>
|
||||
<text class="metric-value">{{ record.bmi }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="metric-col">
|
||||
@@ -72,12 +70,16 @@
|
||||
<view class="metric-label-text">标准体重</view>
|
||||
</view>
|
||||
<view class="metric-value-row">
|
||||
<text class="metric-value">{{ report.stdWeight }}</text>
|
||||
<text class="metric-value">{{ record.stdWeight }}</text>
|
||||
<text class="metric-unit">kg</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-lianjie">
|
||||
<image src="/images/home/lianjie.png" mode=""/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 详细数据卡 -->
|
||||
@@ -95,21 +97,21 @@
|
||||
<view class="detail-item">
|
||||
<view class="detail-label">体脂率</view>
|
||||
<view class="detail-value-row">
|
||||
<text class="detail-value">{{ report.bodyFat }}</text>
|
||||
<text class="detail-value">{{ record.bodyFat }}</text>
|
||||
<text class="detail-unit">%</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<view class="detail-label">体脂肪</view>
|
||||
<view class="detail-value-row">
|
||||
<text class="detail-value">{{ report.bodyFatMass }}</text>
|
||||
<text class="detail-value">{{ record.bodyFatMass }}</text>
|
||||
<text class="detail-unit">kg</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<view class="detail-label">基础代谢</view>
|
||||
<view class="detail-value-row">
|
||||
<text class="detail-value">{{ report.bmr }}</text>
|
||||
<text class="detail-value">{{ record.bmr }}</text>
|
||||
<text class="detail-unit">kcal</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user