update ui

This commit is contained in:
2025-11-13 17:45:09 +08:00
parent cb4c51a958
commit 8dc4ddac66

View File

@@ -63,7 +63,7 @@ const fetchIndexKline = async (indexCode) => {
}; };
/** /**
* 获取热门概念数据(用于词云图 * 获取热门概念数据(用于流动动画
*/ */
const fetchPopularConcepts = async () => { const fetchPopularConcepts = async () => {
try { try {
@@ -74,7 +74,7 @@ const fetchPopularConcepts = async () => {
}, },
body: JSON.stringify({ body: JSON.stringify({
query: '', query: '',
size: 18, // 获取前18个概念 size: 80, // 获取前80个概念
page: 1, page: 1,
sort_by: 'change_pct' sort_by: 'change_pct'
}) })
@@ -455,25 +455,29 @@ const ConceptFlowAnimation = () => {
); );
} }
// 将概念分成3行 // 将 80 个概念均匀分成 5 行(每行 16 个)
const rows = [ const rowCount = 5;
concepts.slice(0, 6), const conceptsPerRow = Math.ceil(concepts.length / rowCount);
concepts.slice(6, 12), const rows = [];
concepts.slice(12, 18)
]; for (let i = 0; i < rowCount; i++) {
const start = i * conceptsPerRow;
const end = Math.min(start + conceptsPerRow, concepts.length);
rows.push(concepts.slice(start, end));
}
return ( return (
<VStack spacing={2} h="200px" justify="center" overflow="hidden" position="relative" w="100%"> <VStack spacing={1} h="200px" justify="center" overflow="hidden" position="relative" w="100%">
{rows.map((row, rowIndex) => { {rows.map((row, rowIndex) => {
// 每行不同的速度:第一行20秒第二行25秒第三行30秒 // 每行不同的速度:第一行30秒第二行35秒依次递增
const duration = 25 + rowIndex * 5; const duration = 30 + rowIndex * 5;
return ( return (
<Box <Box
key={rowIndex} key={rowIndex}
position="relative" position="relative"
width="100%" width="100%"
height="50px" height="38px"
overflow="hidden" overflow="hidden"
> >
<HStack <HStack
@@ -502,15 +506,15 @@ const ConceptFlowAnimation = () => {
return ( return (
<Box <Box
key={`${rowIndex}-${idx}`} key={`${rowIndex}-${idx}`}
px={4} px={3}
py={2} py={1}
borderRadius="full" borderRadius="full"
bg="whiteAlpha.200" bg="whiteAlpha.200"
borderWidth="2px" borderWidth="2px"
borderColor={color} borderColor={color}
color="white" color="white"
fontWeight="bold" fontWeight="bold"
fontSize="sm" fontSize="xs"
whiteSpace="nowrap" whiteSpace="nowrap"
cursor="pointer" cursor="pointer"
position="relative" position="relative"
@@ -526,7 +530,7 @@ const ConceptFlowAnimation = () => {
}} }}
onClick={() => handleConceptClick(concept.name)} onClick={() => handleConceptClick(concept.name)}
_hover={{ _hover={{
transform: 'scale(1.15)', transform: 'scale(1.1)',
bg: 'whiteAlpha.300', bg: 'whiteAlpha.300',
boxShadow: `0 0 20px ${color}80`, boxShadow: `0 0 20px ${color}80`,
zIndex: 100 zIndex: 100