From d6b32620b749a773d69bc24c8273f7ce6307492a Mon Sep 17 00:00:00 2001 From: Lrd <13001933075@sina.cn> Date: Tue, 30 Jun 2026 09:49:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=88=E6=9D=83=E5=88=97=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4=E5=92=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E6=8E=88=E6=9D=83=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- video-gen-app/src/pages/AuthAccountPage.tsx | 14 +++- video-gen-app/src/pages/AuthorizationPage.tsx | 76 ++++++++++--------- video-gen-app/src/pages/ConsumePage.tsx | 2 +- 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/video-gen-app/src/pages/AuthAccountPage.tsx b/video-gen-app/src/pages/AuthAccountPage.tsx index f16d341e..d8f54640 100644 --- a/video-gen-app/src/pages/AuthAccountPage.tsx +++ b/video-gen-app/src/pages/AuthAccountPage.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react'; import { Button, Table, Modal, App, Input, Pagination, Typography, Space } from 'antd'; -import { LockOutlined } from '@ant-design/icons'; +import { LockOutlined, ArrowLeftOutlined } from '@ant-design/icons'; +import { useNavigate } from 'react-router-dom'; import { getOAuthAccountList, deleteOAuthAccount, getOpenTypeAll } from '../api'; const formatDateTime = (dateStr: string) => { @@ -25,6 +26,7 @@ interface AuthorizationData { } const AuthAccountPage: React.FC = () => { + const navigate = useNavigate(); const { message } = App.useApp(); const [authorizations, setAuthorizations] = useState([]); const [listLoading, setListLoading] = useState(false); @@ -213,6 +215,15 @@ const AuthAccountPage: React.FC = () => { }, ]; + const handleBack = () => { + const referrer = document.referrer; + if (referrer.includes(window.location.origin)) { + navigate(-1); + } else { + navigate('/authorization'); + } + }; + const tableData = authorizations.map((item, index) => ({ ...item, index: index + 1, @@ -222,6 +233,7 @@ const AuthAccountPage: React.FC = () => { return (
+
diff --git a/video-gen-app/src/pages/AuthorizationPage.tsx b/video-gen-app/src/pages/AuthorizationPage.tsx index 7e4cd962..89e49f94 100644 --- a/video-gen-app/src/pages/AuthorizationPage.tsx +++ b/video-gen-app/src/pages/AuthorizationPage.tsx @@ -154,6 +154,19 @@ const AuthorizationPage: React.FC = () => { } }; + const handleReauthorize = async (record: AuthorizationData) => { + try { + const response = await requestOAuth({ open_type: record.openType }); + if (response.authUrl) { + window.open(response.authUrl, '_blank'); + } else { + message.error('获取授权链接失败'); + } + } catch (error) { + message.error('重新授权失败'); + } + }; + const columns = [ { title: 'ID', @@ -162,13 +175,12 @@ const AuthorizationPage: React.FC = () => { }, { title: '授权账户ID', - dataIndex: 'advertiserId', - key: 'advertiserId', - width: 160, + dataIndex: 'accountId', + key: 'accountId', }, { title: '授权账户名称', - dataIndex: 'advertiserName', + dataIndex: 'accountName', key: 'accountName', }, { @@ -211,9 +223,10 @@ const AuthorizationPage: React.FC = () => { key: 'accountUsername', }, { - title: '授权应用ID', - dataIndex: 'appid', - key: 'appid', + title: '开户方式', + dataIndex: 'openType', + key: 'openType', + render: (text: number) => {openTypeMap[text] || text}, }, { title: '是否敏感物料授权', @@ -227,27 +240,9 @@ const AuthorizationPage: React.FC = () => { ), }, { - title: '开户方式', - dataIndex: 'openType', - key: 'openType', - render: (text: number) => {openTypeMap[text] || text}, - }, - { - title: '平台端口', - dataIndex: 'portType', - key: 'portType', - ellipsis: true, - render: (text: number) => {PORT_TYPE_MAP[text] || text}, - }, - { - title: '用户id', - dataIndex: 'userId', - key: 'userId', - }, - { - title: '创建时间', - dataIndex: 'createdAt', - key: 'createdAt', + title: '授权过期时间', + dataIndex: 'accessTokenExpired', + key: 'accessTokenExpired', width: 160, render: (text: string) => {formatDateTime(text)}, }, @@ -263,15 +258,24 @@ const AuthorizationPage: React.FC = () => { dataIndex: 'action', fixed: 'right' as const, key: 'action', - width: 140, + width: 190, render: (_: unknown, record) => ( - + <> + + + ), }, ]; diff --git a/video-gen-app/src/pages/ConsumePage.tsx b/video-gen-app/src/pages/ConsumePage.tsx index 2cff4a58..c01bdd13 100644 --- a/video-gen-app/src/pages/ConsumePage.tsx +++ b/video-gen-app/src/pages/ConsumePage.tsx @@ -92,7 +92,7 @@ const ConsumePage: React.FC = () => { if (referrer.includes(window.location.origin)) { navigate(-1); } else { - navigate('/authorization'); + navigate('/materials'); } };