fix: content quality, image format, task monitor, calendar data source, search UI & sort

This commit is contained in:
Yuzhiran Dev
2026-05-26 11:26:10 +08:00
parent b2d043b231
commit ac8644d752
36 changed files with 2294 additions and 873 deletions
+44 -15
View File
@@ -327,22 +327,51 @@
this.loadingPlan = true;
try {
const token = localStorage.getItem('authToken');
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const resp = await fetch(`/api/calendar?year=${year}&month=${month}`, {
headers: { 'Authorization': 'Bearer ' + token }
const today = new Date();
today.setHours(0, 0, 0, 0);
const end = new Date(today);
end.setDate(end.getDate() + 7);
const [entries, topics] = await Promise.all([
fetch(`/api/calendar?year=${today.getFullYear()}&month=${today.getMonth() + 1}`, {
headers: { 'Authorization': 'Bearer ' + token }
}).then(r => r.ok ? r.json() : []),
fetch('/api/topics?limit=200', {
headers: { 'Authorization': 'Bearer ' + token }
}).then(r => r.ok ? r.json() : [])
]);
const events = [];
(entries || []).forEach(e => {
events.push({
id: 'cal_' + e.id,
date: e.planned_date,
title: e.title,
status: e.status === 'published' ? 'published' : 'planned'
});
});
if (resp.ok) {
const all = await resp.json();
const today = new Date();
today.setHours(0, 0, 0, 0);
const end = new Date(today);
end.setDate(end.getDate() + 7);
this.upcomingEntries = (all || [])
.filter(e => { const d = new Date(e.planned_date); return d >= today && d < end; })
.sort((a, b) => a.planned_date.localeCompare(b.planned_date));
}
(topics || []).forEach(t => {
const s = t.status;
if ((s === 'ready' || s === '待发布') && t.ready_at) {
events.push({
id: 'topic_ready_' + t.id,
date: t.ready_at,
title: t.title,
status: 'planned'
});
} else if ((s === 'published' || s === '已发布') && t.published_at) {
events.push({
id: 'topic_pub_' + t.id,
date: t.published_at,
title: t.title,
status: 'published'
});
}
});
this.upcomingEntries = events
.filter(e => { const d = new Date(e.date); return d >= today && d < end; })
.sort((a, b) => a.date.localeCompare(b.date));
} catch (e) {
console.error('获取近期计划失败:', e);
} finally { this.loadingPlan = false; }