ReedawFoodApp/body/home/body.vue

251 lines
5.1 KiB
Vue

<template>
<view class="content indexCarList">
<view class="tagList">
<scroll-view class="scroll-view_H" scroll-x="true" :scroll-into-view="toView">
<text class="scroll-view-item_H" v-for="(ite,ind) in tagList" @click="handlePageScrollTo(ite.key,ind)"
:class="[ind == index?'active':'']" :id="'Body_'+ite.key">
{{ite.name}}
</text>
</scroll-view>
</view>
<!-- 身体数据 -->
<view class="report">
<view class="box" v-if="list.length" v-for="(item,index) in list" :id="item.key_name">
<view class="data data2">
<view class="left">
<view class="name bold">
<image :src="item.icon"></image>
{{item.name}}
</view>
<view class="val">{{item.value?item.value:'0'}}{{item.unit}}</view>
<view class="level">
<view class="btnf"
:style="{backgroundColor:(item.standard=='异常'?'#FFF':item.standard_color)}"
:class="[item.standard=='异常'?'btnC':'']">
{{item.standard=='异常'?'-':item.standard}}
</view>
</view>
</view>
</view>
<view class="desc">
<view v-if="item.description" class="ming size12">{{item.description}}</view>
<view :class="[item.standard_list.length?'statuevue':'']" v-if="item.standard_list">
<view class="bi" v-if="item.title!='基础代谢'">
<view :style="'left:'+item.offset+'%'" class="peobox">
<view class="xx"></view>
</view>
<view class="item" v-for="(ite , ind) in item.standard_list" :key="ind"
:style="{backgroundColor:ite.color}">
<view class="span1">{{ite.text}}</view>
<view class="span" v-if="ind<item.standard_list.length-1">{{ite.max_val}}
</view>
</view>
</view>
<view v-else>
<view class="kcalClass" v-if="item.standard_list&&item.standard_list.length">
标准值:{{item.standard_list[0].max_val}}kcal
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
to: "",
toView: "",
index: 0,
list: [],
tagList: [],
}
},
computed: {
...mapState(['user', "configInfo"]),
endDate() {
return this.$tools.getDate("start")
},
startDate() {
return this.$tools.GetDateStr(-90);
},
},
onLoad(options) {
this.to = options.to
console.log("to", this.to)
this.handleResultDetail()
},
methods: {
handlePageScrollTo(to, ind) {
this.index = ind
uni.createSelectorQuery().select('#' + to).boundingClientRect(function(rect) {
uni.pageScrollTo({
scrollTop: rect.top - 50,
duration: 500
})
}).exec();
},
handleResultDetail() {
let list = []
let that = this
that.$model.getResultDetail({
aud_id: that.user.aud_id
}).then(res => {
if (res.code == 0) {
that.list = res.data
res.data.forEach(ite => {
list.push({
key: ite.key_name,
name: ite.name
})
})
that.tagList = list
const index = res.data.findIndex(ite => ite.key_name == that.to)
setTimeout(() => {
that.handlePageScrollTo(that.to, index)
that.toView = 'Body_' + res.data[index].key_name
}, 500);
}
})
},
}
}
</script>
<style scoped lang="scss">
@import "@/scss/body.scss";
.content {
font-size: 32rpx;
width: 100%;
padding-bottom: 15px;
background-color: #F5F6FA;
min-height: 100vh;
}
.active {
color: #000 !important;
font-weight: bold;
font-size: 16px;
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
.scroll-view-item_H {
display: inline-block;
height: 45rpx;
line-height: 45rpx;
text-align: center;
}
}
.tagList {
width: 100%;
height: 45px;
line-height: 45px;
background: #fff;
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
position: fixed;
top: 0;
z-index: 99999;
text {
color: #666;
padding: 0 15px;
}
}
.title {
display: flex;
align-items: center;
justify-content: space-between;
padding-left: 10px;
margin-bottom: 15px;
position: relative;
}
.title:before {
content: "";
position: absolute;
width: 8px;
height: 20px;
left: -5px;
border-radius: 5px;
background-color: #fea606;
}
.bleTips {
height: 35px;
line-height: 35px;
margin: -10px 10px 10px;
background: #fff;
border-radius: 10px;
text-align: center;
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
}
.bleTips2 {
background: #fea606;
color: #fff;
}
.report {
margin: 60px 0 15px;
width: calc(100% - 30px);
}
.left {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.name {
display: flex;
align-items: center;
width: 33%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
image {
width: 22px;
height: 22px;
margin-right: 5px;
}
}
.tools {
display: flex;
padding: 0 15px;
margin-top: 15px;
justify-content: space-between;
view {
display: flex;
background: #fff;
padding: 10px;
border-radius: 10px;
width: 40%;
align-items: center;
justify-content: center;
}
image {
width: 40px;
height: 40px;
margin-right: 10px;
}
}
</style>