diff --git a/src/assets/api.js b/src/assets/api.js index 0400f565..5828024a 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -5,17 +5,23 @@ import { Notify } from 'zent'; // window.baseurl = 'http://pre.marketapi.1688sup.com' let baseurl = ''; let download_url = 'https://ewm.83323.cn'; +// 测试环境 if (process.env.NODE_ENV == 'test' || process.env.NODE_ENV == 'development') { - // 测试环境 baseurl = 'http://192.168.6.75'; window.baseurl = 'http://192.168.6.75'; - window.unifiedUrl = 'http://192.168.7.200:8888/#/login'; /* 统一登录地址 */ + window.unifiedUrl = 'https://test.user.1688sup.com/'; } + +// 生产环境 if (process.env.NODE_ENV == 'production') { - // 生产环境 baseurl = 'https://marketapi.1688sup.com'; window.baseurl = 'https://marketapi.1688sup.com'; - window.unifiedUrl = 'https://user.1688sup.com/#/login'; /* 统一登录地址 */ + window.unifiedUrl = 'https://user.1688sup.com/'; +} + +/* 开发环境 */ +if (process.env.NODE_ENV == 'development') { + window.unifiedUrl = 'http://192.168.7.200:8888/#/login'; } const upload = (method, url, params, responseType) => { let obj = { @@ -706,9 +712,13 @@ export const postLoginStandby = (data) => { return req('post', baseurl + '/auth/login/original/mobile', data); }; -//获取菜单 +//同统一登录获取菜单 export const getMenus = () => { - return req('unified', 'http://192.168.7.129:8000/v1/menu/tree/marketing'); + const ApiUrl = + process.env.NODE_ENV === 'development' + ? 'http://192.168.7.127:8000' + : window.unifiedUrl + 'api'; + return req('unified', `${ApiUrl}/v1/menu/tree/marketing`); }; // logout退出登录