From fd55cf30a4e94ed399369b489dea6c410ca5670f Mon Sep 17 00:00:00 2001 From: yml Date: Thu, 26 Nov 2026 19:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96(=E6=96=97=E9=B1=BC=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0):=20=E5=90=88=E5=B9=B6=E4=B8=89=E4=B8=AA?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E5=85=A5=E5=8F=A3=E5=B9=B6=E8=AE=B0?= =?UTF-8?q?=E4=BD=8F=E9=A1=B5=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增斗鱼总工作台,统一精英宝典、电竞手册、和平小店三个页签;持久化上次选择并兼容旧路由跳转。 --- web/frontend/src/App.tsx | 12 +- web/frontend/src/layouts/MainLayout.tsx | 6 +- web/frontend/src/pages/DouyuTasksPage.tsx | 2 - web/frontend/src/pages/DouyuWorkbenchPage.tsx | 140 ++++++++++++++++++ .../src/pages/douyu-tasks/DouyuTasksPage.tsx | 10 +- 5 files changed, 157 insertions(+), 13 deletions(-) delete mode 100644 web/frontend/src/pages/DouyuTasksPage.tsx create mode 100644 web/frontend/src/pages/DouyuWorkbenchPage.tsx diff --git a/web/frontend/src/App.tsx b/web/frontend/src/App.tsx index 6cc1ab8..7c61d3b 100644 --- a/web/frontend/src/App.tsx +++ b/web/frontend/src/App.tsx @@ -20,7 +20,7 @@ const PlatformFulfillmentPage = lazy(() => import('./pages/PlatformFulfillmentPa const AutomationPage = lazy(() => import('./pages/AutomationPage')); const UsersPage = lazy(() => import('./pages/UsersPage')); const CookiePage = lazy(() => import('./pages/CookiePage')); -const DouyuTasksPage = lazy(() => import('./pages/DouyuTasksPage')); +const DouyuWorkbenchPage = lazy(() => import('./pages/DouyuWorkbenchPage')); const DouyuCollabPage = lazy(() => import('./pages/DouyuCollabPage')); const HuyaAccountsPage = lazy(() => import('./pages/HuyaAccountsPage')); const HuyaAssignmentsPage = lazy(() => import('./pages/HuyaAssignmentsPage')); @@ -93,10 +93,12 @@ function AppContent() { )} /> )} /> )} /> - } /> - )} /> - )} /> - )} /> + } /> + } /> + )} /> + } /> + } /> + } /> )} /> )} /> )} /> diff --git a/web/frontend/src/layouts/MainLayout.tsx b/web/frontend/src/layouts/MainLayout.tsx index 5637c13..ba1b529 100644 --- a/web/frontend/src/layouts/MainLayout.tsx +++ b/web/frontend/src/layouts/MainLayout.tsx @@ -6,7 +6,7 @@ import { CloudServerOutlined, TeamOutlined, ApiOutlined, KeyOutlined, MenuFoldOutlined, MenuUnfoldOutlined, SwapOutlined, SunOutlined, MoonOutlined, DesktopOutlined, GiftOutlined, ApartmentOutlined, MobileOutlined, ShoppingCartOutlined, - BookOutlined, TrophyOutlined, ShopOutlined, GlobalOutlined, + BookOutlined, GlobalOutlined, SafetyCertificateOutlined, FileSearchOutlined, RobotOutlined, FileExcelOutlined, ThunderboltOutlined, } from '@ant-design/icons'; import { useNavigate, useLocation, Outlet } from 'react-router-dom'; @@ -78,9 +78,7 @@ export default function MainLayout({ onLogout }: { onLogout?: () => void }) { douyuItems.push({ key: '/automation', label: '斗鱼自动化', icon: }); } if (can('douyu:task')) { - douyuItems.push({ key: '/douyu/elite', label: '精英宝典', icon: }); - douyuItems.push({ key: '/douyu/esports', label: '电竞手册', icon: }); - douyuItems.push({ key: '/douyu/peace', label: '和平小店', icon: }); + douyuItems.push({ key: '/douyu/workbench', label: '斗鱼总工作台', icon: }); } // 外部单协作:权限独立,客服没有 douyu:task 也要能进共享台账。 diff --git a/web/frontend/src/pages/DouyuTasksPage.tsx b/web/frontend/src/pages/DouyuTasksPage.tsx deleted file mode 100644 index 5d4502d..0000000 --- a/web/frontend/src/pages/DouyuTasksPage.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from './douyu-tasks/DouyuTasksPage'; -export type { HandbookKind } from './douyu-tasks/config'; diff --git a/web/frontend/src/pages/DouyuWorkbenchPage.tsx b/web/frontend/src/pages/DouyuWorkbenchPage.tsx new file mode 100644 index 0000000..f22625e --- /dev/null +++ b/web/frontend/src/pages/DouyuWorkbenchPage.tsx @@ -0,0 +1,140 @@ +import { useEffect } from 'react'; +import { Tabs, Typography } from 'antd'; +import { + BookOutlined, + ShopOutlined, + TrophyOutlined, +} from '@ant-design/icons'; +import { useSearchParams } from 'react-router-dom'; + +import DouyuTasksPage from './douyu-tasks/DouyuTasksPage'; +import type { HandbookKind } from './douyu-tasks/config'; + +const { Text } = Typography; + +const ACTIVE_HANDBOOK_STORAGE_KEY = 'douyu_workbench_active_handbook'; +const DEFAULT_HANDBOOK: HandbookKind = 'elite'; + +const WORKBENCH_TABS: Array<{ + key: HandbookKind; + label: React.ReactNode; +}> = [ + { + key: 'elite', + label: ( + <> + + 精英宝典 + + ), + }, + { + key: 'esports', + label: ( + <> + + 电竞手册 + + ), + }, + { + key: 'peace', + label: ( + <> + + 和平小店 + + ), + }, +]; + +function normalizeHandbook(value: string | null): HandbookKind | null { + if (value === 'elite' || value === 'esports' || value === 'peace') { + return value; + } + return null; +} + +function readStoredHandbook(): HandbookKind { + try { + return normalizeHandbook(localStorage.getItem(ACTIVE_HANDBOOK_STORAGE_KEY)) + || DEFAULT_HANDBOOK; + } catch { + return DEFAULT_HANDBOOK; + } +} + +export default function DouyuWorkbenchPage() { + const [searchParams, setSearchParams] = useSearchParams(); + const activeHandbook = + normalizeHandbook(searchParams.get('tab')) || readStoredHandbook(); + + useEffect(() => { + try { + localStorage.setItem(ACTIVE_HANDBOOK_STORAGE_KEY, activeHandbook); + } catch { + // 隐私模式下仍允许本次页面内切换。 + } + }, [activeHandbook]); + + const changeHandbook = (key: string) => { + const next = normalizeHandbook(key); + if (!next) return; + const params = new URLSearchParams(searchParams); + params.set('tab', next); + setSearchParams(params, { replace: true }); + }; + + return ( +
+ +
+

斗鱼总工作台

+ 统一处理精英宝典、电竞手册与和平小店任务 +
+ ({ + key: tab.key, + label: tab.label, + children: , + }))} + /> +
+ ); +} diff --git a/web/frontend/src/pages/douyu-tasks/DouyuTasksPage.tsx b/web/frontend/src/pages/douyu-tasks/DouyuTasksPage.tsx index aa982cd..85db3de 100644 --- a/web/frontend/src/pages/douyu-tasks/DouyuTasksPage.tsx +++ b/web/frontend/src/pages/douyu-tasks/DouyuTasksPage.tsx @@ -196,7 +196,13 @@ function BindStatusTag({ status, label }: { status?: string; label?: string }) { return {label || status}; } -export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind }) { +export default function DouyuTasksPage({ + handbook, + showTitle = true, +}: { + handbook: HandbookKind; + showTitle?: boolean; +}) { const isPeaceHandbook = handbook === 'peace'; const isEsportsHandbook = handbook === 'esports'; const isEliteHandbook = handbook === 'elite'; @@ -2914,7 +2920,7 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind }) {/* 头部 */}
-

{handbookTitle}

+ {showTitle ?

{handbookTitle}

: null} {handbookDescription}