diff --git a/lib/layui_plugins/okLayer/okLayer.js b/lib/layui_plugins/okLayer/okLayer.js index f5a3458..f3ba6df 100644 --- a/lib/layui_plugins/okLayer/okLayer.js +++ b/lib/layui_plugins/okLayer/okLayer.js @@ -1,6 +1,7 @@ layui.define(["layer"], function (exports) { var $ = layui.jquery; var okLayer = { + // TODO 统一全站风格 tableNotCheckMsg: function () { layer.msg("未选择有效数据", {offset: "t", anim: 6}); }, @@ -25,6 +26,23 @@ layui.define(["layer"], function (exports) { layer.msg(content, {icon: 1, time: 1000}, function () { $(".layui-laypage-btn")[0].click(); }); + }, + open: function (title, content, width, height) { + layer.open({ + title: title, + type: 2, + shade: false, + maxmin: true, + shade: 0.5, + anim: 4, + area: [width, height], + content: content, + zIndex: layer.zIndex, + skin: "layui-layer-molv", + end: function () { + $(".layui-laypage-btn")[0].click(); + } + }); } } diff --git a/user.html b/user.html index 551e5aa..bacfeef 100644 --- a/user.html +++ b/user.html @@ -106,19 +106,7 @@ var data = obj.data; var layEvent = obj.event; if (layEvent === "edit") { - layer.open({ - title: "编辑用户", - type: 2, - shade: false, - maxmin: true, - shade: 0.5, - area: ["90%", "90%"], - content: "user-edit.html", - zIndex: layer.zIndex, - end: function () { - $(".layui-laypage-btn")[0].click(); - } - }); + okLayer.open("编辑用户", "user-edit.html", "90%", "90%") } else if (layEvent === "del") { okLayer.confirm("确定要删除吗?", function () { okUtils.ajax("/user/batchDel", "post", {idsStr: data.id}).done(function (response) { @@ -179,21 +167,7 @@ }) $("#addUser").click(function () { - layer.open({ - title: "添加用户", - type: 2, - shade: false, - maxmin: true, - shade: 0.5, - anim: 4, - area: ["90%", "90%"], - content: "user-add.html", - zIndex: layer.zIndex, - // skin: "layui-layer-molv", - end: function () { - $(".layui-laypage-btn")[0].click(); - } - }); + okLayer.open("添加用户", "user-add.html", "90%", "90%") }) })