fix: 修复偏移计算上的逻辑问题

This commit is contained in:
MKStoler1024 2025-01-15 22:46:32 +00:00
parent 252689574b
commit 6ce390c321

View File

@ -61,8 +61,8 @@ document.addEventListener("DOMContentLoaded", () => {
let nextExam = null;
data.examInfos.forEach(exam => {
const start = new Date(new Date(exam.start).getTime() + offsetTime * 1000);
const end = new Date(new Date(exam.end).getTime() + offsetTime * 1000);
const start = new Date(exam.start);
const end = new Date(exam.end);
if (now >= start && now <= end) {
currentExam = exam;
}
@ -78,14 +78,14 @@ document.addEventListener("DOMContentLoaded", () => {
const remainingHours = Math.floor(remainingTime / 3600);
const remainingMinutes = Math.floor((remainingTime % 3600) / 60);
const remainingSeconds = Math.floor(remainingTime % 60);
const remainingTimeText = `剩余时间: ${remainingHours}${remainingMinutes}${remainingSeconds}`;
const remainingTimeText = `${remainingHours}${remainingMinutes}${remainingSeconds}`;
if (remainingHours === 0 && remainingMinutes <= 14) {
remainingTimeElem.textContent = `倒计时:` && remainingTimeText;
remainingTimeElem.textContent = `倒计时:${remainingTimeText}`;
remainingTimeElem.style.color = "red";
remainingTimeElem.style.fontWeight = "bold";
} else {
remainingTimeElem.textContent = `剩余时间:` && remainingTimeText;
remainingTimeElem.textContent = `剩余时间:${remainingTimeText}`;
remainingTimeElem.style.color = "#93b4f7";
remainingTimeElem.style.fontWeight = "normal";
}
@ -110,8 +110,8 @@ document.addEventListener("DOMContentLoaded", () => {
// Update next exams table
examTableBodyElem.innerHTML = "";
data.examInfos.forEach(exam => {
const start = new Date(new Date(exam.start).getTime() + offsetTime * 1000);
const end = new Date(new Date(exam.end).getTime() + offsetTime * 1000);
const start = new Date(exam.start);
const end = new Date(exam.end);
let status = "";
if (now < start) {
status = "即将开始";