优化右开页面关闭效果

This commit is contained in:
hdm 2022-06-11 19:59:23 +08:00
parent c8bb1f526a
commit db0d52d952
17 changed files with 35 additions and 67 deletions

View File

@ -175,10 +175,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/admin/add", data.field, callback);

View File

@ -62,10 +62,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/conf/add", data.field, callback);

View File

@ -100,9 +100,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/conf/edit", data.field, callback);

View File

@ -58,9 +58,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/conf/edit", data.field, callback);

View File

@ -60,9 +60,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/conf/edit", data.field, callback);

View File

@ -112,9 +112,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/conf/edit", data.field, callback);

View File

@ -93,9 +93,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/conf/edit", data.field, callback);

View File

@ -50,10 +50,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/keywords/add", data.field, callback);

View File

@ -85,10 +85,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/links/add", data.field, callback);

View File

@ -51,10 +51,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/nav/add", data.field, callback);

View File

@ -100,10 +100,7 @@
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
});

View File

@ -35,10 +35,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/sitemap/add", data.field, callback);

View File

@ -100,10 +100,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/sitemap/sitemap_info_add", data.field, callback);

View File

@ -52,10 +52,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/slide/add", data.field, callback);

View File

@ -93,10 +93,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/slide/slide_info_add", data.field, callback);

View File

@ -86,10 +86,7 @@
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
parent.layui.tool.close(1000);
}
}
tool.post("/admin/user/edit", data.field, callback);

View File

@ -2,6 +2,7 @@ layui.define([], function (exports) {
var MOD_NAME = 'tool';
var tool = {
loading: false,
//右侧iframe的方式打开页面参考勾股CMS、勾股OA
side: function (url, width) {
var sideWidth = window.innerWidth > 1280 ? '1200px' : '996px';
if (width && width > 0) {
@ -16,7 +17,6 @@ layui.define([], function (exports) {
content: url,
area: [sideWidth, '100%'],
success: function (obj, index) {
console.log(index);
if ($('#expressClose').length < 1) {
var btn = '<div id="expressClose" class="express-close" title="关闭">关闭</div>';
obj.append(btn);
@ -27,6 +27,9 @@ layui.define([], function (exports) {
$('body').removeClass('right-open');
$('.layui-anim-rl').remove();
$('.layui-layer-shade').remove();
if (layui.pageTable) {
layui.pageTable.resize();
}
})
})
$(window).resize(function () {
@ -37,6 +40,7 @@ layui.define([], function (exports) {
}
})
},
//右侧ajax请求的方式打开页面参考勾股DEV
open: function (url, width) {
let that = this;
if (that.loading == true) {
@ -44,7 +48,7 @@ layui.define([], function (exports) {
}
that.loading = true;
if (width == 0) {
width = window.innerWidth > 1280 ? '1220px' : '1080px';
width = window.innerWidth > 1280 ? '1200px' : '996px';
}
$.ajax({
url: url,
@ -69,13 +73,10 @@ layui.define([], function (exports) {
$('#expressLayer').animate({ 'right': '-100%' }, 100, 'linear', function () {
$('#expressLayer').remove();
$('#expressMask').remove();
if (layui.pageTable) {
layui.pageTable.resize();
}
})
})
$(window).resize(function () {
width = window.innerWidth > 1280 ? '1200' : '1000';
width = window.innerWidth > 1280 ? '1200' : '996';
$('#expressLayer').width(width);
})
}
@ -139,8 +140,18 @@ layui.define([], function (exports) {
}
});
},
close: function () {
$('#expressClose').click();
close: function (delay) {
//延迟关闭,一般是在编辑完页面数据后需要自动关闭页面用到
if(delay && delay>0){
setTimeout(function () {
$('#expressClose').click();
}, delay);
}else{
$('#expressClose').click();
}
if (layui.pageTable) {
layui.pageTable.reload();
}
},
ajax: function (options, callback) {
var format = 'json';