layui token 过期 重新登陆


这个方法你要全局设置
 
 
//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";
            });
        }
    }
});
 
效果

 

 

 

点击确定后跳转到登陆页
 

 

 

 
 
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM