diff --git a/public/config.js b/public/config.js
index fb731ca..0c99c80 100644
--- a/public/config.js
+++ b/public/config.js
@@ -3,6 +3,8 @@ window.$$nazhuaConfig = {
// freeAmount: '白嫖', // 免费服务的费用名称
// infinityCycle: '长期有效', // 无限周期名称
// buyBtnText: '购买', // 购买按钮文案
+ // customBackgroundImage: '', // 自定义的背景图片地址
+ // lightBackground: true, // 启用了浅色系背景图,会强制关闭点点背景
// listServerItemType: 'row', // 服务器列表项类型 card/row row列表模式移动端自动切换至card
// listServerStatusType: 'progress', // 服务器状态类型--列表
// listServerRealTimeShowLoad: false, // 列表显示服务器实时负载
diff --git a/readme.md b/readme.md
index 835f1e6..4c8673a 100644
--- a/readme.md
+++ b/readme.md
@@ -185,6 +185,8 @@ window.$$nazhuaConfig = {
freeAmount: '白嫖', // 免费服务的费用名称
infinityCycle: '长期有效', // 无限周期名称
buyBtnText: '购买', // 购买按钮文案
+ customBackgroundImage: '', // 自定义的背景图片地址
+ lightBackground: true, // 启用了浅色系背景图,会强制关闭点点背景
listServerItemType: 'row', // 服务器列表项类型 card/row row列表模式目前不兼容移动端
listServerStatusType: 'progress', // 服务器状态类型--列表
listServerRealTimeShowLoad: false, // 列表显示服务器实时负载
diff --git a/src/App.vue b/src/App.vue
index 2948965..0be9a15 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,10 @@
-
+
+
+
+
+
diff --git a/src/components/charts/donut.js b/src/components/charts/donut.js
index 7f1168a..a009836 100644
--- a/src/components/charts/donut.js
+++ b/src/components/charts/donut.js
@@ -1,5 +1,5 @@
import { use } from 'echarts/core';
-import { CanvasRenderer } from 'echarts/renderers';
+import { SVGRenderer } from 'echarts/renderers';
import {
BarChart,
} from 'echarts/charts';
@@ -10,7 +10,7 @@ import {
import config from '@/config';
use([
- CanvasRenderer,
+ SVGRenderer,
BarChart,
PolarComponent,
]);
@@ -80,8 +80,16 @@ export default (used, total, itemColors, size = 100) => ({
itemStyle: {
color: typeof itemColors === 'string' ? itemColors : handleColor(itemColors?.used),
borderRadius: 5,
- shadowColor: config.nazhua.serverStatusLinear ? 'rgba(0, 0, 0, 0.5)' : undefined,
- shadowBlur: config.nazhua.serverStatusLinear ? 10 : undefined,
+ shadowColor: (() => {
+ if (config.nazhua.serverStatusLinear) {
+ return 'rgba(0, 0, 0, 0.5)';
+ }
+ if (config.nazhua.lightBackground) {
+ return 'rgba(0, 0, 0, 0.2)';
+ }
+ return undefined;
+ })(),
+ shadowBlur: (config.nazhua.serverStatusLinear || config.nazhua.lightBackground) ? 10 : undefined,
},
coordinateSystem: 'polar',
cursor: 'default',
diff --git a/src/components/charts/line.js b/src/components/charts/line.js
index 491713f..28b902b 100644
--- a/src/components/charts/line.js
+++ b/src/components/charts/line.js
@@ -1,5 +1,5 @@
import { use } from 'echarts/core';
-import { CanvasRenderer } from 'echarts/renderers';
+import { SVGRenderer } from 'echarts/renderers';
import { LineChart } from 'echarts/charts';
import {
TooltipComponent,
@@ -12,7 +12,7 @@ import dayjs from 'dayjs';
import config from '@/config';
use([
- CanvasRenderer,
+ SVGRenderer,
LineChart,
TooltipComponent,
// LegendComponent,
diff --git a/src/components/dot-dot-box.vue b/src/components/dot-dot-box.vue
index 5d334e4..a594356 100644
--- a/src/components/dot-dot-box.vue
+++ b/src/components/dot-dot-box.vue
@@ -2,7 +2,7 @@
@@ -16,6 +16,7 @@
*/
import { computed } from 'vue';
+import config from '@/config';
const props = defineProps({
borderRadius: {
@@ -32,6 +33,10 @@ const props = defineProps({
},
});
+const lightBackground = computed(() => config.nazhua.lightBackground);
+
+const hideDotBG = computed(() => lightBackground.value || config.nazhua?.hideDotBG === true);
+
const boxStyle = computed(() => {
const style = {};
if (props.borderRadius) {
@@ -68,9 +73,14 @@ const boxStyle = computed(() => {
backdrop-filter: saturate(50%) blur(3px);
&--hide {
- background-color: rgba(#000, 0.8);
+ background-color: rgba(#000, 0.5);
background-image: none;
backdrop-filter: none;
+ transition: all 0.3s linear;
+
+ &:hover {
+ background-color: rgba(#000, 0.8);
+ }
}
@media screen and (max-width: 768px) {
diff --git a/src/components/world-map/world-map.vue b/src/components/world-map/world-map.vue
index ee54982..39e236f 100644
--- a/src/components/world-map/world-map.vue
+++ b/src/components/world-map/world-map.vue
@@ -1,6 +1,9 @@
@@ -39,6 +42,7 @@ import {
computed,
watch,
} from 'vue';
+import config from '@/config';
import validate from '@/utils/validate';
import WorldMapPoint from './world-map-point.vue';
@@ -63,37 +67,46 @@ const props = defineProps({
},
});
+const lightBackground = computed(() => config.nazhua.lightBackground);
+const boxPadding = computed(() => (lightBackground.value ? 20 : 0));
+
// 计算地图大小 保持1280:621的比例 保证地图不变形
const computedSize = computed(() => {
+ // 考虑内边距,从总宽高中减去padding
+ const adjustedWidth = Number(props.width) - (boxPadding.value * 2);
+ const adjustedHeight = Number(props.height) - (boxPadding.value * 2);
+
if (!validate.isEmpty(props.width) && !validate.isEmpty(props.height)) {
return {
width: 1280,
height: 621,
};
}
- const width = Number(props.width);
- const height = Number(props.height);
+
if (!validate.isEmpty(props.width) && validate.isEmpty(props.height)) {
return {
- width,
- height: Math.ceil((621 / 1280) * width),
+ width: adjustedWidth,
+ height: Math.ceil((621 / 1280) * adjustedWidth),
};
}
+
if (validate.isEmpty(props.width) && !validate.isEmpty(props.height)) {
return {
- width: Math.ceil((1280 / 621) * height),
- height,
+ width: Math.ceil((1280 / 621) * adjustedHeight),
+ height: adjustedHeight,
};
}
- if (width / height > 1280 / 621) {
+
+ if (adjustedWidth / adjustedHeight > 1280 / 621) {
return {
- width: Math.ceil(height * (1280 / 621)),
- height,
+ width: Math.ceil(adjustedHeight * (1280 / 621)),
+ height: adjustedHeight,
};
}
+
return {
- width,
- height: Math.ceil(width * (621 / 1280)),
+ width: adjustedWidth,
+ height: Math.ceil(adjustedWidth * (621 / 1280)),
};
});
@@ -118,8 +131,8 @@ function computeMapPoints() {
const points = props.locations.map((i) => {
const item = {
key: i.key,
- left: (computedSize.value.width / 1280) * i.x,
- top: (computedSize.value.height / 621) * i.y,
+ left: (computedSize.value.width / 1280) * i.x + boxPadding.value,
+ top: (computedSize.value.height / 621) * i.y + boxPadding.value,
size: i.size || 4,
label: i.label,
servers: i.servers,
@@ -219,6 +232,30 @@ function handlePointTap(e) {
height: var(--world-map-height, 621px);
position: relative;
+ &--light-background {
+ padding: 20px;
+ background: rgba(#000, 0.6);
+ border-radius: 12px;
+ box-sizing: content-box;
+ transition: background-color 0.3s linear;
+
+ .world-map-img {
+ opacity: 1;
+ }
+
+ &:hover {
+ background: rgba(#000, 0.9);
+ }
+
+ @media screen and (max-width: 768px) {
+ background: rgba(#000, 0.8);
+
+ &:hover {
+ background: rgba(#000, 0.8);
+ }
+ }
+ }
+
.world-map-img {
width: var(--world-map-width, 1280px);
height: var(--world-map-height, 621px);
diff --git a/src/layout/components/header.vue b/src/layout/components/header.vue
index e530404..621b577 100644
--- a/src/layout/components/header.vue
+++ b/src/layout/components/header.vue
@@ -143,6 +143,8 @@ const store = useStore();
const route = useRoute();
const router = useRouter();
+const lightBackground = computed(() => config.nazhua.lightBackground);
+
const headerStyle = computed(() => {
const style = {};
if (route.name === 'ServerDetail') {
@@ -267,6 +269,9 @@ const headerClass = computed(() => {
if (showServerCount.value) {
classes.push('layout-header--show-server-count');
}
+ if (lightBackground.value) {
+ classes.push('layout-header--light-background');
+ }
return classes;
});
@@ -304,6 +309,12 @@ const dashboardUrl = computed(() => config.nazhua.v1DashboardUrl || '/dashboard'
}
}
+ &--light-background {
+ background-color: rgba(#000, 0.7);
+ background-image: none;
+ backdrop-filter: none;
+ }
+
.site-name {
line-height: calc(var(--layout-header-height) - 20px);
font-size: 24px;
diff --git a/src/layout/main.vue b/src/layout/main.vue
index 99463f9..d57810d 100644
--- a/src/layout/main.vue
+++ b/src/layout/main.vue
@@ -1,6 +1,12 @@
-
-
+
+
@@ -13,8 +19,27 @@
/**
* LayoutMain
*/
+import { computed } from 'vue';
+import config from '@/config';
import LayoutHeader from './components/header.vue';
import LayoutFooter from './components/footer.vue';
+
+const layoutGroupStyle = computed(() => {
+ const style = {};
+ if (config.nazhua.lightBackground) {
+ style['--layout-main-bg-color'] = 'rgba(20, 30, 40, 0.2)';
+ }
+ return style;
+});
+
+const layoutBGStyle = computed(() => {
+ const style = {};
+ if (config.nazhua.customBackgroundImage) {
+ style.background = `url(${config.nazhua.customBackgroundImage}) 50% 50%`;
+ style.backgroundSize = 'cover';
+ }
+ return style;
+});