update pay promo

This commit is contained in:
2026-02-05 11:12:02 +08:00
parent c14090b624
commit a2f77371cf
3 changed files with 74 additions and 3 deletions

View File

@@ -278,6 +278,29 @@ const getDefaultTopSector = (count: number | undefined, dateStr: string | undefi
return sectors[dateNum % sectors.length];
};
/**
* 根据股票代码推断涨停幅度
* - 主板60开头、00开头10%
* - 科创板688开头20%
* - 创业板30开头20%
* - 北交所8开头30%
*/
const getLimitUpPercent = (scode: string | undefined): number => {
if (!scode) return 10.0;
const code = scode.replace(/\.\w+$/, ''); // 移除后缀如 .SZ .SH
if (code.startsWith('688')) {
return 20.0; // 科创板
}
if (code.startsWith('30')) {
return 20.0; // 创业板
}
if (code.startsWith('8')) {
return 30.0; // 北交所
}
return 10.0; // 主板
};
/**
* 解析连板天数
* 例如 "2连板" -> 2, "首板" -> 1
@@ -448,7 +471,7 @@ export const fetchHighPositionStocks = async (date: string): Promise<HighPositio
stock_code: stock.scode,
stock_name: stock.sname,
price: 0, // 静态数据中没有实时价格
increase_rate: 10.0, // 涨停固定 10%
increase_rate: getLimitUpPercent(stock.scode), // 根据股票类型推断涨停幅度
continuous_limit_up: days,
industry: (stock.core_sectors || [])[0] || '未知',
turnover_rate: 0, // 静态数据中没有换手率

View File

@@ -6,6 +6,31 @@ import React, { memo, useMemo, useState, useCallback } from 'react';
import { Box, Text, HStack, VStack, Icon, Table, Thead, Tbody, Tr, Th, Td, Badge, Tooltip } from '@chakra-ui/react';
import { Activity, ArrowUp, ArrowDown, Zap, ChevronDown, ChevronUp } from 'lucide-react';
// ============ 辅助函数 ============
/**
* 根据股票代码推断涨停幅度
* - 主板60开头、00开头10%
* - 科创板688开头20%
* - 创业板30开头20%
* - 北交所8开头30%
*/
const getLimitUpPercent = (scode: string | undefined): string => {
if (!scode) return "10.00";
const code = scode.replace(/\.\w+$/, ''); // 移除后缀如 .SZ .SH
if (code.startsWith('688')) {
return "20.00"; // 科创板
}
if (code.startsWith('30')) {
return "20.00"; // 创业板
}
if (code.startsWith('8')) {
return "30.00"; // 北交所
}
return "10.00"; // 主板
};
// ============ 类型定义 ============
interface Stock {
@@ -114,7 +139,7 @@ const SectorMovementTable: React.FC<SectorMovementTableProps> = memo(({ sectorDa
netInflow: typeof netInflow === 'number' ? netInflow : parseFloat(netInflow),
leadingStock: leadingStock?.sname || info.leading_stock || '-',
leadingStockCode: leadingStock?.scode || '',
leadingStockChange: leadingStock?.change_pct || (Math.random() * 3 + 8).toFixed(2),
leadingStockChange: leadingStock?.change_pct || getLimitUpPercent(leadingStock?.scode),
stocks,
};
});

View File

@@ -24,6 +24,29 @@ import {
bgColors,
} from "@/constants/limitAnalyseTheme";
/**
* 根据股票代码推断涨停幅度
* - 主板60开头、00开头10%
* - 科创板688开头20%
* - 创业板30开头20%
* - 北交所8开头30%
*/
function getLimitUpPercent(scode: string): string {
if (!scode) return "10.00";
const code = scode.replace(/\.\w+$/, ''); // 移除后缀如 .SZ .SH
if (code.startsWith('688')) {
return "20.00"; // 科创板
}
if (code.startsWith('30')) {
return "20.00"; // 创业板
}
if (code.startsWith('8')) {
return "30.00"; // 北交所
}
return "10.00"; // 主板
}
/** 获取板块颜色 */
function getSectorTagColor(sector: string): string {
if (sector === "公告") return "#D4AF37";
@@ -136,7 +159,7 @@ const StockRow = memo<StockRowProps>(
minW="70px"
textAlign="center"
>
+{stock.change_pct || "10.00"}%
+{stock.change_pct || getLimitUpPercent(stock.scode)}%
</Text>
{/* 右侧:连板标签 + 板块标签 */}