feat: 新增任务管理功能及相关组件
- 将目标页面改为任务列表,支持任务的创建、完成和跳过功能 - 新增任务卡片和任务进度卡片组件,展示任务状态和进度 - 实现任务数据的获取和管理,集成Redux状态管理 - 更新API服务,支持任务相关的CRUD操作 - 编写任务管理功能实现文档,详细描述功能和组件架构
This commit is contained in:
@@ -177,4 +177,76 @@ export interface GoalDetailResponse extends Goal {
|
||||
export interface GoalListItem extends Goal {
|
||||
progressPercentage: number;
|
||||
daysRemaining?: number;
|
||||
}
|
||||
|
||||
// 任务相关类型定义
|
||||
|
||||
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'overdue' | 'skipped';
|
||||
|
||||
// 任务数据结构
|
||||
export interface Task {
|
||||
id: string;
|
||||
goalId: string;
|
||||
userId: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
startDate: string; // ISO date string
|
||||
endDate: string; // ISO date string
|
||||
targetCount: number;
|
||||
currentCount: number;
|
||||
status: TaskStatus;
|
||||
progressPercentage: number;
|
||||
completedAt?: string; // ISO datetime string
|
||||
notes?: string;
|
||||
metadata?: Record<string, any>;
|
||||
daysRemaining: number;
|
||||
isToday: boolean;
|
||||
goal?: {
|
||||
id: string;
|
||||
title: string;
|
||||
repeatType: RepeatType;
|
||||
frequency: number;
|
||||
category?: string;
|
||||
};
|
||||
}
|
||||
|
||||
// 获取任务列表的查询参数
|
||||
export interface GetTasksQuery {
|
||||
goalId?: string;
|
||||
status?: TaskStatus;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
}
|
||||
|
||||
// 完成任务的请求数据
|
||||
export interface CompleteTaskRequest {
|
||||
count?: number;
|
||||
notes?: string;
|
||||
completedAt?: string;
|
||||
}
|
||||
|
||||
// 跳过任务的请求数据
|
||||
export interface SkipTaskRequest {
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
// 任务统计信息
|
||||
export interface TaskStats {
|
||||
total: number;
|
||||
pending: number;
|
||||
inProgress: number;
|
||||
completed: number;
|
||||
overdue: number;
|
||||
skipped: number;
|
||||
totalProgress: number;
|
||||
todayTasks: number;
|
||||
weekTasks: number;
|
||||
monthTasks: number;
|
||||
}
|
||||
|
||||
// 任务列表项响应
|
||||
export interface TaskListItem extends Task {
|
||||
// 继承Task的所有属性
|
||||
}
|
||||
Reference in New Issue
Block a user