diff --git a/src/assets/api.js b/src/assets/api.js index 71b2e404..fe27e4f5 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -4,31 +4,32 @@ import { Notify } from 'zent'; // const Version = "v1.3.0"; // window.baseurl = 'http://pre.marketapi.1688sup.com' let baseurl = ''; +let unifiedApi = ''; let download_url = 'https://ewm.83323.cn'; // 测试环境 -if (process.env.NODE_ENV == 'test' || process.env.NODE_ENV == 'development') { +if (process.env.NODE_ENV == 'test') { baseurl = 'http://test.marketapi.1688sup.com'; window.baseurl = 'http://test.marketapi.1688sup.com'; - window.unifiedUrl = 'http://test.user.1688sup.com/'; + unifiedApi = 'http://api.test.user.1688sup.com/v1/'; + window.unifiedUrl = 'http://test.user.1688sup.com/#/login'; } // 生产环境 if (process.env.NODE_ENV == 'production') { baseurl = 'https://marketapi.1688sup.com'; window.baseurl = 'https://marketapi.1688sup.com'; - window.unifiedUrl = 'https://user.1688sup.com/'; + unifiedApi = 'https://api.user.1688sup.com/v1/'; + window.unifiedUrl = 'https://user.1688sup.com/#/login'; } /* 开发环境 */ if (process.env.NODE_ENV == 'development') { - window.unifiedUrl = 'http://192.168.7.200:8888/'; + baseurl = 'http://test.marketapi.1688sup.com'; + window.baseurl = 'http://test.marketapi.1688sup.com'; + unifiedApi = 'http://192.168.7.127:8000/v1/'; + window.unifiedUrl = 'http://192.168.7.200:8888/#/login'; } -const ApiUrl = - process.env.NODE_ENV === 'development' - ? 'http://192.168.7.127:8000' - : window.unifiedUrl + 'api'; - const upload = (method, url, params, responseType) => { let obj = { method: method, @@ -649,7 +650,7 @@ export const postLoginStandby = (data) => { //获取权限codes export const getCodes = () => { - return req('get', `${ApiUrl}/v1/menu/myCodes?systemId=2`); + return req('get', `${unifiedApi}/menu/myCodes?systemId=2`); }; // logout退出登录 diff --git a/src/pages/login/login.js b/src/pages/login/login.js index 9d848df2..75290da9 100644 --- a/src/pages/login/login.js +++ b/src/pages/login/login.js @@ -41,7 +41,7 @@ export default class App extends Component { /* 跳转统一登录平台 */ toUnifiedLogin() { setTimeout(() => { - window.location.href = `${window.unifiedUrl}#/?url=${encodeURIComponent( + window.location.href = `${window.unifiedUrl}?url=${encodeURIComponent( window.location.href )}`; }, 1500);