Commit 2d4b771a by 林磊

Merge branch 'feat_micro_build' into 'dev'

feat: 微前端项目打包构建配置修改

See merge request !10
2 parents aba1cf3b 642400f0
// 此文件由 auto-routes 插件自动生成,请勿手动编辑 // 此文件由 auto-routes 插件自动生成,请勿手动编辑
// 如需自定义路由,请在 vite.config.ts 中配置 customRules // 如需自定义路由,请在 vite.config.ts 中配置 customRules
// 生成时间: 2026/1/22 14:14:23 // 生成时间: 2026/1/23 10:58:16
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
...@@ -10,7 +10,7 @@ export const autoRoutes: RouteRecordRaw[] = [ ...@@ -10,7 +10,7 @@ export const autoRoutes: RouteRecordRaw[] = [
id: "assistant", id: "assistant",
title: "Assistant", title: "Assistant",
icon: "", icon: "",
level: 0, level: 1,
hidden: false, hidden: false,
meta: { meta: {
"authority": "assistant", "authority": "assistant",
...@@ -41,7 +41,7 @@ export const autoRoutes: RouteRecordRaw[] = [ ...@@ -41,7 +41,7 @@ export const autoRoutes: RouteRecordRaw[] = [
id: "manage-agentic", id: "manage-agentic",
title: "ManageAgentic", title: "ManageAgentic",
icon: "", icon: "",
level: 0, level: 1,
hidden: false, hidden: false,
meta: { meta: {
"authority": "manage-agentic", "authority": "manage-agentic",
...@@ -55,7 +55,7 @@ export const autoRoutes: RouteRecordRaw[] = [ ...@@ -55,7 +55,7 @@ export const autoRoutes: RouteRecordRaw[] = [
id: "manage-konw", id: "manage-konw",
title: "ManageKonw", title: "ManageKonw",
icon: "", icon: "",
level: 0, level: 1,
hidden: false, hidden: false,
meta: { meta: {
"authority": "manage-konw", "authority": "manage-konw",
......
import type { Router, RouteRecordRaw } from 'vue-router'; import type { Router, RouteRecordRaw, RouterOptions } from 'vue-router';
import { createRouter as _createRouter, createWebHistory } from 'vue-router'; import { createRouter as _createRouter, createWebHistory } from 'vue-router';
// 导入自动生成的路由 // 手动配置的路由
// 注意:使用动态导入以避免构建时错误 // 注意:auto-routes.ts 文件仅作为示例,不在项目中使用
let autoRoutes: RouteRecordRaw[] = []; const routes: RouteRecordRaw[] = [
{
// 使用同步方式导入(在构建时生成的文件) path: '/',
// 由于项目使用 ES 模块,这里使用条件导入 name: 'Home',
try { component: () => import('@/views/Home.vue'),
// @ts-ignore - 动态导入可能不存在,使用同步导入 meta: {
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires title: '首页',
const autoRoutesModule = require('./auto-routes');
autoRoutes = autoRoutesModule.autoRoutes || [];
} catch (error) {
// 如果自动生成的路由文件不存在,使用手动配置的路由
console.warn('[router] 自动路由文件不存在,使用手动配置的路由');
// 手动配置的路由(作为后备方案)
autoRoutes = [
{
path: '/',
name: 'Home',
component: () => import('@/views/Home.vue'),
meta: {
title: '首页',
},
},
{
path: '/managekonw',
name: 'ManageKonw',
component: () => import('@/views/ManageKonw/index.vue'),
meta: {
title: '知识管理',
},
}, },
{ },
path: '/assistant', {
name: 'Assistant', path: '/managekonw',
component: () => import('@/views/Assistant/index.vue'), name: 'ManageKonw',
meta: { component: () => import('@/views/ManageKonw/index.vue'),
title: '岗位助理配置', meta: {
}, title: '知识管理',
}, },
{ },
path: '/manageagentic', {
name: 'ManageAgentic', path: '/assistant',
component: () => import('@/views/ManageAgentic/index.vue'), name: 'Assistant',
meta: { component: () => import('@/views/Assistant/index.vue'),
title: '智能体管理', meta: {
}, title: '岗位助理配置',
}, },
{ },
path: '/assistant/add', {
name: 'AssistantAdd', path: '/manageagentic',
component: () => import('@/views/Assistant/addUpdate.vue'), name: 'ManageAgentic',
meta: { component: () => import('@/views/ManageAgentic/index.vue'),
title: '新增智能体', meta: {
}, title: '智能体管理',
}, },
{ },
path: '/assistant/edit/:id', {
name: 'AssistantEdit', path: '/assistant/add',
component: () => import('@/views/Assistant/addUpdate.vue'), name: 'AssistantAdd',
meta: { component: () => import('@/views/Assistant/addUpdate.vue'),
title: '编辑', meta: {
}, title: '新增智能体',
}, },
{ },
path: '/user', {
name: 'User', path: '/assistant/edit/:id',
component: () => import('@/views/User.vue'), name: 'AssistantEdit',
meta: { component: () => import('@/views/Assistant/addUpdate.vue'),
title: '用户管理', meta: {
}, title: '编辑',
}, },
{ },
path: '/settings', {
name: 'Settings', path: '/user',
component: () => import('@/views/Settings.vue'), name: 'User',
meta: { component: () => import('@/views/User.vue'),
title: '系统设置', meta: {
}, title: '用户管理',
}, },
{ },
path: '/communication', {
name: 'Communication', path: '/settings',
component: () => import('@/views/Communication.vue'), name: 'Settings',
meta: { component: () => import('@/views/Settings.vue'),
title: '通信示例', meta: {
}, title: '系统设置',
}, },
{ },
path: '/:pathMatch(.*)*', {
name: 'NotFound', path: '/communication',
component: () => import('@/views/NotFound.vue'), name: 'Communication',
component: () => import('@/views/Communication.vue'),
meta: {
title: '通信示例',
}, },
]; },
} {
path: '/:pathMatch(.*)*',
// 手动配置的路由(用于覆盖或补充自动生成的路由) name: 'NotFound',
// 手动配置的路由优先级更高,会覆盖自动生成的路由 component: () => import('@/views/NotFound.vue'),
const manualRoutes: RouteRecordRaw[] = [ },
// 可以在这里添加需要手动配置的特殊路由
// 例如:需要特殊权限、动态参数等的路由
// {
// path: '/custom',
// name: 'Custom',
// component: () => import('@/views/Custom.vue'),
// meta: {
// title: '自定义路由',
// },
// },
]; ];
// 合并路由:手动配置的路由优先 // 转换为 RouterOptions 需要的类型
const routes: RouteRecordRaw[] = [ const routerRoutes = routes as unknown as RouterOptions['routes'];
...manualRoutes,
...autoRoutes.filter(
(autoRoute) => !manualRoutes.some((manualRoute) => manualRoute.path === autoRoute.path)
),
];
/** /**
* 创建路由实例 * 创建路由实例
...@@ -129,7 +94,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -129,7 +94,7 @@ const routes: RouteRecordRaw[] = [
export function createRouter(base: string = '/'): Router { export function createRouter(base: string = '/'): Router {
const router = _createRouter({ const router = _createRouter({
history: createWebHistory(base), history: createWebHistory(base),
routes, routes: routerRoutes,
}); });
// 路由守卫 // 路由守卫
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
"include": [ "include": [
"env.d.ts", "env.d.ts",
"src/**/*.ts", "src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.vue", "src/**/*.vue",
"src/**/*.js" "src/**/*.js"
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
"include": [ "include": [
"env.d.ts", "env.d.ts",
"src/**/*.ts", "src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.vue", "src/**/*.vue",
"src/**/*.js" "src/**/*.js"
......
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"skipLibCheck": true "skipLibCheck": true
}, },
"include": ["vite.config.ts", "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] "include": ["vite.config.ts"]
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
}, },
"include": [ "include": [
"src/**/*.ts", "src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.vue", "src/**/*.vue",
"src/**/*.js" "src/**/*.js"
......
...@@ -27,5 +27,5 @@ ...@@ -27,5 +27,5 @@
"skipLibCheck": true "skipLibCheck": true
}, },
"references": [{ "path": "./tsconfig.node.json" }], "references": [{ "path": "./tsconfig.node.json" }],
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "env.d.ts"] "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "env.d.ts"]
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!