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