From f8f59f929f598979ab719ac913bde7f0752cdc97 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 11 Jul 2023 09:07:40 +0800 Subject: [PATCH] fix dashboard --- src/views/dashboard/AnalyticsScheduler.vue | 15 +++++++++++ src/views/dashboard/AnalyticsSpeed.vue | 4 +-- .../dashboard/AnalyticsWeeklyOverview.vue | 25 ++++++++++++++++--- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/views/dashboard/AnalyticsScheduler.vue b/src/views/dashboard/AnalyticsScheduler.vue index 0ea8c44b..32f9f392 100644 --- a/src/views/dashboard/AnalyticsScheduler.vue +++ b/src/views/dashboard/AnalyticsScheduler.vue @@ -5,6 +5,9 @@ import { ScheduleInfo } from "@/api/types"; // 定时服务列表 const schedulerList = ref([]); +// 定时器 +let refreshTimer: NodeJS.Timer | null = null; + // 调用API加载定时服务列表 const loadSchedulerList = async () => { try { @@ -17,6 +20,18 @@ const loadSchedulerList = async () => { onMounted(() => { loadSchedulerList(); + // 启动定时器 + refreshTimer = setInterval(() => { + loadSchedulerList(); + }, 60000); +}); + +// 组件卸载时停止定时器 +onUnmounted(() => { + if (refreshTimer) { + clearInterval(refreshTimer); + refreshTimer = null; + } }); diff --git a/src/views/dashboard/AnalyticsSpeed.vue b/src/views/dashboard/AnalyticsSpeed.vue index 940d1c96..477911d9 100644 --- a/src/views/dashboard/AnalyticsSpeed.vue +++ b/src/views/dashboard/AnalyticsSpeed.vue @@ -36,12 +36,12 @@ const loadDownloaderInfo = async () => { downloadInfo.value = res; infoItems.value = [ { - avatar: "mdi-upload", + avatar: "mdi-cloud-upload", title: "总上传量", amount: formatFileSize(res.upload_size), }, { - avatar: "mdi-download", + avatar: "mdi-download-box", title: "总下载量", amount: formatFileSize(res.download_size), }, diff --git a/src/views/dashboard/AnalyticsWeeklyOverview.vue b/src/views/dashboard/AnalyticsWeeklyOverview.vue index 3a65a0d5..272e0bf4 100644 --- a/src/views/dashboard/AnalyticsWeeklyOverview.vue +++ b/src/views/dashboard/AnalyticsWeeklyOverview.vue @@ -1,4 +1,5 @@