fix: EPS图例颜色改为绿色 & 公告类型编码格式处理
- ForecastReport/constants.ts: epsAvg 颜色从灰色改为绿色 #10B981 - AnnouncementsPanel.tsx: 添加 formatInfoType 函数处理原始编码格式 - 当 info_type 包含 || 分隔符时显示"公告"而非原始编码 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,17 @@ import { THEME } from "../config";
|
|||||||
import { formatDate } from "../utils";
|
import { formatDate } from "../utils";
|
||||||
import LoadingState from "./LoadingState";
|
import LoadingState from "./LoadingState";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化公告类型
|
||||||
|
* 如果是编码格式(包含||),则显示"公告"
|
||||||
|
*/
|
||||||
|
const formatInfoType = (infoType: string | undefined): string => {
|
||||||
|
if (!infoType) return "公告";
|
||||||
|
// 如果包含编码分隔符,说明是原始编码,显示默认文字
|
||||||
|
if (infoType.includes("||")) return "公告";
|
||||||
|
return infoType;
|
||||||
|
};
|
||||||
|
|
||||||
interface AnnouncementsPanelProps {
|
interface AnnouncementsPanelProps {
|
||||||
stockCode: string;
|
stockCode: string;
|
||||||
/** SubTabContainer 传递的激活状态,控制是否加载数据 */
|
/** SubTabContainer 传递的激活状态,控制是否加载数据 */
|
||||||
@@ -74,7 +85,7 @@ const AnnouncementsPanel: React.FC<AnnouncementsPanelProps> = ({ stockCode, isAc
|
|||||||
<VStack align="start" spacing={1} flex={1}>
|
<VStack align="start" spacing={1} flex={1}>
|
||||||
<HStack>
|
<HStack>
|
||||||
<Badge size="sm" bg={THEME.gold} color="gray.900">
|
<Badge size="sm" bg={THEME.gold} color="gray.900">
|
||||||
{announcement.info_type || "公告"}
|
{formatInfoType(announcement.info_type)}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Text fontSize="xs" color={THEME.textSecondary}>
|
<Text fontSize="xs" color={THEME.textSecondary}>
|
||||||
{formatDate(announcement.announce_date)}
|
{formatDate(announcement.announce_date)}
|
||||||
@@ -119,7 +130,7 @@ const AnnouncementsPanel: React.FC<AnnouncementsPanelProps> = ({ stockCode, isAc
|
|||||||
<Text>{selectedAnnouncement?.title}</Text>
|
<Text>{selectedAnnouncement?.title}</Text>
|
||||||
<HStack>
|
<HStack>
|
||||||
<Badge bg={THEME.gold} color="gray.900">
|
<Badge bg={THEME.gold} color="gray.900">
|
||||||
{selectedAnnouncement?.info_type || "公告"}
|
{formatInfoType(selectedAnnouncement?.info_type)}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Text fontSize="sm" color={THEME.textSecondary}>
|
<Text fontSize="sm" color={THEME.textSecondary}>
|
||||||
{formatDate(selectedAnnouncement?.announce_date)}
|
{formatDate(selectedAnnouncement?.announce_date)}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const CHART_COLORS = {
|
|||||||
profit: '#F6AD55', // 利润 - 橙金色
|
profit: '#F6AD55', // 利润 - 橙金色
|
||||||
growth: '#10B981', // 增长率 - 翠绿色
|
growth: '#10B981', // 增长率 - 翠绿色
|
||||||
eps: '#DAA520', // EPS - 金菊色
|
eps: '#DAA520', // EPS - 金菊色
|
||||||
epsAvg: '#A0AEC0', // EPS行业平均 - 亮灰色(提高对比度)
|
epsAvg: '#10B981', // EPS行业平均 - 绿色(与增长率一致)
|
||||||
pe: '#D4AF37', // PE - 金色
|
pe: '#D4AF37', // PE - 金色
|
||||||
peg: '#38B2AC', // PEG - 青色(优化对比度)
|
peg: '#38B2AC', // PEG - 青色(优化对比度)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user