身体成分第一版

This commit is contained in:
weidizhu_admin 2024-08-07 19:10:22 +08:00
parent 48747147ff
commit 8a6eeaa3be
28 changed files with 550 additions and 33 deletions

View File

@ -46,6 +46,11 @@ export const getIndexData = (data) => {
export const forgotPassword = (data) => {
return post('watch/login/forgotPassword', data)
}
// 获取用户信息
export const getUserInfo = (data) => {
return post('watch/user/getUserInfo', data)
}
@ -59,5 +64,6 @@ export default {
getDeviceListDays,
getVersion,
getIndexData,
forgotPassword
forgotPassword,
getUserInfo
}

View File

@ -63,9 +63,7 @@
default:0
}
},
mounted() {
},
data() {
return {
open:false,
@ -80,6 +78,7 @@
icon_info:{
},
bodyDataExample:{
BMI:{
name:"BMI",
@ -110,7 +109,7 @@
}
],
unit:'',//
icon:''
icon:'https://img.agrimedia.cn/-_BMI-tuya.png'
},
bodyFatPercentage:{
name:"体脂率",
@ -141,7 +140,7 @@
}
],
unit:'%',//
icon:''
icon:'https://img.agrimedia.cn/%E4%BD%93%E8%84%82%E7%8E%871-tuya.png'
},
leanBodyMass:{
name:"去脂体重",
@ -167,7 +166,7 @@
],
unit:'千克',//
icon:''
icon:'https://img.agrimedia.cn/%E5%8E%BB%E8%84%82%E4%BD%93%E9%87%8D-tuya.png'
},
muscleRate:{
name:"肌肉率",
@ -193,7 +192,7 @@
],
unit:'%',//
icon:''
icon:'https://img.agrimedia.cn/Surgery-tuya.png'
},
muscleMass:{
name:"肌肉量",
@ -219,7 +218,7 @@
],
unit:'千克',//
icon:''
icon:'https://img.agrimedia.cn/watch-app/exercise-tuya.png'
},
subcutaneousFat:{
name:"皮下脂肪",
@ -245,7 +244,7 @@
],
unit:'%',//
icon:''
icon:'https://img.agrimedia.cn/008%E7%9A%AE%E4%B8%8B%E8%84%82%E8%82%AA-tuya.png'
},
bodyMoisture:{
name:"体内水分",
@ -271,7 +270,7 @@
],
unit:'%',//
icon:''
icon:'https://img.agrimedia.cn/watch-app/%E6%B0%B42-tuya.png'
},
skeletalMuscleRate:{
name:"骨骼肌",
@ -292,12 +291,12 @@
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-up-arrow"
icon_key:"icon-success"
},
],
unit:'%',//
icon:''
icon:'https://img.agrimedia.cn/watch-app/%E9%AA%A8%E9%AA%BC%E8%82%8C%E7%8E%87-tuya.png'
},
boneMass:{
name:"骨重",
@ -323,7 +322,7 @@
],
unit:'千克',//
icon:''
icon:'https://img.agrimedia.cn/%E9%AA%A8%E9%87%8D.png'
},
proteinAmount:{
name:"蛋白质",
@ -349,7 +348,7 @@
],
unit:'%',//
icon:''
icon:'https://img.agrimedia.cn/%E8%9B%8B%E7%99%BD%E8%B4%A8-tuya.png'
},
basalMetabolicRate:{
name:"基础代谢",
@ -369,14 +368,14 @@
],
unit:'千卡',//
icon:''
icon:'https://img.agrimedia.cn/%E5%9F%BA%E7%A1%80%E4%BB%A3%E8%B0%A2.png'
},
}
};
},
created() {
let val = this.getKeyInfo(this.value)
mounted() {
// let val = this.getKeyInfo(this.value)
// let body =this.$utils.getPwd('123456')
},
methods:{
look(){

View File

@ -1,20 +1,109 @@
<template>
<view>
<view class="">
<view class="flx flx_ac" style="background-color: #fff;padding: 30rpx 0 0 30rpx;">
<view class="">
<text class="iconfont icon-wode" :style="'font-size: 50rpx;margin-right:10rpx;color:'+bodyDesc.color "></text>
</view>
<view class="">
<text >{{bodyDesc.name}}</text>
</view>
</view>
<view class="" style="position: relative;">
<image src="../../static/image/body.png" style="width: 100%;" mode="widthFix"></image>
<view class="left_position postion ">
<view class="desc_box">
<view class="flx flx_ac">
<view class="tt">
{{ dataInfo.data_msg.basalMetabolicRate }}
</view>
<view class="unit" >
千卡
</view>
</view>
<view class="name">
基础代谢
</view>
</view>
<view class="desc_box">
<view class="flx flx_ac">
<view class="tt">
{{ dataInfo.data_msg.boneMass }}
</view>
<view class="unit" >
千克
</view>
</view>
<view class="name">
骨重
</view>
</view>
<view class="desc_box">
<view class="flx flx_ac">
<view class="tt">
{{ dataInfo.data_msg.waterContent }}
</view>
<view class="unit" >
千克
</view>
</view>
<view class="name">
水分
</view>
</view>
</view>
<view class="right_position postion">
<view class="desc_box">
<view class="flx flx_ac">
<view class="tt">
{{ dataInfo.data_msg.fatMass }}
</view>
<view class="unit" >
千克
</view>
</view>
<view class="name">
脂肪
</view>
</view>
<view class="desc_box" style="margin-bottom: 0;margin-top: 174rpx;">
<view class="flx flx_ac">
<view class="tt">
{{ dataInfo.data_msg.proteinAmount }}
</view>
<view class="unit" >
千克
</view>
</view>
<view class="name">
蛋白质
</view>
</view>
</view>
<view class="postion center_posion">
</view>
</view>
<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 class="" style="height: 40rpx;">
</view>
</view>
</view>
</template>
<script>
import { mapGetters } from "vuex";
export default {
data() {
return {
dataInfo:{},
bodyDesc:{},
arr:[
'BMI',
'bodyFatPercentage',
@ -47,14 +136,58 @@
}
const data = JSON.parse(get);
this.dataInfo = data;
uni.removeStorageSync(dataKey);
console.log(this.dataInfo)
// this.getUserInfo()
this.bodyDesc = this.$utils.getBodyKeyInfo(this.dataInfo.data_msg.BMI,'BMI')
// uni.removeStorageSync(dataKey);
},
computed: {
...mapGetters({
getActiceDevice: "api/getActiceDevice"
})
},
methods: {
getUserInfo(){
this.$store.dispatch('api/getUserInfo',{
device_id:this.getActiceDevice.device_id
}).then(res => {
})
}
}
}
</script>
<style>
<style lang="scss" scoped>
.postion{
position: absolute;
}
.left_position{
left: 40rpx;
top:12%
}
.right_position{
right: 40rpx;
top:15%
}
.center_posion{
width: 100%;
text-align: center;
}
.desc_box{
margin-bottom: 64rpx;
.tt{
font-size: 30rpx;
font-weight: bold;
margin-right: 10rpx;
}
.unit{
font-size: 24rpx;
color: #666;
}
.name{
font-size: 24rpx;
color: #999;
}
}
</style>

View File

@ -28,4 +28,6 @@
.icon-up-arrow:before {
content: "\e844";
}
.icon-wode:before {
content: "\e60b";
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
static/image/body.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -8,7 +8,8 @@ import {
getDeviceListDays,
getVersion,
getIndexData,
forgotPassword
forgotPassword,
getUserInfo
} from '@/common/api.js';
let state = {
@ -86,6 +87,10 @@ let state = {
const res = await forgotPassword(data)
return res
},
async getUserInfo({commit}, data) {
const res = await getUserInfo(data)
return res
},
}
export default {

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>智能终端</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/watchapp/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/watchapp/static/js/chunk-vendors.29a19873.js></script><script src=/watchapp/static/js/index.02b45117.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/watchapp/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/watchapp/static/js/chunk-vendors.48364482.js></script><script src=/watchapp/static/js/index.e47eef17.js></script></body></html>

View File

@ -0,0 +1,33 @@
@font-face {
font-family: "iconfont"; /* Project id 4645974 */
src: url('~@/static/icon-font/css/iconfont.woff2?t=1722997421621') format('woff2'),
url('~@/static/icon-font/css/iconfont.woff?t=1722997421621') format('woff'),
url('~@/static/icon-font/css/iconfont.ttf?t=1722997421621') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-down-arrow:before {
content: "\e839";
}
.icon-success:before {
content: "\e6d0";
}
.icon-right:before {
content: "\e649";
}
.icon-up-arrow:before {
content: "\e844";
}
.icon-wode:before {
content: "\e60b";
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -48,6 +48,342 @@ export const getPwd = (str) => {
return md5('bmsc-'+str)
}
export const getBodyInfoData = () => {
let bodyDataExample = {
BMI:{
name:"BMI",
tags:[
{
name:'偏瘦',
colorIdx:0,
val:18.5,
icon_key:'icon-down-arrow'
},
{
name:'完美',
colorIdx:1,
val:24,
icon_key:'icon-success'
},
{
name:'超重',
colorIdx:2,
val:28,
icon_key:"icon-up-arrow"
},
{
name:'肥胖',
colorIdx:3,
val:0,
icon_key:"icon-up-arrow"
}
],
unit:'',// 计量单位
icon:'https://img.agrimedia.cn/-_BMI-tuya.png'
},
bodyFatPercentage:{
name:"体脂率",
tags:[
{
name:'偏瘦',
colorIdx:0,
val:18,
icon_key:'icon-down-arrow'
},
{
name:'完美',
colorIdx:1,
val:23,
icon_key:'icon-success'
},
{
name:'超重',
colorIdx:2,
val:30,
icon_key:"icon-up-arrow"
},
{
name:'肥胖',
colorIdx:3,
val:0,
icon_key:"icon-up-arrow"
}
],
unit:'%',// 计量单位
icon:'https://img.agrimedia.cn/%E4%BD%93%E8%84%82%E7%8E%871-tuya.png'
},
leanBodyMass:{
name:"去脂体重",
tags:[
{
name:'低',
colorIdx:0,
val:45.8,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:55.9,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-success"
},
],
unit:'千克',// 计量单位
icon:'https://img.agrimedia.cn/%E5%8E%BB%E8%84%82%E4%BD%93%E9%87%8D-tuya.png'
},
muscleRate:{
name:"肌肉率",
tags:[
{
name:'低',
colorIdx:0,
val:68.1,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:84.8,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-success"
},
],
unit:'%',// 计量单位
icon:'https://img.agrimedia.cn/Surgery-tuya.png'
},
muscleMass:{
name:"肌肉量",
tags:[
{
name:'低',
colorIdx:0,
val:40.8,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:50.8,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-success"
},
],
unit:'千克',// 计量单位
icon:'https://img.agrimedia.cn/watch-app/exercise-tuya.png'
},
subcutaneousFat:{
name:"皮下脂肪",
tags:[
{
name:'低',
colorIdx:0,
val:8.6,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:16.7,
icon_key:'icon-success'
},
{
name:'高',
colorIdx:2,
val:0,
icon_key:"icon-up-arrow"
},
],
unit:'%',// 计量单位
icon:'https://img.agrimedia.cn/008%E7%9A%AE%E4%B8%8B%E8%84%82%E8%82%AA-tuya.png'
},
bodyMoisture:{
name:"体内水分",
tags:[
{
name:'低',
colorIdx:0,
val:53.4,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:66.6,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-up-arrow"
},
],
unit:'%',// 计量单位
icon:'https://img.agrimedia.cn/watch-app/%E6%B0%B42-tuya.png'
},
skeletalMuscleRate:{
name:"骨骼肌",
tags:[
{
name:'低',
colorIdx:0,
val:25,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:35,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-success"
},
],
unit:'%',// 计量单位
icon:'https://img.agrimedia.cn/watch-app/%E9%AA%A8%E9%AA%BC%E8%82%8C%E7%8E%87-tuya.png'
},
boneMass:{
name:"骨重",
tags:[
{
name:'低',
colorIdx:0,
val:2.9,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:3.7,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-up-arrow"
},
],
unit:'千克',// 计量单位
icon:'https://img.agrimedia.cn/%E9%AA%A8%E9%87%8D.png'
},
proteinAmount:{
name:"蛋白质",
tags:[
{
name:'低',
colorIdx:0,
val:14.1,
icon_key:'icon-down-arrow'
},
{
name:'标准',
colorIdx:1,
val:17.7,
icon_key:'icon-success'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-up-arrow"
},
],
unit:'%',// 计量单位
icon:'https://img.agrimedia.cn/%E8%9B%8B%E7%99%BD%E8%B4%A8-tuya.png'
},
basalMetabolicRate:{
name:"基础代谢",
tags:[
{
name:'低',
colorIdx:0,
val:1619,
icon_key:'icon-down-arrow'
},
{
name:'完美',
colorIdx:4,
val:0,
icon_key:"icon-success"
},
],
unit:'千卡',// 计量单位
icon:'https://img.agrimedia.cn/%E5%9F%BA%E7%A1%80%E4%BB%A3%E8%B0%A2.png'
},
}
return bodyDataExample;
}
export const getBodyKeyInfo = (val,key_name) => {
let colorArr = [
"#5990f5",
"#29ce70",
"#fcb041",
"#fa6820",
"#1da30f"
]
let back = {}
let data = getBodyInfoData()[key_name].tags
data.map((v,i) => {
if(i == 0){
if(val < v.val){
back = v
back.prev_val = 0
back.idx = i
back.color = colorArr[i]
back.margin = ((val / (v.val - 0)) * 100).toString() + '%'
}
}else{
if(val >= data[i-1].val && (val < v.val || v.val == 0)){
back = v
back.prev_val = data[i-1].val
back.idx = i
back.color = colorArr[i]
if(v.val == 0){
back.margin = '20%'
}else{
back.margin = (((val - data[i-1].val) / (v.val - data[i-1].val)) * 100).toString() + '%'
}
}
}
})
return back
}
export const makeSign = (obj,serverTime) => {
obj = JSON.parse(JSON.stringify(obj));
let app_key = 'm58c97';
@ -302,5 +638,7 @@ export default {
timestampToTime,
isDateTimeBetween,
areAllIdsEmpty,
getArrMaxValue
getArrMaxValue,
getBodyInfoData,
getBodyKeyInfo
}