Files
vf_react/src/constants/importanceLevels.js
zdl 293d84e065 feat本次提交包含的优化
 StockChangeIndicators 组件优化

  - 调整 padding 使布局更紧凑
  - 修复窄卡片中的折行问题
  - 自动根据内容调整宽度

   重要性等级视觉优化

  - 统一使用红色系(S→A→B→C:从深红到浅红)
  - 添加 badgeBg 字段支持新的角标样式

   DynamicNewsEventCard 卡片改版

  - 左上角矩形角标显示重要性(镂空边框样式)
  - 悬浮显示所有等级说明
  - 标题限制两行显示

   Mock 数据完整性

  - 添加缺失的 related_week_chg 字段
  - 确保三个涨跌幅指标数据完整
2025-11-03 15:38:30 +08:00

86 lines
2.2 KiB
JavaScript

// src/constants/importanceLevels.js
// 事件重要性等级配置
import {
WarningIcon,
WarningTwoIcon,
InfoIcon,
CheckCircleIcon,
} from '@chakra-ui/icons';
/**
* 重要性等级配置
* 用于事件列表展示和重要性说明
*/
export const IMPORTANCE_LEVELS = {
'S': {
level: 'S',
color: 'red.800',
bgColor: 'red.50',
borderColor: 'red.200',
colorScheme: 'red',
badgeBg: 'red.800', // 角标边框和文字颜色 - 极深红色
icon: WarningIcon,
label: '极高',
dotBg: 'red.800',
description: '重大事件,市场影响深远',
antdColor: '#cf1322',
},
'A': {
level: 'A',
color: 'red.600',
bgColor: 'red.50',
borderColor: 'red.200',
colorScheme: 'red',
badgeBg: 'red.600', // 角标边框和文字颜色 - 深红色
icon: WarningTwoIcon,
label: '高',
dotBg: 'red.600',
description: '重要事件,影响较大',
antdColor: '#ff4d4f',
},
'B': {
level: 'B',
color: 'red.500',
bgColor: 'red.50',
borderColor: 'red.100',
colorScheme: 'red',
badgeBg: 'red.500', // 角标边框和文字颜色 - 中红色
icon: InfoIcon,
label: '中',
dotBg: 'red.500',
description: '普通事件,有一定影响',
antdColor: '#ff7875',
},
'C': {
level: 'C',
color: 'red.400',
bgColor: 'red.50',
borderColor: 'red.100',
colorScheme: 'red',
badgeBg: 'red.400', // 角标边框和文字颜色 - 浅红色
icon: CheckCircleIcon,
label: '低',
dotBg: 'red.400',
description: '参考事件,影响有限',
antdColor: '#ffa39e',
}
};
/**
* 获取重要性等级配置
* @param {string} importance - 重要性等级 (S/A/B/C)
* @returns {Object} 重要性配置对象
*/
export const getImportanceConfig = (importance) => {
return IMPORTANCE_LEVELS[importance] || IMPORTANCE_LEVELS['C'];
};
/**
* 获取所有等级配置(用于说明列表)
* @returns {Array} 所有等级配置数组
*/
export const getAllImportanceLevels = () => {
return Object.values(IMPORTANCE_LEVELS);
};