From bdbcd50aa1b1b6958043e26be5b705430312c64c Mon Sep 17 00:00:00 2001 From: Sun <95302870@qq.com> Date: Fri, 5 Jan 2024 14:25:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=AC=E5=85=B1=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppIconSystemMonitor/index.vue | 60 +++++++++---------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/src/components/deskModule/SystemMonitor/AppIconSystemMonitor/index.vue b/src/components/deskModule/SystemMonitor/AppIconSystemMonitor/index.vue index 48afeb4..3f5f61e 100644 --- a/src/components/deskModule/SystemMonitor/AppIconSystemMonitor/index.vue +++ b/src/components/deskModule/SystemMonitor/AppIconSystemMonitor/index.vue @@ -4,17 +4,17 @@ // 如果确定这种方案将 AppIcon/index.vue 封装成通用组件 // ------------------- -import { computed, ref } from 'vue' +import { ref } from 'vue' import { MonitorType } from '../typings' import type { CardStyle } from '../typings' +import GenericMonitorCard from '../components/GenericMonitorCard/index.vue' import CardCPU from './CPU.vue' import Memory from './Memory.vue' import Disk from './Disk.vue' -import { ItemCard, SvgIcon } from '@/components/common' +import { SvgIcon } from '@/components/common' import { PanelPanelConfigStyleEnum } from '@/enums' interface Prop { - size?: number // 默认70 extendParam?: any iconTextColor?: string iconTextIconHideTitle: boolean @@ -23,41 +23,25 @@ interface Prop { cardStyle: CardStyle } -const props = withDefaults(defineProps(), { - size: 70, -}) +withDefaults(defineProps(), {}) -const defaultBackground = '#2a2a2a6b' const iconText = ref('自定义') const refreshInterval = 5 const svgStyle = { width: '35px', height: '35px', } - -const calculateLuminance = (color: string) => { - const hex = color.replace(/^#/, '') - const r = parseInt(hex.substring(0, 2), 16) - const g = parseInt(hex.substring(2, 4), 16) - const b = parseInt(hex.substring(4, 6), 16) - return (0.299 * r + 0.587 * g + 0.114 * b) / 255 -} - -const textColor = computed(() => { - const luminance = calculateLuminance(props.cardStyle.background || defaultBackground) - return luminance > 0.5 ? 'black' : 'white' -})