feat: 添加Company 页面 Tab 切换组件
This commit is contained in:
53
src/views/Company/constants/index.js
Normal file
53
src/views/Company/constants/index.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// src/views/Company/constants/index.js
|
||||
// 公司详情页面常量配置
|
||||
|
||||
import { FaChartLine, FaMoneyBillWave, FaChartBar, FaInfoCircle } from 'react-icons/fa';
|
||||
|
||||
/**
|
||||
* Tab 配置
|
||||
* @type {Array<{key: string, name: string, icon: React.ComponentType}>}
|
||||
*/
|
||||
export const COMPANY_TABS = [
|
||||
{ key: 'overview', name: '公司概览', icon: FaInfoCircle },
|
||||
{ key: 'market', name: '股票行情', icon: FaChartLine },
|
||||
{ key: 'financial', name: '财务全景', icon: FaMoneyBillWave },
|
||||
{ key: 'forecast', name: '盈利预测', icon: FaChartBar },
|
||||
];
|
||||
|
||||
/**
|
||||
* Tab 选中状态样式
|
||||
*/
|
||||
export const TAB_SELECTED_STYLE = {
|
||||
transform: 'scale(1.02)',
|
||||
transition: 'all 0.2s',
|
||||
};
|
||||
|
||||
/**
|
||||
* Toast 消息配置
|
||||
*/
|
||||
export const TOAST_MESSAGES = {
|
||||
WATCHLIST_ADD: { title: '已加入自选', status: 'success', duration: 1500 },
|
||||
WATCHLIST_REMOVE: { title: '已从自选移除', status: 'info', duration: 1500 },
|
||||
WATCHLIST_ERROR: { title: '操作失败,请稍后重试', status: 'error', duration: 2000 },
|
||||
INVALID_CODE: { title: '无效的股票代码', status: 'error', duration: 2000 },
|
||||
LOGIN_REQUIRED: { title: '请先登录后再加入自选', status: 'warning', duration: 2000 },
|
||||
};
|
||||
|
||||
/**
|
||||
* 默认股票代码
|
||||
*/
|
||||
export const DEFAULT_STOCK_CODE = '000001';
|
||||
|
||||
/**
|
||||
* URL 参数名
|
||||
*/
|
||||
export const URL_PARAM_NAME = 'scode';
|
||||
|
||||
/**
|
||||
* 根据索引获取 Tab 名称
|
||||
* @param {number} index - Tab 索引
|
||||
* @returns {string} Tab 名称
|
||||
*/
|
||||
export const getTabNameByIndex = (index) => {
|
||||
return COMPANY_TABS[index]?.name || 'Unknown';
|
||||
};
|
||||
Reference in New Issue
Block a user