diff --git a/common/api/url.js b/common/api/url.js index 25b0990..883ce54 100644 --- a/common/api/url.js +++ b/common/api/url.js @@ -1,5 +1,6 @@ -// TODO 区分环境 -export const host = 'http://47.102.220.189:58089/api/bizsvr' +import { curEnvConf } from "../env" + +export const host = curEnvConf.apiHost export default { uploadFile: '/common/ossUpload', diff --git a/common/env.js b/common/env.js new file mode 100644 index 0000000..5c0fc1c --- /dev/null +++ b/common/env.js @@ -0,0 +1,19 @@ +let envMap = { + development: { + apiHost: 'http://47.102.220.189:58089/api/bizsvr', + }, + production: { + apiHost: 'http://api.emis.tanex56.com/api/bizsvr', + } +} +let curEnvConf +if (process.env.NODE_ENV === 'development') { + curEnvConf = envMap.development + console.log('开发环境curEnvConf======', curEnvConf) +} else { + curEnvConf = envMap.production + console.log('正式环境curEnvConf======', curEnvConf) +} +export { + curEnvConf +} \ No newline at end of file