From 3c060b7aa5412adf477c0d04ac2c0206ace8fb60 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 7 Nov 2025 14:16:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BA=8B=E4=BB=B6=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8F=E8=A7=88=E9=87=8F=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DynamicNewsDetailPanel.js | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js b/src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js index 7bb69ef2..668d9ab9 100644 --- a/src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js +++ b/src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js @@ -49,6 +49,10 @@ const DynamicNewsDetailPanel = ({ event }) => { const isFollowing = event?.id ? (eventFollowStatus[event.id]?.isFollowing || false) : false; const followerCount = event?.id ? (eventFollowStatus[event.id]?.followerCount || event.follower_count || 0) : 0; + // 🎯 浏览量机制:存储从 API 获取的完整事件详情(包含最新 view_count) + const [fullEventDetail, setFullEventDetail] = useState(null); + const [loadingDetail, setLoadingDetail] = useState(false); + // 权限判断函数 const hasAccess = useCallback((requiredTier) => { const tierLevel = { free: 0, pro: 1, max: 2 }; @@ -76,6 +80,30 @@ const DynamicNewsDetailPanel = ({ event }) => { loadChainAnalysis } = useEventStocks(event?.id, event?.created_at, { autoLoad: false }); + // 🎯 加载事件详情(增加浏览量)- 与 EventDetailModal 保持一致 + const loadEventDetail = useCallback(async () => { + if (!event?.id) return; + + setLoadingDetail(true); + try { + const response = await eventService.getEventDetail(event.id); + if (response.success) { + setFullEventDetail(response.data); + console.log('%c📊 [浏览量] 事件详情加载成功', 'color: #10B981; font-weight: bold;', { + eventId: event.id, + viewCount: response.data.view_count, + title: response.data.title + }); + } + } catch (error) { + console.error('[DynamicNewsDetailPanel] loadEventDetail 失败:', error, { + eventId: event?.id + }); + } finally { + setLoadingDetail(false); + } + }, [event?.id]); + // 相关股票、相关概念、历史事件和传导链的权限 const canAccessStocks = hasAccess('pro'); const canAccessConcepts = hasAccess('pro'); @@ -168,6 +196,9 @@ const DynamicNewsDetailPanel = ({ event }) => { useEffect(() => { console.log('%c🔄 [事件切换] 重置所有子模块状态', 'color: #F59E0B; font-weight: bold;', { eventId: event?.id }); + // 🎯 加载事件详情(增加浏览量) + loadEventDetail(); + // PRO 会员的相关股票默认展开,其他情况收起 const shouldOpenStocks = canAccessStocks && userTier === 'pro'; setIsStocksOpen(shouldOpenStocks); @@ -185,7 +216,7 @@ const DynamicNewsDetailPanel = ({ event }) => { setHasLoadedHistorical(false); setIsTransmissionOpen(false); setHasLoadedTransmission(false); - }, [event?.id, canAccessStocks, userTier, loadStocksData]); + }, [event?.id, canAccessStocks, userTier, loadStocksData, loadEventDetail]); // 切换关注状态 const handleToggleFollow = useCallback(async () => { @@ -249,9 +280,9 @@ const DynamicNewsDetailPanel = ({ event }) => { - {/* 头部信息区 */} + {/* 头部信息区 - 优先使用完整详情数据(包含最新浏览量) */}