From cde3707c51f3e597d5abafcc0475bbb54493afa3 Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Wed, 7 Jan 2026 13:37:04 +0800 Subject: [PATCH] =?UTF-8?q?community=E5=A2=9E=E5=8A=A0=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Community/components/HeroPanel.js | 27 +++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/views/Community/components/HeroPanel.js b/src/views/Community/components/HeroPanel.js index 0c939572..814e32d1 100644 --- a/src/views/Community/components/HeroPanel.js +++ b/src/views/Community/components/HeroPanel.js @@ -1443,16 +1443,23 @@ const CombinedCalendar = () => { fetch(`/data/zt/daily/${dateStr}.json`) .then(res => res.ok ? res.json() : null) .then(data => { - if (data && data.sector_data) { - let maxSector = ''; - let maxCount = 0; - Object.entries(data.sector_data).forEach(([sector, info]) => { - if (info.count > maxCount) { - maxCount = info.count; - maxSector = sector; - } - }); - details[dateStr] = { top_sector: maxSector, fullData: data }; + if (data) { + // 优先使用词云图最高频词,fallback 到板块数据 + let topWord = ''; + if (data.word_freq_data && data.word_freq_data.length > 0) { + // word_freq_data 已按频率排序,第一个就是最高频 + topWord = data.word_freq_data[0].name; + } else if (data.sector_data) { + // fallback: 使用板块数据中最高的 + let maxCount = 0; + Object.entries(data.sector_data).forEach(([sector, info]) => { + if (info.count > maxCount) { + maxCount = info.count; + topWord = sector; + } + }); + } + details[dateStr] = { top_sector: topWord, fullData: data }; } }) .catch(() => null)