rhb-server/mes-ui/rhb-app/utils/config.js

68 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2025-10-20 11:14:41 +08:00
/**
* 配置文件
*/
// 环境配置
const BASE_URL = 'http://localhost:9021';
// const BASE_URL = 'https://nxhs.cjyx.cc';
// 当前环境
const currentEnv = 'production'
// const currentEnv = 'development'
const ENV = {
// development: {
// baseURL: 'http://localhost:9021/rhb-api',
// uploadURL: 'http://localhost:9021/rhb-api/upload',
// wsURL: 'ws://localhost:8080/ws'
// },
production: {
baseURL: BASE_URL + '/rhb-api',
uploadURL: BASE_URL + '/rhb-api/upload',
wsURL: 'ws://localhost:8080/ws'
}
}
// 导出配置
export const config = {
// 基础URL
baseURL: ENV[currentEnv].baseURL,
// 上传URL
uploadURL: ENV[currentEnv].uploadURL,
// WebSocket URL
wsURL: ENV[currentEnv].wsURL,
// 请求超时时间
timeout: 1000000,
// 默认请求头
headers: {
// 'Content-Type': 'application/json',
'tenant-id': 2
},
// 响应码配置
responseCode: {
SUCCESS: 0, // 成功
PWDERROR:1002000000,
UNAUTHORIZED: 401, // 未授权
FORBIDDEN: 403, // 禁止访问
NOT_FOUND: 404, // 未找到
SERVER_ERROR: 500, // 服务器错误
TOKEN_EXPIRED: 600, // token过期
TOKEN_INVALID: 601, // token无效
TOKEN_MISSING: 602 // token缺失
},
// 存储键名
storageKeys: {
LOGIN_INFO: 'storage_loginInfo',
USER_INFO: 'storage_userInfo',
TOKEN: 'storage_token'
}
}
export default config