This commit is contained in:
parent
f6437c19bd
commit
83b6ecbcc8
|
@ -30,18 +30,25 @@ axios.interceptors.response.use(
|
|||
(error) => {
|
||||
if (error.response) {
|
||||
if (error.response.status == 401) {
|
||||
// console.log(error.response,"响应拦截器失败")
|
||||
ElMessage.error("请重新登录!");
|
||||
// console.log(error.response,"响应拦截器失败")
|
||||
// window.location.href = '/#/login?returnURL=' + window.location.href
|
||||
// window.location.href =
|
||||
// "http://220.191.238.50:996/api/login?returnURL=" +
|
||||
// window.location.href;
|
||||
|
||||
|
||||
// const cookies = document.cookie.split(";");
|
||||
// for (let i = 0; i < cookies.length; i++) {
|
||||
// const cookie = cookies[i];
|
||||
// const eqPos = cookie.indexOf("=");
|
||||
// const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
|
||||
// document.cookie =
|
||||
// name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";
|
||||
// }
|
||||
|
||||
router.replace({
|
||||
path: '/guide'
|
||||
path: "/guide",
|
||||
});
|
||||
|
||||
} else if (error.response.status == 404) {
|
||||
ElMessage.error("Status:404,正在请求不存在的服务器记录!");
|
||||
} else if (error.response.status == 500) {
|
||||
|
|
|
@ -159,7 +159,9 @@ const login = () => {
|
|||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
||||
var token = getCookie("lytoken");
|
||||
|
||||
// var token = '6b0e380b4a8f46baae4923f83faf670d';
|
||||
// console.log('token', token)
|
||||
if (!token) {
|
||||
|
@ -199,16 +201,6 @@ onMounted(() => {
|
|||
// 调用函数清空所有 cookie
|
||||
// clearCookies();
|
||||
login();
|
||||
// let token = tools.data.get("token");
|
||||
// console.log(token, "token");
|
||||
// if (token == null) {
|
||||
// ElMessage.error({
|
||||
// message: "请重新登录!",
|
||||
// offset: 100,
|
||||
// });
|
||||
// window.location.href =
|
||||
// "http://220.191.238.50:996/api/login?returnURL=" + window.location.href;
|
||||
// }
|
||||
reset_font();
|
||||
reset_font();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue