From f406e548a8e166bef623d54d3dd15dc6247ac3aa Mon Sep 17 00:00:00 2001 From: jinsir <874871581@qq.com> Date: Wed, 19 Nov 2025 11:05:18 +0800 Subject: [PATCH] =?UTF-8?q?list=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/list/List.tsx | 20 ++++++++++---------- app/components/list/NewsData.tsx | 22 +++++++++++++++++++++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/components/list/List.tsx b/app/components/list/List.tsx index c8c706d..b949fc2 100644 --- a/app/components/list/List.tsx +++ b/app/components/list/List.tsx @@ -1,7 +1,5 @@ import React from 'react'; -import { mockNewsData } from './NewsData'; // 导入新闻数据 - - +import { grassNewsData } from './NewsData'; // 引入基层新闻数据 interface NewsProps { title?: string; @@ -11,7 +9,6 @@ interface NewsProps { url?: string; } - const NewsItem: React.FC = ({ title = '', time = '', url = '' }) => { return (
@@ -26,15 +23,18 @@ const NewsItem: React.FC = ({ title = '', time = '', url = '' }) => { ); }; -// 使用新闻数据渲染列表 +// 使用基层新闻数据渲染列表 const List: React.FC = () => { + // 调用 grassNewsData 函数获取基层新闻数据 + const baseNews = grassNewsData(); + return ( -
-
-
+
+
+
    - {mockNewsData.map((news) => ( - + {baseNews.map((news) => ( + ))}
diff --git a/app/components/list/NewsData.tsx b/app/components/list/NewsData.tsx index 6d3f24a..0fb8ae8 100644 --- a/app/components/list/NewsData.tsx +++ b/app/components/list/NewsData.tsx @@ -16,6 +16,10 @@ export const NewsData = (): News[] => { { id: "news-4", type: "科技", title: "量子计算研究取得突破性进展", time: "2023-11-04", url: "https://www.baidu.com" }, { id: "news-5", type: "科技", title: "国际空间站完成新一轮科学实验", time: "2023-11-05", url: "https://www.baidu.com" }, { id: "news-6", type: "科技", title: "数字货币监管政策逐步完善", time: "2023-11-06", url: "https://www.baidu.com" }, + { id: "news-7", type: "科技", title: "区块链技术在金融领域应用前景广阔", time: "2023-11-07", url: "https://www.baidu.com" }, + { id: "news-8", type: "科技", title: "物联网技术在工业自动化领域应用广泛", time: "2023-11-08", url: "https://www.baidu.com" }, + { id: "news-8", type: "科技", title: "物联网技术在工业自动化领域应用广泛", time: "2023-11-08", url: "https://www.baidu.com" }, + { id: "edu-1", type: "教育", title: "在线教育平台助力偏远地区学生学习", time: "2025-01-10", url: "https://www.example.com/edu-1" }, { id: "edu-2", type: "教育", title: "人工智能技术推动个性化教学发展", time: "2025-02-15", url: "https://www.example.com/edu-2" }, @@ -23,11 +27,27 @@ export const NewsData = (): News[] => { { id: "edu-4", type: "教育", title: "高校联合企业开展产学研合作新模式", time: "2025-04-05", url: "https://www.example.com/edu-4" }, { id: "edu-5", type: "教育", title: "教育部发布新政策支持职业教育发展", time: "2025-05-12", url: "https://www.example.com/edu-5" }, { id: "edu-6", type: "教育", title: "全球教育公平问题引发广泛讨论", time: "2025-06-18", url: "https://www.example.com/edu-6" }, + { id: "edu-7", type: "教育", title: "国际教育标准制定与落地", time: "2025-07-25", url: "https://www.example.com/edu-7" }, + { id: "edu-8", type: "教育", title: "在线教育平台助力偏远地区学生学习", time: "2025-08-30", url: "https://www.example.com/edu-8" }, + { id: "edu-9", type: "教育", title: "人工智能技术推动个性化教学发展", time: "2025-09-04", url: "https://www.example.com/edu-9" }, ]; }; +export const grassNewsData = (): News[] => { + return [ + { id: "grass-1", type: "基层", title: "社区志愿者服务队开展环保活动", time: "2025-01-10", url: "https://www.example.com/grass-1" }, + { id: "grass-2", type: "基层", title: "乡镇企业助力乡村振兴计划", time: "2025-01-15", url: "https://www.example.com/grass-2" }, + { id: "grass-3", type: "基层", title: "村级文化活动中心正式开放", time: "2025-02-01", url: "https://www.example.com/grass-3" }, + { id: "grass-4", type: "基层", title: "基层医疗站新增远程诊疗服务", time: "2025-02-18", url: "https://www.example.com/grass-4" }, + { id: "grass-5", type: "基层", title: "农村电商培训帮助农民增收", time: "2025-03-05", url: "https://www.example.com/grass-5" }, + { id: "grass-6", type: "基层", title: "社区图书馆举办亲子阅读活动", time: "2025-03-22", url: "https://www.example.com/grass-6" }, + { id: "grass-7", type: "基层", title: "街道办组织居民参与垃圾分类宣传", time: "2025-04-10", url: "https://www.example.com/grass-7" }, + { id: "grass-8", type: "基层", title: "乡村小学引入智能教学设备", time: "2025-04-25", url: "https://www.example.com/grass-8" }, + { id: "grass-9", type: "基层", title: "基层干部走访调研解决民生问题", time: "2025-05-12", url: "https://www.example.com/grass-9" } + ]; +}; - // 默认导出模拟新闻数据 export const mockNewsData = NewsData(); +export const mockGrassNewsData = grassNewsData();