From 80e8055d67a78801cea6afe5bf756f5efb435e38 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Thu, 7 Jun 2018 12:49:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E6=9B=B4=E6=96=B0Settings=E7=BD=91=E9=A1=B5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Views/Admin/Settings.cshtml | 35 ++++----- Bootstrap.Admin/wwwroot/js/Settings.js | 85 ++++++++------------- 2 files changed, 48 insertions(+), 72 deletions(-) diff --git a/Bootstrap.Admin/Views/Admin/Settings.cshtml b/Bootstrap.Admin/Views/Admin/Settings.cshtml index eebef18d..73ce81dc 100644 --- a/Bootstrap.Admin/Views/Admin/Settings.cshtml +++ b/Bootstrap.Admin/Views/Admin/Settings.cshtml @@ -6,6 +6,7 @@ @section Javascript { + } @@ -14,28 +15,24 @@ }
系统名称设置
-
-
-
- - - - -
-
+
+
+ + + + +
页脚设置
-
-
-
- - - - -
-
+
+
+ + + + +
@@ -54,7 +51,7 @@
  • 默认样式
  • - +
    diff --git a/Bootstrap.Admin/wwwroot/js/Settings.js b/Bootstrap.Admin/wwwroot/js/Settings.js index 5eed3389..b2d6451e 100644 --- a/Bootstrap.Admin/wwwroot/js/Settings.js +++ b/Bootstrap.Admin/wwwroot/js/Settings.js @@ -1,21 +1,5 @@ $(function () { $('a[data-admin="False"]').hide(); - $('#headerDataForm').autoValidate({ - sysName: { - required: true, - maxlength: 50 - } - }, { - button: ['sysSave'] - }); - $('#footerDataForm').autoValidate({ - sysFoot: { - required: true, - maxlength: 50 - } - }, { - button: ['footSave'] - }); var bsa = new BootstrapAdmin({ url: Settings.url, @@ -27,46 +11,41 @@ Title: "sysName", Footer: "sysFoot" } - }), - click: { - assign: [{ - id: 'sysSave', - click: function (row, data) { - if ($(this).attr('data-valid') == "true") { - $.bc({ - url: Settings.url, data: { name: '网站标题', code: data.Title, category: Settings.title }, title: Settings.title, - callback: function (result) { - if (result) $('#websiteTitle').text(data.Title); - } - }); + }) + }); + + $('button[data-method]').on('click', function (e) { + var $this = $(this); + switch ($this.attr('data-method')) { + case 'footer': + var data = bsa.dataEntity.get(); + $.bc({ + url: Settings.url, data: { name: '网站页脚', code: data.Footer, category: Settings.title }, title: Settings.title, + callback: function (result) { + if (result) $('#websiteFooter').text(data.Footer); } - } - }, { - id: 'footSave', - click: function (row, data) { - if ($(this).attr('data-valid') == "true") { - $.bc({ - url: Settings.url, data: { name: '网站页脚', code: data.Footer, category: Settings.title }, title: Settings.title, - callback: function (result) { - if (result) $('#websiteFooter').text(data.Footer); - } - }); + }); + break; + case 'title': + var data = bsa.dataEntity.get(); + $.bc({ + url: Settings.url, data: { name: '网站标题', code: data.Title, category: Settings.title }, title: Settings.title, + callback: function (result) { + if (result) $('#websiteTitle').text(data.Title); } - } - }, { - id: 'cssSave', - click: function (row, data) { - var cssDefine = $('#dictCssDefine').val(); - $.bc({ - url: Settings.url, data: { name: '使用样式', code: cssDefine, category: '当前样式' }, title: '网站样式', - callback: function (result) { - if (result) { - window.setTimeout(function () { window.location.reload(true); }, 1000); - } + }); + break; + case 'css': + var cssDefine = $('#dictCssDefine').val(); + $.bc({ + url: Settings.url, data: { name: '使用样式', code: cssDefine, category: '当前样式' }, title: '网站样式', + callback: function (result) { + if (result) { + window.setTimeout(function () { window.location.reload(true); }, 1000); } - }); - } - }] + } + }); + break; } });