diff --git a/frontend/index.html b/frontend/index.html index 07f9e10..3c29d3c 100755 --- a/frontend/index.html +++ b/frontend/index.html @@ -454,7 +454,7 @@ return state.allEntries.find(entry => entry.date === date); } - function renderCalendar(year, month, selectedDate, hasDataDates, onClick) { + function renderCalendar(year, month, selectedDate, hasDataDates) { const firstDay = new Date(year, month, 1); const lastDay = new Date(year, month + 1, 0); const startDay = firstDay.getDay(); @@ -494,45 +494,96 @@ } function renderTasksView() { - const dateTasks = getTasksByDate(state.selectedDate); - const tasksToShow = state.selectedTask ? [state.selectedTask] : dateTasks; - - const taskDates = state.allTasks.map(t => t.created_at.split('T')[0]); const current = state.currentCalendar || new Date(); - const calendarHtml = renderCalendar(current.getFullYear(), current.getMonth(), state.selectedDate, taskDates); + + // 任务列表视图 + if (!state.selectedTask) { + return ` +
+ + + +
- return ` -
- - - -
- -
-

${state.selectedTask ? '📋 任务详情' : `📋 ${state.selectedDate} 的任务`}

-
- ${calendarHtml} +
+

📋 所有任务

- ${tasksToShow.length === 0 ? ` + ${state.allTasks.length === 0 ? `
-

📅 ${state.selectedDate} 没有任务

-

点击日历选择其他日期

+

暂无任务

- ` : tasksToShow.map(task => ` + ` : state.allTasks.map(task => `
${task.title} ${task.status_display}
优先级:${task.priority_display} | 创建:${task.created_at.split('T')[0]}
- ${task.description ? `
${task.description}
` : ''} + ${task.description ? `
${task.description}
` : ''}
进展:${task.progress_percent}%
`).join('')} - ${state.selectedTask ? `` : ''} +
+
+ `; + } + + // 任务详情视图(带日历) + const task = state.selectedTask; + const taskProgressDates = task.progress_notes ? + task.progress_notes.match(/\[(\d{4}-\d{2}-\d{2})\]/g)?.map(s => s.slice(1, 11)) || [] : []; + const calendarHtml = renderCalendar(current.getFullYear(), current.getMonth(), + state.selectedDate, taskProgressDates, true); + + const selectedDateProgress = task.progress_notes + .split('\n') + .filter(line => line.startsWith(`[${state.selectedDate}]`)) + .map(line => line.slice(13)) + .join('\n'); + + return ` +
+ + + +
+ +
+

📋 任务详情

+ + +
+

${task.title}

+
+
状态:${task.status_display}
+
优先级:${task.priority_display}
+
负责人:${task.assigned_to || '码神'}
+
创建:${task.created_at.split('T')[0]}
+
进展:${task.progress_percent}%
+
+ ${task.description ? `
描述:
${task.description}
` : ''} + +

📅 任务进展日历

+

点击日历查看当日的任务记录

+
+ ${calendarHtml} +
+
+

📝 ${state.selectedDate} 的进展记录

+ ${selectedDateProgress ? ` +
+
${selectedDateProgress}
+
+ ` : ` +
+

${state.selectedDate} 暂无记录

+
+ `} +
+
@@ -553,7 +604,8 @@
-

📝 ${state.selectedDate} 的日记

+

📝 日记

+

点击日历选择日期查看日记

${calendarHtml}
@@ -563,7 +615,7 @@

点击日历选择其他日期

` : ` -
+
${entry.title || '每日日记'} ${entry.date}