mirror of https://github.com/halo-dev/halo
🎨 更改主题设置代码结构
parent
bc1a0918a8
commit
b394677a50
|
@ -75,31 +75,6 @@ function initMenu() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提示框
|
||||
* @param text
|
||||
* @param icon
|
||||
* @param hideAfter
|
||||
*/
|
||||
function showMsg(text, icon, hideAfter) {
|
||||
if(heading==undefined){
|
||||
var heading = "提示";
|
||||
}
|
||||
$.toast({
|
||||
text: text,
|
||||
heading: heading,
|
||||
icon: icon,
|
||||
showHideTransition: 'fade',
|
||||
allowToastClose: true,
|
||||
hideAfter: hideAfter,
|
||||
stack: 1,
|
||||
position: 'top-center',
|
||||
textAlign: 'left',
|
||||
loader: true,
|
||||
loaderBg: '#ffffff'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通提示框
|
||||
*
|
||||
|
@ -185,6 +160,36 @@ $.halo.prototype.showMsgAndRedirect = function (text, icon, hideAfter, url) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 提示之后 父页面重定向
|
||||
* @param text text
|
||||
* @param icon icon
|
||||
* @param hideAfter hideAfter
|
||||
* @param url url
|
||||
*/
|
||||
$.halo.prototype.showMsgAndParentRedirect = function (text, icon, hideAfter, url) {
|
||||
if (heading == undefined) {
|
||||
var heading = "提示";
|
||||
}
|
||||
$.toast({
|
||||
text: text,
|
||||
heading: heading,
|
||||
icon: icon,
|
||||
showHideTransition: 'fade',
|
||||
allowToastClose: true,
|
||||
hideAfter: hideAfter,
|
||||
stack: 1,
|
||||
position: 'top-center',
|
||||
textAlign: 'left',
|
||||
loader: true,
|
||||
loaderBg: '#ffffff',
|
||||
afterHidden: function () {
|
||||
parent.location.href = url;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 格式化字符串
|
||||
*
|
||||
|
|
|
@ -31,6 +31,12 @@
|
|||
<script src="/static/js/halo.js"></script>
|
||||
<#nested />
|
||||
<script>
|
||||
var halo = new $.halo();
|
||||
var heading = "<@spring.message code='common.text.tips' />";
|
||||
/**
|
||||
* 保存设置选项
|
||||
* @param option option
|
||||
*/
|
||||
function saveThemeOptions(option) {
|
||||
var param = $('#'+option).serialize();
|
||||
$.ajax({
|
||||
|
@ -39,17 +45,22 @@
|
|||
data: param,
|
||||
success: function (data) {
|
||||
if(data.code==1){
|
||||
showMsg(data.msg,"success",1000);
|
||||
halo.showMsg(data.msg, "success", 1000);
|
||||
}else{
|
||||
showMsg(data.msg,"error",1000);
|
||||
halo.showMsg(data.msg, "error", 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有附件
|
||||
* @param id id
|
||||
*/
|
||||
function openAttach(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '所有附件',
|
||||
title: '<@spring.message code="common.js.all-attachment" />',
|
||||
shadeClose: true,
|
||||
shade: 0.5,
|
||||
area: ['90%', '90%'],
|
||||
|
@ -57,6 +68,28 @@
|
|||
scrollbar: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主题
|
||||
*/
|
||||
function updateTheme(theme, e) {
|
||||
$(e).button('loading');
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/admin/themes/pull',
|
||||
data: {
|
||||
'themeName': theme
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
halo.showMsgAndParentRedirect(data.msg, 'success', 1000, '/admin/themes');
|
||||
} else {
|
||||
halo.showMsg(data.msg, 'error', 2000);
|
||||
$(e).button('reset');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
</#macro>
|
||||
|
|
Loading…
Reference in New Issue