From f595e8dc78247aa27b95a7eb9b8f546d1ce1f3a5 Mon Sep 17 00:00:00 2001 From: Lrd <13001933075@sina.cn> Date: Mon, 8 Jun 2026 17:56:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=88=E6=9D=83=E7=AE=A1=E7=90=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B6=88=E8=80=97=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- video-gen-app/src/App.tsx | 8 -- video-gen-app/src/pages/AuthorizationPage.tsx | 128 +++++++++++++++++- video-gen-app/src/pages/RecordsPage.tsx | 3 - 4 files changed, 123 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 5df1b271..4887c932 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,4 @@ video-gen-api/dist/ # 忽略特定类型文件但保留目录 # *.pyc -# !dir/*.pyc \ No newline at end of file +# !dir/*.pycnode_modules/ diff --git a/video-gen-app/src/App.tsx b/video-gen-app/src/App.tsx index d1c13417..69b029a4 100644 --- a/video-gen-app/src/App.tsx +++ b/video-gen-app/src/App.tsx @@ -13,10 +13,6 @@ import InitialReplication from './pages/InitialReplication'; import RemoveLens from './pages/RemoveLens'; import GeneratedRecord from './pages/GeneratedRecord'; import AuthorizationPage from './pages/AuthorizationPage'; - - - - import { useAuthStore } from './store/useAuthStore'; const ProtectedRoute = ({ children }: { children: React.ReactNode }) => { @@ -96,10 +92,6 @@ const App = () => { } /> } /> - - - - } /> diff --git a/video-gen-app/src/pages/AuthorizationPage.tsx b/video-gen-app/src/pages/AuthorizationPage.tsx index 210be13b..17b2fcf0 100644 --- a/video-gen-app/src/pages/AuthorizationPage.tsx +++ b/video-gen-app/src/pages/AuthorizationPage.tsx @@ -1,14 +1,12 @@ import React, { useEffect, useState, useLayoutEffect, useRef, useCallback } from 'react'; -import { Button, Table, Checkbox, Tag, Space, message } from 'antd'; -import { PlusOutlined, CheckCircleOutlined, ClockCircleOutlined, CiCircleOutlined } from '@ant-design/icons'; - +import { Button, Table, Checkbox, Tag, Space, message, Modal } from 'antd'; +import { PlusOutlined, CheckCircleOutlined, ClockCircleOutlined, CiCircleOutlined, EyeOutlined, XOutlined } from '@ant-design/icons'; // 模拟授权数据 const mockAuthorizations = [ { id: '1867060028363785', status: 'active', description: '用户张三的API授权' }, { id: '1867059757929740', status: 'pending', description: '用户李四的API授权' }, { id: '1867059808785418', status: 'active', description: '用户王五的API授权' }, ]; - // 状态配置 const statusConfig = { active: { label: '已授权', color: 'green', icon: CheckCircleOutlined }, @@ -17,10 +15,27 @@ const statusConfig = { revoked: { label: '已撤销', color: 'gray', icon: CiCircleOutlined }, }; +// 模拟消耗记录数据 +const mockConsumptionRecords = [ + { id: 'C001', authorizationId: '1867060028363785', amount: 100, type: 'video', description: '视频生成消耗', createdAt: '2024-01-15 10:30:00' }, + { id: 'C002', authorizationId: '1867060028363785', amount: 50, type: 'audio', description: '音频转换消耗', createdAt: '2024-01-15 11:20:00' }, + { id: 'C003', authorizationId: '1867059808785418', amount: 200, type: 'video', description: '视频生成消耗', createdAt: '2024-01-14 14:45:00' }, + { id: 'C004', authorizationId: '1867060028363785', amount: 75, type: 'image', description: '图片处理消耗', createdAt: '2024-01-14 09:15:00' }, + { id: 'C005', authorizationId: '1867059757929740', amount: 150, type: 'video', description: '视频生成消耗', createdAt: '2024-01-13 16:00:00' }, +]; + +// 消耗类型配置 +const consumptionTypeConfig = { + video: { label: '视频生成', color: 'blue' }, + audio: { label: '音频转换', color: 'purple' }, + image: { label: '图片处理', color: 'green' }, +}; const AuthorizationPage: React.FC = () => { const [authorizations, setAuthorizations] = useState(mockAuthorizations); const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [loading, setLoading] = useState(false); + const [showConsumptionModal, setShowConsumptionModal] = useState(false); + const [consumptionRecords, setConsumptionRecords] = useState(mockConsumptionRecords); // 状态标签渲染 const renderStatus = (status: string) => { @@ -77,6 +92,26 @@ const AuthorizationPage: React.FC = () => { width: 140, render: (text: string) => renderStatus(text), }, + { + title: '操作', + dataIndex: 'operation', + key: 'operation', + width: 120, + render: (_: any, record: typeof mockAuthorizations[0]) => ( + + ), + } ]; // 处理点击授权按钮 @@ -85,7 +120,6 @@ const AuthorizationPage: React.FC = () => { message.warning('请先选择需要授权的记录'); return; } - setLoading(true); // 模拟授权操作 setTimeout(() => { @@ -107,6 +141,13 @@ const AuthorizationPage: React.FC = () => { key: item.id, })); + // 准备消耗记录表格数据(添加序号) + const consumptionTableData = consumptionRecords.map((item, index) => ({ + ...item, + index: index + 1, + key: item.id, + })); + return (
{/* 页面标题 */} @@ -118,7 +159,7 @@ const AuthorizationPage: React.FC = () => {
{/* 操作栏 */} -
+