diff --git a/src/components/StockChart/KLineChartModal.tsx b/src/components/StockChart/KLineChartModal.tsx index 68bfa502..c303d517 100644 --- a/src/components/StockChart/KLineChartModal.tsx +++ b/src/components/StockChart/KLineChartModal.tsx @@ -6,14 +6,7 @@ import * as echarts from 'echarts'; import dayjs from 'dayjs'; import { stockService } from '@services/eventService'; import { selectIsMobile } from '@store/slices/deviceSlice'; - -/** - * 股票信息 - */ -interface StockInfo { - stock_code: string; - stock_name?: string; -} +import { StockInfo } from './types'; /** * KLineChartModal 组件 Props diff --git a/src/components/StockChart/TimelineChartModal.tsx b/src/components/StockChart/TimelineChartModal.tsx index f38302cb..5328e551 100644 --- a/src/components/StockChart/TimelineChartModal.tsx +++ b/src/components/StockChart/TimelineChartModal.tsx @@ -21,14 +21,7 @@ import * as echarts from 'echarts'; import dayjs from 'dayjs'; import { klineDataCache, getCacheKey, fetchKlineData } from '@views/Community/components/StockDetailPanel/utils/klineDataCache'; import { selectIsMobile } from '@store/slices/deviceSlice'; - -/** - * 股票信息 - */ -interface StockInfo { - stock_code: string; - stock_name?: string; -} +import { StockInfo } from './types'; /** * TimelineChartModal 组件 Props diff --git a/src/components/StockChart/types.ts b/src/components/StockChart/types.ts new file mode 100644 index 00000000..b120812b --- /dev/null +++ b/src/components/StockChart/types.ts @@ -0,0 +1,56 @@ +// src/components/StockChart/types.ts +// 图表弹窗共享类型和常量 + +/** + * 股票信息(两个组件共用) + */ +export interface StockInfo { + stock_code: string; + stock_name?: string; +} + +/** + * 图表颜色常量 + */ +export const CHART_COLORS = { + background: '#1a1a1a', + border: '#404040', + text: '#e0e0e0', + textSecondary: '#999', + gridLine: '#2a2a2a', + up: '#ef5350', // 涨 + down: '#26a69a', // 跌 + accent: '#ffd700', // 金色强调 + avgLine: '#ffa726', // 均价线 + priceLine: '#2196f3', // 价格线 +} as const; + +/** + * Modal 样式常量 + */ +export const MODAL_STYLES = { + border: '2px solid #ffd700', + boxShadow: '0 0 30px rgba(255, 215, 0, 0.5)', + borderRadius: { mobile: '12px', desktop: '8px' }, + maxHeight: '85vh', + width: { mobile: '96vw', desktop: '90vw' }, +} as const; + +/** + * Tooltip 样式 + */ +export const TOOLTIP_STYLES = { + backgroundColor: 'rgba(30, 30, 30, 0.95)', + borderColor: '#404040', + borderWidth: 1, + textStyle: { color: '#e0e0e0' }, +} as const; + +/** + * 轴线样式 + */ +export const AXIS_STYLES = { + lineColor: '#404040', + labelColor: '#999', + fontSize: { mobile: 10, desktop: 12 }, +} as const;