更新Company页面的UI为FUI风格
This commit is contained in:
@@ -19,8 +19,9 @@ import ConceptStockItem from './ConceptStockItem';
|
||||
/**
|
||||
* 详细概念卡片组件
|
||||
* @param {Object} props
|
||||
* @param {Object} props.concept - 概念对象(兼容 v1/v2 API)
|
||||
* @param {Object} props.concept - 概念对象(兼容 v1/v2 API 和 related_concepts 表数据)
|
||||
* - concept: 概念名称
|
||||
* - reason: 关联原因(来自 related_concepts 表)
|
||||
* - stock_count: 相关股票数量
|
||||
* - score: 相关度(0-1)
|
||||
* - price_info.avg_change_pct: 平均涨跌幅
|
||||
@@ -34,6 +35,8 @@ const DetailedConceptCard = ({ concept, onClick }) => {
|
||||
const borderColor = useColorModeValue('gray.200', 'gray.600');
|
||||
const headingColor = useColorModeValue('gray.700', 'gray.200');
|
||||
const stockCountColor = useColorModeValue('gray.500', 'gray.400');
|
||||
const reasonBg = useColorModeValue('blue.50', 'blue.900');
|
||||
const reasonColor = useColorModeValue('gray.700', 'gray.200');
|
||||
|
||||
// 计算相关度百分比
|
||||
const relevanceScore = Math.round((concept.score || 0) * 100);
|
||||
@@ -43,6 +46,9 @@ const DetailedConceptCard = ({ concept, onClick }) => {
|
||||
const changeColor = changePct > 0 ? 'red' : changePct < 0 ? 'green' : 'gray';
|
||||
const changeSymbol = changePct > 0 ? '+' : '';
|
||||
|
||||
// 判断是否来自数据库(有 reason 字段)
|
||||
const isFromDatabase = !!concept.reason;
|
||||
|
||||
return (
|
||||
<Card
|
||||
bg={cardBg}
|
||||
@@ -67,17 +73,27 @@ const DetailedConceptCard = ({ concept, onClick }) => {
|
||||
{concept.concept}
|
||||
</Text>
|
||||
<HStack spacing={2} flexWrap="wrap">
|
||||
<Badge colorScheme="purple" fontSize="xs">
|
||||
相关度: {relevanceScore}%
|
||||
</Badge>
|
||||
<Badge colorScheme="orange" fontSize="xs">
|
||||
{concept.stock_count} 只股票
|
||||
</Badge>
|
||||
{/* 数据库数据显示"AI分析"标签,搜索数据显示相关度 */}
|
||||
{isFromDatabase ? (
|
||||
<Badge colorScheme="green" fontSize="xs">
|
||||
AI 分析
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge colorScheme="purple" fontSize="xs">
|
||||
相关度: {relevanceScore}%
|
||||
</Badge>
|
||||
)}
|
||||
{/* 只有搜索数据才显示股票数量 */}
|
||||
{!isFromDatabase && concept.stock_count > 0 && (
|
||||
<Badge colorScheme="orange" fontSize="xs">
|
||||
{concept.stock_count} 只股票
|
||||
</Badge>
|
||||
)}
|
||||
</HStack>
|
||||
</VStack>
|
||||
|
||||
{/* 右侧:涨跌幅 */}
|
||||
{concept.price_info?.avg_change_pct && (
|
||||
{/* 右侧:涨跌幅(仅搜索数据有) */}
|
||||
{!isFromDatabase && concept.price_info?.avg_change_pct && (
|
||||
<Box textAlign="right">
|
||||
<Text fontSize="xs" color={stockCountColor} mb={1}>
|
||||
平均涨跌幅
|
||||
@@ -97,8 +113,30 @@ const DetailedConceptCard = ({ concept, onClick }) => {
|
||||
|
||||
<Divider />
|
||||
|
||||
{/* 概念描述 */}
|
||||
{concept.description && (
|
||||
{/* 关联原因(来自数据库,突出显示) */}
|
||||
{concept.reason && (
|
||||
<Box
|
||||
bg={reasonBg}
|
||||
p={3}
|
||||
borderRadius="md"
|
||||
borderLeft="4px solid"
|
||||
borderLeftColor="blue.400"
|
||||
>
|
||||
<Text fontSize="xs" fontWeight="bold" color="blue.500" mb={1}>
|
||||
关联原因
|
||||
</Text>
|
||||
<Text
|
||||
fontSize="sm"
|
||||
color={reasonColor}
|
||||
lineHeight="1.8"
|
||||
>
|
||||
{concept.reason}
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* 概念描述(仅搜索数据有,且没有 reason 时显示) */}
|
||||
{!concept.reason && concept.description && (
|
||||
<Text
|
||||
fontSize="sm"
|
||||
color={stockCountColor}
|
||||
|
||||
Reference in New Issue
Block a user