Add summary statistics and macroeconomic data files for 2025
- Created summary_statistics.csv with total news articles and key metrics from January 1 to October 13, 2025. - Added 一号文件十四五十五五规划情况.csv detailing keyword occurrences related to planning documents. - Introduced 主要宏观经济数据.csv capturing mentions of key economic indicators. - Included 国外交流随行企业与企业家名单.csv listing leaders and their engagements with foreign enterprises. - Added 国家领导人考察行程清单.csv documenting leaders' inspection itineraries. - Created 国际合作与外交动态.csv summarizing international cooperation and diplomatic activities. - Added 高频行业关键词统计.csv with statistics on frequently mentioned industry keywords.
This commit is contained in:
+30
-64
@@ -42,17 +42,40 @@ class NewsApp {
|
||||
initializeDates() {
|
||||
const today = new Date();
|
||||
const weekAgo = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000);
|
||||
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1000);
|
||||
|
||||
// 设置默认日期范围(最近一周)
|
||||
this.currentEndDate = this.formatDate(today);
|
||||
this.currentStartDate = this.formatDate(weekAgo);
|
||||
this.currentStartDate = this.formatDate(yesterday);
|
||||
|
||||
this.startDateInput.value = this.currentStartDate;
|
||||
this.endDateInput.value = this.currentEndDate;
|
||||
}
|
||||
|
||||
formatDate(date) {
|
||||
return date.toISOString().split('T')[0];
|
||||
// 获取北京时间(东八区)偏移
|
||||
const beijingTime = new Intl.DateTimeFormat('zh-CN', {
|
||||
timeZone: 'Asia/Shanghai',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
}).format(date);
|
||||
return beijingTime.replace(/\//g, '-');
|
||||
}
|
||||
|
||||
// 2. 日期+时间
|
||||
formatDateTime(date) {
|
||||
const d = new Intl.DateTimeFormat('zh-CN', {
|
||||
timeZone: 'Asia/Shanghai',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hour12: false
|
||||
}).format(date); // 返回 "2025-07-07 15:32:45"
|
||||
return d.replace(/\//g, '-').replace(',', '');
|
||||
}
|
||||
|
||||
updateDateRange() {
|
||||
@@ -99,10 +122,10 @@ class NewsApp {
|
||||
this.showLoading(true);
|
||||
|
||||
try {
|
||||
// 构建API URL - 请替换为您的实际API地址
|
||||
const apiUrl = `https://api.doorcome.cn/api/xwlbNews/?start_date=${startDate}&end_date=${endDate}`;
|
||||
// 构建API URL
|
||||
const apiUrl = `https://api.doorcome.cn/api/xwlbFine/?start_date=${startDate}&end_date=${endDate}`;
|
||||
|
||||
console.log('Fetching news from:', apiUrl); // 调试日志
|
||||
//console.log('Fetching news from:', apiUrl); // 调试日志
|
||||
|
||||
const response = await fetch(apiUrl, {
|
||||
method: 'GET',
|
||||
@@ -116,13 +139,7 @@ class NewsApp {
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log('API Response:', result); // 调试日志
|
||||
|
||||
// 根据您的API返回格式调整
|
||||
// 常见格式示例:
|
||||
// 1. { "data": { "news": [...] } }
|
||||
// 2. { "news": [...] }
|
||||
// 3. [...] // 直接是数组
|
||||
//console.log('API Response:', result); // 调试日志
|
||||
|
||||
if (result.data && result.data.news) {
|
||||
result.data.news.forEach(item => {
|
||||
@@ -253,7 +270,7 @@ class NewsApp {
|
||||
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
${news.daily_sub_id + 1}
|
||||
${news.daily_sub_id}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -292,21 +309,6 @@ class NewsApp {
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
setupInfiniteScroll() {
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting && !this.isLoading && this.hasMoreNews) {
|
||||
this.loadMoreNews();
|
||||
}
|
||||
});
|
||||
}, {
|
||||
rootMargin: '100px'
|
||||
});
|
||||
|
||||
// 观察加载指示器
|
||||
observer.observe(this.loadingIndicator);
|
||||
}*/
|
||||
|
||||
setupInfiniteScroll() {
|
||||
const options = {
|
||||
@@ -337,42 +339,6 @@ class NewsApp {
|
||||
// 同时观察加载指示器
|
||||
observer.observe(this.loadingIndicator);
|
||||
}
|
||||
/*
|
||||
async loadMoreNews() {
|
||||
if (this.isLoading || !this.hasMoreNews) return;
|
||||
|
||||
this.showLoading(true);
|
||||
|
||||
try {
|
||||
// 找到当前最早的日期
|
||||
const earliestDate = this.getEarliestDate();
|
||||
if (!earliestDate) {
|
||||
this.hasMoreNews = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算前一天的日期
|
||||
const prevDate = new Date(earliestDate);
|
||||
prevDate.setDate(prevDate.getDate() - 1);
|
||||
const prevDateStr = this.formatDate(prevDate);
|
||||
|
||||
// 加载前一天的新闻
|
||||
const moreNews = await this.fetchNews(prevDateStr, prevDateStr);
|
||||
|
||||
if (moreNews.length === 0) {
|
||||
this.hasMoreNews = false;
|
||||
this.endOfContent.classList.remove('hidden');
|
||||
} else {
|
||||
this.renderNews(moreNews);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载更多新闻失败:', error);
|
||||
this.showError('加载更多新闻失败,请稍后重试');
|
||||
} finally {
|
||||
this.showLoading(false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
async loadMoreNews() {
|
||||
if (this.isLoading || !this.hasMoreNews) {
|
||||
|
||||
Reference in New Issue
Block a user