feat: 首页样式修改

pull/117/head
zhengkunwang223 2023-02-03 17:52:37 +08:00 committed by zhengkunwang223
parent 5ed3df14ec
commit 0f7c915ca7
3 changed files with 246 additions and 207 deletions

View File

@ -1,9 +1,14 @@
<template> <template>
<div> <div>
<el-card :style="{ height: height }"> <el-card :style="{ height: height }" class="home-card">
<el-divider direction="vertical" /> <div class="header">
<span style="font-size: 16px; font-weight: 700">{{ header }}</span> <span></span>
<div style="margin-top: 20px"><slot name="body" /></div> <span>{{ header }}</span>
</div>
<div>
<slot name="body" />
</div>
</el-card> </el-card>
</div> </div>
</template> </template>
@ -17,13 +22,26 @@ defineProps({
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.el-divider--vertical { .home-card {
display: inline-block; .header {
width: 1px; span:first-child {
height: 2.5em; background: $primary-color;
margin: 0px 8px; border-radius: 7px;
vertical-align: middle; flex: none;
position: relative; order: 0;
border-left: 5px #0054e1 var(--el-border-style); flex-grow: 0;
padding: 3px;
}
span:nth-child(2) {
font-size: 18px;
font-weight: 700;
margin-left: 10px;
}
}
div:nth-child(2) {
margin-top: 20px;
}
} }
</style> </style>

View File

@ -1,140 +1,52 @@
<template> <template>
<div> <div>
<el-row style="margin-top: 30px"> <el-scrollbar max-height="500px">
<el-col :span="4" align="right"> <div class="h-app-card" v-for="(app, index) in apps" :key="index">
<img style="width: 40px; height: 40px" src="../images/halo.jpg" alt="" /> <el-row :gutter="10">
</el-col> <el-col :span="5">
<el-col :span="1"><br /></el-col>
<el-col :span="19">
<span style="font-size: 20px">Halo</span>
<el-button
round
plain
type="primary"
@click="goInstall()"
style="float: right; margin-top: 15px; margin-right: 10px"
>
{{ $t('app.install') }}
</el-button>
<div> <div>
<span style="font-size: 12px">{{ $t('home.haloInfo') }}</span> <el-avatar shape="square" :size="60" :src="'data:image/png;base64,' + app.icon" />
<el-divider />
</div> </div>
</el-col> </el-col>
</el-row> <el-col :span="15">
<el-row style="margin-top: 15px"> <div class="h-app-content">
<el-col :span="4" align="right">
<img style="width: 40px; height: 40px" src="../images/de.jpg" alt="" />
</el-col>
<el-col :span="1"><br /></el-col>
<el-col :span="19">
<span style="font-size: 20px">Dataease</span>
<el-button
round
plain
@click="goInstall()"
type="primary"
style="float: right; margin-top: 15px; margin-right: 10px"
>
{{ $t('app.install') }}
</el-button>
<div> <div>
<span style="font-size: 12px">{{ $t('home.deInfo') }}</span> <span class="h-app-title">{{ app.name }}</span>
<el-divider /> </div>
<div class="h-app-desc">
<span>
{{ app.shortDesc }}
</span>
</div>
</div> </div>
</el-col> </el-col>
</el-row> <el-col :span="2">
<el-row style="margin-top: 15px"> <el-button class="h-app-button" type="primary" plain round size="small" @click="goInstall">
<el-col :span="4" align="right">
<img style="width: 40px; height: 40px" src="../images/js.jpg" alt="" />
</el-col>
<el-col :span="1"><br /></el-col>
<el-col :span="19">
<span style="font-size: 20px">JumpServer</span>
<el-button
round
plain
@click="goInstall()"
type="primary"
style="float: right; margin-top: 15px; margin-right: 10px"
>
{{ $t('app.install') }} {{ $t('app.install') }}
</el-button> </el-button>
<div>
<span style="font-size: 12px">{{ $t('home.jsInfo') }}</span>
<el-divider />
</div>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-top: 15px"> <div class="h-app-divider"></div>
<el-col :span="4" align="right">
<img style="width: 40px; height: 40px" src="../images/ms.jpg" alt="" />
</el-col>
<el-col :span="1"><br /></el-col>
<el-col :span="19">
<span style="font-size: 20px">MeterSphere</span>
<el-button
round
plain
@click="goInstall()"
type="primary"
style="float: right; margin-top: 15px; margin-right: 10px"
>
{{ $t('app.install') }}
</el-button>
<div>
<span style="font-size: 12px">{{ $t('home.msInfo') }}</span>
<el-divider />
</div> </div>
</el-col> </el-scrollbar>
</el-row>
<el-row style="margin-top: 15px">
<el-col :span="4" align="right">
<img style="width: 40px; height: 40px" src="../images/ko.jpg" alt="" />
</el-col>
<el-col :span="1"><br /></el-col>
<el-col :span="19">
<span style="font-size: 20px">KubeOperator</span>
<el-button round plain type="primary" style="float: right; margin-top: 15px; margin-right: 10px">
{{ $t('app.install') }}
</el-button>
<div>
<span style="font-size: 12px">{{ $t('home.koInfo') }}</span>
<el-divider />
</div>
</el-col>
</el-row>
<el-row style="margin-top: 15px">
<el-col :span="4" align="right">
<img style="width: 40px; height: 40px" src="../images/kubepi.jpg" alt="" />
</el-col>
<el-col :span="1"><br /></el-col>
<el-col :span="19">
<span style="font-size: 20px">KubePi</span>
<el-button
round
plain
@click="goInstall()"
type="primary"
style="float: right; margin-top: 15px; margin-right: 10px"
>
{{ $t('app.install') }}
</el-button>
<div>
<span style="font-size: 12px">{{ $t('home.kubepiInfo') }}</span>
<el-divider />
</div>
</el-col>
</el-row>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { App } from '@/api/interface/app';
import { Dashboard } from '@/api/interface/dashboard'; import { Dashboard } from '@/api/interface/dashboard';
import { ref } from 'vue'; import { SearchApp } from '@/api/modules/app';
import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const router = useRouter(); const router = useRouter();
let req = reactive({
name: '',
tags: [],
page: 1,
pageSize: 50,
});
const baseInfo = ref({ const baseInfo = ref({
haloID: 0, haloID: 0,
dateeaseID: 0, dateeaseID: 0,
@ -144,6 +56,9 @@ const baseInfo = ref({
kubepiID: 0, kubepiID: 0,
}); });
let loading = ref(false);
let apps = ref<App.App[]>([]);
const acceptParams = (base: Dashboard.BaseInfo): void => { const acceptParams = (base: Dashboard.BaseInfo): void => {
baseInfo.value.haloID = base.haloID; baseInfo.value.haloID = base.haloID;
baseInfo.value.dateeaseID = base.dateeaseID; baseInfo.value.dateeaseID = base.dateeaseID;
@ -151,23 +66,65 @@ const acceptParams = (base: Dashboard.BaseInfo): void => {
baseInfo.value.metersphereID = base.metersphereID; baseInfo.value.metersphereID = base.metersphereID;
baseInfo.value.kubeoperatorID = base.kubeoperatorID; baseInfo.value.kubeoperatorID = base.kubeoperatorID;
baseInfo.value.kubepiID = base.kubepiID; baseInfo.value.kubepiID = base.kubepiID;
search(req);
}; };
const goInstall = () => { const goInstall = () => {
router.push({ name: 'App' }); router.push({ name: 'App' });
}; };
const search = async (req: App.AppReq) => {
loading.value = true;
await SearchApp(req)
.then((res) => {
apps.value = res.data.items;
})
.finally(() => {
loading.value = false;
});
};
defineExpose({ defineExpose({
acceptParams, acceptParams,
}); });
</script> </script>
<style scoped lang="scss"> <style lang="scss">
.el-divider--horizontal { .h-app-card {
display: block; cursor: pointer;
height: 1px; padding: 15px;
width: 100%;
margin: 7px 0; .h-app-content {
border-top: 1px var(--el-border-color) var(--el-border-style); .h-app-title {
font-weight: 500;
font-size: 16px;
}
.h-app-desc {
span {
font-weight: 400;
font-size: 14px;
color: #646a73;
}
}
}
.h-app-button {
margin-top: 10px;
}
}
.h-app-divider {
margin-top: 5px;
border: 0;
border-top: 1px solid #f2f2f2;
}
.h-app-card:hover {
background-color: rgba(0, 94, 235, 0.03);
}
.el-avatar {
--el-avatar-bg-color: #ffffff;
} }
</style> </style>

View File

@ -10,52 +10,48 @@
/> />
<el-row :gutter="20" style="margin-top: 20px"> <el-row :gutter="20" style="margin-top: 20px">
<el-col :span="16"> <el-col :span="16">
<CardWithHeader :header="$t('home.overview')" height="150px"> <CardWithHeader :header="$t('home.overview')" height="160px">
<template #body> <template #body>
<el-form label-position="top" label-width="100px"> <div class="h-overview">
<el-row :gutter="20"> <el-row>
<el-col :span="6" align="center"> <el-col :span="6">
<span style="font-size: 16px">{{ $t('menu.website') }}</span> <span>{{ $t('menu.website') }}</span>
<div> <div class="count">
<el-link style="font-size: 24px" @click="goRouter('/websites')" type="primary"> <span @click="goRouter('/websites')">{{ baseInfo?.websiteNumber }}</span>
{{ baseInfo?.websiteNumber }}
</el-link>
</div> </div>
</el-col> </el-col>
<el-col :span="6" align="center"> <el-col :span="6">
<span style="font-size: 16px">{{ $t('menu.database') }}</span> <span>{{ $t('menu.database') }}</span>
<div> <div class="count">
<el-link style="font-size: 24px" @click="goRouter('/databases')" type="primary"> <span @click="goRouter('/databases')">{{ baseInfo?.databaseNumber }}</span>
{{ baseInfo?.databaseNumber }}
</el-link>
</div> </div>
</el-col> </el-col>
<el-col :span="6" align="center"> <el-col :span="6">
<span style="font-size: 16px">{{ $t('menu.cronjob') }}</span> <span>{{ $t('menu.cronjob') }}</span>
<div> <div class="count">
<el-link style="font-size: 24px" @click="goRouter('/cronjobs')" type="primary"> <span @click="goRouter('/cronjobs')">
{{ baseInfo?.cronjobNumber }} {{ baseInfo?.cronjobNumber }}
</el-link> </span>
</div> </div>
</el-col> </el-col>
<el-col :span="6" align="center"> <el-col :span="6">
<span style="font-size: 16px">{{ $t('home.appInstalled') }}</span> <span>{{ $t('home.appInstalled') }}</span>
<div> <div class="count">
<el-link style="font-size: 24px" @click="goRouter('/apps')" type="primary"> <span @click="goRouter('/apps')">
{{ baseInfo?.appInstalldNumber }} {{ baseInfo?.appInstalldNumber }}
</el-link> </span>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </div>
</template> </template>
</CardWithHeader> </CardWithHeader>
<CardWithHeader :header="$t('commons.table.status')" style="margin-top: 20px" height="280px"> <CardWithHeader :header="$t('commons.table.status')" style="margin-top: 20px" height="265px">
<template #body> <template #body>
<Status ref="statuRef" /> <Status ref="statuRef" />
</template> </template>
</CardWithHeader> </CardWithHeader>
<CardWithHeader :header="$t('menu.monitor')" style="margin-top: 20px" height="450px"> <CardWithHeader :header="$t('menu.monitor')" style="margin-top: 20px" height="465px">
<template #body> <template #body>
<el-radio-group <el-radio-group
style="float: right; margin-left: 5px" style="float: right; margin-left: 5px"
@ -81,29 +77,19 @@
> >
<el-option v-for="item in ioOptions" :key="item" :label="item" :value="item" /> <el-option v-for="item in ioOptions" :key="item" :label="item" :value="item" />
</el-select> </el-select>
<div style="margin-top: 20px; margin-left: 8px" v-if="chartOption === 'network'"> <div class="monitor-tags" v-if="chartOption === 'network'">
<el-tag>{{ $t('monitor.up') }}: {{ currentChartInfo.netBytesSent }} KB/s</el-tag> <el-tag>{{ $t('monitor.up') }}: {{ currentChartInfo.netBytesSent }} KB/s</el-tag>
<el-tag style="margin-left: 20px"> <el-tag>{{ $t('monitor.down') }}: {{ currentChartInfo.netBytesRecv }} KB/s</el-tag>
{{ $t('monitor.down') }}: {{ currentChartInfo.netBytesRecv }} KB/s <el-tag>{{ $t('home.totalSend') }}: {{ computeSize(currentInfo.netBytesSent) }}</el-tag>
</el-tag> <el-tag>{{ $t('home.totalRecv') }}: {{ computeSize(currentInfo.netBytesRecv) }}</el-tag>
<el-tag style="margin-left: 20px">
{{ $t('home.totalSend') }}: {{ computeSize(currentInfo.netBytesSent) }}
</el-tag>
<el-tag style="margin-left: 20px">
{{ $t('home.totalRecv') }}: {{ computeSize(currentInfo.netBytesRecv) }}
</el-tag>
</div> </div>
<div style="margin-top: 20px" v-if="chartOption === 'io'"> <div class="monitor-tags" v-if="chartOption === 'io'">
<el-tag>{{ $t('monitor.read') }}: {{ currentChartInfo.ioReadBytes }} MB</el-tag> <el-tag>{{ $t('monitor.read') }}: {{ currentChartInfo.ioReadBytes }} MB</el-tag>
<el-tag style="margin-left: 20px"> <el-tag>{{ $t('monitor.write') }}: {{ currentChartInfo.ioWriteBytes }} MB</el-tag>
{{ $t('monitor.write') }}: {{ currentChartInfo.ioWriteBytes }} MB <el-tag>
</el-tag>
<el-tag style="margin-left: 20px">
{{ $t('home.rwPerSecond') }}: {{ currentChartInfo.ioCount }} {{ $t('home.time') }} {{ $t('home.rwPerSecond') }}: {{ currentChartInfo.ioCount }} {{ $t('home.time') }}
</el-tag> </el-tag>
<el-tag style="margin-left: 20px"> <el-tag>{{ $t('home.rwPerSecond') }}: {{ currentInfo.ioTime }} ms</el-tag>
{{ $t('home.rwPerSecond') }}: {{ currentInfo.ioTime }} ms
</el-tag>
</div> </div>
<div <div
v-if="chartOption === 'io'" v-if="chartOption === 'io'"
@ -119,28 +105,62 @@
</CardWithHeader> </CardWithHeader>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<CardWithHeader :header="$t('home.systemInfo')" height="370px"> <CardWithHeader :header="$t('home.systemInfo')" height="330px">
<template #body> <template #body>
<el-form style="margin-left: 10px"> <el-descriptions :column="1" class="h-systemInfo">
<el-form-item style="margin-top: 15px" :label="$t('home.hostname')"> <el-descriptions-item class-name="system-content">
<template #label>
<span class="system-label">
{{ $t('home.hostname') }}
</span>
</template>
{{ baseInfo.hostname }} {{ baseInfo.hostname }}
</el-form-item> </el-descriptions-item>
<el-form-item :label="$t('home.platformVersion')"> <el-descriptions-item class-name="system-content">
<template #label>
<span class="system-label">
{{ $t('home.platformVersion') }}
</span>
</template>
{{ baseInfo.platform }}-{{ baseInfo.platformVersion }} {{ baseInfo.platform }}-{{ baseInfo.platformVersion }}
</el-form-item> </el-descriptions-item>
<el-form-item :label="$t('home.kernelVersion')"> <el-descriptions-item class-name="system-content">
<template #label>
<span class="system-label">
{{ $t('home.kernelVersion') }}
</span>
</template>
{{ baseInfo.kernelVersion }} {{ baseInfo.kernelVersion }}
</el-form-item> </el-descriptions-item>
<el-form-item :label="$t('home.kernelArch')">{{ baseInfo.kernelArch }}</el-form-item> <el-descriptions-item class-name="system-content">
<el-form-item :label="$t('home.uptime')">{{ currentInfo.timeSinceUptime }}</el-form-item> <template #label>
<el-form-item :label="$t('home.runningTime')"> <span class="system-label">
{{ $t('home.kernelArch') }}
</span>
</template>
{{ baseInfo.kernelArch }}
</el-descriptions-item>
<el-descriptions-item class-name="system-content">
<template #label>
<span class="system-label">
{{ $t('home.uptime') }}
</span>
</template>
{{ currentInfo.timeSinceUptime }}
</el-descriptions-item>
<el-descriptions-item class-name="system-content">
<template #label>
<span class="system-label">
{{ $t('home.runningTime') }}
</span>
</template>
{{ loadUpTime(currentInfo.uptime) }} {{ loadUpTime(currentInfo.uptime) }}
</el-form-item> </el-descriptions-item>
</el-form> </el-descriptions>
</template> </template>
</CardWithHeader> </CardWithHeader>
<CardWithHeader :header="$t('home.app')" style="margin-top: 20px" height="532px"> <CardWithHeader :header="$t('home.app')" style="margin-top: 20px" height="581px">
<template #body> <template #body>
<App ref="appRef" /> <App ref="appRef" />
</template> </template>
@ -546,10 +566,54 @@ onBeforeUnmount(() => {
}); });
</script> </script>
<style scoped lang="scss"> <style lang="scss">
.el-form-item--small { .el-form-item--small {
--font-size: 14px; --font-size: 14px;
--el-form-label-font-size: var(--font-size); --el-form-label-font-size: var(--font-size);
margin-bottom: 8px; margin-bottom: 8px;
} }
.h-overview {
text-align: center;
span:first-child {
font-size: 18px;
color: #646a73;
}
.count {
margin-top: 10px;
span {
font-size: 28px;
color: $primary-color;
font-weight: 500;
line-height: 32px;
cursor: pointer;
}
}
}
.h-systemInfo {
margin-left: 18px;
}
.system-label {
font-weight: 400 !important;
font-size: 16px !important;
color: #1f2329;
}
.system-content {
font-size: 15px !important;
}
.monitor-tags {
margin-top: 20px;
margin-left: 8px;
.el-tag {
margin-right: 10px;
margin-bottom: 10px;
}
}
</style> </style>