From d1a5e5c6d84a5fa7166b5b1a5d0e1ff663522704 Mon Sep 17 00:00:00 2001 From: MKStoler1024 <158786854+MKStoler1024@users.noreply.github.com> Date: Fri, 17 Jan 2025 04:03:24 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E5=AF=B9=E4=B8=8A?= =?UTF-8?q?=E5=9C=BA=E8=80=83=E8=AF=95=E7=8A=B6=E6=80=81=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=B7=B2=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E7=9A=84=E8=80=83=E8=AF=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exam/script.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exam/script.js b/exam/script.js index 8ddff53..afdce62 100644 --- a/exam/script.js +++ b/exam/script.js @@ -60,6 +60,7 @@ document.addEventListener("DOMContentLoaded", () => { const now = new Date(new Date().getTime() + offsetTime * 1000); let currentExam = null; let nextExam = null; + let lastExam = null; data.examInfos.forEach(exam => { const start = new Date(exam.start); @@ -70,6 +71,9 @@ document.addEventListener("DOMContentLoaded", () => { if (!currentExam && !nextExam && now < start) { nextExam = exam; } + if (now > end && (!lastExam || end > new Date(lastExam.end))) { + lastExam = exam; + } }); if (currentExam) { @@ -93,6 +97,13 @@ document.addEventListener("DOMContentLoaded", () => { statusElem.textContent = "状态: 进行中"; statusElem.style.color = "#5ba838"; + } else if (lastExam && now < new Date(lastExam.end).getTime() + 60000) { + const timeSinceEnd = (now.getTime() - new Date(lastExam.end).getTime()) / 1000; + currentSubjectElem.textContent = `上场科目: ${lastExam.name}`; + examTimingElem.textContent = ""; + remainingTimeElem.textContent = ``; + statusElem.textContent = "状态: 已结束"; + statusElem.style.color = "red"; } else if (nextExam) { const timeUntilStart = ((new Date(nextExam.start).getTime() - now.getTime()) / 1000) + 1; const remainingHours = Math.floor(timeUntilStart / 3600);