From e428caf57838951cfc1f334ff42da4ace851177f Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Fri, 14 Nov 2025 15:50:21 +0800 Subject: [PATCH] update ui --- src/components/Citation/CitedContent.js | 27 ++++++++++++++++--- .../DynamicNewsDetail/StockListItem.js | 1 + .../components/HistoricalEvents.js | 1 + .../components/TransmissionChainAnalysis.js | 7 +++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/components/Citation/CitedContent.js b/src/components/Citation/CitedContent.js index a9726ab3..0f1426ef 100644 --- a/src/components/Citation/CitedContent.js +++ b/src/components/Citation/CitedContent.js @@ -21,6 +21,8 @@ const { Text } = Typography; * @param {Object} props.prefixStyle - 前缀标签的自定义样式(可选) * @param {boolean} props.showAIBadge - 是否显示右上角 AI 标识,默认 true(可选) * @param {Object} props.containerStyle - 容器额外样式(可选) + * @param {string} props.textColor - 文本颜色,默认自动判断背景色(可选) + * @param {string} props.titleColor - 标题颜色,默认继承 textColor(可选) * * @example * */ const CitedContent = ({ @@ -38,7 +41,9 @@ const CitedContent = ({ prefix = '', prefixStyle = {}, showAIBadge = true, - containerStyle = {} + containerStyle = {}, + textColor, + titleColor }) => { // 处理数据 const processed = processCitationData(data); @@ -52,6 +57,19 @@ const CitedContent = ({ return null; } + // 自动判断文本颜色:如果容器背景是深色,使用浅色文本 + const bgColor = containerStyle.backgroundColor; + const isDarkBg = bgColor && ( + bgColor.includes('rgba(0,0,0') || + bgColor.includes('rgba(0, 0, 0') || + bgColor === 'transparent' || + bgColor.includes('#1A202C') || + bgColor.includes('#171923') + ); + + const finalTextColor = textColor || (isDarkBg ? '#E2E8F0' : '#262626'); + const finalTitleColor = titleColor || finalTextColor; + return (
- + {title}
@@ -105,6 +123,7 @@ const CitedContent = ({ fontWeight: 'bold', display: 'inline', marginRight: 4, + color: finalTextColor, ...prefixStyle }}> {prefix} @@ -114,7 +133,7 @@ const CitedContent = ({ {processed.segments.map((segment, index) => ( {/* 文本片段 */} - + {segment.text} @@ -126,7 +145,7 @@ const CitedContent = ({ {/* 在片段之间添加逗号分隔符(最后一个不加) */} {index < processed.segments.length - 1 && ( - + )} ))} diff --git a/src/views/Community/components/DynamicNewsDetail/StockListItem.js b/src/views/Community/components/DynamicNewsDetail/StockListItem.js index d10adfb5..f5a361e4 100644 --- a/src/views/Community/components/DynamicNewsDetail/StockListItem.js +++ b/src/views/Community/components/DynamicNewsDetail/StockListItem.js @@ -311,6 +311,7 @@ const StockListItem = ({ data={stock.relation_desc} title="" showAIBadge={true} + textColor={PROFESSIONAL_COLORS.text.primary} containerStyle={{ backgroundColor: 'transparent', borderRadius: '0', diff --git a/src/views/EventDetail/components/HistoricalEvents.js b/src/views/EventDetail/components/HistoricalEvents.js index 48cc4204..e5539ea4 100644 --- a/src/views/EventDetail/components/HistoricalEvents.js +++ b/src/views/EventDetail/components/HistoricalEvents.js @@ -344,6 +344,7 @@ const HistoricalEvents = ({ data={content} title="" showAIBadge={true} + textColor={PROFESSIONAL_COLORS.text.primary} containerStyle={{ backgroundColor: useColorModeValue('#f7fafc', 'rgba(45, 55, 72, 0.6)'), borderRadius: '8px', diff --git a/src/views/EventDetail/components/TransmissionChainAnalysis.js b/src/views/EventDetail/components/TransmissionChainAnalysis.js index 34009aa0..ab6896a8 100644 --- a/src/views/EventDetail/components/TransmissionChainAnalysis.js +++ b/src/views/EventDetail/components/TransmissionChainAnalysis.js @@ -972,6 +972,7 @@ const TransmissionChainAnalysis = ({ eventId }) => { ) : ( `${selectedNode.extra.description}(AI合成)` @@ -1081,7 +1082,8 @@ const TransmissionChainAnalysis = ({ eventId }) => { data={parent.transmission_mechanism} title="" prefix="机制:" - prefixStyle={{ fontSize: 12, color: '#666', fontWeight: 'bold' }} + prefixStyle={{ fontSize: 12, color: PROFESSIONAL_COLORS.text.secondary, fontWeight: 'bold' }} + textColor={PROFESSIONAL_COLORS.text.primary} containerStyle={{ marginTop: 8 }} showAIBadge={false} /> @@ -1136,7 +1138,8 @@ const TransmissionChainAnalysis = ({ eventId }) => { data={child.transmission_mechanism} title="" prefix="机制:" - prefixStyle={{ fontSize: 12, color: '#666', fontWeight: 'bold' }} + prefixStyle={{ fontSize: 12, color: PROFESSIONAL_COLORS.text.secondary, fontWeight: 'bold' }} + textColor={PROFESSIONAL_COLORS.text.primary} containerStyle={{ marginTop: 8 }} showAIBadge={false} />