mirror of
https://github.com/hi2shark/nazhua.git
synced 2026-01-16 09:10:42 +08:00
🪄 优化不同尺寸下的server-status处理;移动端环境下的server-status替代card模式采用尽可能的最小化处理
This commit is contained in:
parent
0b9da8fe01
commit
93f66cb42c
@ -32,9 +32,14 @@ const config = reactive({
|
|||||||
if (config.nazhua.nezhaVersion) {
|
if (config.nazhua.nezhaVersion) {
|
||||||
config.init = true;
|
config.init = true;
|
||||||
}
|
}
|
||||||
if (window.$$serverStatus) {
|
|
||||||
config.nazhua.listServerItemType = 'server-status';
|
function handle$$serverStatus() {
|
||||||
|
if (window.$$serverStatus) {
|
||||||
|
config.nazhua.listServerItemType = 'server-status';
|
||||||
|
config.nazhua.homeWorldMapPosition = 'bottom';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
handle$$serverStatus();
|
||||||
|
|
||||||
function setColorMode() {
|
function setColorMode() {
|
||||||
if (config.nazhua.simpleColorMode) {
|
if (config.nazhua.simpleColorMode) {
|
||||||
@ -67,9 +72,7 @@ export function mergeNazhuaConfig(customConfig) {
|
|||||||
});
|
});
|
||||||
replaceFavicon();
|
replaceFavicon();
|
||||||
setColorMode();
|
setColorMode();
|
||||||
if (window.$$serverStatus) {
|
handle$$serverStatus();
|
||||||
config.nazhua.listServerItemType = 'server-status';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 暴露合并配置方法
|
// 暴露合并配置方法
|
||||||
window.$mergeNazhuaConfig = mergeNazhuaConfig;
|
window.$mergeNazhuaConfig = mergeNazhuaConfig;
|
||||||
|
|||||||
@ -162,12 +162,24 @@ const show = computed(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
height: 40px;
|
|
||||||
border-bottom-left-radius: var(--list-item-border-radius);
|
border-bottom-left-radius: var(--list-item-border-radius);
|
||||||
border-bottom-right-radius: var(--list-item-border-radius);
|
border-bottom-right-radius: var(--list-item-border-radius);
|
||||||
background: rgba(#000, 0.3);
|
background: rgba(#000, 0.3);
|
||||||
box-shadow: 0 -2px 4px rgba(#000, 0.5);
|
box-shadow: 0 -2px 4px rgba(#000, 0.5);
|
||||||
|
|
||||||
|
--list-item-bill-height: 40px;
|
||||||
|
--list-item-bill-font-size: 14px;
|
||||||
|
--list-item-bill-icon-font-size: 16px;
|
||||||
|
|
||||||
|
height: var(--list-item-bill-height);
|
||||||
|
font-size: var(--list-item-bill-font-size);
|
||||||
|
|
||||||
|
@media screen and (max-width: 720px) {
|
||||||
|
--list-item-bill-height: 30px;
|
||||||
|
--list-item-bill-font-size: 12px;
|
||||||
|
--list-item-bill-icon-font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
&.dot-dot-box--hide {
|
&.dot-dot-box--hide {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border-top: 1px solid rgba(#ddd, 0.1);
|
border-top: 1px solid rgba(#ddd, 0.1);
|
||||||
@ -186,23 +198,27 @@ const show = computed(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 30px;
|
width: calc(var(--list-item-bill-height) * 0.75);
|
||||||
height: 30px;
|
height: calc(var(--list-item-bill-height) * 0.75);
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
font-size: 16px;
|
font-size: var(--list-item-bill-icon-font-size);
|
||||||
color: #74dbef;
|
color: #74dbef;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
line-height: 30px;
|
line-height: var(--list-item-bill-height);
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value-text {
|
.value-text {
|
||||||
color: #74dbef;
|
color: #74dbef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 720px) {
|
||||||
|
padding-left: 6px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-list {
|
.tag-list {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="server-list-item-status"
|
class="server-list-item-status"
|
||||||
:class="'type--' + componentName"
|
:class="classNames"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="componentMaps[componentName]"
|
:is="componentMaps[componentName]"
|
||||||
@ -21,6 +21,10 @@
|
|||||||
* 服务器状态盒子
|
* 服务器状态盒子
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
|
|
||||||
import handleServerStatus from '@/views/composable/server-status';
|
import handleServerStatus from '@/views/composable/server-status';
|
||||||
@ -39,10 +43,13 @@ const componentMaps = {
|
|||||||
progress: ServerStatusProgress,
|
progress: ServerStatusProgress,
|
||||||
};
|
};
|
||||||
|
|
||||||
const componentName = [
|
const componentName = computed(() => {
|
||||||
'donut',
|
const name = [
|
||||||
'progress',
|
'donut',
|
||||||
].includes(config.nazhua.listServerStatusType) ? config.nazhua.listServerStatusType : 'donut';
|
'progress',
|
||||||
|
].includes(config.nazhua.listServerStatusType) ? config.nazhua.listServerStatusType : 'donut';
|
||||||
|
return config.nazhua.listServerItemType === 'server-status' ? 'progress' : name;
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
serverStatusList,
|
serverStatusList,
|
||||||
@ -51,6 +58,13 @@ const {
|
|||||||
statusListTpl: 'cpu,mem,disk',
|
statusListTpl: 'cpu,mem,disk',
|
||||||
statusListItemContent: false,
|
statusListItemContent: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const classNames = computed(() => {
|
||||||
|
const names = {};
|
||||||
|
names[`type--${componentName.value}`] = true;
|
||||||
|
names[`len--${serverStatusList.value?.length}`] = true;
|
||||||
|
return names;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -63,11 +77,16 @@ const {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
||||||
|
--progress-bar-width: calc(50% - 5px);
|
||||||
--progress-bar-height: 20px;
|
--progress-bar-height: 20px;
|
||||||
|
|
||||||
@media screen and (max-width: 350px) {
|
@media screen and (max-width: 400px) {
|
||||||
--progress-bar-height: 16px;
|
--progress-bar-height: 16px;
|
||||||
padding: 0 15px;
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.len--3 {
|
||||||
|
--progress-bar-width: calc((100% - 20px) / 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ const { cpuAndMemAndDisk } = handleServerInfo({
|
|||||||
const platformLogoIconClassName = computed(() => hostUtils.getPlatformLogoIconClassName(props.info?.Host?.Platform));
|
const platformLogoIconClassName = computed(() => hostUtils.getPlatformLogoIconClassName(props.info?.Host?.Platform));
|
||||||
|
|
||||||
const serverRealTimeListTpls = computed(() => {
|
const serverRealTimeListTpls = computed(() => {
|
||||||
if (config.nazhua?.listServerRealTimeShowLoad) {
|
if (config.nazhua?.listServerRealTimeShowLoad || config.nazhua.listServerItemType === 'server-status') {
|
||||||
return 'D-A-T,T-A-U,L-A-P,I-A-O';
|
return 'D-A-T,T-A-U,L-A-P,I-A-O';
|
||||||
}
|
}
|
||||||
return 'duration,transfer,inSpeed,outSpeed';
|
return 'duration,transfer,inSpeed,outSpeed';
|
||||||
@ -114,12 +114,12 @@ function openDetail() {
|
|||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
|
|
||||||
.server-info-group {
|
.server-info-group {
|
||||||
|
--list-item-head-height: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
height: 50px;
|
|
||||||
border-top-left-radius: var(--list-item-border-radius);
|
border-top-left-radius: var(--list-item-border-radius);
|
||||||
border-top-right-radius: var(--list-item-border-radius);
|
border-top-right-radius: var(--list-item-border-radius);
|
||||||
background: rgba(#000, 0.3);
|
background: rgba(#000, 0.3);
|
||||||
@ -128,6 +128,7 @@ function openDetail() {
|
|||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
@media screen and (max-width: 768px) {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
--list-item-head-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.dot-dot-box--hide {
|
&.dot-dot-box--hide {
|
||||||
@ -138,6 +139,7 @@ function openDetail() {
|
|||||||
&.server-list-item-head {
|
&.server-list-item-head {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
height: var(--list-item-head-height, 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.left-box,
|
.left-box,
|
||||||
@ -196,6 +198,8 @@ function openDetail() {
|
|||||||
--real-time-text-font-size: 12px;
|
--real-time-text-font-size: 12px;
|
||||||
--real-time-label-font-size: 14px;
|
--real-time-label-font-size: 14px;
|
||||||
|
|
||||||
|
font-size: var(--real-time-label-font-size);
|
||||||
|
|
||||||
@media screen and (max-width: 1280px) {
|
@media screen and (max-width: 1280px) {
|
||||||
padding: 10px 0 15px;
|
padding: 10px 0 15px;
|
||||||
|
|
||||||
@ -210,8 +214,12 @@ function openDetail() {
|
|||||||
--real-time-value-font-size: 20px;
|
--real-time-value-font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 680px) {
|
@media screen and (max-width: 720px) {
|
||||||
--real-time-value-font-size: 24px;
|
--real-time-value-font-size: 24px;
|
||||||
|
--real-time-text-font-size: 12px;
|
||||||
|
--real-time-label-font-size: 12px;
|
||||||
|
|
||||||
|
padding: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 320px) {
|
@media screen and (max-width: 320px) {
|
||||||
|
|||||||
@ -159,7 +159,7 @@ const COLUMN_MAP = Object.freeze({
|
|||||||
* 默认列配置
|
* 默认列配置
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line max-len, vue/max-len
|
// eslint-disable-next-line max-len, vue/max-len
|
||||||
const DEFAULT_COLUMNS = 'status,name,country,system,config,duration,speeds,transfer,conns,load,cpuText,memText,diskText,billing,remainingTime';
|
const DEFAULT_COLUMNS = 'status,name,country,system,config,duration,speeds,transfer,tcp,udp,load,cpuText,memText,diskText,billing,remainingTime';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 需要实时更新的数据
|
* 需要实时更新的数据
|
||||||
|
|||||||
@ -118,6 +118,7 @@ function isSet(value) {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: var(--td-content-justify-content);
|
justify-content: var(--td-content-justify-content);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
line-height: var(--server-status-td-height);
|
||||||
|
|
||||||
&--transfer {
|
&--transfer {
|
||||||
.text--value {
|
.text--value {
|
||||||
@ -148,6 +149,18 @@ function isSet(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--tcp {
|
||||||
|
.text--value {
|
||||||
|
color: var(--conn-tcp-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--udp {
|
||||||
|
.text--value {
|
||||||
|
color: var(--conn-udp-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&--load {
|
&--load {
|
||||||
.text--value {
|
.text--value {
|
||||||
color: var(--load-color);
|
color: var(--load-color);
|
||||||
|
|||||||
@ -99,13 +99,13 @@ const progressStyle = computed(() => {
|
|||||||
|
|
||||||
@media screen and (max-width: 480px) {
|
@media screen and (max-width: 480px) {
|
||||||
flex: none;
|
flex: none;
|
||||||
width: calc(50% - 5px);
|
width: var(--progress-bar-width, calc(50% - 5px));
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 350px) {
|
// @media screen and (max-width: 350px) {
|
||||||
flex: none;
|
// flex: none;
|
||||||
width: 100%;
|
// width: 100%;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.progress-bar-box {
|
.progress-bar-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="index-container">
|
<div
|
||||||
|
class="index-container"
|
||||||
|
:class="indexContainerClass"
|
||||||
|
>
|
||||||
<div class="scroll-container">
|
<div class="scroll-container">
|
||||||
<div
|
<div
|
||||||
v-if="worldMapPosition === 'top' && showWorldMap"
|
v-if="worldMapPosition === 'top' && showWorldMap"
|
||||||
@ -170,6 +173,20 @@ const showListCard = computed(() => {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const indexContainerClass = computed(() => {
|
||||||
|
const className = {};
|
||||||
|
if (showListRow.value) {
|
||||||
|
className['list-is--row'] = true;
|
||||||
|
}
|
||||||
|
if (showListCard.value) {
|
||||||
|
className['list-is--card'] = true;
|
||||||
|
}
|
||||||
|
if (showListRowByServerStatus.value) {
|
||||||
|
className['list-is--server-status'] = true;
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
});
|
||||||
|
|
||||||
const showFilter = computed(() => config.nazhua.hideFilter !== true);
|
const showFilter = computed(() => config.nazhua.hideFilter !== true);
|
||||||
const filterFormData = ref({
|
const filterFormData = ref({
|
||||||
tag: '',
|
tag: '',
|
||||||
@ -410,6 +427,7 @@ onActivated(() => {
|
|||||||
.index-container {
|
.index-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.scroll-container {
|
.scroll-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -428,6 +446,19 @@ onActivated(() => {
|
|||||||
.bottom-world-map {
|
.bottom-world-map {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.list-is--server-status {
|
||||||
|
--list-container-width: 1300px;
|
||||||
|
// 针对1440px以下的屏幕
|
||||||
|
@media screen and (max-width: 1440px) {
|
||||||
|
--list-container-width: 1300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 针对1280px以下的屏幕
|
||||||
|
@media screen and (max-width: 1280px) {
|
||||||
|
--list-container-width: 1200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fitler-group {
|
.fitler-group {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user