修改BUG:设置网站页头页脚成功后立即更新网页元素

This commit is contained in:
Argo-Lenovo 2016-11-18 11:58:54 +08:00
parent dd66ea77a6
commit 1bb654d626
5 changed files with 28 additions and 27 deletions

View File

@ -23,7 +23,7 @@
}, 200);
});
$('footer > div > span').text($('#footer').val());
$('#websiteFooter').text($('#footer').val());
$('#sidebar .sub-menu > a').click(function () {
var o = ($(this).offset());

View File

@ -289,6 +289,9 @@
}
}
};
window.bd = processData;
// Roles
Role = {
url: '../api/Roles/',
@ -405,15 +408,6 @@
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 });
};
// Exceptions
Exceptions = {
url: '../api/Exceptions/',

View File

@ -17,8 +17,10 @@
button: ['footSave']
});
var options = { url: '../api/Profiles', title: '网站设置' };
var bsa = new BootstrapAdmin({
url: '../api/Profiles',
url: options.url,
bootstrapTable: null,
validateForm: null,
modal: null,
@ -33,50 +35,55 @@
id: 'sysSave',
click: function (row, data) {
if ($(this).attr('data-valid') == "true") {
Profiles.saveWebSite({ name: '网站标题', code: data.Title, category: '网站设置' });
var op = $.extend({
data: { name: '网站标题', code: data.Title, category: '网站设置' },
callback: function (result) {
$('#websiteTitle').text(data.Title);
}
}, options)
bd(op);
}
}
}, {
id: 'footSave',
click: function (row, data) {
if ($(this).attr('data-valid') == "true") {
Profiles.saveWebSite({ name: '网站页脚', code: data.Footer, category: '网站设置' });
var op = $.extend({
data: { name: '网站页脚', code: data.Footer, category: '网站设置' },
callback: function (result) {
$('#websiteFooter').text(data.Footer);
}
}, options)
bd(op);
}
}
}]
}
});
var html = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp tooltips" data-placement="right" title="{1}">{2}</span><span class="badge badge-sm label-success">{0}</span><span class="task-value tooltips" data-placement="top" data-original-title="{3}">{3}</span><div class="pull-right hidden-phone"><button class="btn btn-danger btn-xs fa fa-trash-o" data-key="{1}"></button></div></div></li>';
function listCache(options) {
options = $.extend({ url: '../../CacheList.axd' }, options);
$.ajax({
bd({
url: options.url,
type: 'POST',
success: function (result) {
swal: false,
callback: function (result) {
if (result) {
result = $.parseJSON(result);
if ($.isArray(result)) {
var html = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp tooltips" data-placement="right" title="{1}">{2}</span><span class="badge badge-sm label-success">{0}</span><span class="task-value tooltips" data-placement="top" data-original-title="{3}">{3}</span><div class="pull-right hidden-phone"><button class="btn btn-danger btn-xs fa fa-trash-o" data-key="{1}"></button></div></div></li>';
var content = result.map(function (ele) {
return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value);
}).join('');
$('#sortable').html(content);
$('.tooltips').tooltip();
$('#sortable .btn').click(function () {
var key = $(this).attr('data-key');
listCache({ url: $.format('../../CacheList.axd?cacheKey={0}', key) });
listCache({ url: $.format('../../CacheList.axd?cacheKey={0}', $(this).attr('data-key')) });
});
}
}
else {
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
}
});
}
listCache();
$('#refreshCache').click(function () { listCache(); });
$('#clearCache').click(function () { listCache({ url: '../../CacheList.axd?clear=clear' }); });

View File

@ -1,7 +1,7 @@
<!--footer start-->
<footer class="site-footer">
<div class="text-center">
<span></span>
<span id="websiteFooter"></span>
<a href="#" class="go-top tooltips" data-placement="left" data-original-title="返回顶部">
<i class="fa fa-angle-up"></i>
</a>

View File

@ -4,7 +4,7 @@
<a id="navbar" href="#" class="sidebar-toggle-box">
<i class="fa fa-bars"></i>
<!--logo start-->
<span>@Model.Title</span>
<span id="websiteTitle">@Model.Title</span>
</a>
<!--logo end-->
@if (Model.Menus.Count() > 0 && Model.ShowMenu)