普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

491 lines
15 KiB

<template>
<view class="page__view">
<navbar title="报告对比" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
<view class="main">
<reportCard>
<view class="report" v-if="list.length">
<view class="flex section">
<view
v-for="(item, index) in list"
:key="item.id"
:class="['section-item-box', `section-item-box-${index == 0 ? 'left' : 'right'}`]"
>
<view class="section-item info-score">
<view class="time">{{ item.createTime }}</view>
<view class="flex score">
综合得分
<text class="score-value">{{ item.score }}</text>
<text class="score-unit">分</text>
</view>
<view class="score-detail">
<view class="score-detail-item" v-for="(score, sIdx) in item.scoreDetail" :key="sIdx">
<progressBar :progress="score" :total="100"></progressBar>
<view class="score-detail-item-score">{{ `${axis[sIdx]}:` }}<text class="highlight">{{ score }}</text></view>
</view>
</view>
</view>
</view>
</view>
<view class="flex section">
<view
v-for="(item, index) in list"
:key="item.id"
:class="['section-item-box', `section-item-box-${index == 0 ? 'left' : 'right'}`]"
>
<view class="section-item info-BMI">
<view class="flex label">
<text>BMI 指数</text>
<text class="highlight">{{ item.BMI || '-' }}</text>
</view>
<view class="progress">
<!-- todo: check -->
<progressBar :progress="item.BMI" :total="30"></progressBar>
</view>
</view>
</view>
</view>
<view class="flex section"
v-for="(step, sIdx) in list[0].children" :key="step.key"
>
<view
v-for="(report, rIdx) in list"
:key="rIdx"
:class="['section-item-box', `section-item-box-${rIdx == 0 ? 'left' : 'right'}`]"
>
<view class="section-item">
<view class="section-header">
<view class="section-header-zh">{{ `${sIdx + 1}.${step.name}` }}</view>
<view class="section-header-en">{{ step.nameEn }}</view>
</view>
<view class="section-content">
<template v-if="step.key === 'improvementGoal'">
<view class="tags">
<view class="tag" v-for="(tag, tIdx) in report.children[sIdx].tags" :key="tIdx">{{ tag }}</view>
</view>
</template>
<template v-else-if="step.key === 'topPriority'">
<view class="tags">
<view class="tag highlight">{{ report.children[sIdx].tag }}</view>
</view>
</template>
<template v-else-if="step.key === 'potentialHealthIssues'">
<view class="flex section-content-tag">
<image class="section-content-tag-icon" :src="report.children[sIdx].tag.icon" mode="widthFix"></image>
<text class="section-content-tag-text">{{ report.children[sIdx].tag.text }}</text>
</view>
<view>
<view class="section-content-item" v-for="(item, idx) in report.children[sIdx].content" :key="idx">
<view class="flex section-content-item-header">
<view class="section-content-item-index" v-if="report.children[sIdx].content.length > 1">{{ `${idx + 1}.` }}</view>
<view class="section-content-item-title">{{ item.title }}</view>
</view>
<view class="section-content-item-detail">{{ item.detail }}</view>
</view>
</view>
</template>
<template v-else>
<view>
<view class="section-content-item" v-for="(item, idx) in report.children[sIdx].content" :key="idx">
<view class="flex section-content-item-header">
<view class="section-content-item-index" v-if="report.children[sIdx].content.length > 1">{{ `${idx + 1}.` }}</view>
<view class="section-content-item-title">{{ item.title }}</view>
</view>
<view class="section-content-item-detail">{{ item.detail }}</view>
</view>
</view>
</template>
</view>
</view>
</view>
</view>
</view>
</reportCard>
</view>
</view>
</template>
<script>
import reportCard from '@/pages_order/components/reportCard.vue';
import progressBar from '@/pages_order/components/progressBar.vue';
export default {
components: {
reportCard,
progressBar,
},
data() {
return {
list: [],
axis: ['饮食', '运动', '心理', '体质', '作息']
}
},
onLoad(arg) {
const ids = JSON.parse(arg.ids)
// todo
const children = [
{
id: '001',
key: 'improvementGoal',
name: '本次改善目标',
nameEn: 'This improvement goal',
url: '/pages_order/static/report/report-detail-1.png',
tags: ['皮肤', '脑力/注意力', '眼睛/视力', '睡眠', '骨骼/关节']
},
{
id: '002',
key: 'topPriority',
name: '首要目标',
nameEn: 'Top priority',
url: '/pages_order/static/report/report-detail-2.png',
tag: '脑力/注意力'
},
{
id: '003',
key: 'targetSuggestion',
name: '健康目标建议',
nameEn: 'Target Suggestion',
url: '/pages_order/static/report/report-detail-3.png',
content: [
{ title: '吃一小把混合坚果对皮肤好', detail: '增加不饱和脂肪酸的摄入有益皮肤健康,可以每天食用一小把混合类坚果,例如核桃、葵花籽、开心果等。' },
]
},
{
id: '004',
key: 'dailyGoals',
name: '每日小目标',
nameEn: 'Daily Small Goals',
url: '/pages_order/static/report/report-detail-4.png',
content: [
{ title: '每天吃1个水煮鸡蛋', detail: '每天食用1个鸡蛋可以补充丰富的动物蛋白以及多种维生素和矿物质,如维生素A、维生素D、 维生素B12、胆碱、叶酸、磷和碘等。' },
{ title: '今天的饭后甜点是低糖酸奶', detail: '每天食用1个鸡蛋可以补充丰富的动物蛋白以及多种维生素和矿物质,如维生素A、维生素D、 维生素B12、胆碱、叶酸、磷和碘等。' },
]
},
{
id: '005',
key: 'potentialHealthIssues',
name: '需要注意的潜在健康问题',
nameEn: 'Potential health issues to note',
url: '/pages_order/static/report/report-detail-5.png',
tag: {
text: '心血管问题',
icon: '/pages_order/static/report/cardiovascular.png',
},
content: [
{ title: '影响因素', detail: '较少食用富含Omega3的食物(如:深海鱼,坚果)' },
{ title: '营养建议', detail: '建议每天吃一把坚果。' },
]
},
{
id: '006',
key: 'specialReminder',
name: '特殊提醒',
nameEn: 'Special Reminder',
url: '/pages_order/static/report/report-detail-6.png',
content: [
{ title: '眼睛长时间感觉到干涩可能是干眼症,一般是由于泪腺泪液分泌不足导致的,严重的话请及时就医。' },
{ title: '同时使用不同品牌的膳食补剂容易导致营养素摄入过量, 请注意服用剂量,避免造成补剂摄入过量带来的副作用。' },
]
},
{
id: '007',
key: 'exerciseRest',
name: '运动 & 作息',
nameEn: 'Exercise & Rest',
url: '/pages_order/static/report/report-detail-7.png',
content: [
{ title: '请尽量避免在阳光强烈的时段(通常是中午至下午3点)户外活动。在户外时,涂抹SPF(防晒系数)高的防晒霜在暴露的皮肤上,并穿着长袖衣物、帽子和太阳镜减少皮肤接触到紫外线的机会。' }
]
},
{
id: '008',
key: 'dietaryRecommendations',
name: '饮食建议',
nameEn: 'Dietary recommendations',
url: '/pages_order/static/report/report-detail-8.png',
content: [
{ title: '一天不要超过三杯美式咖啡', detail: '健康成年人每天摄入的咖啡因应控制在400mg以内。1杯 355mL的小杯美式咖啡,所含咖啡因为150mg,所以一天最好不要饮用超过3小杯咖啡。' },
]
},
]
this.list = [
{
id: '001',
createTime: '2025-05-01',
score: 56,
scoreDetail: [72, 94, 60, 82, 78],
BMI: 16.5,
children,
},
{
id: '002',
createTime: '2025-05-19',
score: 77,
scoreDetail: [72, 94, 60, 82, 78],
BMI: 16.5,
children,
},
]
},
methods: {
},
}
</script>
<style scoped lang="scss">
.page__view {
width: 100vw;
min-height: 100vh;
background-color: $uni-bg-color;
position: relative;
/deep/ .nav-bar__view {
position: fixed;
top: 0;
left: 0;
}
}
.main {
padding: calc(var(--status-bar-height) + 152rpx) 32rpx 64rpx 32rpx;
/deep/ .report-card__view {
.card-content {
padding-top: 232rpx;
padding-left: 0;
padding-right: 0;
}
}
}
.section {
width: 100%;
& + & {
.section-item {
padding-top: 32rpx;
border-top: 2rpx dashed #989898;
}
}
&-item {
padding-bottom: 32rpx;
&-box {
flex: 1;
padding: 0 32rpx;
&-left {
padding-left: 24rpx;
}
&-right {
padding-right: 24rpx;
background: #FBFCFE;
}
}
}
&-header {
font-family: PingFang SC;
line-height: 1.4;
color: #252545;
&-zh {
font-weight: 600;
font-size: 32rpx;
}
&-en {
font-weight: 400;
font-size: 24rpx;
}
}
&-content {
padding-top: 18rpx;
&-item {
font-family: PingFang SC;
font-weight: 400;
line-height: 1.5;
color: #252545;
& + & {
margin-top: 24rpx;
}
&-header {
align-items: flex-start;
justify-content: flex-start;
}
&-index {
display: inline-block;
width: 44rpx;
font-size: 24rpx;
text-align: right;
line-height: 44rpx;
padding-right: 10rpx;
box-sizing: border-box;
}
&-title {
font-size: 28rpx;
}
&-detail {
margin-top: 8rpx;
font-size: 24rpx;
color: #989898;
}
}
&-tag {
margin-bottom: 24rpx;
padding: 16rpx 0;
background: #E5E4EB8C;
border-radius: 16rpx;
column-gap: 16rpx;
&-icon {
width: 40rpx;
height: 40rpx;
}
&-text {
font-family: PingFang SC;
font-weight: 400;
font-size: 28rpx;
line-height: 1.5;
color: #252545;
}
}
}
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
.tag {
padding: 8rpx 40rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 28rpx;
line-height: 1.5;
color: #252545;
background: #E5E4EB;
border-radius: 30rpx;
&.highlight {
font-weight: 600;
color: #FFFFFF;
background: #252545;
}
}
}
.info {
&-score {
padding: 40rpx 0;
.time {
display: inline-flex;
width: auto;
padding: 8rpx 16rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 28rpx;
line-height: 1.5;
color: #252545;
border: 2rpx solid #252545;
border-radius: 30rpx;
}
.score {
margin-top: 4rpx;
justify-content: flex-start;
column-gap: 8rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 36rpx;
line-height: 1.2;
color: #252545CC;
&-value {
font-weight: 600;
font-size: 64rpx;
line-height: 1.4;
color: transparent;
background-image: linear-gradient(to right, #4B348F, #845CFA);
background-clip: text;
display: inline-block;
}
&-unit {
font-weight: 600;
font-size: 40rpx;
line-height: 1.4;
color: #252545;
}
}
.score-detail {
margin-top: 20rpx;
&-item {
padding-top: 10rpx;
&-score {
padding: 10rpx 0 0 16rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 24rpx;
line-height: 1;
color: #8B8B8B;
.highlight {
margin-left: 12rpx;
font-weight: 500;
font-size: 28rpx;
line-height: 1.4;
color: #000000;
}
}
}
}
}
&-BMI {
.label {
white-space: nowrap;
font-family: PingFang SC;
font-weight: 400;
font-size: 36rpx;
line-height: 1.2;
color: #252545CC;
.highlight {
margin-left: 8rpx;
font-size: 64rpx;
font-weight: 600;
line-height: 1.4;
font-family: PingFang SC;
color: transparent;
background-image: linear-gradient(to right, #4B348F, #845CFA);
background-clip: text;
display: inline-block;
}
}
.progress {
margin: 18rpx 0 34rpx 0;
width: 100%;
}
}
}
</style>