diff --git a/lib/layui_plugins/okLayer/okLayer.js b/lib/layui_plugins/okLayer/okLayer.js index 29c4a83..b475fd0 100644 --- a/lib/layui_plugins/okLayer/okLayer.js +++ b/lib/layui_plugins/okLayer/okLayer.js @@ -25,7 +25,7 @@ layui.define(["layer"], function (exports) { var options = {skin: okLayer.skinChoose(), icon: 2, title: "提示", anim: okLayer.animChoose()}; layer.confirm(content, options, yesFunction); }, - open: function (title, content, width, height) { + open: function (title, content, width, height, isRefreshTable) { layer.open({ title: title, type: 2, @@ -38,7 +38,9 @@ layui.define(["layer"], function (exports) { zIndex: layer.zIndex, skin: okLayer.skinChoose(), end: function () { - $(".layui-laypage-btn")[0].click(); + if (isRefreshTable) { + $(".layui-laypage-btn")[0].click(); + } } }); }, diff --git a/lib/layui_plugins/okUtils/okUtils.js b/lib/layui_plugins/okUtils/okUtils.js index 37122b9..8e676bd 100644 --- a/lib/layui_plugins/okUtils/okUtils.js +++ b/lib/layui_plugins/okUtils/okUtils.js @@ -1,12 +1,13 @@ layui.define("layer", function (exports) { var $ = layui.jquery; var okUtils = { + isFrontendBackendSeparate: true, baseUrl: "http://localhost:8080", ajax: function (url, type, param) { var deferred = $.Deferred(); var loadIndex; $.ajax({ - url: okUtils.baseUrl + url, + url: okUtils.isFrontendBackendSeparate ? okUtils.baseUrl + url : url, type: type || "get", data: param || {}, dataType: "json", diff --git a/user.html b/user.html index bacfeef..3c03511 100644 --- a/user.html +++ b/user.html @@ -106,7 +106,7 @@ var data = obj.data; var layEvent = obj.event; if (layEvent === "edit") { - okLayer.open("编辑用户", "user-edit.html", "90%", "90%") + okLayer.open("编辑用户", "user-edit.html", "90%", "90%", true) } else if (layEvent === "del") { okLayer.confirm("确定要删除吗?", function () { okUtils.ajax("/user/batchDel", "post", {idsStr: data.id}).done(function (response) { @@ -167,7 +167,7 @@ }) $("#addUser").click(function () { - okLayer.open("添加用户", "user-add.html", "90%", "90%") + okLayer.open("添加用户", "user-add.html", "90%", "90%", true) }) })