layui弹窗里面 session过期 后跳转到登录页面

1.在登录页面添加

<script>
$(function () {
if (top != window) {
layer.msg("登录失效", {icon: 5});
top.location.href = window.location.href;
}
    })
</script>

2.在layui弹窗里点击添加的方法里添加
form.on('submit(add)', function (data) {
//发异步,把数据提交给控制器
var indexs = layer.load(2);
$.post("/console/admin/add.json", data.field, function (result) {
layer.close(indexs);
if (result.code == 'SUCCESS') {
layer.alert("增加成功", {icon: 1}, function () {
closeFrame();
parent.layui.table.reload('formList');
});
} else {
if (top != window) {
layer.msg("登录失效", {icon: 5});
top.location.href = window.location.href;
} else {
layer.msg(result.message, {icon: 5});
}
}
});
return false;
});


参考文档:
https://blog.csdn.net/benpaodelulu_guajian/article/details/87736290
posted @ 2020-06-09 15:16  伏沙金  阅读(1451)  评论(0编辑  收藏  举报