增加公共请求方法配置
This commit is contained in:
46
commons/config.js
Normal file
46
commons/config.js
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
//打包时修改env的值即可
|
||||
const env='test' //test , production,local
|
||||
|
||||
export const encryptKey='1234567890123456' // http数据加解密的key
|
||||
|
||||
export const apiUrl='/czg/'
|
||||
export const h5Config = {
|
||||
production: 'https://dj-h5.hnsiyao.cn',
|
||||
test: 'https://web-api.hnsiyao.cn',
|
||||
local: 'http://192.168.1.41:8100'
|
||||
}
|
||||
|
||||
export const AppConfig = {
|
||||
production: 'https://dj-api.hnsiyao.cn',
|
||||
test: 'https://video-h5.hnsiyao.cn',
|
||||
local: 'http://192.168.1.41:8100'
|
||||
}
|
||||
|
||||
function returnShareUrl(){
|
||||
if(env==='test'){
|
||||
return 'https://video-h5.hnsiyao.cn'
|
||||
}
|
||||
if(env==='production'){
|
||||
return 'https://dj-h5.hnsiyao.cn'
|
||||
}
|
||||
if(env==='local'){
|
||||
return AppConfig[env]
|
||||
}
|
||||
}
|
||||
// #ifdef H5
|
||||
export default{
|
||||
baseUrl:h5Config[env],
|
||||
baseApiUrl:h5Config[env]+apiUrl,
|
||||
shareUrl:returnShareUrl()
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
||||
// #ifdef APP
|
||||
export default{
|
||||
baseUrl:AppConfig[env],
|
||||
baseApiUrl:AppConfig[env]+apiUrl,
|
||||
shareUrl:returnShareUrl()
|
||||
}
|
||||
// #endif
|
||||
Reference in New Issue
Block a user