fix: 点击日历日期后高亮跟随选中日期
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
var autoSaveTimer = null; // 自动保存防抖
|
||||
var lastSavedData = null; // 上次保存快照
|
||||
var lastSavedDate = null; // 上次保存日期
|
||||
var selectedDate = null; // 日历中选中日期
|
||||
|
||||
/* 勤学预设项目 */
|
||||
var PRESET_STUDY_ITEMS = [
|
||||
@@ -163,6 +164,7 @@
|
||||
var isOtherMonth = false;
|
||||
|
||||
if (isSameDay(cur, today)) classes.push('today');
|
||||
if (ds === selectedDate) classes.push('selected');
|
||||
var status = calendarStatus[ds];
|
||||
if (status) classes.push(status);
|
||||
|
||||
@@ -189,9 +191,11 @@
|
||||
|
||||
/** 导航到指定日期 */
|
||||
function navigateToDate(date) {
|
||||
selectedDate = date;
|
||||
switchPanel('daily');
|
||||
document.getElementById('check-date').value = date;
|
||||
loadCheckin();
|
||||
renderCalendar(); // 刷新日历高亮
|
||||
}
|
||||
|
||||
/** 回到今天 */
|
||||
@@ -643,6 +647,7 @@
|
||||
var todayStr = fmtDate(today);
|
||||
if (cd) cd.value = todayStr;
|
||||
|
||||
selectedDate = todayStr;
|
||||
initStudyPresets();
|
||||
bindAutoSave();
|
||||
lastSavedDate = todayStr;
|
||||
|
||||
@@ -252,6 +252,20 @@ body {
|
||||
background: var(--primary-light);
|
||||
}
|
||||
|
||||
.cal-cell.selected {
|
||||
font-weight: 600;
|
||||
color: var(--primary-dark);
|
||||
border-color: var(--primary-dark);
|
||||
background: #DDE3FD;
|
||||
}
|
||||
|
||||
.cal-cell.selected.today {
|
||||
font-weight: 700;
|
||||
color: #FFF;
|
||||
border-color: var(--primary-dark);
|
||||
background: var(--primary);
|
||||
}
|
||||
|
||||
.cal-cell::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user