From b399dfa2ec899bff0af661d4386ecddaae08cb32 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Tue, 9 May 2023 11:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20config:=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BB=9F=E4=B8=80=E7=99=BB=E9=99=86=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 21 +++++++++++---------- src/pages/login/login.js | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) 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);