修改
This commit is contained in:
@@ -78,6 +78,7 @@ server {
|
|||||||
|
|
||||||
# Platform 管理平台
|
# Platform 管理平台
|
||||||
location /platform/ {
|
location /platform/ {
|
||||||
|
# 优先尝试文件,如果不存在则返回 index.html(SPA history 模式)
|
||||||
proxy_pass http://platform/;
|
proxy_pass http://platform/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
@@ -91,7 +92,9 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location @platform_fallback {
|
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_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -114,7 +117,9 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location @workcase_fallback {
|
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_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ FROM node:20-alpine
|
|||||||
|
|
||||||
ENV TZ=Asia/Shanghai
|
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 \
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||||
&& echo "Asia/Shanghai" > /etc/timezone
|
&& echo "Asia/Shanghai" > /etc/timezone
|
||||||
|
|
||||||
@@ -39,6 +39,21 @@ ENV SHARED_PORT=8000 \
|
|||||||
BIDDING_PORT=8003
|
BIDDING_PORT=8003
|
||||||
# WORKCASE_WECHAT_PORT=8004
|
# 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"]
|
VOLUME ["/app/config", "/app/logs"]
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ window.APP_RUNTIME_CONFIG = {
|
|||||||
maxSize: {
|
maxSize: {
|
||||||
image: 5,
|
image: 5,
|
||||||
video: 100,
|
video: 100,
|
||||||
document: 10
|
document: 10,
|
||||||
|
default: 100 * 1024 * 1024
|
||||||
},
|
},
|
||||||
acceptTypes: {
|
acceptTypes: {
|
||||||
image: 'image/*',
|
image: 'image/*',
|
||||||
@@ -58,6 +59,10 @@ window.APP_RUNTIME_CONFIG = {
|
|||||||
jitsi: {
|
jitsi: {
|
||||||
serverUrl: 'https://demo-jitsi.tensorgrove.com'
|
serverUrl: 'https://demo-jitsi.tensorgrove.com'
|
||||||
},
|
},
|
||||||
|
// AI 配置
|
||||||
|
ai: {
|
||||||
|
defaultAgentId: '17678420499370001' // 默认 AI Agent ID
|
||||||
|
},
|
||||||
|
|
||||||
// 功能开关
|
// 功能开关
|
||||||
features: {
|
features: {
|
||||||
|
|||||||
@@ -89,11 +89,14 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
|
|
||||||
// 如果已登录且动态路由未加载,先加载动态路由
|
// 如果已登录且动态路由未加载,先加载动态路由
|
||||||
if (hasToken && !dynamicRoutesLoaded) {
|
if (hasToken && !dynamicRoutesLoaded) {
|
||||||
dynamicRoutesLoaded = true
|
|
||||||
try {
|
try {
|
||||||
|
console.log('[Platform Router] 开始加载动态路由...')
|
||||||
const loaded = await loadRoutesFromStorage()
|
const loaded = await loadRoutesFromStorage()
|
||||||
|
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
|
dynamicRoutesLoaded = true // ✅ 加载成功后才设置标志
|
||||||
|
console.log('[Platform Router] 动态路由加载成功')
|
||||||
|
|
||||||
if (to.path === '/') {
|
if (to.path === '/') {
|
||||||
// 访问根路径,重定向到第一个可用路由
|
// 访问根路径,重定向到第一个可用路由
|
||||||
const firstRoute = getFirstAvailableRoute()
|
const firstRoute = getFirstAvailableRoute()
|
||||||
@@ -106,12 +109,16 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 动态路由已加载,重新导航到目标路由
|
// 动态路由已加载,重新导航到目标路由
|
||||||
|
console.log('[Platform Router] 重新导航到目标路由:', to.path)
|
||||||
next({ ...to, replace: true })
|
next({ ...to, replace: true })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('[Platform Router] 动态路由加载失败,未返回有效数据')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[Platform Router] 加载动态路由失败:', error)
|
console.error('[Platform Router] 加载动态路由失败:', error)
|
||||||
|
// 加载失败不设置标志,下次还会尝试加载
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ window.APP_RUNTIME_CONFIG = {
|
|||||||
maxSize: {
|
maxSize: {
|
||||||
image: 5,
|
image: 5,
|
||||||
video: 100,
|
video: 100,
|
||||||
document: 10
|
document: 10,
|
||||||
|
default: '__FILE_MAX_SIZE__' // 默认最大文件大小(MB)
|
||||||
},
|
},
|
||||||
acceptTypes: {
|
acceptTypes: {
|
||||||
image: 'image/*',
|
image: 'image/*',
|
||||||
@@ -64,6 +65,11 @@ window.APP_RUNTIME_CONFIG = {
|
|||||||
serverUrl: '__JITSI_SERVER_URL__'
|
serverUrl: '__JITSI_SERVER_URL__'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// AI 配置
|
||||||
|
ai: {
|
||||||
|
defaultAgentId: '__AI_DEFAULT_AGENT_ID__' // 默认 AI Agent ID
|
||||||
|
},
|
||||||
|
|
||||||
// 功能开关
|
// 功能开关
|
||||||
features: {
|
features: {
|
||||||
enableDebug: false,
|
enableDebug: false,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export interface AppRuntimeConfig {
|
|||||||
image: number;
|
image: number;
|
||||||
video: number;
|
video: number;
|
||||||
document: number;
|
document: number;
|
||||||
|
default: number; // 默认最大文件大小(MB)
|
||||||
};
|
};
|
||||||
acceptTypes: {
|
acceptTypes: {
|
||||||
image: string;
|
image: string;
|
||||||
@@ -46,6 +47,9 @@ export interface AppRuntimeConfig {
|
|||||||
jitsi?: {
|
jitsi?: {
|
||||||
serverUrl: string;
|
serverUrl: string;
|
||||||
};
|
};
|
||||||
|
ai?: {
|
||||||
|
defaultAgentId: string; // 默认 AI Agent ID
|
||||||
|
};
|
||||||
features?: {
|
features?: {
|
||||||
enableDebug?: boolean;
|
enableDebug?: boolean;
|
||||||
enableMockData?: boolean;
|
enableMockData?: boolean;
|
||||||
@@ -71,7 +75,7 @@ const devConfig: AppRuntimeConfig = {
|
|||||||
file: {
|
file: {
|
||||||
downloadUrl: '/api/urban-lifeline/file/download/',
|
downloadUrl: '/api/urban-lifeline/file/download/',
|
||||||
uploadUrl: '/api/urban-lifeline/file/upload',
|
uploadUrl: '/api/urban-lifeline/file/upload',
|
||||||
maxSize: { image: 5, video: 100, document: 10 },
|
maxSize: { image: 5, video: 100, document: 10, default: 100 },
|
||||||
acceptTypes: {
|
acceptTypes: {
|
||||||
image: 'image/*',
|
image: 'image/*',
|
||||||
video: 'video/*',
|
video: 'video/*',
|
||||||
@@ -93,6 +97,9 @@ const devConfig: AppRuntimeConfig = {
|
|||||||
jitsi: {
|
jitsi: {
|
||||||
serverUrl: 'https://meet.example.com'
|
serverUrl: 'https://meet.example.com'
|
||||||
},
|
},
|
||||||
|
ai: {
|
||||||
|
defaultAgentId: '17664699513920001'
|
||||||
|
},
|
||||||
features: {
|
features: {
|
||||||
enableDebug: true,
|
enableDebug: true,
|
||||||
enableMockData: false
|
enableMockData: false
|
||||||
@@ -112,7 +119,7 @@ const prodDefaultConfig: AppRuntimeConfig = {
|
|||||||
file: {
|
file: {
|
||||||
downloadUrl: '/api/urban-lifeline/file/download/',
|
downloadUrl: '/api/urban-lifeline/file/download/',
|
||||||
uploadUrl: '/api/urban-lifeline/file/upload',
|
uploadUrl: '/api/urban-lifeline/file/upload',
|
||||||
maxSize: { image: 5, video: 100, document: 10 },
|
maxSize: { image: 5, video: 100, document: 10, default: 100 },
|
||||||
acceptTypes: {
|
acceptTypes: {
|
||||||
image: 'image/*',
|
image: 'image/*',
|
||||||
video: 'video/*',
|
video: 'video/*',
|
||||||
@@ -134,6 +141,9 @@ const prodDefaultConfig: AppRuntimeConfig = {
|
|||||||
jitsi: {
|
jitsi: {
|
||||||
serverUrl: 'https://meet.example.com'
|
serverUrl: 'https://meet.example.com'
|
||||||
},
|
},
|
||||||
|
ai: {
|
||||||
|
defaultAgentId: '17664699513920001'
|
||||||
|
},
|
||||||
features: {
|
features: {
|
||||||
enableDebug: false,
|
enableDebug: false,
|
||||||
enableMockData: false
|
enableMockData: false
|
||||||
@@ -201,8 +211,8 @@ const config = getRuntimeConfig();
|
|||||||
// AES 密钥
|
// AES 密钥
|
||||||
export const AES_SECRET_KEY = config.aesSecretKey || 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=';
|
export const AES_SECRET_KEY = config.aesSecretKey || 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=';
|
||||||
|
|
||||||
// AI Agent ID
|
// AI Agent ID(从配置读取,支持外部配置)
|
||||||
export const AGENT_ID = '17664699513920001';
|
export const AGENT_ID = config.ai?.defaultAgentId || '17664699513920001';
|
||||||
|
|
||||||
// 常用配置项
|
// 常用配置项
|
||||||
export const API_BASE_URL = config.api.baseUrl;
|
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 FILE_UPLOAD_URL = config.file.uploadUrl;
|
||||||
export const PUBLIC_IMG_PATH = config.publicImgPath;
|
export const PUBLIC_IMG_PATH = config.publicImgPath;
|
||||||
export const PUBLIC_WEB_PATH = config.publicWebPath;
|
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 配置
|
// Jitsi 配置
|
||||||
export const JITSI_SERVER_URL = config.jitsi?.serverUrl || 'https://meet.example.com';
|
export const JITSI_SERVER_URL = config.jitsi?.serverUrl || 'https://meet.example.com';
|
||||||
@@ -227,6 +239,7 @@ export const APP_CONFIG = {
|
|||||||
publicWebPath: config.publicWebPath,
|
publicWebPath: config.publicWebPath,
|
||||||
sso: config.sso || { platformUrl: '/', workcaseUrl: '/workcase', biddingUrl: '/bidding' },
|
sso: config.sso || { platformUrl: '/', workcaseUrl: '/workcase', biddingUrl: '/bidding' },
|
||||||
jitsi: config.jitsi || { serverUrl: 'https://meet.example.com' },
|
jitsi: config.jitsi || { serverUrl: 'https://meet.example.com' },
|
||||||
|
ai: config.ai || { defaultAgentId: '17664699513920001' },
|
||||||
features: config.features || {}
|
features: config.features || {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user