From 8e7588292559c681e966c8a452813196a3effd46 Mon Sep 17 00:00:00 2001 From: wwwwwwwww <526125649@qq.com> Date: Mon, 15 Jun 2026 15:06:12 +0800 Subject: [PATCH] 1 --- video-gen-app/src/App.tsx | 1 + video-gen-app/src/components/Layout/AppLayout.tsx | 4 ++-- video-gen-app/src/pages/UserCenterPage.tsx | 13 ++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/video-gen-app/src/App.tsx b/video-gen-app/src/App.tsx index 88eea2d6..6c62ed35 100644 --- a/video-gen-app/src/App.tsx +++ b/video-gen-app/src/App.tsx @@ -100,6 +100,7 @@ const App = () => { } /> } /> } /> + } /> } /> } /> } /> diff --git a/video-gen-app/src/components/Layout/AppLayout.tsx b/video-gen-app/src/components/Layout/AppLayout.tsx index 3cbb0e74..dbb00dd4 100644 --- a/video-gen-app/src/components/Layout/AppLayout.tsx +++ b/video-gen-app/src/components/Layout/AppLayout.tsx @@ -281,8 +281,8 @@ const AppLayout: React.FC = () => { else if (key === 'changePwd') { setPwdModalOpen(true); } else if (key === 'messages') { navigate('/messages'); } else if (key === 'recharge') { setRechargeModalOpen(true); } - else if (key === 'myCredits') { navigate('/credit-records'); } - else if (key === 'orderRecords') { navigate('/order-records'); } + else if (key === 'myCredits') { navigate('/user-center?tab=credits'); } + else if (key === 'orderRecords') { navigate('/user-center?tab=orders'); } }; const handleChangePwd = async () => { diff --git a/video-gen-app/src/pages/UserCenterPage.tsx b/video-gen-app/src/pages/UserCenterPage.tsx index 91544ee1..221b2abc 100644 --- a/video-gen-app/src/pages/UserCenterPage.tsx +++ b/video-gen-app/src/pages/UserCenterPage.tsx @@ -1,11 +1,22 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { Tabs } from 'antd'; +import { useSearchParams } from 'react-router-dom'; import CreditRecordsPage from './CreditRecordsPage'; import OrderRecordsPage from './OrderRecordsPage'; const UserCenterPage: React.FC = () => { + const [searchParams] = useSearchParams(); const [activeTab, setActiveTab] = useState('credits'); + useEffect(() => { + const tab = searchParams.get('tab') || 'credits'; + if (tab === 'orders') { + setActiveTab('orders'); + } else { + setActiveTab('credits'); + } + }, [searchParams]); + const tabs = [ { key: 'credits',