Skip to content

Commit aa84624

Browse files
committed
2026/1/19
1 parent d999901 commit aa84624

13 files changed

Lines changed: 3227 additions & 8 deletions

File tree

WHKScore/WeekTask.js

Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
// 每周任务数据
2+
// 格式:weekTasks[周数] = { startDate: 开始日期, endDate: 结束日期, tasks: [任务列表] }
3+
// 任务列表格式:{ title: 任务名称, completed: 是否完成 }
4+
5+
const weekTasks = {
6+
"1": {
7+
"startDate": "2026-01-19",
8+
"endDate": "2026-01-25",
9+
"tasks": [
10+
{ "title": "学完教材帮选必二", "completed": false },
11+
{ "title": "数学领航计划大小本写完", "completed": false },
12+
{ "title": "一化必刷100讲写到化学工艺流程", "completed": false },
13+
{ "title": "做3张生物卷子", "completed": false }
14+
]
15+
},
16+
"2": {
17+
"startDate": "2026-01-26",
18+
"endDate": "2026-02-01",
19+
"tasks": [
20+
]
21+
},
22+
"3": {
23+
"startDate": "2026-02-02",
24+
"endDate": "2026-02-08",
25+
"tasks": [
26+
]
27+
},
28+
"4": {
29+
"startDate": "2026-02-09",
30+
"endDate": "2026-02-15",
31+
"tasks": [
32+
]
33+
},
34+
"5": {
35+
"startDate": "2026-02-16",
36+
"endDate": "2026-02-22",
37+
"tasks": [
38+
]
39+
},
40+
"6": {
41+
"startDate": "2026-02-23",
42+
"endDate": "2026-02-29",
43+
"tasks": [
44+
]
45+
},
46+
"7": {
47+
"startDate": "2026-03-01",
48+
"endDate": "2026-03-07",
49+
"tasks": [
50+
]
51+
},
52+
"8": {
53+
"startDate": "2026-03-08",
54+
"endDate": "2026-03-14",
55+
"tasks": [
56+
]
57+
},
58+
"9": {
59+
"startDate": "2026-03-15",
60+
"endDate": "2026-03-21",
61+
"tasks": [
62+
]
63+
},
64+
"10": {
65+
"startDate": "2026-03-22",
66+
"endDate": "2026-03-28",
67+
"tasks": [
68+
]
69+
},
70+
"11": {
71+
"startDate": "2026-03-29",
72+
"endDate": "2026-04-04",
73+
"tasks": [
74+
]
75+
},
76+
"12": {
77+
"startDate": "2026-04-05",
78+
"endDate": "2026-04-11",
79+
"tasks": [
80+
]
81+
},
82+
"13": {
83+
"startDate": "2026-04-12",
84+
"endDate": "2026-04-18",
85+
"tasks": [
86+
]
87+
},
88+
"14": {
89+
"startDate": "2026-04-19",
90+
"endDate": "2026-04-25",
91+
"tasks": [
92+
]
93+
},
94+
"15": {
95+
"startDate": "2026-04-26",
96+
"endDate": "2026-05-02",
97+
"tasks": [
98+
]
99+
},
100+
"16": {
101+
"startDate": "2026-05-03",
102+
"endDate": "2026-05-09",
103+
"tasks": [
104+
]
105+
},
106+
"17": {
107+
"startDate": "2026-05-10",
108+
"endDate": "2026-05-16",
109+
"tasks": [
110+
]
111+
},
112+
"18": {
113+
"startDate": "2026-05-17",
114+
"endDate": "2026-05-23",
115+
"tasks": [
116+
]
117+
},
118+
"19": {
119+
"startDate": "2026-05-24",
120+
"endDate": "2026-05-30",
121+
"tasks": [
122+
]
123+
},
124+
"20": {
125+
"startDate": "2026-05-31",
126+
"endDate": "2026-06-06",
127+
"tasks": [
128+
]
129+
}
130+
};
131+
132+
// 页面加载完成后执行
133+
window.addEventListener('load', function() {
134+
generateWeekGrid();
135+
// 启动实时时间更新
136+
updateCurrentTime();
137+
setInterval(updateCurrentTime, 1000);
138+
});
139+
140+
// 更新当前时间和当前周数显示
141+
function updateCurrentTime() {
142+
const now = new Date();
143+
144+
// 更新第一个h3:显示当前时间
145+
const timeH3 = document.querySelectorAll('.calendar-view h3')[0];
146+
if (timeH3) {
147+
const timeString = now.toLocaleString('zh-CN', {
148+
year: 'numeric',
149+
month: '2-digit',
150+
day: '2-digit',
151+
hour: '2-digit',
152+
minute: '2-digit',
153+
second: '2-digit'
154+
});
155+
timeH3.textContent = timeString;
156+
}
157+
158+
// 更新第二个h3:显示当前周数
159+
const weekH3 = document.querySelectorAll('.calendar-view h3')[1];
160+
if (weekH3) {
161+
// 计算当前是第几周(相对于2026-01-19)
162+
const startDate = new Date('2026-01-19');
163+
const diffTime = now - startDate;
164+
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
165+
const currentWeek = Math.max(1, Math.floor(diffDays / 7) + 1);
166+
weekH3.textContent = `第${currentWeek}周`;
167+
}
168+
169+
// 更新当前周高亮
170+
highlightCurrentWeek();
171+
}
172+
173+
// 生成周格子
174+
function generateWeekGrid() {
175+
const weekGrid = document.getElementById('weekGrid');
176+
177+
// 遍历所有周
178+
for (const week in weekTasks) {
179+
if (weekTasks.hasOwnProperty(week)) {
180+
const weekData = weekTasks[week];
181+
const weekElement = document.createElement('div');
182+
weekElement.className = 'week-box';
183+
weekElement.dataset.week = week;
184+
185+
// 计算完成的任务数量
186+
const completedTasks = weekData.tasks.filter(task => task.completed).length;
187+
const totalTasks = weekData.tasks.length;
188+
const completionRate = totalTasks > 0 ? (completedTasks / totalTasks) * 100 : 0;
189+
190+
weekElement.innerHTML = `
191+
<div class="week-number">第${week}周</div>
192+
`;
193+
194+
// 添加点击事件
195+
weekElement.addEventListener('click', function() {
196+
showWeekTasks(week);
197+
});
198+
199+
weekGrid.appendChild(weekElement);
200+
}
201+
}
202+
203+
// 高亮当前周
204+
highlightCurrentWeek();
205+
}
206+
207+
// 高亮当前周
208+
function highlightCurrentWeek() {
209+
const now = new Date();
210+
// 计算当前是第几周(相对于2026-01-19)
211+
const startDate = new Date('2026-01-19');
212+
const diffTime = now - startDate;
213+
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
214+
const currentWeek = Math.max(1, Math.floor(diffDays / 7) + 1);
215+
216+
// 移除所有周的高亮样式
217+
const allWeekBoxes = document.querySelectorAll('.week-box');
218+
allWeekBoxes.forEach(box => {
219+
box.classList.remove('current-week');
220+
});
221+
222+
// 高亮当前周
223+
const currentWeekBox = document.querySelector(`[data-week="${currentWeek}"]`);
224+
if (currentWeekBox) {
225+
currentWeekBox.classList.add('current-week');
226+
}
227+
}
228+
229+
// 显示周任务详情
230+
function showWeekTasks(week) {
231+
const taskDetails = document.getElementById('weekTaskDetails');
232+
const weekData = weekTasks[week];
233+
234+
if (!weekData) {
235+
taskDetails.innerHTML = `
236+
<h3>任务详情</h3>
237+
<div class="no-selection">无效的周数</div>
238+
`;
239+
return;
240+
}
241+
242+
// 对任务进行排序:未完成的任务在前面,已完成的任务在后面
243+
const sortedTasks = [...weekData.tasks].sort((a, b) => {
244+
// 未完成任务(false)排在前面,已完成任务(true)排在后面
245+
return (a.completed === b.completed) ? 0 : (a.completed ? 1 : -1);
246+
});
247+
248+
// 生成任务列表
249+
let tasksHtml = '';
250+
if (sortedTasks.length === 0) {
251+
tasksHtml = '<div class="no-tasks">暂无任务</div>';
252+
} else {
253+
tasksHtml = '<ul class="task-list">';
254+
sortedTasks.forEach(task => {
255+
const statusIcon = task.completed ?
256+
'<div class="task-status-container">' +
257+
'<div class="status-circle">◯</div>' +
258+
'<div class="status-check">✓</div>' +
259+
'</div>' :
260+
'<span class="task-uncompleted">㊀</span>';
261+
262+
// 为已完成的任务添加暗色样式类
263+
const taskTitleClass = task.completed ? 'task-title completed-task' : 'task-title';
264+
265+
tasksHtml += `
266+
<li class="task-item">
267+
<div class="task-status">${statusIcon}</div>
268+
<div class="${taskTitleClass}">${task.title}</div>
269+
</li>
270+
`;
271+
});
272+
tasksHtml += '</ul>';
273+
}
274+
275+
// 计算完成进度
276+
const completedTasks = weekData.tasks.filter(task => task.completed).length;
277+
const totalTasks = weekData.tasks.length;
278+
const completionPercentage = totalTasks > 0 ? Math.round((completedTasks / totalTasks) * 100) : 0;
279+
280+
// 更新任务详情
281+
taskDetails.innerHTML = `
282+
<h3>Week ${week} 任务详情</h3>
283+
<div class="week-info">
284+
<div class="week-date-range">${weekData.startDate} - ${weekData.endDate}</div>
285+
<div class="task-progress">
286+
<div class="progress-text">${completedTasks}/${totalTasks} 已完成</div>
287+
<div class="progress-bar-container">
288+
<div class="progress-bar" style="width: ${completionPercentage}%"></div>
289+
</div>
290+
</div>
291+
</div>
292+
${tasksHtml}
293+
`;
294+
}

WHKScore/backstation/Date.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const dateData = {
55
"2026-01": {
66
"05": 1, "06": 0, "07": 0, "08": 0, "09": 1, "10": 1, "11": 1,
77
"12": 0, "13": 1, "14": 1, "15": 1, "16": 1, "17": 1, "18": 0,
8-
"19": 0, "20": 0, "21": 0, "22": 0, "23": 0, "24": 0, "25": 0,
8+
"19": 1, "20": 0, "21": 0, "22": 0, "23": 0, "24": 0, "25": 0,
99
"26": 0, "27": 0, "28": 0, "29": 0, "30": 0, "31": 0
1010
},
1111
"2026-02": {
101 KB
Loading
166 KB
Loading

0 commit comments

Comments
 (0)