Compare commits

..

No commits in common. "b235be5fa1735d830e167549ef51fc410ef2d173" and "8a53dcbb0fe7feb3cf260b62611961a31271c38e" have entirely different histories.

10 changed files with 25 additions and 143 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "nazhua", "name": "nazhua",
"version": "0.4.19", "version": "0.4.18",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -6,7 +6,6 @@ window.$$nazhuaConfig = {
// listServerStatusType: 'progress', // 服务器状态类型--列表 // listServerStatusType: 'progress', // 服务器状态类型--列表
// listServerRealTimeShowLoad: false, // 列表显示服务器实时负载 // listServerRealTimeShowLoad: false, // 列表显示服务器实时负载
// detailServerStatusType: 'progress', // 服务器状态类型--详情页 // detailServerStatusType: 'progress', // 服务器状态类型--详情页
// serverStatusLinear: true, // 服务器状态渐变线性显示
// disableSarasaTermSC: false, // 禁用Sarasa Term SC字体 // disableSarasaTermSC: false, // 禁用Sarasa Term SC字体
// hideWorldMap: false, // 隐藏地图 // hideWorldMap: false, // 隐藏地图
// hideHomeWorldMap: false, // 隐藏首页地图 // hideHomeWorldMap: false, // 隐藏首页地图

View File

@ -25,7 +25,8 @@
--list-item-price-color: #eee; --list-item-price-color: #eee;
--list-item-buy-link-color: #ffc300; --list-item-buy-link-color: #ffc300;
--public-note-tag-color: #ddd; --public-note-tag-color: #ccc;
// --public-note-tag-bg: #6a7efc;
--public-note-tag-bg: linear-gradient(125deg, #8f94fb, #4e54c8); --public-note-tag-bg: linear-gradient(125deg, #8f94fb, #4e54c8);
// 针对1440px以下的屏幕 // 针对1440px以下的屏幕

View File

@ -7,34 +7,12 @@ import {
PolarComponent, PolarComponent,
} from 'echarts/components'; } from 'echarts/components';
import config from '@/config';
use([ use([
CanvasRenderer, CanvasRenderer,
BarChart, BarChart,
PolarComponent, PolarComponent,
]); ]);
function handleColor(color) {
if (Array.isArray(color)) {
return {
type: 'linear',
x: 1,
y: 1,
x2: 0,
y2: 0,
colorStops: [{
offset: 0,
color: color[0], // 0% 处的颜色
}, {
offset: 1,
color: color[1], // 100% 处的颜色
}],
};
}
return color;
}
export default (used, total, itemColors, size = 100) => ({ export default (used, total, itemColors, size = 100) => ({
angleAxis: { angleAxis: {
max: total, // 满分 max: total, // 满分
@ -78,10 +56,11 @@ export default (used, total, itemColors, size = 100) => ({
value: used, value: used,
}], }],
itemStyle: { itemStyle: {
color: typeof itemColors === 'string' ? itemColors : handleColor(itemColors?.used), color: typeof itemColors === 'string' ? itemColors : itemColors?.used,
borderRadius: 5, borderRadius: 5,
shadowColor: config.nazhua.serverStatusLinear ? 'rgba(0, 0, 0, 0.5)' : undefined, shadowColor: 'rgba(0, 0, 0, 0.2)',
shadowBlur: config.nazhua.serverStatusLinear ? 10 : undefined, shadowBlur: 10,
shadowOffsetY: 2,
}, },
coordinateSystem: 'polar', coordinateSystem: 'polar',
cursor: 'default', cursor: 'default',
@ -95,7 +74,7 @@ export default (used, total, itemColors, size = 100) => ({
value: total, value: total,
}], }],
itemStyle: { itemStyle: {
color: handleColor(itemColors?.total) || 'rgba(255, 255, 255, 0.2)', color: itemColors?.total || 'rgba(255, 255, 255, 0.2)',
}, },
coordinateSystem: 'polar', coordinateSystem: 'polar',
cursor: 'default', cursor: 'default',

View File

@ -190,7 +190,7 @@ const tipsContentStyle = computed(() => {
style.left = `${activeTipsXY.value.x}px`; style.left = `${activeTipsXY.value.x}px`;
style.transform = 'translate(-50%, 20px)'; style.transform = 'translate(-50%, 20px)';
} else { } else {
style.bottom = '4px'; style.bottom = '10px';
style.left = '50%'; style.left = '50%';
style.transform = 'translate(-50%, 0)'; style.transform = 'translate(-50%, 0)';
} }
@ -232,11 +232,11 @@ function handlePointTap(e) {
padding: 5px 10px; padding: 5px 10px;
border-radius: 5px; border-radius: 5px;
line-height: 20px; line-height: 20px;
white-space: pre;
color: #eee; color: #eee;
background: rgba(#000, 0.8); background: rgba(#000, 0.8);
box-shadow: 1px 4px 8px rgba(#303841, 0.4); box-shadow: 1px 4px 8px rgba(#303841, 0.4);
z-index: 100; z-index: 100;
white-space: pre;
// //
&::before { &::before {
@ -250,15 +250,6 @@ function handlePointTap(e) {
border-bottom-color: rgba(#000, 0.8); border-bottom-color: rgba(#000, 0.8);
transform: translateX(-50%); transform: translateX(-50%);
} }
@media screen and (max-width: 500px) {
line-height: 16px;
font-size: 12px;
&::before {
display: none;
}
}
} }
} }

View File

@ -120,8 +120,8 @@ const codeMaps = {
country: '美国', country: '美国',
}, },
MIA: { MIA: {
x: 237, x: 243,
y: 249, y: 244,
name: '迈阿密', name: '迈阿密',
country: '美国', country: '美国',
}, },
@ -137,48 +137,12 @@ const codeMaps = {
name: '纽约', name: '纽约',
country: '美国', country: '美国',
}, },
DFW: {
x: 172,
y: 211,
name: '达拉斯',
country: '美国',
},
ATL: {
x: 225,
y: 205,
name: '亚特兰大',
country: '美国',
},
HNL: {
x: 28,
y: 270,
name: '檀香山',
country: '美国',
},
YYZ: { YYZ: {
x: 267, x: 267,
y: 161, y: 161,
name: '多伦多', name: '多伦多',
country: '加拿大', country: '加拿大',
}, },
MEX: {
x: 158,
y: 280,
name: '墨西哥城',
country: '墨西哥',
},
SCQ: {
x: 289,
y: 513,
name: '圣地亚哥',
country: '智利',
},
GRU: {
x: 370,
y: 473,
name: '圣保罗',
country: '巴西',
},
SYD: { SYD: {
x: 1167, x: 1167,
y: 519, y: 519,
@ -203,12 +167,6 @@ const codeMaps = {
name: '法兰克福', name: '法兰克福',
country: '德国', country: '德国',
}, },
BER: {
x: 620,
y: 130,
name: '柏林',
country: '德国',
},
LUX: { LUX: {
x: 591, x: 591,
y: 140, y: 140,
@ -221,24 +179,6 @@ const codeMaps = {
name: '巴黎', name: '巴黎',
country: '法国', country: '法国',
}, },
WAW: {
name: '华沙',
country: '波兰',
x: 649,
y: 123,
},
MAD: {
name: '马德里',
country: '西班牙',
x: 554,
y: 180,
},
MXP: {
name: '米兰',
country: '意大利',
x: 604,
y: 153,
},
SVO: { SVO: {
x: 704, x: 704,
y: 115, y: 115,
@ -295,13 +235,6 @@ export const countryCodeMapping = {
GB: 'LON', GB: 'LON',
AU: 'SYD', AU: 'SYD',
US: 'LAX', US: 'LAX',
CA: 'YYZ',
MX: 'MEX',
CL: 'SCQ',
BR: 'GRU',
IT: 'MXP',
ES: 'MAD',
PL: 'WAW',
}; };
export default codeMaps; export default codeMaps;

View File

@ -427,7 +427,7 @@ onUnmounted(() => {
.switch-dot { .switch-dot {
left: 16px; left: 16px;
box-shadow: 1px 1px 2px rgba(#000, 0.4); box-shadow: 1px 1px 2px #000;
} }
} }
} }
@ -497,7 +497,7 @@ onUnmounted(() => {
&.active { &.active {
color: #fff; color: #fff;
text-shadow: 1px 1px 2px rgba(#000, 0.6); text-shadow: 1px 1px 2px #000;
} }
} }

View File

@ -75,11 +75,7 @@ const progressStyle = computed(() => {
style.width = `${Math.min(props.used, 100)}%`; style.width = `${Math.min(props.used, 100)}%`;
const color = typeof props.colors === 'string' ? props.colors : props.colors?.used; const color = typeof props.colors === 'string' ? props.colors : props.colors?.used;
if (color) { if (color) {
if (Array.isArray(color)) { style.backgroundColor = color;
style.background = `linear-gradient(-35deg, ${color.join(',')})`;
} else {
style.backgroundColor = color;
}
} }
return style; return style;
}); });
@ -109,7 +105,7 @@ const progressStyle = computed(() => {
width: 100%; width: 100%;
height: var(--progress-bar-height); height: var(--progress-bar-height);
background: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.2);
border-radius: calc(var(--progress-bar-height) / 2); border-radius: var(--progress-bar-height);
overflow: hidden; overflow: hidden;
} }
@ -119,7 +115,7 @@ const progressStyle = computed(() => {
left: 0; left: 0;
bottom: 0; bottom: 0;
background-color: #08f; background-color: #08f;
border-radius: calc(var(--progress-bar-height) / 2); border-radius: var(--progress-bar-height);
} }
.progress-bar-label { .progress-bar-label {

View File

@ -38,11 +38,6 @@ export function getThreshold(data, tolerance = 2) {
*/ */
const lineColorMap = {}; const lineColorMap = {};
const lineColors = []; const lineColors = [];
const defaultColors = [
'#5470c6', '#91cc75', '#fac858',
'#ee6666', '#73c0de', '#3ba272',
'#fc8452', '#9a60b4', '#ea7ccc',
];
/** /**
* 将十六进制颜色转换为 RGB 数组 * 将十六进制颜色转换为 RGB 数组
@ -104,13 +99,6 @@ export function getLineColor(name) {
if (lineColorMap[name]) { if (lineColorMap[name]) {
return lineColorMap[name]; return lineColorMap[name];
} }
// 如果默认颜色还有剩余,直接使用
if (defaultColors.length > 0) {
const color = defaultColors.shift();
lineColorMap[name] = color;
lineColors.push(color);
return color;
}
const color = getColor(); const color = getColor();
lineColorMap[name] = color; lineColorMap[name] = color;
lineColors.push(color); lineColors.push(color);

View File

@ -1,7 +1,6 @@
import { import {
computed, computed,
} from 'vue'; } from 'vue';
import config from '@/config';
import validate from '@/utils/validate'; import validate from '@/utils/validate';
import * as hostUtils from '@/utils/host'; import * as hostUtils from '@/utils/host';
@ -64,13 +63,12 @@ export default (params) => {
case 'cpu': case 'cpu':
{ {
const CoresVal = cpuInfo.value?.cores ? `${cpuInfo.value?.cores}C` : '-'; const CoresVal = cpuInfo.value?.cores ? `${cpuInfo.value?.cores}C` : '-';
const usedColor = config.nazhua.serverStatusLinear ? ['#0088FF', '#72B7FF'] : '#0088FF';
return { return {
type: 'cpu', type: 'cpu',
used: (props.info.State?.CPU || 0).toFixed(1) * 1, used: (props.info.State?.CPU || 0).toFixed(1) * 1,
colors: { colors: {
used: usedColor, used: '#0088ff',
total: 'rgba(255, 255, 255, 0.25)', total: 'rgba(255, 255, 255, 0.2)',
}, },
valText: `${(props.info.State?.CPU || 0).toFixed(1) * 1}%`, valText: `${(props.info.State?.CPU || 0).toFixed(1) * 1}%`,
label: 'CPU', label: 'CPU',
@ -94,13 +92,12 @@ export default (params) => {
} else { } else {
contentVal = `${Math.ceil(useMemAndTotalMem.value.total.m)}M`; contentVal = `${Math.ceil(useMemAndTotalMem.value.total.m)}M`;
} }
const usedColor = config.nazhua.serverStatusLinear ? ['#2B6939', '#0AA344'] : '#0AA344';
return { return {
type: 'mem', type: 'mem',
used: useMemAndTotalMem.value.usePercent, used: useMemAndTotalMem.value.usePercent,
colors: { colors: {
used: usedColor, used: '#0aa344',
total: 'rgba(255, 255, 255, 0.25)', total: 'rgba(255, 255, 255, 0.2)',
}, },
valText: usedVal, valText: usedVal,
label: '内存', label: '内存',
@ -127,13 +124,12 @@ export default (params) => {
} else { } else {
contentVal = `${Math.ceil(useSwapAndTotalSwap.value.total.m)}M`; contentVal = `${Math.ceil(useSwapAndTotalSwap.value.total.m)}M`;
} }
const usedColor = config.nazhua.serverStatusLinear ? ['#FF8C00', '#F38100'] : '#FF8C00';
return { return {
type: 'swap', type: 'swap',
used: useSwapAndTotalSwap.value.usePercent, used: useSwapAndTotalSwap.value.usePercent,
colors: { colors: {
used: usedColor, used: '#ff8c00',
total: 'rgba(255, 255, 255, 0.25)', total: 'rgba(255, 255, 255, 0.2)',
}, },
valText: usedVal, valText: usedVal,
label: '交换', label: '交换',
@ -151,13 +147,12 @@ export default (params) => {
} else { } else {
contentValue = `${Math.ceil(useDiskAndTotalDisk.value.total.g)}G`; contentValue = `${Math.ceil(useDiskAndTotalDisk.value.total.g)}G`;
} }
const usedColor = config.nazhua.serverStatusLinear ? ['#00848F', '#70F3FF'] : '#70F3FF';
return { return {
type: 'disk', type: 'disk',
used: useDiskAndTotalDisk.value.usePercent, used: useDiskAndTotalDisk.value.usePercent,
colors: { colors: {
used: usedColor, used: '#70f3ff',
total: 'rgba(255, 255, 255, 0.25)', total: 'rgba(255, 255, 255, 0.2)',
}, },
valText: `${(useDiskAndTotalDisk.value.used.g).toFixed(1) * 1}G`, valText: `${(useDiskAndTotalDisk.value.used.g).toFixed(1) * 1}G`,
label: '磁盘', label: '磁盘',