提交 f3ecefbe 编写于 作者: zhangpingchuan's avatar zhangpingchuan

update:更新适配安永业务系统数据下沉一层问题

上级 bafed3dd
......@@ -103,6 +103,7 @@ export class Interceptors {
if(response.headers && response.headers['refreshtoken'] && localStorage.getItem('token')){
this.refreshToken(response);
}
response = this.handleResponse(response);
return response;
}, (error: any) => {
error = error ? error : { response: {} };
......@@ -134,6 +135,54 @@ export class Interceptors {
});
}
/**
* 处理响应
*
* @private
* @param {*} response
* @memberof Interceptors
*/
private handleResponse(response: any) {
const requestUrl = response.config.url;
// 静态资源
if (requestUrl.startsWith('./assets')
// uaa
|| requestUrl.startsWith(`${Environment.BaseUrl}/v7`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/uaa`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/sysauthlogs`)
// ou
|| requestUrl.startsWith(`${Environment.BaseUrl}/ibzemployees`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/ibzemployees`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/ibzdepartments`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/sysdepartments`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/ibzorganizations`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/sysorganizations`)
// oss
|| requestUrl.startsWith(`${Environment.BaseUrl}/ibizutil`)
|| requestUrl.startsWith(`${Environment.BaseUrl}/net-disk`)
// configs
|| requestUrl.startsWith(`${Environment.BaseUrl}/configs`)
// dict
|| requestUrl.startsWith(`${Environment.BaseUrl}/dictionar`)
// wfcore
|| requestUrl.startsWith(`${Environment.BaseUrl}/wfcore`)
) {
return response;
} else {
const responseData = Util.deepCopy(response.data);
if (responseData.hasOwnProperty('code')) {
response.status = responseData.code == 0 ? 200 : responseData.code;
}
if (responseData.hasOwnProperty("data")) {
response.data = responseData.data;
}
if(responseData.hasOwnProperty('msg')){
response.data.message = responseData.msg;
}
return response;
}
}
/**
* 处理未登录异常情况
*
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册