普兆健康管家前端代码仓库
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.
 
 
 

304 lines
7.4 KiB

<template>
<view class="page__view">
<navbar title="详情报告" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
<view class="main">
<reportCard>
<view class="section">
<cardHeader :BMI="BMI"></cardHeader>
</view>
<view class="section" v-for="(step, index) in list" :key="step.key">
<view class="flex section-header">
<view class="section-header-index">
<text>{{ index + 1 }}</text>
<image class="section-header-index-icon" :src="step.icon" mode="widthFix"></image>
</view>
<view class="section-header-title">
<view class="section-header-title-zh">{{ step.name }}</view>
<view class="section-header-title-en">{{ step.enTitle }}</view>
</view>
</view>
<view class="section-content">
<!-- 普通标签 -->
<template v-if="step.type == '0'">
<view class="tags">
<view class="tag" v-for="(item, tIdx) in step.schemes" :key="tIdx">{{ item.title }}</view>
</view>
</template>
<!-- 暗色标签 -->
<template v-else-if="step.type === '1'">
<view class="tags">
<view class="tag highlight" v-for="(item, tIdx) in step.schemes" :key="tIdx">{{ item.title }}</view>
</view>
</template>
<!-- 有序文本 -->
<template v-else-if="step.type === '2'">
<!-- todo -->
<!-- <view class="flex section-content-tag">
<image class="section-content-tag-icon" :src="step.tag.icon" mode="widthFix"></image>
<text class="section-content-tag-text">{{ step.tag.text }}</text>
</view> -->
<view>
<view class="section-content-item" v-for="(item, idx) in step.schemes" :key="idx">
<view class="flex section-content-item-header">
<view class="section-content-item-index">{{ `${idx + 1}.` }}</view>
<view class="section-content-item-title">{{ item.title }}</view>
</view>
<view class="section-content-item-detail" v-if="item.info">{{ item.info }}</view>
</view>
</view>
</template>
<!-- 无序文本 -->
<template v-else-if="step.type === '3'">
<view>
<view class="section-content-item" v-for="(item, idx) in step.schemes" :key="idx">
<view class="flex section-content-item-header">
<view class="section-content-item-title">{{ item.title }}</view>
</view>
<view class="section-content-item-detail" v-if="item.info">{{ item.info }}</view>
</view>
</view>
</template>
</view>
</view>
<view class="section tips">
*以上是根据你的营养目标以及饮食运动作息状况给出的针对性健康建议可以辅助你达成营养目标同时养成良好的生活习惯
</view>
</reportCard>
</view>
<view class="bottom">
<button class="flex btn" @click="jumpToNutritionProgram">查看营养方案</button>
</view>
</view>
</template>
<script>
import reportCard from '@/pages_order/components/reportCard.vue';
import cardHeader from './cardHeader.vue';
export default {
components: {
reportCard,
cardHeader,
},
data() {
return {
BMI: 0,
list: [],
}
},
onLoad(arg) {
const { id } = arg
this.id = id
this.fetchReportData(id)
// todo: delete
this.BMI = 16.5
},
methods: {
async fetchReportData(id) {
try {
const { json } = await this.$fetch('getReportDetail', { id })
this.list = JSON.parse(json).map((item, index) => {
let url = `/pages_order/static/report/report-detail-${index + 1}.png`
return {
...item,
// todo: delete
icon: item.icon || url,
}
})
console.log('list', this.list)
} catch (err) {
}
},
jumpToNutritionProgram() {
this.$utils.navigateTo(`/pages_order/report/nutritionProgram/index?id=${this.id}`)
},
},
}
</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 272rpx 32rpx;
}
.section {
& + & {
margin-top: 48rpx;
padding-top: 12rpx;
border-top: 2rpx dashed #989898;
}
&-header {
justify-content: flex-start;
&-index {
position: relative;
font-family: HarmonyOS Sans;
font-weight: 700;
font-size: 96rpx;
line-height: 1.4;
color: #D9D9D9;
&-icon {
position: absolute;
left: 34rpx;
top: 70rpx;
width: 40rpx;
height: 40rpx;
}
}
&-title {
margin-left: 32rpx;
font-family: PingFang SC;
line-height: 1.4;
color: #252545;
&-zh {
font-weight: 600;
font-size: 40rpx;
}
&-en {
font-weight: 400;
font-size: 26rpx;
}
}
}
&-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;
}
}
}
.section.tips {
padding-top: 48rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 18rpx;
line-height: 1.4;
color: #989898;
}
.bottom {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
padding: 24rpx 40rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
box-sizing: border-box;
background: #FFFFFF;
.btn {
padding: 16rpx 0;
font-family: PingFang SC;
font-size: 36rpx;
font-weight: 500;
line-height: 1;
color: #FFFFFF;
background-image: linear-gradient(to right, #4B348F, #845CFA);
border-radius: 41rpx;
}
}
</style>