examTeamApp/pages/compk/pkdetail.vue

342 lines
7.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content pkconp">
<view class="header">
<view class="left">
<image :src="memInfo.headimg" class="image1"></image>
</view>
<view class="right">
<view class="name">{{memInfo.name?memInfo.name:memInfo.nickname}}</view>
<view class="top">
<view class="age">性别{{memInfo.sex==0?'未知':memInfo.sex==1?'男':'女'}}</view>
<view>年龄{{user.age}}</view>
</view>
</view>
<!-- <button class="pkclass" @click="handleImage">保存图片</button> -->
</view>
<view class="box">
<view class="item">
<view>{{memInfo.day?memInfo.day:'0'}}</view>
<text>时间()</text>
</view>
<view class="item">
<view>{{Math.abs(memInfo.weightdiff)}}</view>
<text v-if="Number(memInfo.weightdiff)>0">增重(kg)</text>
<text v-else>减重(kg)</text>
</view>
<view class="item">
<view>{{Math.abs(memInfo.fat_wdiff)}}</view>
<text v-if="Number(memInfo.fat_wdiff)>0">增脂(kg)</text>
<text v-else>减脂(kg)</text>
</view>
<view class="time">
<view>
<icon class="yuanxing"></icon>{{memInfo.time}}
</view>数据变化
</view>
</view>
<view class="control">
<!-- 名称 -->
<view class="title">
<view class="name"></view>
<view>趋势</view>
<view>之前</view>
<view>之后</view>
</view>
<view v-for="(ite,ind) in listStr" :key="ind" class="li">
<view class="name">
<view class="icon">
<view class="t-icon" :class="'t-icon-'+ite.key"></view>
</view>
<text>{{ite.title}}</text>
</view>
<view class="num" v-if="ite.title=='体型'||ite.title=='肥胖等级'">
<view class="t-icon t-icon-hengxian"></view>
</view>
<view class="num" v-else>
{{ite.num}}
<text class="t-icon t-icon-shang" v-if="ite.vs=='1'"></text>
<text class="t-icon t-icon-xia" v-if="ite.vs=='-1'"></text>
<text class="t-icon t-icon-hengxian" v-if="!ite.vs||ite.vs=='0'||ite.num=='0.00'"></text>
</view>
<view class="f0" v-if="ite.title=='体型'||ite.title=='肥胖等级'">
<text>{{ite.fevaluation}}</text>
</view>
<view class="f" v-else>
<view>{{ite.fvalue}}</view>
<text v-if="ite.fevaluation">{{ite.fevaluation}}</text>
</view>
<view class="f0" v-if="ite.title=='体型'||ite.title=='肥胖等级'">
<text>{{ite.sevaluation}}</text>
</view>
<view class="f" v-else>
<view>{{ite.svalue}}</view>
<text v-if="ite.fevaluation">{{ite.sevaluation}}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
onLoad(options) {
let that = this
// 导航栏颜色
console.log("options", options)
that.memInfo = that.$json.contrastDetail
// if (options.info) {
// that.infoID = JSON.parse(options.info)
// that.handleSharepic(that.infoID)
// }
},
computed: {
...mapState(["user", "appTheme"]),
},
methods: {
handleSharepic(id) {
let that = this
that.$model.getresultdiff({
familyid: id.familyid,
firstId: id.firstId,
secondId: id.secondId,
}).then(res => {
console.log("res", res)
if (res.code != 0) {
this.$tools.msg(res.message)
return
}
that.handleInfoList(res.data)
})
},
handleInfoList(data) {
let that = this
that.memInfo = data
let listStr = that.weightInfo.infoList(data.firstresult)
let str = that.memInfo.secondresult
for (var i = 0; i < listStr.length; i++) {
listStr[i].svalue = str[listStr[i].key];
let num = listStr[i].svalue - listStr[i].fvalue
if (num < 0) {
listStr[i].vs = '-1'
} else if (num > 0) {
listStr[i].vs = '1'
} else {
listStr[i].vs = '0'
}
listStr[i].num = Math.abs(num).toFixed(2)
if (str[listStr[i].level]) {
listStr[i].sevaluation = str[listStr[i].level];
}
console.log("listStr[i].title", listStr[i].title)
// if (listStr[i].title == "体重") {
// if (listStr[i].svalue > Number(str.standardweight)) {
// listStr[i].sevaluation = "偏高"
// } else if (listStr[i].svalue < Number(str.standardweight)) {
// listStr[i].sevaluation = "偏低"
// } else {
// listStr[i][i].sevaluation = "标准"
// }
// }
}
that.listStr = listStr
console.log("listStr[i]", that.memInfo, listStr)
},
},
data() {
return {
infoID: {},
memInfo: {},
listStr: [],
}
},
}
</script>
<style scoped lang="scss">
.pkconp {
background: #f7f7f7;
min-height: 100vh;
.header {
text-align: center;
background: #fff;
padding: 15px 15px 10px;
margin: 15px;
border-radius: 10px 10px 0 0;
display: flex;
align-items: center;
position: relative;
.name {
text-align: left;
}
image {
width: 55px;
height: 55px;
border-radius: 50%;
margin-right: 15px;
}
.pkclass {
position: absolute;
background: linear-gradient(to right, #ff99ae, #ffb2c2);
right: 15px;
padding: 0px 10px;
border-radius: 10px;
color: #fff;
height: 30px;
line-height: 30px;
font-size: 14px;
}
.top {
display: flex;
color: #999;
margin-top: 10px;
}
}
.box {
background: #ffff;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
padding: 15px 0;
margin: 15px;
border-radius: 0 0 10px 10px;
.item {
text-align: center;
color: #999;
width: 33.3%;
line-height: 26px;
border-right: 1px solid #f7f7f7;
box-sizing: border-box;
view {
font-size: 20px;
font-weight: 700;
color: #666;
}
}
}
.control {
background: #fff;
margin: 15px;
display: flex;
border: 1px solid #F0F0F0;
border-radius: 10px;
flex-wrap: wrap;
justify-content: space-between;
.title {
width: 100%;
margin: 10px;
display: flex;
justify-content: space-between;
view {
width: 22%;
text-align: center;
}
.name {
width: 33%;
}
}
.li {
display: flex;
margin: 0 10px;
justify-content: space-between;
height: 54px;
border-top: 1px solid #eee;
align-items: center;
width: 100%;
.name {
width: 33%;
display: flex;
align-items: center;
image {
width: 20px;
height: 20px;
margin-right: 5px;
}
}
.num {
width: 22%;
display: flex;
align-items: center;
justify-content: center;
image {
width: 40rpx;
height: 40rpx;
}
}
.f,
.f0 {
width: 22%;
text-align: center;
text {
display: block;
width: 100%;
color: #999999;
font-size: 11px;
}
}
.f0 {
text {
font-size: 12px;
}
}
}
}
.time {
border-top: 1px solid #f0f0f0;
width: 100%;
padding: 15px 15px 0;
margin-top: 5px;
display: flex;
justify-content: space-between;
.yuanxing {
float: left;
}
}
}
.age {
margin-right: 20px;
}
.icon {
width: 18px;
height: 18px;
padding: 3px;
margin-right: 7px;
background-color: #aaa;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.t-icon-hengxian {
height: 4px !important;
}
</style>