接口兼容

This commit is contained in:
aixianling
2022-07-26 09:34:00 +08:00
parent bd3ef507cc
commit 2831c8b5af

View File

@@ -3,7 +3,7 @@ import {Message} from 'element-ui'
let baseURLs = { let baseURLs = {
production: "/", production: "/",
development: '/saas' development: '/lan'
} }
instance.defaults.baseURL = baseURLs[process.env.NODE_ENV] instance.defaults.baseURL = baseURLs[process.env.NODE_ENV]
instance.interceptors.request.use(config => { instance.interceptors.request.use(config => {
@@ -15,15 +15,13 @@ instance.interceptors.request.use(config => {
config.baseURL = "/saas" config.baseURL = "/saas"
} else if (/\/xiushan/.test(location.pathname)) { } else if (/\/xiushan/.test(location.pathname)) {
config.baseURL = "/xsjr" config.baseURL = "/xsjr"
config.url = config.url.replace(/(app|auth|admin)\//, "")
} else if (/project\/oms/.test(location.pathname)) { } else if (/project\/oms/.test(location.pathname)) {
config.baseURL = "/omsapi" config.baseURL = "/omsapi"
config.url = config.url.replace(/(app|auth|admin)\//, "")
} else if (/#url-/.test(location.hash)) { } else if (/#url-/.test(location.hash)) {
config.baseURL = location.hash.replace(/#url-/, '/') config.baseURL = location.hash.replace(/#url-/, '/')
if (["/xsjr", "/omsapi"].includes(config.baseURL)) { }
config.url = config.url.replace(/(app|auth|admin)\//, "") if (["/xsjr", "/omsapi"].includes(config.baseURL)) {
} config.url = config.url.replace(/(app|auth|admin)\//, "")
} }
return config return config
}, error => Message.error(error)) }, error => Message.error(error))