From d26274d89d377067c1e2648192cffbf89464b361 Mon Sep 17 00:00:00 2001
From: wsj <593216709@qq.com>
Date: Wed, 28 Oct 2026 23:34:32 +0800
Subject: [PATCH] feat: 拆包
---
src/router/routeConfig.tsx | 67 ++++++++++++++++++++++++++++-----
1 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/src/router/routeConfig.tsx b/src/router/routeConfig.tsx
index 5a5fb6e..226fa47 100644
--- a/src/router/routeConfig.tsx
+++ b/src/router/routeConfig.tsx
@@ -1,16 +1,29 @@
-import type { ReactNode } from 'react';
+import { lazy, type ReactNode } from 'react';
import {
+ ApartmentOutlined,
AppstoreOutlined,
+ AuditOutlined,
ContactsOutlined,
DashboardOutlined,
ProfileOutlined,
+ SafetyCertificateOutlined,
+ SafetyOutlined,
SettingOutlined,
TeamOutlined,
+ UnorderedListOutlined,
} from '@ant-design/icons';
-import Customers from '@/pages/business/customers';
-import Orders from '@/pages/business/orders';
-import Dashboard from '@/pages/dashboard';
-import Users from '@/pages/system/users';
+
+/**
+ * 页面组件统一按路由懒加载:首屏只加载布局与当前页面,
+ * 其余页面在切换菜单时按需加载,避免所有页面打进同一个入口 chunk。
+ */
+const Orders = lazy(() => import('@/pages/business/orders'));
+const CustomerList = lazy(() => import('@/pages/customers/list'));
+const Dashboard = lazy(() => import('@/pages/dashboard'));
+const AuditLogs = lazy(() => import('@/pages/platform/audit-logs'));
+const Departments = lazy(() => import('@/pages/system/departments'));
+const Roles = lazy(() => import('@/pages/system/roles'));
+const Users = lazy(() => import('@/pages/system/users'));
export interface AppRouteItem {
/** 完整路径,同时作为菜单 key */
@@ -35,15 +48,40 @@
element: <Dashboard />,
},
{
+ path: '/customers',
+ title: '客户管理',
+ icon: <ContactsOutlined />,
+ children: [
+ {
+ path: '/customers/list',
+ title: '客户列表',
+ icon: <UnorderedListOutlined />,
+ element: <CustomerList />,
+ },
+ ],
+ },
+ {
path: '/system',
- title: '系统管理',
- icon: <SettingOutlined />,
+ title: '用户与权限',
+ icon: <SafetyCertificateOutlined />,
children: [
{
path: '/system/users',
title: '用户管理',
icon: <TeamOutlined />,
element: <Users />,
+ },
+ {
+ path: '/system/roles',
+ title: '角色管理',
+ icon: <SafetyOutlined />,
+ element: <Roles />,
+ },
+ {
+ path: '/system/departments',
+ title: '部门管理',
+ icon: <ApartmentOutlined />,
+ element: <Departments />,
},
],
},
@@ -58,11 +96,18 @@
icon: <ProfileOutlined />,
element: <Orders />,
},
+ ],
+ },
+ {
+ path: '/platform',
+ title: '平台管理',
+ icon: <SettingOutlined />,
+ children: [
{
- path: '/business/customers',
- title: '客户管理',
- icon: <ContactsOutlined />,
- element: <Customers />,
+ path: '/platform/audit-logs',
+ title: '审计日志',
+ icon: <AuditOutlined />,
+ element: <AuditLogs />,
},
],
},
--
Gitblit v1.9.3