这个方法你要全局设置
 
 
//jquery全局配置
$.ajaxSetup({
    cache: false,
    crossDomain: true,  
    headers :{'Authorization':token},
    complete: function (xhr) {
        console.log(xhr)
        if(xhr.responseJSON&&xhr.responseJSON.status==401) {
            console.log(xhr.responseJSON);
            layer.alert('权限不足,请重新登陆', {
                icon: 5,
                title: "提示"
            },function() {
                window.parent.location.reload(); //刷新父页面
                window.parent.location.href="./index.html";
            });
        }
    }
});
 
效果
layui  token 过期 重新登陆

 

 

 

点击确定后跳转到登陆页
 
layui  token 过期 重新登陆

 

 

 
 
 

相关文章:

  • 2021-11-16
  • 2022-03-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
猜你喜欢
  • 2021-05-18
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
相关资源
相似解决方案