恢复:框架层对接芋道后端

- 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) <noreply@anthropic.com>
This commit is contained in:
lzh
2026-04-17 09:14:00 +08:00
parent 09fb8ebc61
commit c7b2ad1e79
3 changed files with 8 additions and 71 deletions

View File

@@ -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

View File

@@ -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<string, string> = {
'摄像头告警汇总': '告警看板',
'告警汇总': '告警看板',
};
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;
}

View File

@@ -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,
},