外包风险评估系统:领域引擎+前端+服务端持久化与生产部署
- 确定性领域引擎(分类/评分/分级/红线/费用/裁决)+LLM(通义千问)语言理解 - 6步评估向导、服务端草稿持久化(跨设备/编辑草稿保护) - 工作流(草稿→风控→管理层)、RBAC、报告导出、校准、客户/费率/红线/最低工资管理 - 专业图标体系替换全部emoji、看板美化 - 生产化:API_BASE可配置(同源反代)、auth密钥惰性读取修复RBAC - 444单测+204前端测试+51 e2e
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 应用根组件:BrowserRouter + 登录/路由守卫 + AppShell 布局壳 + 页面路由。
|
||||
*/
|
||||
import { BrowserRouter, Routes, Route, Navigate, Outlet } from 'react-router-dom';
|
||||
import { useAuthStore } from './stores/authStore.js';
|
||||
import { AppShell } from './app/AppShell.js';
|
||||
import { Dashboard } from './pages/Dashboard.js';
|
||||
import { NewAssessment } from './pages/NewAssessment.js';
|
||||
import { AssessmentDetail } from './pages/AssessmentDetail.js';
|
||||
import { Login } from './pages/Login.js';
|
||||
import { RateManagement } from './pages/RateManagement.js';
|
||||
import { RedlineManagement } from './pages/RedlineManagement.js';
|
||||
import { CustomerManagement } from './pages/CustomerManagement.js';
|
||||
|
||||
/** 路由守卫:未登录重定向到登录页。 */
|
||||
function ProtectedRoute(): JSX.Element {
|
||||
const { isAuthenticated } = useAuthStore();
|
||||
return isAuthenticated ? <Outlet /> : <Navigate to="/login" replace />;
|
||||
}
|
||||
|
||||
/** 角色守卫:当前角色不在允许列表时重定向回首页。 */
|
||||
function RoleRoute({ allow }: { readonly allow: readonly string[] }): JSX.Element {
|
||||
const { user } = useAuthStore();
|
||||
const role = user?.role ?? '';
|
||||
return allow.includes(role) ? <Outlet /> : <Navigate to="/" replace />;
|
||||
}
|
||||
|
||||
export function App(): JSX.Element {
|
||||
return (
|
||||
<BrowserRouter
|
||||
future={{
|
||||
v7_startTransition: true,
|
||||
v7_relativeSplatPath: true,
|
||||
}}
|
||||
>
|
||||
<Routes>
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route element={<ProtectedRoute />}>
|
||||
<Route element={<AppShell />}>
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
<Route path="/new" element={<NewAssessment />} />
|
||||
<Route path="/assessments/:id" element={<AssessmentDetail />} />
|
||||
{/* 费率/红线管理:仅管理层 */}
|
||||
<Route element={<RoleRoute allow={['管理层']} />}>
|
||||
<Route path="/rates" element={<RateManagement />} />
|
||||
<Route path="/redlines" element={<RedlineManagement />} />
|
||||
</Route>
|
||||
{/* 客户档案:销售 + 管理层 */}
|
||||
<Route element={<RoleRoute allow={['商务/销售', '管理层']} />}>
|
||||
<Route path="/customers" element={<CustomerManagement />} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user