From c7b2ad1e796c9af963a2808b09df7ef17ab7f328 Mon Sep 17 00:00:00 2001 From: lzh Date: Fri, 17 Apr 2026 09:14:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=EF=BC=9A=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E5=B1=82=E5=AF=B9=E6=8E=A5=E8=8A=8B=E9=81=93=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - vite.config.mts: 移除 /admin-api/system/* 5 条转发至 8000 的规则, system/infra 等基础接口回归兜底 /admin-api → 48080; 保留 AIoT 业务必需的代理(/admin-api/aiot/*、/uploads、/captures) - store/auth.ts: 移除 hideMenuItems/renameMenuItems 菜单后处理, 恢复 accessStore.setAccessMenus 直接写入后端原始菜单 - .env: VITE_APP_TITLE / VITE_APP_TENANT_ENABLE / VITE_APP_API_ENCRYPT_ENABLE 三项恢复 upstream 默认值(芋道管理系统 / true / true) 保留项(AIoT 业务):/work-order 公开路由、AIoT API & 视图、 WVP 代理规则、packages/@core/preferences 默认主题 Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web-antd/.env | 6 ++--- apps/web-antd/src/store/auth.ts | 40 ++------------------------------- apps/web-antd/vite.config.mts | 33 +++------------------------ 3 files changed, 8 insertions(+), 71 deletions(-) diff --git a/apps/web-antd/.env b/apps/web-antd/.env index dca9fe050..a0bfde11e 100644 --- a/apps/web-antd/.env +++ b/apps/web-antd/.env @@ -1,5 +1,5 @@ # 应用标题 -VITE_APP_TITLE=摄像头管理系统 +VITE_APP_TITLE=芋道管理系统 # 应用命名空间,用于缓存、store等功能的前缀,确保隔离 VITE_APP_NAMESPACE=yudao-vben-antd @@ -11,7 +11,7 @@ VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key VITE_NITRO_MOCK=false # 租户开关 -VITE_APP_TENANT_ENABLE=false +VITE_APP_TENANT_ENABLE=true # 验证码的开关 VITE_APP_CAPTCHA_ENABLE=false @@ -26,7 +26,7 @@ VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093 VITE_GOVIEW_URL='http://127.0.0.1:3000' # API 加解密 -VITE_APP_API_ENCRYPT_ENABLE = false +VITE_APP_API_ENCRYPT_ENABLE = true VITE_APP_API_ENCRYPT_HEADER = X-Api-Encrypt VITE_APP_API_ENCRYPT_ALGORITHM = AES VITE_APP_API_ENCRYPT_REQUEST_KEY = 52549111389893486934626385991395 diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index 9cf7883e4..dcef71175 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -137,48 +137,12 @@ export const useAuthStore = defineStore('auth', () => { // userStore userStore.setUserInfo(authPermissionInfo.user); userStore.setUserRoles(authPermissionInfo.roles); - // accessStore - 隐藏不需要的菜单项 + 重命名菜单 - const processedMenus = renameMenuItems(hideMenuItems(authPermissionInfo.menus)); - accessStore.setAccessMenus(processedMenus); + // accessStore + accessStore.setAccessMenus(authPermissionInfo.menus); accessStore.setAccessCodes(authPermissionInfo.permissions); return authPermissionInfo; } - /** 递归标记菜单为隐藏(visible=false),保留路由可直接访问 */ - function hideMenuItems(menus: any[]): any[] { - // 需要从侧边栏隐藏的菜单路径(ROI 区域配置已整合到摄像头管理中) - const hiddenPaths = new Set(['roi']); - const hiddenNameKeywords = ['ROI', 'roi']; - return menus.map((menu) => { - const shouldHide = - hiddenPaths.has(menu.path) || - (menu.name && - hiddenNameKeywords.some((kw: string) => menu.name.includes(kw))); - return { - ...menu, - visible: shouldHide ? false : menu.visible, - children: menu.children ? hideMenuItems(menu.children) : menu.children, - }; - }); - } - - /** 递归重命名菜单项 */ - function renameMenuItems(menus: any[]): any[] { - const renameMap: Record = { - '摄像头告警汇总': '告警看板', - '告警汇总': '告警看板', - }; - return menus.map((menu) => { - const newName = menu.name && renameMap[menu.name]; - return { - ...menu, - name: newName || menu.name, - meta: newName && menu.meta ? { ...menu.meta, title: newName } : menu.meta, - children: menu.children ? renameMenuItems(menu.children) : menu.children, - }; - }); - } - function $reset() { loginLoading.value = false; } diff --git a/apps/web-antd/vite.config.mts b/apps/web-antd/vite.config.mts index 14e5a9076..8a768c7a8 100644 --- a/apps/web-antd/vite.config.mts +++ b/apps/web-antd/vite.config.mts @@ -69,39 +69,12 @@ export default defineConfig(async () => { path.replace('/admin-api/aiot/device', '/api/ai'), }, - // ==================== 系统基础路由 ==================== - - // 认证相关接口 -> 告警平台(测试阶段提供模拟认证) - '/admin-api/system/auth': { - changeOrigin: true, - target: 'http://127.0.0.1:8000', - ws: true, - }, - // 租户相关接口 -> 告警平台(测试阶段返回默认值) - '/admin-api/system/tenant': { - changeOrigin: true, - target: 'http://127.0.0.1:8000', - }, - // 验证码接口 -> 告警平台(测试阶段返回禁用状态) - '/admin-api/system/captcha': { - changeOrigin: true, - target: 'http://127.0.0.1:8000', - }, - // 字典数据接口 -> 告警平台(测试阶段返回空) - '/admin-api/system/dict-data': { - changeOrigin: true, - target: 'http://127.0.0.1:8000', - }, - // 消息通知接口 -> 告警平台(测试阶段返回空) - '/admin-api/system/notify-message': { - changeOrigin: true, - target: 'http://127.0.0.1:8000', - }, - // 其他接口 -> 芋道主平台(未来对接) - // 测试阶段:这些接口会 404,但不影响核心功能 + // ==================== 芋道主平台 ==================== + // 所有 system/*、infra/* 等基础接口 -> 芋道后端 48080 '/admin-api': { changeOrigin: true, rewrite: (path) => path.replace(/^\/admin-api/, ''), + // mock代理目标地址 target: 'http://localhost:48080/admin-api', ws: true, },