|
@@ -32,8 +32,8 @@ const serviceAxios = axios.create({
|
|
|
serviceAxios.interceptors.request.use(config => {
|
|
|
// 弹层相关
|
|
|
loadingInstance = Loading.service(options)
|
|
|
- if (localStorage.getItem('token')) {
|
|
|
- config.headers['Authorization'] = localStorage.getItem('token') // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
|
+ if (localStorage.getItem('instituteToken')) {
|
|
|
+ config.headers['Authorization'] = localStorage.getItem('instituteToken') // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
|
}
|
|
|
// get请求映射params参数
|
|
|
if (config.method === 'get' && config.params) {
|
|
@@ -68,8 +68,8 @@ serviceAxios.interceptors.response.use(res => {
|
|
|
const code = res.data.code || 200;
|
|
|
// 获取错误信息
|
|
|
if(code == 5002){
|
|
|
- if(localStorage.getItem('token')){
|
|
|
- localStorage.removeItem('token')
|
|
|
+ if(localStorage.getItem('instituteToken')){
|
|
|
+ localStorage.removeItem('instituteToken')
|
|
|
MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
showCancelButton:false,
|
|
@@ -82,9 +82,9 @@ serviceAxios.interceptors.response.use(res => {
|
|
|
}).catch(() => {});
|
|
|
}
|
|
|
}else if (code == 5005) {
|
|
|
- if(localStorage.getItem('token')){
|
|
|
+ if(localStorage.getItem('instituteToken')){
|
|
|
//无权限
|
|
|
- localStorage.removeItem('token')
|
|
|
+ localStorage.removeItem('instituteToken')
|
|
|
MessageBox.confirm('没有相关权限,请联系管理员', '系统提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
showCancelButton:false,
|
|
@@ -130,8 +130,8 @@ serviceAxios.interceptors.response.use(res => {
|
|
|
}
|
|
|
else if (message.includes("Request failed with status code")) {
|
|
|
if(message.substr(message.length - 3) == 401){
|
|
|
- if(localStorage.getItem('token')){
|
|
|
- // localStorage.removeItem('token')
|
|
|
+ if(localStorage.getItem('instituteToken')){
|
|
|
+ // localStorage.removeItem('instituteToken')
|
|
|
MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
showCancelButton:false,
|
|
@@ -178,7 +178,7 @@ export function download(url, params, filename) {
|
|
|
headers: {
|
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
"Access-Control-Allow-Origin": "*",
|
|
|
- token:localStorage.getItem("token"),
|
|
|
+ token:localStorage.getItem("instituteToken"),
|
|
|
|
|
|
},
|
|
|
responseType: 'blob'
|