From aa332537d4eeeaaca879435c16c895aca35d73c5 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Sun, 26 Oct 2025 20:04:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20UI=20=E5=B1=82=E9=9D=A2:=20=20=20=20?= =?UTF-8?q?=20-=20=E2=9C=85=20=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=B8=80?= =?UTF-8?q?=E5=A5=97=E6=A0=87=E7=AD=BE=EF=BC=88=E5=9C=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86=E4=B8=8B=E6=96=B9=EF=BC=89=20=20=20=20=20-=20?= =?UTF-8?q?=E2=9C=85=20=E6=A0=87=E7=AD=BE=E6=A0=B7=E5=BC=8F=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=EF=BC=88Ant=20Design=20Tag=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=89=20=20=20=20=20-=20=E2=9C=85=20=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6=E9=83=BD=E6=9C=89=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E6=A0=87=E7=AD=BE=E6=98=BE=E7=A4=BA=20=20=20?= =?UTF-8?q?2.=20=E5=8A=9F=E8=83=BD=E5=B1=82=E9=9D=A2:=20=20=20=20=20-=20?= =?UTF-8?q?=E2=9C=85=20=E6=A0=87=E7=AD=BE=E5=86=85=E5=AE=B9=E4=B8=8E?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6=E5=AE=8C?= =?UTF-8?q?=E5=85=A8=E5=90=8C=E6=AD=A5=20=20=20=20=20-=20=E2=9C=85=20?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=A0=87=E7=AD=BE=E5=88=A0=E9=99=A4=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E5=AF=B9=E5=BA=94=E7=AD=9B=E9=80=89=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E8=A2=AB=E6=B8=85=E9=99=A4=20=20=20=20=20-=20?= =?UTF-8?q?=E2=9C=85=20=E5=88=A0=E9=99=A4=E6=A0=87=E7=AD=BE=E5=90=8E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=E4=BA=8B=E4=BB=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=20=20=20=20-=20=E2=9C=85=20=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=EF=BC=8C=E4=BE=BF?= =?UTF-8?q?=E4=BA=8E=E8=B0=83=E8=AF=95=20=20=203.=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=B1=82=E9=9D=A2:=20=20=20=20=20-=20=E2=9C=85=20=E6=B6=88?= =?UTF-8?q?=E9=99=A4=E9=87=8D=E5=A4=8D=E4=BB=A3=E7=A0=81=20=20=20=20=20-?= =?UTF-8?q?=20=E2=9C=85=20=E5=8D=95=E4=B8=80=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=EF=BC=88UnifiedSearchBox=20=E7=9A=84=E5=86=85=E9=83=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=EF=BC=89=20=20=20=20=20-=20=E2=9C=85=20?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E7=BB=9F=E4=B8=80=EF=BC=8C=E6=98=93=E4=BA=8E?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Community/index.js | 75 ++++-------------------------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/src/views/Community/index.js b/src/views/Community/index.js index f35dd7aa..33a74928 100644 --- a/src/views/Community/index.js +++ b/src/views/Community/index.js @@ -73,18 +73,6 @@ import { useNotification } from '../../contexts/NotificationContext'; // 导航栏已由 MainLayout 提供,无需在此导入 -// const { RangePicker } = DatePicker; -// const { Option } = AntSelect; - -const filterLabelMap = { - date_range: v => v ? `日期: ${v}` : '', - sort: v => v ? `排序: ${v === 'new' ? '最新' : v === 'hot' ? '热门' : v === 'returns' ? '收益率' : v}` : '', - importance: v => v && v !== 'all' ? `重要性: ${v}` : '', - industry_classification: v => v ? `行业: ${v}` : '', - industry_code: v => v ? `行业代码: ${v}` : '', - q: v => v ? `关键词: ${v}` : '', -}; - const Community = () => { const [searchParams, setSearchParams] = useSearchParams(); const navigate = useNavigate(); @@ -127,16 +115,17 @@ const Community = () => { importance: searchParams.get('importance') || 'all', date_range: searchParams.get('date_range') || '', q: searchParams.get('q') || '', - search_type: searchParams.get('search_type') || 'topic', industry_classification: searchParams.get('industry_classification') || '', industry_code: searchParams.get('industry_code') || '', + stock_code: searchParams.get('stock_code') || '', page: parseInt(searchParams.get('page') || '1', 10) }; }); - // 更新筛选参数 - 不再修改URL + // 更新筛选参数 - 直接替换(由 UnifiedSearchBox 输出完整参数) const updateFilters = useCallback((newFilters) => { - setFilters(prev => ({ ...prev, ...newFilters })); + logger.debug('Community', 'updateFilters 接收到完整参数', newFilters); + setFilters(newFilters); }, []); // 加载事件列表 @@ -169,14 +158,10 @@ const Community = () => { } }, [filters, pagination.pageSize]); - // 处理筛选变化 - const handleFilterChange = useCallback((filterType, value) => { - updateFilters({ [filterType]: value, page: 1 }); - }, [updateFilters]); - // 处理分页变化 const handlePageChange = useCallback((page) => { - updateFilters({ page }); + // 保持现有筛选条件,只更新页码 + updateFilters({ ...filters, page }); // 滚动到实时事件时间轴(平滑滚动) setTimeout(() => { @@ -187,7 +172,7 @@ const Community = () => { }); } }, 100); // 延迟100ms,确保DOM更新 - }, [updateFilters]); + }, [updateFilters, filters]); // 处理事件点击 const handleEventClick = useCallback((event) => { @@ -200,36 +185,6 @@ const Community = () => { navigate(`/event-detail/${eventId}`); }, [navigate]); - // 处理关键词点击 - const handleKeywordClick = useCallback((keyword) => { - updateFilters({ q: keyword, page: 1 }); - }, [updateFilters]); - - - - // 处理标签删除 - const handleRemoveFilterTag = (key) => { - let reset = ''; - if (key === 'sort') reset = 'new'; - if (key === 'importance') reset = 'all'; - updateFilters({ [key]: reset, page: 1 }); - }; - - // 获取筛选标签 - const filterTags = Object.entries(filters) - .filter(([key, value]) => { - if (key === 'industry_code') return !!value; - if (key === 'importance') return value && value !== 'all'; - if (key === 'sort') return value && value !== 'new'; - if (key === 'date_range') return !!value; - if (key === 'q') return !!value; - return false; - }) - .map(([key, value]) => { - if (key === 'industry_code') return { key, label: `行业代码: ${value}` }; - return { key, label: filterLabelMap[key] ? filterLabelMap[key](value) : `${key}: ${value}` }; - }); - // 创建防抖的 loadEvents 函数(500ms 防抖延迟) const debouncedLoadEvents = useRef( debounce((page) => { @@ -306,7 +261,7 @@ const Community = () => { {/* 主体内容 */} - {/* 统一搜索组件(整合了话题、股票、行业、日期、排序、重要性、热门概念) */} + {/* 统一搜索组件(整合了话题、股票、行业、日期、排序、重要性、热门概念、筛选标签) */} { /> - {/* 筛选标签 */} - {filterTags.length > 0 && ( - - {filterTags.map(tag => ( - - - {tag.label} - handleRemoveFilterTag(tag.key)} /> - - - ))} - - )} - {/* 事件列表 */} {loading ? (