From 080dbdb26bf68f9c4543a445f77f12b91b4625fd Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Wed, 24 Dec 2025 18:31:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(mock):=20=E5=AE=8C=E5=96=84=E6=B6=A8?= =?UTF-8?q?=E5=81=9C=E5=88=86=E6=9E=90=20Mock=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增午盘、尾盘涨停数量统计 - 添加 chart_data 字段支持板块分布饼图 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/mocks/handlers/limitAnalyse.js | 39 +++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/mocks/handlers/limitAnalyse.js b/src/mocks/handlers/limitAnalyse.js index 91956d03..2921c387 100644 --- a/src/mocks/handlers/limitAnalyse.js +++ b/src/mocks/handlers/limitAnalyse.js @@ -216,24 +216,39 @@ const generateDailyAnalysis = (date) => { // 统计数据 const morningCount = Math.floor(totalStocks * 0.35); // 早盘涨停 + const middayCount = Math.floor(totalStocks * 0.25); // 午盘涨停 + const afternoonCount = totalStocks - morningCount - middayCount; // 尾盘涨停 const announcementCount = sectorData['公告']?.count || 0; const topSector = sectorNames.filter(s => s !== '公告' && s !== '其他') .reduce((max, name) => (sectorData[name]?.count || 0) > (sectorData[max]?.count || 0) ? name : max , '人工智能'); + // 生成 chart_data(板块分布饼图需要) + const sortedSectors = Object.entries(sectorData) + .filter(([name]) => name !== '其他' && name !== '公告') + .sort((a, b) => b[1].count - a[1].count) + .slice(0, 10); + + const chartData = { + labels: sortedSectors.map(([name]) => name), + counts: sortedSectors.map(([, info]) => info.count) + }; + return { date: date, total_stocks: totalStocks, total_sectors: Object.keys(sectorData).length, sector_data: sectorData, // 👈 SectorDetails 组件需要的数据 + chart_data: chartData, // 👈 板块分布饼图需要的数据 summary: { top_sector: topSector, top_sector_count: sectorData[topSector]?.count || 0, announcement_stocks: announcementCount, zt_time_distribution: { morning: morningCount, - afternoon: totalStocks - morningCount, + midday: middayCount, + afternoon: afternoonCount, } } }; @@ -382,6 +397,22 @@ const generateDailyJson = (date) => { { name: '区块链', value: Math.floor(Math.random() * 5) + 2 }, ]; + // 生成 chart_data(板块分布饼图需要) + const sortedSectors = Object.entries(sectorData) + .filter(([name]) => name !== '其他' && name !== '公告') + .sort((a, b) => b[1].count - a[1].count) + .slice(0, 10); + + const chartData = { + labels: sortedSectors.map(([name]) => name), + counts: sortedSectors.map(([, info]) => info.count) + }; + + // 时间分布(早盘、午盘、尾盘) + const morningCount = Math.floor(stocks.length * 0.35); + const middayCount = Math.floor(stocks.length * 0.25); + const afternoonCount = stocks.length - morningCount - middayCount; + return { date: date, total_stocks: stocks.length, @@ -389,13 +420,15 @@ const generateDailyJson = (date) => { stocks: stocks, sector_data: sectorData, word_freq_data: wordFreqData, + chart_data: chartData, // 👈 板块分布饼图需要的数据 summary: { top_sector: '人工智能', top_sector_count: sectorData['人工智能']?.count || 0, announcement_stocks: sectorData['公告']?.count || 0, zt_time_distribution: { - morning: Math.floor(stocks.length * 0.4), - afternoon: Math.floor(stocks.length * 0.6), + morning: morningCount, // 早盘 9:30-11:30 + midday: middayCount, // 午盘 11:30-13:00 + afternoon: afternoonCount, // 尾盘 13:00-15:00 } } };