- 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>
86 lines
3.0 KiB
TypeScript
86 lines
3.0 KiB
TypeScript
import { defineConfig } from '@vben/vite-config';
|
||
|
||
export default defineConfig(async () => {
|
||
return {
|
||
application: {},
|
||
vite: {
|
||
server: {
|
||
allowedHosts: true,
|
||
proxy: {
|
||
// ==================== AIoT 统一路由 ====================
|
||
|
||
// aiot/alarm, aiot/edge -> 告警服务 :8000(直通)
|
||
'/admin-api/aiot/alarm': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:8000',
|
||
},
|
||
'/admin-api/aiot/edge': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:8000',
|
||
},
|
||
// 告警截图静态文件 -> 告警服务 :8000
|
||
'/uploads': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:8000',
|
||
},
|
||
// Edge 本地截图(COS 未配置时回退)-> 告警服务 :8000
|
||
'/captures': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:8000',
|
||
},
|
||
// COS 存储相关接口 -> 告警服务 :8000
|
||
'/admin-api/aiot/storage': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:8000',
|
||
},
|
||
|
||
// aiot/device/* -> WVP :18080(按子路径分别 rewrite)
|
||
// 注意:更具体的路径必须写在通配路径前面
|
||
|
||
// 摄像头拉流代理: /admin-api/aiot/device/proxy -> /api/proxy
|
||
'/admin-api/aiot/device/proxy': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:18080',
|
||
rewrite: (path: string) =>
|
||
path.replace('/admin-api/aiot/device/proxy', '/api/proxy'),
|
||
},
|
||
// WVP 用户认证: /admin-api/aiot/device/user -> /api/user
|
||
'/admin-api/aiot/device/user': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:18080',
|
||
rewrite: (path: string) =>
|
||
path.replace('/admin-api/aiot/device/user', '/api/user'),
|
||
},
|
||
// 媒体服务器: /admin-api/aiot/device/server -> /api/server/media_server
|
||
'/admin-api/aiot/device/server': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:18080',
|
||
rewrite: (path: string) =>
|
||
path.replace(
|
||
'/admin-api/aiot/device/server',
|
||
'/api/server/media_server',
|
||
),
|
||
},
|
||
// ROI/算法/配置等: /admin-api/aiot/device -> /api/ai(通配,放最后)
|
||
'/admin-api/aiot/device': {
|
||
changeOrigin: true,
|
||
target: 'http://127.0.0.1:18080',
|
||
rewrite: (path: string) =>
|
||
path.replace('/admin-api/aiot/device', '/api/ai'),
|
||
},
|
||
|
||
// ==================== 芋道主平台 ====================
|
||
// 所有 system/*、infra/* 等基础接口 -> 芋道后端 48080
|
||
'/admin-api': {
|
||
changeOrigin: true,
|
||
rewrite: (path) => path.replace(/^\/admin-api/, ''),
|
||
// mock代理目标地址
|
||
target: 'http://localhost:48080/admin-api',
|
||
ws: true,
|
||
},
|
||
},
|
||
},
|
||
},
|
||
};
|
||
});
|