修改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 Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

View File

@ -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: '网站设置' });
}
}]
}

View File

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