修改
This commit is contained in:
@@ -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)
|
||||
// 加载失败不设置标志,下次还会尝试加载
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 || {}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user