|
|
@@ -43,8 +43,16 @@ service.interceptors.response.use(
|
|
|
if (response.config.responseType == "blob") {
|
|
|
return response;
|
|
|
}else if (res.code === 401) {
|
|
|
- // 跳转登录页
|
|
|
- window.location.href = '/#/login'
|
|
|
+ // token 失效:清除本地登录信息并跳转登录页
|
|
|
+ localStorage.removeItem('token')
|
|
|
+ localStorage.removeItem('userInfo')
|
|
|
+ if (import.meta.env.MODE === 'development') {
|
|
|
+ window.location.href = '/#/login'
|
|
|
+ } else if (import.meta.env.MODE === 'test') {
|
|
|
+ window.location.href = 'https://index.k12100.net'
|
|
|
+ } else if (import.meta.env.MODE === 'production') {
|
|
|
+ window.location.href = 'https://www.k12100.com'
|
|
|
+ }
|
|
|
}else
|
|
|
{
|
|
|
return res
|