refactor(sleep): 重构睡眠数据获取逻辑,移除冗余代码并优化组件结构

- 从 healthSlice 和 health.ts 中移除 sleepDuration 字段及相关获取逻辑
- 将 SleepCard 改为按需异步获取睡眠数据,支持传入指定日期
- 睡眠详情页改为通过路由参数接收日期,支持查看历史记录
- 移除 statistics 页面对 sleepDuration 的直接依赖,统一由 SleepCard 管理
- 删除未使用的 SleepStageChart 组件,简化页面结构
This commit is contained in:
richarjiang
2025-09-11 09:08:51 +08:00
parent aee87e8900
commit 62690ee3fc
5 changed files with 43 additions and 181 deletions

View File

@@ -1,6 +1,6 @@
import { HourlyStepData } from '@/utils/health';
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { AppDispatch, RootState } from './index';
import { HourlyStepData } from '@/utils/health';
// 健康数据类型定义
export interface FitnessRingsData {
@@ -16,7 +16,6 @@ export interface HealthData {
steps: number | null;
activeCalories: number | null;
basalEnergyBurned: number | null;
sleepDuration: number | null;
hrv: number | null;
oxygenSaturation: number | null;
heartRate: number | null;