This commit is contained in:
2026-06-15 15:06:12 +08:00
parent 91a802e9fa
commit 8e75882925
3 changed files with 15 additions and 3 deletions
+1
View File
@@ -100,6 +100,7 @@ const App = () => {
<Route path="credits" element={<CreditsPage />} /> <Route path="credits" element={<CreditsPage />} />
<Route path="credit-records" element={<UserCenterPage />} /> <Route path="credit-records" element={<UserCenterPage />} />
<Route path="order-records" element={<UserCenterPage />} /> <Route path="order-records" element={<UserCenterPage />} />
<Route path="user-center" element={<UserCenterPage />} />
<Route path="messages" element={<MessagesPage />} /> <Route path="messages" element={<MessagesPage />} />
<Route path="conversation" element={<GenerateConver />} /> <Route path="conversation" element={<GenerateConver />} />
<Route path="initial" element={<InitialReplication />} /> <Route path="initial" element={<InitialReplication />} />
@@ -281,8 +281,8 @@ const AppLayout: React.FC = () => {
else if (key === 'changePwd') { setPwdModalOpen(true); } else if (key === 'changePwd') { setPwdModalOpen(true); }
else if (key === 'messages') { navigate('/messages'); } else if (key === 'messages') { navigate('/messages'); }
else if (key === 'recharge') { setRechargeModalOpen(true); } else if (key === 'recharge') { setRechargeModalOpen(true); }
else if (key === 'myCredits') { navigate('/credit-records'); } else if (key === 'myCredits') { navigate('/user-center?tab=credits'); }
else if (key === 'orderRecords') { navigate('/order-records'); } else if (key === 'orderRecords') { navigate('/user-center?tab=orders'); }
}; };
const handleChangePwd = async () => { const handleChangePwd = async () => {
+12 -1
View File
@@ -1,11 +1,22 @@
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import { Tabs } from 'antd'; import { Tabs } from 'antd';
import { useSearchParams } from 'react-router-dom';
import CreditRecordsPage from './CreditRecordsPage'; import CreditRecordsPage from './CreditRecordsPage';
import OrderRecordsPage from './OrderRecordsPage'; import OrderRecordsPage from './OrderRecordsPage';
const UserCenterPage: React.FC = () => { const UserCenterPage: React.FC = () => {
const [searchParams] = useSearchParams();
const [activeTab, setActiveTab] = useState('credits'); const [activeTab, setActiveTab] = useState('credits');
useEffect(() => {
const tab = searchParams.get('tab') || 'credits';
if (tab === 'orders') {
setActiveTab('orders');
} else {
setActiveTab('credits');
}
}, [searchParams]);
const tabs = [ const tabs = [
{ {
key: 'credits', key: 'credits',