fix(frontend): 移除运行时演示数据并接入真实后端状态

This commit is contained in:
2026-09-04 07:47:05 +08:00
parent 2e496462a9
commit c04f4c1989
34 changed files with 332 additions and 869 deletions
+1 -67
View File
@@ -1,5 +1,5 @@
import apiClient from './apiClient'
import type { ApiTask, OperationResponse, PageMeta, TaskItem, TaskStatus, TaskPriority } from '@/contracts'
import type { ApiTask, OperationResponse, PageMeta, TaskItem, TaskStatus } from '@/contracts'
function toTask(task: ApiTask): TaskItem {
return {
@@ -7,10 +7,8 @@ function toTask(task: ApiTask): TaskItem {
title: task.title,
description: task.description,
status: task.status,
priority: 'medium',
due_date: task.due_at ?? undefined,
note_id: task.note_id ?? undefined,
source: 'user',
created_at: task.created_at,
updated_at: task.updated_at,
}
@@ -60,67 +58,3 @@ export async function updateTask(
export async function deleteTask(taskId: string): Promise<OperationResponse> {
return apiClient.delete(`/api/tasks/${taskId}`)
}
export const mockTasks: TaskItem[] = [
{
task_id: 't-1',
title: '完成红黑树章节复习',
description: '整理插入、删除操作的所有情况,准备期末复习',
status: 'todo',
priority: 'high',
due_date: '2026-08-30T23:59:00Z',
note_id: 'n-rbt',
note_title: '红黑树',
source: 'user',
created_at: '2026-08-20T10:00:00Z',
updated_at: '2026-08-25T14:30:00Z',
},
{
task_id: 't-2',
title: '理解死锁的银行家算法',
description: '推导银行家算法的安全性检查过程',
status: 'in_progress',
priority: 'medium',
note_id: 'n-deadlock',
note_title: '死锁',
source: 'agent',
created_at: '2026-08-22T09:00:00Z',
updated_at: '2026-08-24T16:00:00Z',
},
{
task_id: 't-3',
title: 'TCP 三次握手与四次挥手',
description: '',
status: 'done',
priority: 'high',
note_id: 'n-tcp',
note_title: 'TCP_IP',
source: 'user',
created_at: '2026-08-15T08:00:00Z',
updated_at: '2026-08-18T20:00:00Z',
},
{
task_id: 't-4',
title: 'HTTP 状态码整理',
description: '整理常见 HTTP 状态码及含义',
status: 'todo',
priority: 'low',
note_id: 'n-http',
note_title: 'HTTP协议',
source: 'note',
created_at: '2026-08-10T10:00:00Z',
updated_at: '2026-08-10T10:00:00Z',
},
{
task_id: 't-5',
title: '链表操作实现练习',
description: '实现单链表和双向链表的基本操作',
status: 'todo',
priority: 'medium',
note_id: 'n-slist',
note_title: '单链表',
source: 'agent',
created_at: '2026-08-23T11:00:00Z',
updated_at: '2026-08-23T11:00:00Z',
},
]