From 9b7f68b86fae2807084ce00d4b4b887b2a3d95bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=B7=E8=BE=89?= Date: Fri, 27 Jun 2025 17:56:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 5 +- src/api/services/DefaultService.ts | 4 +- src/pages/ModelPage/index.tsx | 73 +++----------------- src/pages/TasksPage/index.tsx | 106 +++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 65 deletions(-) create mode 100644 src/pages/TasksPage/index.tsx 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;