🪄 单独处理darwin系统、windows系统的LOGO

This commit is contained in:
hi2hi 2024-12-09 14:11:13 +00:00
parent 8e6489ba5c
commit 6558f2ffe9
3 changed files with 26 additions and 8 deletions

View File

@ -192,6 +192,23 @@ export function calcTransfer(bytes) {
return result;
}
export function getPlatformLogoIconClassName(platform) {
const platformStr = (platform || '').toLowerCase();
if (platformStr.includes('windows') || platformStr.includes('microsoft')) {
return 'ri-microsoft-fill';
}
switch (platformStr) {
case 'darwin':
case 'macos':
return 'fl-apple';
default:
}
if (platform) {
return `fl-${platform}`;
}
return 'ri-server-line';
}
/**
* 获取系统发行版本
*/

View File

@ -21,12 +21,9 @@
class="cpu-mem-group"
>
<span
v-if="info?.Host?.Platform"
class="system-os-icon"
>
<span
:class="'fl-' + info?.Host?.Platform"
/>
<span :class="platformLogoIconClassName" />
</span>
<span class="core-mem">{{ cpuAndMemAndDisk }}</span>
</span>
@ -91,6 +88,7 @@ const { cpuAndMemAndDisk } = handleServerInfo({
const slogan = computed(() => props.info?.PublicNote?.customData?.slogan);
const cpuInfo = computed(() => hostUtils.getCPUInfo(props.info?.Host?.CPU?.[0]));
const platformLogoIconClassName = computed(() => hostUtils.getPlatformLogoIconClassName(props.info?.Host?.Platform));
</script>
<style lang="scss" scoped>

View File

@ -18,10 +18,7 @@
<span
class="server-flag"
>
<span
class="fi"
:class="'fi-' + (info?.Host?.CountryCode || 'un')"
/>
<span :class="platformLogoIconClassName" />
</span>
<span class="server-name">
{{ info.Name }}
@ -66,9 +63,13 @@
* 单节点
*/
import {
computed,
} from 'vue';
import {
useRouter,
} from 'vue-router';
import * as hostUtils from '@/utils/host';
import handleServerInfo from '@/views/composable/server-info';
import ServerRealTime from '@/views/components/server/server-real-time.vue';
@ -91,6 +92,8 @@ const { cpuAndMemAndDisk } = handleServerInfo({
props,
});
const platformLogoIconClassName = computed(() => hostUtils.getPlatformLogoIconClassName(props.info?.Host?.Platform));
function openDetail() {
router.push({
name: 'ServerDetail',