diff --git a/src/filters/filter.js b/src/filters/filter.js index a4d895d..2f977eb 100644 --- a/src/filters/filter.js +++ b/src/filters/filter.js @@ -46,15 +46,19 @@ export function calcBMI(height, weight) { const bmiObj = {}; // 计算 BMI 指数 const bmi = weight / (realHeight * realHeight); - bmiObj.bmi = bmi; + bmiObj.bmi = bmi.toFixed(1); if (bmi < 18.5) { bmiObj.result = '体重过轻'; + bmiObj.color = '#2ea7e0'; } else if (bmi >= 18.5 && bmi < 24.9) { bmiObj.result = '正常体重'; + bmiObj.color = '#189b3b'; } else if (bmi >= 25 && bmi < 29.9) { bmiObj.result = '超重'; + bmiObj.color = '#ff5f8b'; } else { - bmiObj.result = '肥胖'; + bmiObj.color = '#189b3b'; + bmiObj.result = '暂无数据'; } return bmiObj; } diff --git a/src/views/insight/index.vue b/src/views/insight/index.vue index 7dc94f4..ff9c419 100644 --- a/src/views/insight/index.vue +++ b/src/views/insight/index.vue @@ -64,8 +64,8 @@
{{ bmi.result }}