diff --git a/src/App.tsx b/src/App.tsx index 6628c7c..d5d3ebf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,12 +1,14 @@ import { ConfirmDialog } from '@/components/block/confirm-dialog'; import { Sidebar, SidebarContent, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from '@/components/ui/sidebar'; -import { Home, Users } from 'lucide-react'; +import { Home, List, Users } from 'lucide-react'; import { Link, Route, Routes, useLocation } from 'react-router-dom'; import ModelPage from './pages/ModelPage'; import TryOnPage from './pages/TryOnPage'; +import TasksPage from './pages/TasksPage'; const menu = [ { path: '/', label: '首页', icon: }, + { path: '/tasks', label: '任务列表', icon: }, { path: '/models', label: '模特维护', icon: }, ]; @@ -36,6 +38,7 @@ function App() { } /> } /> + } /> diff --git a/src/api/services/DefaultService.ts b/src/api/services/DefaultService.ts index 7f23f1e..64886e3 100644 --- a/src/api/services/DefaultService.ts +++ b/src/api/services/DefaultService.ts @@ -227,13 +227,13 @@ export class DefaultService { * @returns PaginationResponse Successful Response * @throws ApiError */ - public static getImageDataListApiImageDataListGet({ + public static getImageDataListApiImageDataListPost({ requestBody, }: { requestBody: VideoDataPaginationRequest, }): CancelablePromise { return __request(OpenAPI, { - method: 'GET', + method: 'POST', url: '/api/image/data/list', body: requestBody, mediaType: 'application/json', diff --git a/src/pages/ModelPage/index.tsx b/src/pages/ModelPage/index.tsx index f1626cb..b217849 100644 --- a/src/pages/ModelPage/index.tsx +++ b/src/pages/ModelPage/index.tsx @@ -75,75 +75,24 @@ const ModelPage: React.FC = () => {

模特维护

-
+
{models.map(item => ( -
-
- cover - - {item.status === 1 ? '启用' : '禁用'} - -
+
+ cover
-
ID: {item.id}
-
- 标签: - {Object.values(item.tag).map((t, i) => ( - - {t} - - ))} +
ID: {item.id}
+
标签: {Object.values(item.tag).join('_')}
+
+ 状态: {item.status === 1 ? '启用' : '禁用'}
-
创建时间: {item.create_time}
+
创建时间: {item.create_time}
-
- -
diff --git a/src/pages/TasksPage/index.tsx b/src/pages/TasksPage/index.tsx new file mode 100644 index 0000000..4d75b63 --- /dev/null +++ b/src/pages/TasksPage/index.tsx @@ -0,0 +1,106 @@ +import React, { useCallback, useEffect, useState } from 'react'; +import { useApi } from '@/hooks/useApi'; +import { api } from '@/lib/api'; +import type { VideoDataPaginationRequest } from '@/api/models/VideoDataPaginationRequest'; +import type { PaginationResponse } from '@/api/models/PaginationResponse'; +import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell } from '@/components/ui/table'; +import { Button } from '@/components/ui/button'; +import { Skeleton } from '@/components/ui/skeleton'; +import { Dialog, DialogContent } from '@/components/ui/dialog'; + +const PAGE_SIZE = 10; + +const TasksPage: React.FC = () => { + const [page, setPage] = useState(1); + const [previewImg, setPreviewImg] = useState(null); + const [dialogOpen, setDialogOpen] = useState(false); + + const r = useCallback(async (params: VideoDataPaginationRequest) => { + const res = await api.DefaultService.getImageDataListApiImageDataListPost({ requestBody: params }); + return res; + }, []); + + const { data, loading, error, execute } = useApi(r, null); + + useEffect(() => { + execute({ page, page_size: PAGE_SIZE }); + }, [page, execute]); + + const handlePrev = () => setPage(p => Math.max(1, p - 1)); + const handleNext = () => setPage(p => p + 1); + + return ( +
+ {/* 图片预览 Dialog */} + + + {previewImg && 预览图片} + + +

任务列表

+ {loading ? ( + + ) : error ? ( +
{error}
+ ) : ( + + + + 图片 + ID + 任务ID + 图片状态 + 视频状态 + 创建时间 + + + + {data?.data?.length ? ( + data.data.map(item => ( + + + {item.img_url ? ( + img { + setPreviewImg(item.img_url!); + setDialogOpen(true); + }} + /> + ) : ( + + )} + + {item.id} + {item.task_id} + {item.img_status || '-'} + {item.video_status || '-'} + {item.create_time || '-'} + + )) + ) : ( + + + 暂无数据 + + + )} + +
+ )} +
+ + 第 {page} 页 + +
+
+ ); +}; + +export default TasksPage;