|
@@ -12,35 +12,14 @@ const service = axios.create({
|
|
|
// 超时
|
|
|
timeout: 1200000
|
|
|
})
|
|
|
-
|
|
|
-// 存储当前激活的组件状态键
|
|
|
-let activeStateKey = null;
|
|
|
-
|
|
|
-// 重置指定页面的状态
|
|
|
-export function resetEndpoint() {
|
|
|
- setActive(null);
|
|
|
-}
|
|
|
-// 设置当前激活状态键
|
|
|
-export function setActive(stateKey) {
|
|
|
- activeStateKey = stateKey;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
// request拦截器
|
|
|
service.interceptors.request.use(config => {
|
|
|
-
|
|
|
- // 使用当前激活的组件状态来决定是否添加前缀
|
|
|
- let useNewEndpoint = false
|
|
|
- let routePrefix = ''
|
|
|
- let canReg = false
|
|
|
- if (activeStateKey) {
|
|
|
- const state = JSON.parse(sessionStorage.getItem(activeStateKey));
|
|
|
- useNewEndpoint = state.isUsingNewEndpoint;
|
|
|
- routePrefix = state.prefix;
|
|
|
- canReg= state.regexGate.split(',').any(reg => config.url.includes(reg));
|
|
|
- }
|
|
|
- if (useNewEndpoint && canReg) {
|
|
|
- config.url = routePrefix + config.url;
|
|
|
+ //判断APP商城请求
|
|
|
+ if(sessionStorage.getItem('hisStore') === '1'
|
|
|
+ && (config.url.includes('store') || config.url.includes('order'))
|
|
|
+ && (config.url.indexOf('/system/dict/data/type') === -1)
|
|
|
+ ){
|
|
|
+ config.url = '/store' + config.url;
|
|
|
}
|
|
|
|
|
|
//判断watch请求
|
|
@@ -80,8 +59,8 @@ service.interceptors.request.use(config => {
|
|
|
}
|
|
|
return config
|
|
|
}, error => {
|
|
|
- console.log(error)
|
|
|
- Promise.reject(error)
|
|
|
+ console.log(error)
|
|
|
+ Promise.reject(error)
|
|
|
})
|
|
|
|
|
|
// 响应拦截器
|