From 5392423fef02a181d9335acd85b866bb1306227e Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Thu, 17 Nov 2016 15:06:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9A=E7=BD=91?= =?UTF-8?q?=E7=AB=99=E7=BB=B4=E6=8A=A4=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ProfilesController.cs | 5 ---- Bootstrap.Admin/Scripts/Profiles.js | 28 +++++++++++++------ Bootstrap.Admin/Views/Admin/Profiles.cshtml | 28 +++++++++++-------- 3 files changed, 36 insertions(+), 25 deletions(-) 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 @@
系统名称设置
-
- - - - -
+
+
+ + + + +
+
页脚设置
-
- - - - -
+
+
+ + + + +
+