修改更新缓存鼠标悬停样式,以及更改个性化维护页面网站设置保存方式,修复bottom无间隙bug

This commit is contained in:
Argo-Lenovo 2016-11-10 00:47:23 +08:00
parent 382a254c4c
commit 27adf29e82
6 changed files with 101 additions and 145 deletions

View File

@ -169,7 +169,6 @@ ul.sidebar-menu {
.modal-body .checkbox {
padding: 5px;
margin-top: 0;
margin-bottom: 0;
}
.modal-body .checkbox label input[type='checkbox'] {
@ -198,3 +197,13 @@ ul.sidebar-menu {
padding: 8px 20px;
border-left: solid 1px #aeb2b7;
}
/*cache*/
a.cf {
font-size: 15px;
}
a.cf:hover {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear;
}

View File

@ -30,7 +30,7 @@
}
// handler modal window show event
if (this.options.modal.constructor === String) {
if (this.options.modal && this.options.modal.constructor === String) {
$('#' + this.options.modal).on('show.bs.modal', function (e) {
if (that.options.validateForm.constructor === String) {
var v = $('#' + that.options.validateForm).validate();
@ -198,21 +198,27 @@
assign: function (eventSrc, callback) {
var options = this.options;
if (options.bootstrapTable.constructor !== String) return;
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
if (arrselections.length == 0) {
swal('请选择要编辑的数据', "编辑操作", "warning");
}
else if (arrselections.length > 1) {
swal('请选择一个要编辑的数据', "编辑操作", "warning");
}
else {
if ($.isFunction(callback)) {
callback.call(eventSrc, arrselections[0]);
var row = {};
if (options.bootstrapTable && options.bootstrapTable.constructor === String) {
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
if (arrselections.length == 0) {
swal('请选择要编辑的数据', "编辑操作", "warning");
return;
}
else if (arrselections.length > 1) {
swal('请选择一个要编辑的数据', "编辑操作", "warning");
return;
}
else {
row = arrselections[0];
}
}
if ($.isFunction(callback)) {
var data = options.dataEntity;
if (data instanceof DataEntity) data = data.get();
callback.call(eventSrc, row, $.extend({}, data));
}
},
};
var htmlTemplate = '<div class="form-group checkbox col-lg-3 col-xs-4"><label class="tooltips" data-placement="top" data-original-title="{3}" title="{3}"><input type="checkbox" value="{0}" {2}/>{1}</label></div>';
@ -342,4 +348,12 @@
Menu.saveMenusByRoleId = function (roleId, menuIds, callback) {
processData.call(this, { Id: roleId, callback: callback, method: "PUT", data: { type: "role", menuIds: menuIds } });
};
//Profiles
Profiles = {
url: '../api/Profiles/',
title: "个性化维护"
}
Profiles.saveWebSite = function (options) {
processData.call(this, { data: options });
}
})(jQuery);

View File

@ -1,41 +1,23 @@
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;
namespace Bootstrap.Admin.Controllers
{
public class ProfilesController : ApiController
{
// GET api/<controller>
public IEnumerable<string> Get()
{
string sysName = DictHelper.RetrieveWebTitle();
string footer = DictHelper.RetrieveWebFooter();
return new string[] { sysName, footer };
}
// POST api/<controller>
public bool Post([FromBody]JObject value)
{
//保存个性化设置
dynamic json = value;
return DictHelper.SaveProfiles((string)json.type, (string)json.dvalue);
}
// PUT api/<controller>/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/<controller>/5
public void Delete(int id)
{
}
}
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;
namespace Bootstrap.Admin.Controllers
{
public class ProfilesController : ApiController
{
// POST api/<controller>
public bool Post([FromBody]JObject value)
{
//保存个性化设置
dynamic json = value;
return DictHelper.SaveProfiles((string)json.name, (string)json.code, (string)json.category);
}
}
}

View File

@ -1,55 +1,30 @@
$(function () {
var url = "../api/Profiles";
$.ajax({
url: url,
type: 'GET',
success: function (result) {
if (result) {
$('#sysNameSet').val(result[0]);
$('#footSet').val(result[1]);
}
else {
swal("失败", "加载数据失败", "error");
var bsa = new BootstrapAdmin({
url: '../api/Profiles',
bootstrapTable: null,
validateForm: null,
modal: null,
dataEntity: new DataEntity({
map: {
Title: "sysName",
Footer: "sysFoot"
}
}),
click: {
assign: [{
id: 'sysSave',
click: function (row, data) {
Profiles.saveWebSite({ name: '网站标题', code: data.Title, category: '网站设置' });
}
}, {
id: 'footSave',
click: function (row, data) {
Profiles.saveWebSite({ name: '网站页脚', code: data.Footer, category: '网站设置' });
}
}]
}
});
$('#sysSave').click(function () {
var dvalue = $('#sysNameSet').val();
$.ajax({
url: url,
data: { "type": "sysName", "dvalue": dvalue },
type: 'POST',
success: function (result) {
if (result) {
swal("成功", "设置网站标题成功", "success");
}
else {
swal("失败", "设置网站标题失败", "error");
}
}
});
});
$('#footSave').click(function () {
var dvalue = $('#footSet').val();
$.ajax({
url: url,
data: { "type": "foot", "dvalue": dvalue },
type: 'POST',
success: function (result) {
if (result) {
swal("成功", "设置网站页脚成功", "success");
}
else {
swal("失败", "设置网站页脚失败", "error");
}
}
});
});
var html = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp">{2}</span><span class="badge badge-sm label-success">{0}</span><div class="task-wrapper"><span class="task-value tooltips" data-placement="top" data-original-title="{3}">{3}</span></div><div class="pull-right hidden-phone"><button class="btn btn-danger btn-xs fa fa-trash-o tooltips" data-key="{1}" data-placement="left" data-original-title="{1}"></button></div></div></li>';
function listCache(options) {
@ -80,10 +55,5 @@
}
listCache({ url: '../../CacheList.axd' });
$('a.fa-refresh').click(function () { listCache({ url: '../../CacheList.axd' }); });
})

View File

@ -4,7 +4,8 @@
Layout = "~/Views/Shared/_Admin.cshtml";
}
@section Javascript {
<script src="~/Content/js/sweetalert.js"></script>
<script src="~/content/js/sweetalert.js"></script>
<script src="~/content/js/longbow.dataentity.js"></script>
<script src="~/Scripts/Profiles.js"></script>
}
@section css {
@ -16,23 +17,22 @@
@section navigator {
@Html.Partial("Navigator", Model)
}
<div class="panel panel-default">
<div class="panel-heading">系统名称设置</div>
<div class="panel-body">
<div class="input-group">
<input type="text" class="form-control" id="sysNameSet">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="sysSave">保存</button>
</span>
</div>
<div class="input-group form-group">
<input type="text" class="form-control" id="sysName" value="@Model.Title" />
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="sysSave">保存</button>
</span>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">页脚设置</div>
<div class="panel-body">
<div class="input-group">
<input type="text" class="form-control" id="footSet">
<div class="input-group form-group">
<input type="text" class="form-control" id="sysFoot" value="@Model.Footer" />
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="footSave">保存</button>
</span>
@ -40,12 +40,10 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">网站缓存<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></span></div>
<div class="panel-heading">网站缓存<a href="javascript:;" class="cf pull-right tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></div>
<div class="panel-body">
<div class="tasks-widget">
<ul id="sortable" class="task-list ui-sortable"></ul>
</div>
</div>
</div>
</div>

View File

@ -158,41 +158,26 @@ namespace Bootstrap.DataAccess
}
/// <summary>
/// 保存网站个性化设置
/// 2016-11-8
/// </summary>
/// <param name="name"></param>
/// <param name="code"></param>
/// <param name="category"></param>
/// <returns></returns>
public static bool SaveProfiles(string type, string value)
public static bool SaveProfiles(string name, string code, string category)
{
string name="";
string category="网站设置";
switch(type)
{
case "sysName": name = "网站标题"; break;
case "foot": name = "网站页脚"; break;
}
var settings = DictHelper.RetrieveWebSettings();
var p = from ps in settings
where ps.Name.Equals(name)
select new
{
ID=ps.ID
};
var ret = false;
string sql = "Update Dicts set Code = @Code where Category =@Category and Name=@Name";
string sql = "Update Dicts set Code = @Code where Category = @Category and Name = @Name";
try
{
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
{
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Code", value, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Name", name, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Code", code, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Category", category, ParameterDirection.Input));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Name", name, ParameterDirection.Input));
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
}
CacheManager.Clear(key => key == RetrieveWebSettingsDataKey);
ret = true;
foreach(var px in p)
CacheCleanUtility.ClearCache(dictIds:px.ID.ToString());
}
catch (DbException ex)
{
@ -200,7 +185,5 @@ namespace Bootstrap.DataAccess
}
return ret;
}
}
}