From 587e3df20eb3d1bcd3f9e707cc7461cfb73b65bc Mon Sep 17 00:00:00 2001
From: zdl <3489966805@qq.com>
Date: Wed, 15 Oct 2025 20:59:27 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=90=88=E8=A7=84?=
=?UTF-8?q?=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../StockChart/StockChartAntdModal.js | 14 ++-
.../components/InvestmentCalendar.js | 87 +++++++++++++++++--
.../components/TransmissionChainAnalysis.js | 29 ++++++-
3 files changed, 116 insertions(+), 14 deletions(-)
diff --git a/src/components/StockChart/StockChartAntdModal.js b/src/components/StockChart/StockChartAntdModal.js
index a10a6e70..fd92c925 100644
--- a/src/components/StockChart/StockChartAntdModal.js
+++ b/src/components/StockChart/StockChartAntdModal.js
@@ -5,6 +5,7 @@ import ReactECharts from 'echarts-for-react';
import * as echarts from 'echarts';
import moment from 'moment';
import { stockService } from '../../services/eventService';
+import CitedContent from '../Citation/CitedContent';
const { Text } = Typography;
@@ -524,12 +525,21 @@ const StockChartAntdModal = ({
{/* 关联描述 */}
- {stock?.relation_desc && (
+ {stock?.relation_desc?.data ? (
+ // 使用引用组件(带研报来源)
+
+ ) : stock?.relation_desc ? (
+ // 降级显示(无引用数据)
关联描述:
{stock.relation_desc}(AI合成)
- )}
+ ) : null}
{/* 调试信息 */}
{process.env.NODE_ENV === 'development' && chartData && (
diff --git a/src/views/Community/components/InvestmentCalendar.js b/src/views/Community/components/InvestmentCalendar.js
index 61a0e30d..3913c141 100644
--- a/src/views/Community/components/InvestmentCalendar.js
+++ b/src/views/Community/components/InvestmentCalendar.js
@@ -6,7 +6,7 @@ import {
} from 'antd';
import {
StarFilled, StarOutlined, CalendarOutlined, LinkOutlined, StockOutlined,
- TagsOutlined, ClockCircleOutlined, InfoCircleOutlined, LockOutlined
+ TagsOutlined, ClockCircleOutlined, InfoCircleOutlined, LockOutlined, RobotOutlined
} from '@ant-design/icons';
import moment from 'moment';
import ReactMarkdown from 'react-markdown';
@@ -14,6 +14,8 @@ import { eventService, stockService } from '../../../services/eventService';
import StockChartAntdModal from '../../../components/StockChart/StockChartAntdModal';
import { useSubscription } from '../../../hooks/useSubscription';
import SubscriptionUpgradeModal from '../../../components/SubscriptionUpgradeModal';
+import CitationMark from '../../../components/Citation/CitationMark';
+import { processCitationData } from '../../../utils/citationUtils';
import './InvestmentCalendar.css';
const { TabPane } = Tabs;
@@ -474,26 +476,95 @@ const InvestmentCalendar = () => {
const stockCode = record[0];
const isExpanded = expandedReasons[stockCode] || false;
const shouldTruncate = reason && reason.length > 100;
-
+
const toggleExpanded = () => {
setExpandedReasons(prev => ({
...prev,
[stockCode]: !prev[stockCode]
}));
};
-
+
+ // 检查是否有引用数据(可能在 record.reason_citation 或 record[4])
+ const citationData = record.reason;
+ const hasCitation = citationData && citationData.data && Array.isArray(citationData.data);
+
+ if (hasCitation) {
+ // 使用引用组件,支持展开/收起
+ const processed = processCitationData(citationData);
+
+ if (processed) {
+ // 计算所有段落的总长度
+ const totalLength = processed.segments.reduce((sum, seg) => sum + seg.text.length, 0);
+ const shouldTruncate = totalLength > 100;
+
+ // 确定要显示的段落
+ let displaySegments = processed.segments;
+ if (shouldTruncate && !isExpanded) {
+ // 需要截断:计算应该显示到哪个段落
+ let charCount = 0;
+ displaySegments = [];
+ for (const seg of processed.segments) {
+ if (charCount + seg.text.length <= 100) {
+ // 完整显示这个段落
+ displaySegments.push(seg);
+ charCount += seg.text.length;
+ } else {
+ // 截断这个段落
+ const remainingChars = 100 - charCount;
+ if (remainingChars > 0) {
+ const truncatedText = seg.text.substring(0, remainingChars) + '...';
+ displaySegments.push({ ...seg, text: truncatedText });
+ }
+ break;
+ }
+ }
+ }
+
+ return (
+
+
+ {displaySegments.map((segment, index) => (
+
+ {segment.text}
+
+ {index < displaySegments.length - 1 && ,}
+
+ ))}
+
+ {shouldTruncate && (
+
+ )}
+
+ (AI合成)
+
+
+ );
+ }
+ }
+
+ // 降级显示:纯文本 + 展开/收起
return (
- {isExpanded || !shouldTruncate
- ? reason
+ {isExpanded || !shouldTruncate
+ ? reason
: `${reason?.slice(0, 100)}...`
}
{shouldTruncate && (
-