ai-watch-app/pages/index/body_info.vue

61 lines
1.0 KiB
Vue

<template>
<view>
<view class="">
<view class="radius_box" style="padding: 0;margin: 30rpx;">
<view class="" v-for="(v,i) in arr" :key="i">
<body_info_components :key_name="v" :value="parseFloat(dataInfo.data_msg[v])"></body_info_components>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
dataInfo:{},
arr:[
'BMI',
'bodyFatPercentage',
'leanBodyMass',
'muscleRate',
'muscleMass',
'subcutaneousFat',
'bodyMoisture',
'skeletalMuscleRate',
'boneMass',
'proteinAmount',
'basalMetabolicRate',
]
}
},
onLoad() {
const dataKey = 'bodyData'; // 同上面设置的key
let get = uni.getStorageSync(dataKey)
if(!get){
uni.showToast({
title:"读取数据失败"
})
setTimeout(() => {
uni.navigateBack({
delta:-1
})
},2000)
return
}
const data = JSON.parse(get);
this.dataInfo = data;
uni.removeStorageSync(dataKey);
},
methods: {
}
}
</script>
<style>
</style>