diff --git a/src/vitals/web/app.py b/src/vitals/web/app.py
index 3d5c79d..b39c13c 100644
--- a/src/vitals/web/app.py
+++ b/src/vitals/web/app.py
@@ -4758,6 +4758,17 @@ def get_exercise_page_html() -> str:
+
+
近 30 天运动时长趋势
@@ -4941,6 +4952,87 @@ def get_exercise_page_html() -> str:
}
}
+ async function loadBmiAnalysis() {
+ try {
+ const res = await fetch('/api/bmi/analysis');
+ const data = await res.json();
+ const container = document.getElementById('bmi-content');
+
+ if (!data.current_bmi) {
+ container.innerHTML = `
+
+
数据不足
+
请完善身高、体重信息以启用 BMI 分析
+
去设置
+
+ `;
+ return;
+ }
+
+ const statusColor = data.bmi_status?.color || '#94A3B8';
+ const bmiPercent = Math.min(Math.max((data.current_bmi - 15) / 20 * 100, 0), 100);
+
+ container.innerHTML = `
+
+
+
当前体重
+
${data.current_weight || '--'} kg
+
+
+
当前 BMI
+
${data.current_bmi || '--'}
+
+
+
BMI 状态
+
${data.bmi_status?.status || '--'}
+
(${data.bmi_status?.range || ''})
+
+
+
+
+
+
+
+
偏瘦 <18.5
+
正常
+
偏重
+
肥胖 >28
+
+
+
+
+
目标达成预估
+
+
目标体重: ${data.target_weight} kg
+
目标 BMI: ${data.target_bmi}
+
距离目标: ${data.weight_diff > 0 ? '-' : '+'}${Math.abs(data.weight_diff || 0)} kg
+
预估达成: ${data.estimated_days ? '约 ' + data.estimated_days + ' 天' : '数据不足'}
+
+ ${data.calculation_basis ? `
+
+ 计算依据: 近30天平均每日净消耗 ${data.calculation_basis.daily_deficit} 卡
+ (TDEE ${data.calculation_basis.tdee} - 摄入 ${data.calculation_basis.avg_intake} + 运动 ${data.calculation_basis.avg_exercise})
+
+ ` : ''}
+
+
+
+ 健康减重建议每周 0.5-1 kg
+
+ `;
+ } catch (e) {
+ console.error('加载 BMI 分析失败:', e);
+ document.getElementById('bmi-content').innerHTML = '
加载失败
';
+ }
+ }
+
async function loadExerciseList() {
try {
const res = await fetch('/api/exercises?days=30');
@@ -5027,6 +5119,7 @@ def get_exercise_page_html() -> str:
loadExerciseStats();
loadExerciseList();
loadTodaySteps();
+ loadBmiAnalysis();
async function loadTodaySteps() {
try {