<template>
	<view class="box">
		<view class="form lanBox">
			<view class="lan border-bottom" v-for="(item,index) in list" :key="index">
				<view class="left">
					<view class="icon">
						<icon class="t-icon" :class="'t-icon-'+item.name"></icon>
					</view>
					{{item.title}}
				</view>
				<view class="center">
					<view v-if="item.title=='肥胖等级'||item.title=='体型'||item.title=='年龄'"><text>{{item.level}}</text></view>
					<view v-else>
						<text>{{item.value?item.value:"0"}}</text><text v-if="item.unit">{{item.unit}}</text>
					</view>
				</view>
			</view>
			<!-- <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-height"></icon>
            </view>身高
          </view>
          <view class="right">{{memInfo.height?memInfo.height:"0"}}cm</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-weight"></icon>
            </view>体重
          </view>
          <view class="right">{{memInfo.weight?memInfo.weight:"0"}}kg</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <image src="../../static/age.png"></image>
            </view>年龄
          </view>
          <view class="right">{{memInfo.age?memInfo.age:"0岁"}}</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-bmi"></icon>
            </view>BMI
          </view>
          <view class="right">{{memInfo.bmi?memInfo.bmi:"0"}}</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-fat_w"></icon>
            </view>脂肪量
          </view>
          <view class="right">{{memInfo.fat_w?memInfo.fat_w:"0"}}%</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-fat_r"></icon>
            </view>脂肪率
          </view>
          <view class="right">{{memInfo.fat_r?memInfo.fat_r:"0"}}%</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-muscleval"></icon>
            </view>肌肉量
          </view>
          <view class="right">{{memInfo.muscleval?memInfo.muscleval:"0"}}kg</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-muscle"></icon>
            </view>肌肉率
          </view>
          <view class="right">{{memInfo.muscle?memInfo.muscle:"0"}}%</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-proteinval"></icon>
            </view>蛋白量
          </view>
          <view class="right">{{memInfo.proteinval?memInfo.proteinval:'0'}}kg</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-protein"></icon>
            </view>蛋白率
          </view>
          <view class="right">{{memInfo.protein?memInfo.protein:"0"}}%</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-water"></icon>
            </view>水分
          </view>
          <view class="right">{{memInfo.water?memInfo.water:"0"}}</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-bone"></icon>
            </view>骨重
          </view>
          <view class="right">{{memInfo.bone?memInfo.bone:"0"}}kg</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-visceral"></icon>
            </view>内脏指数
          </view>
          <view class="right">{{memInfo.visceral?memInfo.visceral:"0"}}</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-sfr"></icon>
            </view>皮下脂肪
          </view>
          <view class="right">{{memInfo.sfr?memInfo.sfr:"0"}}%</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-kcal"></icon>
            </view>基础代谢率
          </view>
          <view class="right">{{memInfo.kcal?memInfo.kcal:'0'}}kcal</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-lbm"></icon>
            </view>去脂体重
          </view>
          <view class="right">{{memInfo.lbm?memInfo.lbm:"0"}}kg</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-bodyage"></icon>
            </view>体龄
          </view>
          <view class="right">{{memInfo.bodyage?memInfo.bodyage:"0"}}</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-fatlevel"></icon>
            </view>肥胖等级
          </view>
          <view class="right">{{memInfo.fatlevel?memInfo.fatlevel:'0'}}</view>
        </view>
        <view class="lan border-bottom">
          <view class="left">
            <view class="icon">
              <icon class="t-icon t-icon-body"></icon>
            </view>体型
          </view>
          <view class="right">{{memInfo.body?memInfo.body:'0'}}</view>
        </view>
      </view> -->
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	export default {
		data() {
			return {
				list: {},
				memInfo: {}
			};
		},
		computed: {
			...mapState(["appTheme"])
		},
		onLoad(options) {
			let that = this
			// 导航栏颜色
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: that.appTheme,
			})
			// 
			let info = options.index
			let memInfo = JSON.parse(info)
			that.memInfo = memInfo
			that.getList()
		},
		methods: {
			getList() {
				let that = this
				that.$model.gethistorydetail({
					id: that.memInfo.id,
				}).then((res) => {
					console.log("历史记录详情", res)
					if (res.code != 0) return
					that.list = res.data.list
				})
			},
		}
	};
</script>

<style scoped="scoped" lang="scss">
	.box {
		min-height: 100vh;
		background-color: #fff;
	}

	.lanBox {
		padding: 0px 15px 0;
	}

	.lan {
		display: flex;
		align-items: center;
		font-size: 14px;
		height: 50px;
		line-height: 50px;
		justify-content: space-between;
		border-bottom: 1px solid #f7f7f7;

		.left {
			display: flex;
			align-items: center;
			text-align: left;
			font-size: 14px;
			padding-left: 30px;

			.icon {
				width: 18px;
				height: 18px;
				position: absolute;
				left: 15px;
				padding: 2px;
				background-color: #c7c7c7;
				border-radius: 50%;
				display: flex;
				align-items: center;
				justify-content: center;
			}

			.t-icon,
			image {
				width: 16px;
				height: 16px;
			}

		}

		.right {
			display: flex;
			align-items: center;
			justify-content: flex-end;
			width: 50%;
			min-height: 38px;
			box-sizing: border-box;
			line-height: 36px;
		}
	}
</style>