|
@@ -46,6 +46,7 @@ service.interceptors.request.use(config => {
|
|
|
if (getToken() && !isToken) {
|
|
|
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
|
}
|
|
|
+ config.headers['Access-Control-Allow-Origin'] = 'https://icas.jnu.edu.cn'
|
|
|
// get请求映射params参数
|
|
|
if (config.method === 'get' && config.params) {
|
|
|
let url = config.url + '?' + tansParams(config.params);
|
|
@@ -77,6 +78,10 @@ service.interceptors.response.use(res => {
|
|
|
const code = res.data.code || 200;
|
|
|
// 获取错误信息
|
|
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
|
|
+ if(res.config.url == '/auth/sso/getLoginUser'&&res.request.responseURL){
|
|
|
+ window.location.href = res.request.responseURL;
|
|
|
+ return
|
|
|
+ }
|
|
|
if (code == 401) {
|
|
|
if(!localStorage.getItem('serviceType')){
|
|
|
localStorage.setItem('serviceType','1')
|