init
This commit is contained in:
57
admin/config/index.js
Normal file
57
admin/config/index.js
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Admin 前端配置(模板)
|
||||
* 多环境:development / sit / prod(由 webpack DefinePlugin 注入 __APP_BUILD_ENV__)
|
||||
*/
|
||||
const buildEnv = (typeof __APP_BUILD_ENV__ !== 'undefined' ? __APP_BUILD_ENV__ : (typeof process !== 'undefined' && process.env && process.env.BUILD_ENV)) || (typeof process !== 'undefined' && process.env && process.env.NODE_ENV) || 'development'
|
||||
|
||||
const baseConfig = {
|
||||
title: '管理后台',
|
||||
showSettings: true,
|
||||
showTagsView: true,
|
||||
fixedHeader: true,
|
||||
sidebarLogo: true,
|
||||
cookieExpires: 1,
|
||||
themeColor: '#2d8cf0'
|
||||
}
|
||||
|
||||
// 本地开发(默认)
|
||||
const developmentConfig = {
|
||||
...baseConfig,
|
||||
apiUrl: 'http://localhost:9098/admin_api/',
|
||||
uploadUrl: 'http://localhost:9098/admin_api/upload',
|
||||
debug: true
|
||||
}
|
||||
|
||||
// SIT 环境(build:sit)— 请在 .env.sit 中配合 BUILD_ENV=sit,并按需改域名
|
||||
const sitConfig = {
|
||||
...baseConfig,
|
||||
apiUrl: 'https://your-sit-domain.com/admin_api/',
|
||||
uploadUrl: 'https://your-sit-domain.com/admin_api/upload',
|
||||
debug: false
|
||||
}
|
||||
|
||||
// 生产环境(build:prod)
|
||||
const productionConfig = {
|
||||
...baseConfig,
|
||||
apiUrl: 'https://your-prod-domain.com/admin_api/',
|
||||
uploadUrl: 'https://your-prod-domain.com/admin_api/upload',
|
||||
debug: false
|
||||
}
|
||||
|
||||
const configMap = {
|
||||
development: developmentConfig,
|
||||
sit: sitConfig,
|
||||
production: productionConfig,
|
||||
prod: productionConfig
|
||||
}
|
||||
|
||||
const config = configMap[buildEnv] || developmentConfig
|
||||
|
||||
export default config
|
||||
|
||||
export {
|
||||
baseConfig,
|
||||
developmentConfig,
|
||||
sitConfig,
|
||||
productionConfig
|
||||
}
|
||||
Reference in New Issue
Block a user