修复设置主题,刷新后失效的bug,修复主题失效的bug

This commit is contained in:
郑杰
2018-09-20 13:39:51 +08:00
parent 8d58e5d06c
commit daa8f1bf9c
2 changed files with 9 additions and 14 deletions
@@ -153,23 +153,19 @@
</div>
<script th:src="@{'/js/jquery.min.js'}"></script>
<script>
/**
* 默认选中状态
* @type {string}
*/
var themeKey = 'KITADMIN_SETTING_THEME';
var theme = localStorage.getItem(themeKey);
if(theme == null){
$("input[name='setting-theme']")[0].attr("checked","checked");
} else {
var themeName = $.parseJSON(theme).theme;
$(function () {
var themeKey = 'KITADMIN_SETTING_THEME';
var theme = localStorage.getItem(themeKey);
var themeName = "default"
if(theme != null){
themeName = $.parseJSON(theme).theme;
}
$("input[name='setting-theme']").each(function () {
if($(this).parent().attr("data-theme") == themeName){
$(this).attr("checked","checked");
}
})
}
})
layui.use(['form', 'utils'], function () {
var form = layui.form,
$ = layui.jquery,
+1 -2
View File
@@ -129,9 +129,8 @@
*/
var themeKey = 'KITADMIN_SETTING_THEME';
var theme = localStorage.getItem(themeKey);
var themeName = ""
if(theme != null){
themeName = $.parseJSON(theme).theme;
var themeName = $.parseJSON(theme).theme;
var str = $('#theme').attr('href');
var _themeUrl = str.substr(0, str.lastIndexOf('/') + 1);
$('#theme').attr('href', _themeUrl + themeName + '.css');