diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl index 1a5354f0..ac7d718a 100644 --- a/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl +++ b/xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl @@ -49,7 +49,6 @@ <#-- common --> - diff --git a/xxl-job-admin/src/main/webapp/static/js/common.1.js b/xxl-job-admin/src/main/webapp/static/js/common.1.js index 734ad2f6..bd879436 100644 --- a/xxl-job-admin/src/main/webapp/static/js/common.1.js +++ b/xxl-job-admin/src/main/webapp/static/js/common.1.js @@ -2,17 +2,29 @@ $(function(){ // logout $("#logoutBtn").click(function(){ - ComConfirm.show("确认注销登录?", function(){ + layer.confirm('确认注销登录?', {icon: 3, title:'系统提示'}, function(index){ + layer.close(index); + $.post(base_url + "/logout", function(data, status) { if (data.code == "200") { - ComAlert.show(1, "注销成功", function(){ - window.location.href = base_url + "/"; + layer.open({ + title: '系统提示', + content: '注销成功', + icon: '1', + end: function(layero, index){ + window.location.href = base_url + "/"; + } }); } else { - ComAlert.show(1, data.msg); + layer.open({ + title: '系统提示', + content: (data.msg || "操作失败"), + icon: '2' + }); } }); }); + }); // slideToTop diff --git a/xxl-job-admin/src/main/webapp/static/js/index.js b/xxl-job-admin/src/main/webapp/static/js/index.js index e6fa5223..0f74d16b 100644 --- a/xxl-job-admin/src/main/webapp/static/js/index.js +++ b/xxl-job-admin/src/main/webapp/static/js/index.js @@ -18,7 +18,11 @@ $(function () { lineChartInit(data) pieChartInit(data); } else { - ComAlert.show(2, data.msg || '调度报表数据加载异常' ); + layer.open({ + title: '系统提示', + content: (data.msg || '调度报表数据加载异常'), + icon: '2' + }); } } }); diff --git a/xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js b/xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js index 14727bcd..3386f263 100644 --- a/xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js +++ b/xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js @@ -49,14 +49,21 @@ $(function() { var glueRemark = $("#glueRemark").val(); if (!glueRemark) { - ComAlert.show(2, "请输入备注"); + layer.open({ + title: '系统提示', + content: '请输入备注', + icon: '2' + }); return; } if (glueRemark.length <4 || glueRemark.length > 100) { - ComAlert.show(2, "备注长度应该在4至100之间"); + layer.open({ + title: '系统提示', + content: '备注长度应该在4至100之间', + icon: '2' + }); return; } - $.ajax({ type : 'POST', @@ -69,12 +76,21 @@ $(function() { dataType : "json", success : function(data){ if (data.code == 200) { - ComAlert.show(1, '保存成功', function(){ - //$(window).unbind('beforeunload'); - window.location.reload(); + layer.open({ + title: '系统提示', + content: '保存成功', + icon: '1', + end: function(layero, index){ + //$(window).unbind('beforeunload'); + window.location.reload(); + } }); } else { - ComAlert.show(2, data.msg); + layer.open({ + title: '系统提示', + content: (data.msg || "保存失败"), + icon: '2' + }); } } }); diff --git a/xxl-job-admin/src/main/webapp/static/js/jobgroup.index.1.js b/xxl-job-admin/src/main/webapp/static/js/jobgroup.index.1.js index 92c0402b..c3b8181d 100644 --- a/xxl-job-admin/src/main/webapp/static/js/jobgroup.index.1.js +++ b/xxl-job-admin/src/main/webapp/static/js/jobgroup.index.1.js @@ -4,7 +4,9 @@ $(function() { $('.remove').on('click', function(){ var id = $(this).attr('id'); - ComConfirm.show("确认删除分组?", function(){ + layer.confirm('确认删除分组?', {icon: 3, title:'系统提示'}, function(index){ + layer.close(index); + $.ajax({ type : 'POST', url : base_url + '/jobgroup/remove', @@ -12,18 +14,25 @@ $(function() { dataType : "json", success : function(data){ if (data.code == 200) { - ComAlert.show(1, '删除成功'); - window.location.reload(); + layer.open({ + title: '系统提示', + content: '删除成功', + icon: '1', + end: function(layero, index){ + window.location.reload(); + } + }); } else { - if (data.msg) { - ComAlert.show(2, data.msg); - } else { - ComAlert.show(2, '删除失败'); - } + layer.open({ + title: '系统提示', + content: (data.msg || "删除失败"), + icon: '2' + }); } }, }); }); + }); // jquery.validate 自定义校验 “英文字母开头,只含有英文字母、数字和下划线” @@ -86,17 +95,20 @@ $(function() { $.post(base_url + "/jobgroup/save", $("#addModal .form").serialize(), function(data, status) { if (data.code == "200") { $('#addModal').modal('hide'); - setTimeout(function () { - ComAlert.show(1, "新增成功", function(){ + layer.open({ + title: '系统提示', + content: '新增成功', + icon: '1', + end: function(layero, index){ window.location.reload(); - }); - }, 315); + } + }); } else { - if (data.msg) { - ComAlert.show(2, data.msg); - } else { - ComAlert.show(2, "新增失败"); - } + layer.open({ + title: '系统提示', + content: (data.msg || "新增失败"), + icon: '2' + }); } }); } @@ -186,17 +198,21 @@ $(function() { $.post(base_url + "/jobgroup/update", $("#updateModal .form").serialize(), function(data, status) { if (data.code == "200") { $('#addModal').modal('hide'); - setTimeout(function () { - ComAlert.show(1, "更新成功", function(){ + + layer.open({ + title: '系统提示', + content: '更新成功', + icon: '1', + end: function(layero, index){ window.location.reload(); - }); - }, 315); + } + }); } else { - if (data.msg) { - ComAlert.show(2, data.msg); - } else { - ComAlert.show(2, "更新失败"); - } + layer.open({ + title: '系统提示', + content: (data.msg || "更新失败"), + icon: '2' + }); } }); } diff --git a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js index 865de884..8f446a17 100644 --- a/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js +++ b/xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js @@ -201,8 +201,10 @@ $(function() { } var id = $(this).parent('p').attr("id"); - - ComConfirm.show("确认" + typeName + "?", function(){ + + layer.confirm('确认' + typeName + '?', {icon: 3, title:'系统提示'}, function(index){ + layer.close(index); + $.ajax({ type : 'POST', url : url, @@ -212,14 +214,24 @@ $(function() { dataType : "json", success : function(data){ if (data.code == 200) { - ComAlert.show(1, typeName + "成功", function(){ - if (needFresh) { - //window.location.reload(); - jobTable.fnDraw(); + + layer.open({ + title: '系统提示', + content: typeName + "成功", + icon: '1', + end: function(layero, index){ + if (needFresh) { + //window.location.reload(); + jobTable.fnDraw(); + } } }); } else { - ComAlert.show(1, typeName + "失败"); + layer.open({ + title: '系统提示', + content: (data.msg || typeName + "失败"), + icon: '2' + }); } }, }); @@ -278,18 +290,21 @@ $(function() { $.post(base_url + "/jobinfo/add", $("#addModal .form").serialize(), function(data, status) { if (data.code == "200") { $('#addModal').modal('hide'); - setTimeout(function () { - ComAlert.show(1, "新增任务成功", function(){ + layer.open({ + title: '系统提示', + content: '新增任务成功', + icon: '1', + end: function(layero, index){ jobTable.fnDraw(); //window.location.reload(); - }); - }, 315); + } + }); } else { - if (data.msg) { - ComAlert.show(2, data.msg); - } else { - ComAlert.show(2, "新增失败"); - } + layer.open({ + title: '系统提示', + content: (data.msg || "新增失败"), + icon: '2' + }); } }); } @@ -394,18 +409,21 @@ $(function() { $.post(base_url + "/jobinfo/reschedule", $("#updateModal .form").serialize(), function(data, status) { if (data.code == "200") { $('#updateModal').modal('hide'); - setTimeout(function () { - ComAlert.show(1, "更新成功", function(){ + layer.open({ + title: '系统提示', + content: '更新成功', + icon: '1', + end: function(layero, index){ //window.location.reload(); jobTable.fnDraw(); - }); - }, 315); + } + }); } else { - if (data.msg) { - ComAlert.show(2, data.msg); - } else { - ComAlert.show(2, "更新失败"); - } + layer.open({ + title: '系统提示', + content: (data.msg || "更新失败"), + icon: '2' + }); } }); } diff --git a/xxl-job-admin/src/main/webapp/static/js/login.1.js b/xxl-job-admin/src/main/webapp/static/js/login.1.js index d35ee371..67bd6cac 100644 --- a/xxl-job-admin/src/main/webapp/static/js/login.1.js +++ b/xxl-job-admin/src/main/webapp/static/js/login.1.js @@ -48,11 +48,20 @@ $(function(){ submitHandler : function(form) { $.post(base_url + "/login", $("#loginForm").serialize(), function(data, status) { if (data.code == "200") { - ComAlert.show(1, "登录成功", function(){ - window.location.href = base_url; - }); + layer.open({ + title: '系统提示', + content: '登录成功', + icon: '1', + end: function(layero, index){ + window.location.href = base_url; + } + }); } else { - ComAlert.show(2, data.msg); + layer.open({ + title: '系统提示', + content: (data.msg || "登录失败"), + icon: '2' + }); } }); } diff --git a/xxl-job-admin/src/main/webapp/static/js/xxl.alert.1.js b/xxl-job-admin/src/main/webapp/static/js/xxl.alert.1.js deleted file mode 100644 index 021c4b76..00000000 --- a/xxl-job-admin/src/main/webapp/static/js/xxl.alert.1.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Created by xuxueli on 16/8/12. - * - * dependency, jquery + bootstrap - */ - -// 通用提示 -var ComAlert = { - html:function(){ - var html = - ''; - return html; - }, - show:function(type, msg, callback){ - // dom init - if ($('#ComAlert').length == 0){ - $('body').append(ComAlert.html()); - } - - // 弹框初始 - if (type == 1) { - $('#ComAlert .alert').attr('class', 'alert alert-success'); - } else { - $('#ComAlert .alert').attr('class', 'alert alert-warning'); - } - $('#ComAlert .alert').html(msg); - $('#ComAlert').modal('show'); - - $('#ComAlert .ok').click(function(){ - $('#ComAlert').modal('hide'); - if(typeof callback == 'function') { - callback(); - } - }); - - // $("#ComAlert").on('hide.bs.modal', function () { }); // 监听关闭 - } -}; - -// 通用确认弹框 -var ComConfirm = { - html:function(){ - var html = - ''; - return html; - }, - show:function(msg, callback){ - // dom init - if ($('#ComConfirm').length == 0){ - $("body").append(ComConfirm.html()); - } - - // 弹框初始 - $('#ComConfirm .alert').attr('class', 'alert alert-warning'); - $('#ComConfirm .alert').html(msg); - $('#ComConfirm').modal('show'); - - $('#ComConfirm .ok').unbind("click"); // 解绑陈旧事件 - $('#ComConfirm .ok').click(function(){ - $('#ComConfirm').modal('hide'); - if(typeof callback == 'function') { - setTimeout(function(){ - callback(); - return; - }, 315); - } - }); - - $('#ComConfirm .cancel').click(function(){ - $('#ComConfirm').modal('hide'); - return; - }); - } -};