1.lauyi 弹出层关闭后刷新页面
//加入下面两行
parent.location.reload();
parent.layui.admin.events.closeThisTabs()
//示例
//监听提交
form.on('submit(save)', function(datas) {
console.log(datas);
//发异步,把数据提交给后台
datas.field["userid"]={{.userid}};
var obj = {
url: "/admin/setRoomCardsData",
type: "post",
data:datas.field,
dataType: "json",
async: true,
success: function (result) {
if (result.isok){
layer.alert("修改成功", {
icon: 6
}, function() {
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);
//关闭当前frame
parent.layer.close(index);
});
layer.close();
parent.location.reload();
parent.layui.admin.events.closeThisTabs()
}else {
layer.alert("错误提示密码修改错误:",{
icon: 2
});
}
},
error:function(xhr){
layer.alert("错误提示:密码不正确!");
}
};
$.ajax(obj);
2.弹出层
layer.open({
type: 2,
title:["处理页面详情",'background-image: url(/csp/static/js/theme/default/layerTiltle.fw_03.png);'],
//title:["处理页面详情"],
area: ['70%', '70%'],
maxmin:true,
scrollbar: false ,
//content:['InAcctID.html','yes'] //页面
content:['/admin/setDiamondsPage?userid=3&diamonds=1'] //url
});
layer.open({
type: 2,
title: title, //不显示标题栏
closeBtn: 2,
area: area,
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
btn: ['保存', '取消'],
btnAlign: 'r',
moveType: 1, //拖拽模式,0或者1
content: path,
yes: function (index, layero) {
var btn = layero.find('.layui-layer-btn').find('.layui-layer-btn0');
alert("-----");
try {
var _ifr = btn[0].parentNode.parentNode.getElementsByClassName("layui-layer-content")[0].children[0].contentWindow ||
btn[0].parentNode.parentNode.getElementsByClassName("layui-layer-content")[0].children[0].children[0].contentWindow;
var func = new Function('_ifr', "return _ifr." + sucFunName + "();");
var flg = func(_ifr);
if (flg == false) {
return false;
} else {
if (callBack != null) callBack();
window.location.reload();
}
} catch (ex) {
}
},
btn2: function (index, layero) {
}
});