diff --git a/Bootstrap.Admin/Controllers/ProfilesController.cs b/Bootstrap.Admin/Controllers/ProfilesController.cs index 08328812..12ab1c78 100644 --- a/Bootstrap.Admin/Controllers/ProfilesController.cs +++ b/Bootstrap.Admin/Controllers/ProfilesController.cs @@ -1,10 +1,5 @@ using Bootstrap.DataAccess; using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; using System.Web.Http; diff --git a/Bootstrap.Admin/Scripts/Profiles.js b/Bootstrap.Admin/Scripts/Profiles.js index 1f3b96f2..23993fbb 100644 --- a/Bootstrap.Admin/Scripts/Profiles.js +++ b/Bootstrap.Admin/Scripts/Profiles.js @@ -1,5 +1,21 @@ $(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: '../api/Profiles', @@ -16,20 +32,16 @@ assign: [{ id: 'sysSave', click: function (row, data) { - if (data.Title == "") { - swal("请输入网站标题内容", "保存操作", "error"); - return; + if ($(this).attr('data-valid') == "true") { + Profiles.saveWebSite({ name: '网站标题', code: data.Title, category: '网站设置' }); } - Profiles.saveWebSite({ name: '网站标题', code: data.Title, category: '网站设置' }); } }, { id: 'footSave', click: function (row, data) { - if (data.Title == "") { - swal("请输入网站页脚内容", "保存操作", "error"); - return; + if ($(this).attr('data-valid') == "true") { + Profiles.saveWebSite({ name: '网站页脚', code: data.Footer, category: '网站设置' }); } - Profiles.saveWebSite({ name: '网站页脚', code: data.Footer, category: '网站设置' }); } }] } diff --git a/Bootstrap.Admin/Views/Admin/Profiles.cshtml b/Bootstrap.Admin/Views/Admin/Profiles.cshtml index 54f9cd2f..f9ffff26 100644 --- a/Bootstrap.Admin/Views/Admin/Profiles.cshtml +++ b/Bootstrap.Admin/Views/Admin/Profiles.cshtml @@ -23,23 +23,27 @@
系统名称设置
-
- - - - -
+
+
+ + + + +
+
页脚设置
-
- - - - -
+
+
+ + + + +
+