Files
schoolNews/schoolNewsWeb/public/app-config.js
2025-11-24 11:50:15 +08:00

76 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 应用配置文件 - 可独立替换
*
* 此文件与 src/config/index.ts 的配置结构完全对应
* 可以整个替换此文件来修改配置,无需重新构建镜像
*
* Docker部署
* 1. 修改此文件
* 2. 挂载到容器:-v ./app-config.js:/app/config/app-config.js
* 3. 重启容器即可生效
*/
(function() {
'use strict';
// ============================================
// 配置定义
// ============================================
window.APP_RUNTIME_CONFIG = {
// 环境标识
env: 'production',
// API 配置
api: {
baseUrl: '/schoolNewsServ', // API基础路径
timeout: 30000 // 请求超时(毫秒)
},
// 应用基础路径
baseUrl: '/schoolNewsWeb/',
// 文件配置
file: {
downloadUrl: '/schoolNewsServ/file/download/',
uploadUrl: '/schoolNewsServ/file/upload',
maxSize: {
image: 5, // MB
video: 100, // MB
document: 10 // MB
},
acceptTypes: {
image: 'image/*',
video: 'video/*',
document: '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx'
}
},
// Token 配置
token: {
key: 'token',
refreshThreshold: 300000 // 5分钟毫秒
},
// 公共路径
publicImgPath: '/schoolNewsWeb/img',
publicWebPath: '/schoolNewsWeb',
// 功能开关(可自由扩展)
features: {
enableDebug: false,
enableMockData: false
// 你可以添加更多功能开关
// enableXXX: false
}
};
// 配置加载完成标记
window.__CONFIG_LOADED__ = true;
// 控制台输出配置信息(可选)
if (console && console.log) {
console.log('%c[配置]%c app-config.js 已加载', 'color: green; font-weight: bold', 'color: inherit');
console.log('[配置] 环境:', window.APP_RUNTIME_CONFIG.env);
console.log('[配置] API地址:', window.APP_RUNTIME_CONFIG.api.baseUrl);
}
})();