From ff23ac6bbbf894ef2e0731a4a605ab7c9c897247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B1=95=E9=B9=8F?= Date: Sat, 6 Dec 2025 01:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=B6=E9=97=B4=E6=AE=B5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=B2=A1=E6=9C=89=E5=8F=8D=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pending_bookings.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pending_bookings.php b/pending_bookings.php index fbd0ed5..794b9e4 100644 --- a/pending_bookings.php +++ b/pending_bookings.php @@ -689,7 +689,14 @@ try { calendarGrid.querySelectorAll('.calendar-day').forEach(day => { day.classList.remove('selected'); }); - document.querySelector(`[data-date="${date}"]`).classList.add('selected'); + + // 找到当前日历中的日期元素 + const calendarDays = calendarGrid.querySelectorAll('.calendar-day'); + calendarDays.forEach(day => { + if (day.dataset.date === date) { + day.classList.add('selected'); + } + }); // 生成时间段 generateTimeSlots(submissionId, date); @@ -717,6 +724,7 @@ try { const slotDiv = document.createElement('div'); slotDiv.className = `time-slot ${isPast ? 'past' : ''} ${isBooked ? 'booked' : 'available'}`; slotDiv.textContent = timeString; + slotDiv.dataset.time = timeString; slotDiv.onclick = () => selectTimeSlot(submissionId, timeString); timeGrid.appendChild(slotDiv); @@ -763,7 +771,7 @@ try { slot.classList.remove('selected'); }); - const slotElement = timeGrid.querySelector(`[onclick="selectTimeSlot(${submissionId}, '${time}')"]`); + const slotElement = timeGrid.querySelector(`[data-time="${time}"]`); if (slotElement) { slotElement.classList.add('selected'); }