server-status主题优化 (#405)

* server-status主题优化
1.前台增加半透明样式切换按钮,同时适配了深色和浅色模式
2.右小角功能区增加收纳,点击展开,滚动页面关闭
3.vps世界分布地图全屏展示
4.修改默认页底版权信息位置,从跟随container box修改为默认置于页面底部,container box到底底部后再跟随
5.修改container box默认宽度和最大宽度,适配高分辨率显示器
6.优化样式文件结构,删除无用的样式文件
7.一些小优化

* 修改默认背景图

* 修改背景图片

* 1.echart图表适配半透明样式切换
2.echart图表移动端设置更细折线
3.修改半透明样式下的默认背景图

* echart Y轴移动端更细刻度线

* fixbug

* 修改半透明样式默认背景图片为本地调用
This commit is contained in:
nap0o
2024-08-09 09:49:45 -04:00
committed by GitHub
parent 6b05a21641
commit d9097540c3
18 changed files with 659 additions and 609 deletions

View File

@@ -1,12 +1,14 @@
const mixinsVue = {
data: {
cache: [],
isMobile: false,
theme: "light",
isSystemTheme: false,
showGroup: false,
showGoTop: false,
showTools: false,
preferredTemplate: null,
isMobile: false,
semiTransparent: false,
staticUrl: '/static/theme-server-status',
adaptedTemplates: [
{ key: 'default', name: 'Default', icon: 'th large' },
@@ -18,6 +20,7 @@ const mixinsVue = {
this.isMobile = this.checkIsMobile();
this.theme = this.initTheme();
this.showGroup = this.initShowGroup();
this.semiTransparent = this.initSemiTransparent();
this.preferredTemplate = this.getCookie('preferred_theme') ? this.getCookie('preferred_theme') : this.$root.defaultTemplate;
window.addEventListener('scroll', this.handleScroll);
},
@@ -32,6 +35,9 @@ const mixinsVue = {
window.location.reload();
}
},
toggleShowTools() {
this.showTools = !this.showTools;
},
initTheme() {
const storedTheme = localStorage.getItem("theme");
const theme = (storedTheme === 'dark' || storedTheme === 'light') ? storedTheme : (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
@@ -64,6 +70,21 @@ const mixinsVue = {
this.$root.initTooltip();
}
},
initSemiTransparent() {
const storedSemiTransparent = localStorage.getItem("semiTransparent");
const semiTransparent = storedSemiTransparent !== null ? JSON.parse(storedSemiTransparent) : false;
if (storedSemiTransparent === null) {
localStorage.setItem("semiTransparent", semiTransparent);
}
return semiTransparent;
},
toggleSemiTransparent(){
this.semiTransparent = !this.semiTransparent;
localStorage.setItem("semiTransparent", this.semiTransparent);
if(this.$root.page == 'index') {
this.reloadCharts(); // 重新载入echarts图表
}
},
updateCookie(name, value) {
document.cookie = name + "=" + value +"; path=/";
},
@@ -106,6 +127,7 @@ const mixinsVue = {
},
handleScroll() {
this.showGoTop = window.scrollY >= 100;
if(this.showTools) this.showTools = false;
},
groupingData(data, field) {
let map = new Map();