From f0a5fcc68a43154f2219d6b07d861f206df8bc67 Mon Sep 17 00:00:00 2001 From: MKStoler Date: Wed, 9 Oct 2024 19:54:33 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=BC=80=E8=80=83=E5=89=8D15?= =?UTF-8?q?=E5=88=86=E9=92=9F=E5=92=8C=E8=80=83=E8=AF=95=E6=97=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=80=92=E8=AE=A1=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/components/SubjectInfo.vue | 26 +++++++++++++++++++++ src/renderer/src/pages/about.vue | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/components/SubjectInfo.vue b/src/renderer/src/components/SubjectInfo.vue index 4e3cc6e..c2c28bc 100644 --- a/src/renderer/src/components/SubjectInfo.vue +++ b/src/renderer/src/components/SubjectInfo.vue @@ -11,6 +11,7 @@ 考试状态: {{ statusText }}
考试即将结束
+
剩余时间: {{ remainingTime }}
@@ -69,6 +70,27 @@ const isWarning = computed(() => { return now.value >= fifteenMinutesBeforeEnd && now.value < end; }); +const showRemainingTime = computed(() => { + if (!props.exam) return false; + + const start = new Date(props.exam.start); + const end = new Date(props.exam.end); + const fifteenMinutesBeforeStart = new Date(start.getTime() - 15 * 60 * 1000); + + return now.value >= fifteenMinutesBeforeStart && now.value < end; +}); + +const remainingTime = computed(() => { + if (!props.exam) return ''; + + const end = new Date(props.exam.end); + const timeDiff = end.getTime() - now.value.getTime(); + const minutes = Math.floor(timeDiff / (1000 * 60)); + const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000); + + return `${minutes}分${seconds}秒`; +}); + // Update the current time every second const updateNow = () => { now.value = new Date(); @@ -86,6 +108,10 @@ updateNow(); color: #ffc107 !important; /* Vuetify's default warning color */ } +.text--info { + color: #17a2b8 !important; /* Info color */ +} + .status-before { color: orange; } diff --git a/src/renderer/src/pages/about.vue b/src/renderer/src/pages/about.vue index 9ddbc5f..985dfa0 100644 --- a/src/renderer/src/pages/about.vue +++ b/src/renderer/src/pages/about.vue @@ -12,7 +12,7 @@

版本号: 1.1.0-Malkuth

开发者:Hello8963 & Mkstoler4096