修改BUG:网站维护页面增加客户端验证

This commit is contained in:
Argo-Lenovo 2016-11-17 15:06:35 +08:00
parent 77b1d48162
commit 5392423fef
3 changed files with 36 additions and 25 deletions

View File

@ -1,10 +1,5 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http; using System.Web.Http;

View File

@ -1,5 +1,21 @@
$(function () { $(function () {
$('a[data-admin="False"]').hide(); $('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({ var bsa = new BootstrapAdmin({
url: '../api/Profiles', url: '../api/Profiles',
@ -16,21 +32,17 @@
assign: [{ assign: [{
id: 'sysSave', id: 'sysSave',
click: function (row, data) { click: function (row, data) {
if (data.Title == "") { if ($(this).attr('data-valid') == "true") {
swal("请输入网站标题内容", "保存操作", "error");
return;
}
Profiles.saveWebSite({ name: '网站标题', code: data.Title, category: '网站设置' }); Profiles.saveWebSite({ name: '网站标题', code: data.Title, category: '网站设置' });
} }
}
}, { }, {
id: 'footSave', id: 'footSave',
click: function (row, data) { click: function (row, data) {
if (data.Title == "") { if ($(this).attr('data-valid') == "true") {
swal("请输入网站页脚内容", "保存操作", "error");
return;
}
Profiles.saveWebSite({ name: '网站页脚', code: data.Footer, category: '网站设置' }); Profiles.saveWebSite({ name: '网站页脚', code: data.Footer, category: '网站设置' });
} }
}
}] }]
} }
}); });

View File

@ -23,23 +23,27 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">系统名称设置</div> <div class="panel-heading">系统名称设置</div>
<div class="panel-body"> <div class="panel-body">
<div class="input-group form-group"> <form id="headerDataForm" name="headerDataForm" class="form-inline" role="form">
<input type="text" class="form-control" id="sysName" placeholder="请输入网站标题" value="@Model.Title" /> <div class="input-group form-group col-xs-12">
<input type="text" class="form-control" id="sysName" name="sysName" placeholder="请输入网站标题" value="@Model.Title" />
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type="button" id="sysSave">保存</button> <button class="btn btn-default" type="button" id="sysSave">保存</button>
</span> </span>
</div> </div>
</form>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">页脚设置</div> <div class="panel-heading">页脚设置</div>
<div class="panel-body"> <div class="panel-body">
<div class="input-group form-group"> <form id="footerDataForm" name="footerDataForm" class="form-inline" role="form">
<input type="text" class="form-control" id="sysFoot" placeholder="请输入网站页脚" value="@Model.Footer" /> <div class="input-group form-group col-xs-12">
<input type="text" class="form-control" id="sysFoot" name="sysFoot" placeholder="请输入网站页脚" value="@Model.Footer" />
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type="button" id="footSave">保存</button> <button class="btn btn-default" type="button" id="footSave">保存</button>
</span> </span>
</div> </div>
</form>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">