feat(dc): Complete Phase 1 - Portal workbench page development

Summary:
- Implement DC module Portal page with 3 tool cards
- Create ToolCard component with decorative background and hover animations
- Implement TaskList component with table layout and progress bars
- Implement AssetLibrary component with tab switching and file cards
- Complete database verification (4 tables confirmed)
- Complete backend API verification (6 endpoints ready)
- Optimize UI to match prototype design (V2.html)

Frontend Components (~715 lines):
- components/ToolCard.tsx - Tool cards with animations
- components/TaskList.tsx - Recent tasks table view
- components/AssetLibrary.tsx - Data asset library with tabs
- hooks/useRecentTasks.ts - Task state management
- hooks/useAssets.ts - Asset state management
- pages/Portal.tsx - Main portal page
- types/portal.ts - TypeScript type definitions

Backend Verification:
- Backend API: 1495 lines code verified
- Database: dc_schema with 4 tables verified
- API endpoints: 6 endpoints tested (templates API works)

Documentation:
- Database verification report
- Backend API test report
- Phase 1 completion summary
- UI optimization report
- Development task checklist
- Development plan for Tool B

Status: Phase 1 completed (100%), ready for browser testing
Next: Phase 2 - Tool B Step 1 and 2 development
This commit is contained in:
2025-12-02 21:53:24 +08:00
parent f240aa9236
commit d4d33528c7
83 changed files with 21863 additions and 1601 deletions

View File

@@ -0,0 +1,74 @@
/**
* 全文复筛任务进度Hook
*
* 功能:
* 1. 轮询任务进度
* 2. 自动刷新
* 3. 错误处理
*/
import { useQuery } from '@tanstack/react-query';
import { aslApi } from '../api';
interface UseFulltextTaskOptions {
taskId: string;
enabled?: boolean;
refetchInterval?: number | false;
}
export function useFulltextTask({
taskId,
enabled = true,
refetchInterval,
}: UseFulltextTaskOptions) {
const {
data,
isLoading,
error,
refetch,
} = useQuery({
queryKey: ['fulltextTask', taskId],
queryFn: async () => {
const response = await aslApi.getFulltextTaskProgress(taskId);
return response.data;
},
enabled: enabled && !!taskId,
refetchInterval: refetchInterval !== undefined
? refetchInterval
: ((data) => {
// 默认行为任务进行中时每2秒轮询否则停止
if (!data?.data) return false;
const status = (data.data as any).status;
return status === 'processing' || status === 'pending' ? 2000 : false;
}),
retry: 1,
});
const task = data as any;
const isRunning = task?.status === 'processing' || task?.status === 'pending';
const isCompleted = task?.status === 'completed';
const isFailed = task?.status === 'failed';
const progress = task?.progress?.progressPercent || 0;
return {
task,
progress,
isRunning,
isCompleted,
isFailed,
isLoading,
error,
refetch,
};
}