- 新增 forecast Tab(从 FinancialPanorama 迁移) - 新增 loadForecast 数据加载逻辑 - 新增业绩预告列表展示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.1 KiB
JavaScript
68 lines
2.1 KiB
JavaScript
// src/views/Company/components/DynamicTracking/index.js
|
||
// 动态跟踪 - 独立一级 Tab 组件(包含新闻动态等二级 Tab)
|
||
|
||
import React, { useState, useEffect, useMemo } from 'react';
|
||
import { Box } from '@chakra-ui/react';
|
||
import { FaNewspaper, FaBullhorn, FaCalendarAlt, FaChartBar } from 'react-icons/fa';
|
||
|
||
import SubTabContainer from '@components/SubTabContainer';
|
||
import AnnouncementsPanel from '../CompanyOverview/BasicInfoTab/components/AnnouncementsPanel';
|
||
import DisclosureSchedulePanel from '../CompanyOverview/BasicInfoTab/components/DisclosureSchedulePanel';
|
||
import { NewsPanel, ForecastPanel } from './components';
|
||
|
||
// 二级 Tab 配置
|
||
const TRACKING_TABS = [
|
||
{ key: 'news', name: '新闻动态', icon: FaNewspaper, component: NewsPanel },
|
||
{ key: 'announcements', name: '公司公告', icon: FaBullhorn, component: AnnouncementsPanel },
|
||
{ key: 'disclosure', name: '财报披露日程', icon: FaCalendarAlt, component: DisclosureSchedulePanel },
|
||
{ key: 'forecast', name: '业绩预告', icon: FaChartBar, component: ForecastPanel },
|
||
];
|
||
|
||
/**
|
||
* 动态跟踪组件
|
||
*
|
||
* 功能:
|
||
* - 使用 SubTabContainer 实现二级导航
|
||
* - Tab1: 新闻动态
|
||
* - Tab2: 公司公告
|
||
* - Tab3: 财报披露日程
|
||
* - Tab4: 业绩预告
|
||
*
|
||
* @param {Object} props
|
||
* @param {string} props.stockCode - 股票代码
|
||
*/
|
||
const DynamicTracking = ({ stockCode: propStockCode }) => {
|
||
const [stockCode, setStockCode] = useState(propStockCode || '000001');
|
||
const [activeTab, setActiveTab] = useState(0);
|
||
|
||
// 监听 props 中的 stockCode 变化
|
||
useEffect(() => {
|
||
if (propStockCode && propStockCode !== stockCode) {
|
||
setStockCode(propStockCode);
|
||
}
|
||
}, [propStockCode, stockCode]);
|
||
|
||
// 传递给子组件的 props
|
||
const componentProps = useMemo(
|
||
() => ({
|
||
stockCode,
|
||
}),
|
||
[stockCode]
|
||
);
|
||
|
||
return (
|
||
<Box>
|
||
<SubTabContainer
|
||
tabs={TRACKING_TABS}
|
||
componentProps={componentProps}
|
||
themePreset="blackGold"
|
||
index={activeTab}
|
||
onTabChange={(index) => setActiveTab(index)}
|
||
isLazy
|
||
/>
|
||
</Box>
|
||
);
|
||
};
|
||
|
||
export default DynamicTracking;
|