This commit is contained in:
2026-01-08 16:16:06 +08:00
parent b1e7aeca43
commit b0ddabd819
6 changed files with 62 additions and 11 deletions

View File

@@ -78,6 +78,7 @@ server {
# Platform 管理平台
location /platform/ {
# 优先尝试文件,如果不存在则返回 index.htmlSPA history 模式)
proxy_pass http://platform/;
proxy_http_version 1.1;
proxy_set_header Host $host;
@@ -91,7 +92,9 @@ server {
}
location @platform_fallback {
proxy_pass http://platform/index.html;
# 重写为根路径的 index.html保留原始 URI 让前端路由处理
rewrite ^/platform/(.*)$ /platform/index.html break;
proxy_pass http://platform;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -114,7 +117,9 @@ server {
}
location @workcase_fallback {
proxy_pass http://workcase-web/index.html;
# 重写为根路径的 index.html保留原始 URI 让前端路由处理
rewrite ^/workcase/(.*)$ /workcase/index.html break;
proxy_pass http://workcase-web;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

View File

@@ -8,7 +8,7 @@ FROM node:20-alpine
ENV TZ=Asia/Shanghai
RUN apk add --no-cache tzdata curl bash sed \
RUN apk add --no-cache tzdata curl bash sed gettext \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
@@ -39,6 +39,21 @@ ENV SHARED_PORT=8000 \
BIDDING_PORT=8003
# WORKCASE_WECHAT_PORT=8004
# ============================================
# 应用配置环境变量(可通过 docker-compose 覆盖)
# ============================================
ENV APP_ENV=production \
API_BASE_URL=/api \
PUBLIC_PATH=/ \
SSO_PLATFORM_URL=/ \
SSO_WORKCASE_URL=/workcase \
SSO_BIDDING_URL=/bidding \
AES_SECRET_KEY=MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI= \
JITSI_SERVER_URL=https://meet.example.com \
AI_DEFAULT_AGENT_ID=17664699513920001 \
FILE_MAX_SIZE=100 \
ENABLE_DEBUG=false
# 配置和日志目录 (可外挂)
VOLUME ["/app/config", "/app/logs"]

View File

@@ -25,7 +25,8 @@ window.APP_RUNTIME_CONFIG = {
maxSize: {
image: 5,
video: 100,
document: 10
document: 10,
default: 100 * 1024 * 1024
},
acceptTypes: {
image: 'image/*',
@@ -58,6 +59,10 @@ window.APP_RUNTIME_CONFIG = {
jitsi: {
serverUrl: 'https://demo-jitsi.tensorgrove.com'
},
// AI 配置
ai: {
defaultAgentId: '17678420499370001' // 默认 AI Agent ID
},
// 功能开关
features: {

View File

@@ -89,11 +89,14 @@ router.beforeEach(async (to, from, next) => {
// 如果已登录且动态路由未加载,先加载动态路由
if (hasToken && !dynamicRoutesLoaded) {
dynamicRoutesLoaded = true
try {
console.log('[Platform Router] 开始加载动态路由...')
const loaded = await loadRoutesFromStorage()
if (loaded) {
dynamicRoutesLoaded = true // ✅ 加载成功后才设置标志
console.log('[Platform Router] 动态路由加载成功')
if (to.path === '/') {
// 访问根路径,重定向到第一个可用路由
const firstRoute = getFirstAvailableRoute()
@@ -106,12 +109,16 @@ router.beforeEach(async (to, from, next) => {
}
} else {
// 动态路由已加载,重新导航到目标路由
console.log('[Platform Router] 重新导航到目标路由:', to.path)
next({ ...to, replace: true })
return
}
} else {
console.warn('[Platform Router] 动态路由加载失败,未返回有效数据')
}
} catch (error) {
console.error('[Platform Router] 加载动态路由失败:', error)
// 加载失败不设置标志,下次还会尝试加载
}
}

View File

@@ -30,7 +30,8 @@ window.APP_RUNTIME_CONFIG = {
maxSize: {
image: 5,
video: 100,
document: 10
document: 10,
default: '__FILE_MAX_SIZE__' // 默认最大文件大小MB
},
acceptTypes: {
image: 'image/*',
@@ -64,6 +65,11 @@ window.APP_RUNTIME_CONFIG = {
serverUrl: '__JITSI_SERVER_URL__'
},
// AI 配置
ai: {
defaultAgentId: '__AI_DEFAULT_AGENT_ID__' // 默认 AI Agent ID
},
// 功能开关
features: {
enableDebug: false,

View File

@@ -24,6 +24,7 @@ export interface AppRuntimeConfig {
image: number;
video: number;
document: number;
default: number; // 默认最大文件大小MB
};
acceptTypes: {
image: string;
@@ -46,6 +47,9 @@ export interface AppRuntimeConfig {
jitsi?: {
serverUrl: string;
};
ai?: {
defaultAgentId: string; // 默认 AI Agent ID
};
features?: {
enableDebug?: boolean;
enableMockData?: boolean;
@@ -71,7 +75,7 @@ const devConfig: AppRuntimeConfig = {
file: {
downloadUrl: '/api/urban-lifeline/file/download/',
uploadUrl: '/api/urban-lifeline/file/upload',
maxSize: { image: 5, video: 100, document: 10 },
maxSize: { image: 5, video: 100, document: 10, default: 100 },
acceptTypes: {
image: 'image/*',
video: 'video/*',
@@ -93,6 +97,9 @@ const devConfig: AppRuntimeConfig = {
jitsi: {
serverUrl: 'https://meet.example.com'
},
ai: {
defaultAgentId: '17664699513920001'
},
features: {
enableDebug: true,
enableMockData: false
@@ -112,7 +119,7 @@ const prodDefaultConfig: AppRuntimeConfig = {
file: {
downloadUrl: '/api/urban-lifeline/file/download/',
uploadUrl: '/api/urban-lifeline/file/upload',
maxSize: { image: 5, video: 100, document: 10 },
maxSize: { image: 5, video: 100, document: 10, default: 100 },
acceptTypes: {
image: 'image/*',
video: 'video/*',
@@ -134,6 +141,9 @@ const prodDefaultConfig: AppRuntimeConfig = {
jitsi: {
serverUrl: 'https://meet.example.com'
},
ai: {
defaultAgentId: '17664699513920001'
},
features: {
enableDebug: false,
enableMockData: false
@@ -201,8 +211,8 @@ const config = getRuntimeConfig();
// AES 密钥
export const AES_SECRET_KEY = config.aesSecretKey || 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=';
// AI Agent ID
export const AGENT_ID = '17664699513920001';
// AI Agent ID(从配置读取,支持外部配置)
export const AGENT_ID = config.ai?.defaultAgentId || '17664699513920001';
// 常用配置项
export const API_BASE_URL = config.api.baseUrl;
@@ -210,7 +220,9 @@ export const FILE_DOWNLOAD_URL = config.file.downloadUrl;
export const FILE_UPLOAD_URL = config.file.uploadUrl;
export const PUBLIC_IMG_PATH = config.publicImgPath;
export const PUBLIC_WEB_PATH = config.publicWebPath;
export const FILE_MAX_SIZE = 100 * 1024 * 1024;
// 文件最大大小从配置读取单位MB转换为字节
export const FILE_MAX_SIZE = (config.file.maxSize.default || 100) * 1024 * 1024;
// Jitsi 配置
export const JITSI_SERVER_URL = config.jitsi?.serverUrl || 'https://meet.example.com';
@@ -227,6 +239,7 @@ export const APP_CONFIG = {
publicWebPath: config.publicWebPath,
sso: config.sso || { platformUrl: '/', workcaseUrl: '/workcase', biddingUrl: '/bidding' },
jitsi: config.jitsi || { serverUrl: 'https://meet.example.com' },
ai: config.ai || { defaultAgentId: '17664699513920001' },
features: config.features || {}
};