* fix bugs

1. 修复default主题mixin.js文件丢失
2. 修复主题默认值为后台设置值
3. default主题样式优化

* 修复前台切换 theme-custom 不生效
This commit is contained in:
nap0o
2024-02-25 20:31:16 -05:00
committed by GitHub
parent e24925b049
commit ab39782c78
16 changed files with 104 additions and 15 deletions

View File

@@ -86,21 +86,35 @@ td {
margin-right: 0;
}
.ui.grid {
margin-bottom:-0.5em
}
.ui.card>.content>.header:not(.ui), .ui.cards>.card>.content>.header:not(.ui){
line-height: 1em;
}
.status.cards .wide.column {
padding-top: 0 !important;
padding-bottom: 0 !important;
height:3.3rem !important;
height:2.3rem !important;
}
.status.cards .wide.column:nth-child(1) {
margin-top:2rem !important;
margin-top:1.2rem !important;
}
.status.cards .wide.column:nth-child(2) {
margin-top:2rem !important;
margin-top:1.2rem !important;
}
.status.cards .three.wide.column {
text-align: center;
width: 22%!important;
}
.status.cards .thirteen.wide.column{
width: 78%!important;
padding-left:0;
}
@@ -124,7 +138,7 @@ td {
.closePopup{
color:rgb(10, 148, 242) !important;
position: absolute;
top: 10px;
top: 7px;
right: 10px;
cursor: pointer;
z-index: 9999;
@@ -194,6 +208,7 @@ td {
}
.nezha-secondary-font {
height: 1em;
color: rgb(10, 148, 242) !important;
}

View File

@@ -0,0 +1,56 @@
const mixinsVue = {
delimiters: ['@#', '#@'],
data: {
preferredTemplate: null,
isMobile: false
},
created() {
this.isMobile = this.checkIsMobile();
this.preferredTemplate = this.getCookie('preferred_theme') ? this.getCookie('preferred_theme') : this.$root.defaultTemplate;
},
methods: {
toggleTemplate(template) {
if( template != this.preferredTemplate){
this.preferredTemplate = template;
this.updateCookie("preferred_theme", template);
window.location.reload();
}
},
updateCookie(name, value) {
document.cookie = name + "=" + value +"; path=/";
},
getCookie(name) {
const cookies = document.cookie.split(';');
let cookieValue = null;
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
if (cookie.startsWith(name + '=')) {
cookieValue = cookie.substring(name.length + 1, cookie.length);
break;
}
}
return cookieValue;
},
checkIsMobile() { // 检测设备类型,页面宽度小于768px认为是移动设备
return window.innerWidth <= 768;
},
logOut(id) {
$.ajax({
type: 'POST',
url: '/api/logout',
data: JSON.stringify({ id: id }),
contentType: 'application/json',
success: function (resp) {
if (resp.code == 200) {
window.location.reload();
} else {
alert('注销失败(Error ' + resp.code + '): ' + resp.message);
}
},
error: function (err) {
alert('网络错误: ' + err.responseText);
}
});
}
}
}

View File

@@ -5,14 +5,14 @@ const mixinsVue = {
isSystemTheme: false,
showGroup: false,
showGoTop: false,
preferredTemplate: 'default',
preferredTemplate: null,
isMobile: false
},
created() {
this.isMobile = this.checkIsMobile();
this.initTheme();
this.storedShowGroup();
this.preferredTemplate = this.getCookie('preferred_theme') ? this.getCookie('preferred_theme') : 'default';
this.preferredTemplate = this.getCookie('preferred_theme') ? this.getCookie('preferred_theme') : this.$root.defaultTemplate;
window.addEventListener('scroll', this.handleScroll);
},
destroyed() {