From 992e9b2ecc19caad2d1a5c679b75998132aff288 Mon Sep 17 00:00:00 2001 From: "Logan.Li" Date: Fri, 26 Jun 2026 11:02:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BF=AE=E5=A4=8D=20SPA=20?= =?UTF-8?q?=E6=B7=B1=E9=93=BE=E7=9B=B4=E8=AE=BF=E7=99=BD=E5=B1=8F=EF=BC=88?= =?UTF-8?q?vite=20base=20=E6=94=B9=E4=B8=BA=E7=BB=9D=E5=AF=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - base: './' → '/',避免 /audit/terminal 等路径下 assets 404 - 审计页改为独立路由组件,支持 URL 直链 --- frontend/src/App.tsx | 12 +++++++----- frontend/vite.config.ts | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 4783582..e7d0fca 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -38,7 +38,9 @@ const ApprovalPermissionPage = lazy(() => import('@/pages/ApprovalPermissionPage const ApprovalWorkflowPage = lazy(() => import('@/pages/ApprovalWorkflowPage').then(m => ({ default: m.default }))); const ScriptManager = lazy(() => import('@/components/automation/ScriptManager').then(m => ({ default: m.ScriptManager }))); const SystemManager = lazy(() => import('@/components/system/SystemManager').then(m => ({ default: m.SystemManager }))); -const AuditPage = lazy(() => import('@/pages/AuditPage').then(m => ({ default: m.AuditPage }))); +const TerminalAuditTab = lazy(() => import('@/pages/TerminalAuditTab').then(m => ({ default: m.TerminalAuditTab }))); +const AuditOperationsTab = lazy(() => import('@/pages/AuditOperationsTab').then(m => ({ default: m.AuditOperationsTab }))); +const LoginLogsTab = lazy(() => import('@/pages/LoginLogsTab').then(m => ({ default: m.LoginLogsTab }))); const CredentialManager = lazy(() => import('@/components/deploy/CredentialManager').then(m => ({ default: m.default }))); const PipelineManager = lazy(() => import('@/components/deploy/PipelineManager').then(m => ({ default: m.PipelineManager }))); const DeployCredentials = lazy(() => import('@/components/deploy/DeployCredentials').then(m => ({ default: m.default }))); @@ -190,10 +192,10 @@ function App() { } /> } /> - {/* Audit */} - } /> - } /> - } /> + {/* Audit — 各 Tab 独立路由,支持 URL 直链 // Logan.Li */} + } /> + } /> + } /> {/* System */} } /> diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 6e0e89f..e59627b 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -5,7 +5,8 @@ import { inspectAttr } from 'kimi-plugin-inspect-react' // https://vite.dev/config/ export default defineConfig({ - base: './', + // 必须用绝对路径,否则 /audit/terminal 等深链会解析成 /audit/assets/... 导致白屏 // Logan.Li + base: '/', plugins: [inspectAttr(), react()], resolve: { alias: {