This commit is contained in:
lnn19986213 2024-05-21 16:21:54 +08:00
parent 13160e4954
commit dc3e05e241
2 changed files with 25 additions and 25 deletions

View File

@ -71,27 +71,27 @@ function getCookie(cname) {
// return ''
}
// router.beforeEach((to, form, next) => {
// var token = getCookie('lytoken')
// console.log('token', token)
// if (token == '') {
// window.location.href =
// 'http://220.191.238.50:996/api/login?returnURL=' +
// window.location.href
// } else {
// // http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => {
// // if (res.code == '500') {
// // window.location.href =
// // 'http://220.191.238.50:996/api/login?returnURL=' +
// // window.location.href
// // } else {
// // tools.data.set('token',token)
// // next();
// // }
// // });
// tools.data.set('token', token)
// next();
// }
// })
router.beforeEach((to, form, next) => {
var token = getCookie('lytoken')
console.log('token', token)
if (token == '') {
window.location.href =
'http://220.191.238.50:996/api/login?returnURL=' +
window.location.href
} else {
// http.get("/api/zzdn_event/auditToken?token=" + token).then((res) => {
// if (res.code == '500') {
// window.location.href =
// 'http://220.191.238.50:996/api/login?returnURL=' +
// window.location.href
// } else {
// tools.data.set('token',token)
// next();
// }
// });
tools.data.set('token', token)
next();
}
})
export default router

View File

@ -30,9 +30,9 @@ axios.interceptors.response.use(
if (error.response.status == 401) {
ElMessage.error("请重新登录!");
// window.location.href = '/#/login?returnURL=' + window.location.href
// window.location.href =
// 'http://220.191.238.50:996/api/login?returnURL=' +
// window.location.href
window.location.href =
'http://220.191.238.50:996/api/login?returnURL=' +
window.location.href
} else if (error.response.status == 404) {
ElMessage.error("Status:404正在请求不存在的服务器记录");
} else if (error.response.status == 500) {