feat: 区分环境路径

This commit is contained in:
wangsongsole 2023-04-14 10:19:55 +08:00
parent ba60f78f69
commit 0de24d258d
1 changed files with 16 additions and 6 deletions

View File

@ -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') {
// 测试环境
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') {
// 生产环境
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退出登录