feat: 涨停分析/股票详情弹窗 添加风险提示
This commit is contained in:
@@ -38,6 +38,7 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { getFormattedTextProps } from '../../../utils/textUtils';
|
||||
import { ExternalLinkIcon } from '@chakra-ui/icons';
|
||||
import RiskDisclaimer from '../../../components/RiskDisclaimer';
|
||||
import './WordCloud.css';
|
||||
import {
|
||||
BarChart, Bar,
|
||||
@@ -598,6 +599,9 @@ export const StockDetailModal = ({ isOpen, onClose, selectedStock }) => {
|
||||
))}
|
||||
</Wrap>
|
||||
</Box>
|
||||
|
||||
{/* 风险提示 */}
|
||||
<RiskDisclaimer variant="default" />
|
||||
</VStack>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
import { StarIcon, ViewIcon, TimeIcon, ChevronDownIcon, ChevronUpIcon } from '@chakra-ui/icons';
|
||||
import { getFormattedTextProps } from '../../../utils/textUtils';
|
||||
|
||||
const SectorDetails = ({ sortedSectors, totalStocks }) => {
|
||||
const SectorDetails = ({ sortedSectors, totalStocks, onStockClick }) => {
|
||||
// 使用 useRef 来维持展开状态,避免重新渲染时重置
|
||||
const expandedSectorsRef = useRef([]);
|
||||
const [expandedSectors, setExpandedSectors] = useState([]);
|
||||
@@ -194,6 +194,8 @@ const SectorDetails = ({ sortedSectors, totalStocks }) => {
|
||||
bg: 'gray.50'
|
||||
}}
|
||||
transition="all 0.2s"
|
||||
cursor="pointer"
|
||||
onClick={() => onStockClick && onStockClick(stock)}
|
||||
>
|
||||
<Flex justify="space-between" align="start">
|
||||
<VStack align="start" spacing={2} flex={1}>
|
||||
|
||||
@@ -60,6 +60,8 @@ export default function LimitAnalyse() {
|
||||
const [wordCloudData, setWordCloudData] = useState([]);
|
||||
const [searchResults, setSearchResults] = useState(null);
|
||||
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
||||
const [selectedStock, setSelectedStock] = useState(null);
|
||||
const [isStockDetailOpen, setIsStockDetailOpen] = useState(false);
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
@@ -243,6 +245,20 @@ export default function LimitAnalyse() {
|
||||
}
|
||||
};
|
||||
|
||||
// 处理股票点击
|
||||
const handleStockClick = (stock) => {
|
||||
setSelectedStock(stock);
|
||||
setIsStockDetailOpen(true);
|
||||
// 🎯 追踪股票详情查看
|
||||
trackStockDetailViewed(stock.scode, stock.sname, 'sector_details');
|
||||
};
|
||||
|
||||
// 关闭股票详情弹窗
|
||||
const handleCloseStockDetail = () => {
|
||||
setIsStockDetailOpen(false);
|
||||
setSelectedStock(null);
|
||||
};
|
||||
|
||||
// 处理板块数据排序
|
||||
const getSortedSectorData = () => {
|
||||
if (!dailyData?.sector_data) return [];
|
||||
@@ -470,6 +486,7 @@ export default function LimitAnalyse() {
|
||||
<SectorDetails
|
||||
sortedSectors={getSortedSectorData()}
|
||||
totalStocks={dailyData?.total_stocks || 0}
|
||||
onStockClick={handleStockClick}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
@@ -496,6 +513,13 @@ export default function LimitAnalyse() {
|
||||
onStockClick={() => {}}
|
||||
/>
|
||||
|
||||
{/* 股票详情弹窗 */}
|
||||
<StockDetailModal
|
||||
isOpen={isStockDetailOpen}
|
||||
onClose={handleCloseStockDetail}
|
||||
selectedStock={selectedStock}
|
||||
/>
|
||||
|
||||
{/* 浮动按钮 */}
|
||||
<Box position="fixed" bottom={8} right={8} zIndex={1000}>
|
||||
<VStack spacing={3}>
|
||||
|
||||
Reference in New Issue
Block a user