feat: 更新训练计划和打卡功能
- 在训练计划中新增训练项目的添加、更新和删除功能,支持用户灵活管理训练内容 - 优化训练计划排课界面,提升用户体验 - 更新打卡功能,支持按日期加载和展示打卡记录 - 删除不再使用的打卡相关页面,简化代码结构 - 新增今日训练页面,集成今日训练计划和动作展示 - 更新样式以适应新功能的展示和交互
This commit is contained in:
@@ -1,31 +1,48 @@
|
||||
import { api } from '@/services/api';
|
||||
|
||||
export type ExerciseCategoryDto = {
|
||||
// 与后端保持一致的数据结构定义
|
||||
export interface ExerciseLibraryItem {
|
||||
key: string;
|
||||
name: string;
|
||||
sortOrder: number;
|
||||
};
|
||||
description?: string;
|
||||
category: string; // 中文分类名(显示用)
|
||||
targetMuscleGroups: string;
|
||||
equipmentName?: string;
|
||||
beginnerReps?: number;
|
||||
beginnerSets?: number;
|
||||
breathingCycles?: number;
|
||||
holdDuration?: number;
|
||||
specialInstructions?: string;
|
||||
}
|
||||
|
||||
export type ExerciseDto = {
|
||||
export interface ExerciseCategoryDto {
|
||||
key: string; // 英文 key
|
||||
name: string; // 中文名
|
||||
type: 'mat_pilates' | 'equipment_pilates';
|
||||
equipmentName?: string;
|
||||
sortOrder?: number;
|
||||
}
|
||||
|
||||
export interface ExerciseDto {
|
||||
key: string;
|
||||
name: string;
|
||||
description: string;
|
||||
description?: string;
|
||||
categoryKey: string;
|
||||
categoryName: string;
|
||||
sortOrder: number;
|
||||
};
|
||||
targetMuscleGroups: string;
|
||||
equipmentName?: string;
|
||||
beginnerReps?: number;
|
||||
beginnerSets?: number;
|
||||
breathingCycles?: number;
|
||||
holdDuration?: number;
|
||||
specialInstructions?: string;
|
||||
sortOrder?: number;
|
||||
}
|
||||
|
||||
export type ExerciseConfigResponse = {
|
||||
export interface ExerciseConfigResponse {
|
||||
categories: ExerciseCategoryDto[];
|
||||
exercises: ExerciseDto[];
|
||||
};
|
||||
|
||||
export type ExerciseLibraryItem = {
|
||||
key: string;
|
||||
name: string;
|
||||
description: string;
|
||||
category: string; // display name
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchExerciseConfig(): Promise<ExerciseConfigResponse> {
|
||||
return await api.get<ExerciseConfigResponse>('/exercises/config');
|
||||
@@ -38,7 +55,13 @@ export function normalizeToLibraryItems(resp: ExerciseConfigResponse | null | un
|
||||
name: e.name,
|
||||
description: e.description,
|
||||
category: e.categoryName || e.categoryKey,
|
||||
targetMuscleGroups: e.targetMuscleGroups,
|
||||
equipmentName: e.equipmentName,
|
||||
beginnerReps: e.beginnerReps,
|
||||
beginnerSets: e.beginnerSets,
|
||||
breathingCycles: e.breathingCycles,
|
||||
holdDuration: e.holdDuration,
|
||||
specialInstructions: e.specialInstructions,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user