Merge branch 'feature_bugfix/251201_py_h5_ui' into feature_2025/251209_stock_pref

* feature_bugfix/251201_py_h5_ui:
  feat: Company 页面搜索框添加股票模糊搜索功能
  update pay ui
  update pay ui
  fix: 个股中心bug修复
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  update pay ui
  feat: 替换公众号文件
  update pay ui
This commit is contained in:
zdl
2025-12-10 14:30:25 +08:00
61 changed files with 22548 additions and 1177 deletions

View File

@@ -313,12 +313,29 @@ const StockChartAntdModal = ({
axisPointer: { type: 'cross' },
formatter: function(params) {
const d = params[0]?.dataIndex ?? 0;
const priceChangePercent = ((prices[d] - prevClose) / prevClose * 100);
const avgChangePercent = ((avgPrices[d] - prevClose) / prevClose * 100);
const price = prices[d];
const avgPrice = avgPrices[d];
const volume = volumes[d];
// 安全计算涨跌幅,处理 undefined/null/0 的情况
const safeCalcPercent = (val, base) => {
if (val == null || base == null || base === 0) return 0;
return ((val - base) / base * 100);
};
const priceChangePercent = safeCalcPercent(price, prevClose);
const avgChangePercent = safeCalcPercent(avgPrice, prevClose);
const priceColor = priceChangePercent >= 0 ? '#ef5350' : '#26a69a';
const avgColor = avgChangePercent >= 0 ? '#ef5350' : '#26a69a';
return `时间:${times[d]}<br/>现价:<span style="color: ${priceColor}">¥${prices[d]?.toFixed(2)} (${priceChangePercent >= 0 ? '+' : ''}${priceChangePercent.toFixed(2)}%)</span><br/>均价:<span style="color: ${avgColor}">¥${avgPrices[d]?.toFixed(2)} (${avgChangePercent >= 0 ? '+' : ''}${avgChangePercent.toFixed(2)}%)</span><br/>昨收:¥${prevClose?.toFixed(2)}<br/>成交量:${Math.round(volumes[d]/100)}`;
// 安全格式化数字
const safeFixed = (val, digits = 2) => (val != null && !isNaN(val)) ? val.toFixed(digits) : '-';
const formatPercent = (val) => {
if (val == null || isNaN(val)) return '-';
return (val >= 0 ? '+' : '') + val.toFixed(2) + '%';
};
return `时间:${times[d] || '-'}<br/>现价:<span style="color: ${priceColor}">¥${safeFixed(price)} (${formatPercent(priceChangePercent)})</span><br/>均价:<span style="color: ${avgColor}">¥${safeFixed(avgPrice)} (${formatPercent(avgChangePercent)})</span><br/>昨收:¥${safeFixed(prevClose)}<br/>成交量:${volume != null ? Math.round(volume/100) + '手' : '-'}`;
}
},
grid: [
@@ -337,6 +354,7 @@ const StockChartAntdModal = ({
position: 'left',
axisLabel: {
formatter: function(value) {
if (value == null || isNaN(value)) return '-';
return (value >= 0 ? '+' : '') + value.toFixed(2) + '%';
}
},
@@ -354,11 +372,12 @@ const StockChartAntdModal = ({
position: 'right',
axisLabel: {
formatter: function(value) {
if (value == null || isNaN(value)) return '-';
return (value >= 0 ? '+' : '') + value.toFixed(2) + '%';
}
}
},
{ type: 'value', gridIndex: 1, scale: true, axisLabel: { formatter: v => Math.round(v/100) + '手' } }
{ type: 'value', gridIndex: 1, scale: true, axisLabel: { formatter: v => (v != null && !isNaN(v)) ? Math.round(v/100) + '手' : '-' } }
],
dataZoom: [
{ type: 'inside', xAxisIndex: [0, 1], start: 0, end: 100 },

View File

@@ -217,27 +217,34 @@ const TimelineChartModal: React.FC<TimelineChartModalProps> = ({
if (dataIndex === undefined) return '';
const item = data[dataIndex];
const changeColor = item.change_percent >= 0 ? '#ef5350' : '#26a69a';
const changeSign = item.change_percent >= 0 ? '+' : '';
if (!item) return '';
// 安全格式化数字
const safeFixed = (val: any, digits = 2) =>
val != null && !isNaN(val) ? Number(val).toFixed(digits) : '-';
const changePercent = item.change_percent ?? 0;
const changeColor = changePercent >= 0 ? '#ef5350' : '#26a69a';
const changeSign = changePercent >= 0 ? '+' : '';
return `
<div style="padding: 8px;">
<div style="font-weight: bold; margin-bottom: 8px;">${item.time}</div>
<div style="font-weight: bold; margin-bottom: 8px;">${item.time || '-'}</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<span>价格:</span>
<span style="color: ${changeColor}; font-weight: bold; margin-left: 20px;">${item.price.toFixed(2)}</span>
<span style="color: ${changeColor}; font-weight: bold; margin-left: 20px;">${safeFixed(item.price)}</span>
</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<span>均价:</span>
<span style="color: #ffa726; margin-left: 20px;">${item.avg_price.toFixed(2)}</span>
<span style="color: #ffa726; margin-left: 20px;">${safeFixed(item.avg_price)}</span>
</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
<span>涨跌幅:</span>
<span style="color: ${changeColor}; margin-left: 20px;">${changeSign}${item.change_percent.toFixed(2)}%</span>
<span style="color: ${changeColor}; margin-left: 20px;">${changeSign}${safeFixed(changePercent)}%</span>
</div>
<div style="display: flex; justify-content: space-between;">
<span>成交量:</span>
<span style="margin-left: 20px;">${(item.volume / 100).toFixed(0)}手</span>
<span style="margin-left: 20px;">${item.volume != null ? (item.volume / 100).toFixed(0) : '-'}手</span>
</div>
</div>
`;
@@ -314,7 +321,7 @@ const TimelineChartModal: React.FC<TimelineChartModalProps> = ({
axisLabel: {
color: '#999',
fontSize: isMobile ? 10 : 12,
formatter: (value: number) => value.toFixed(2),
formatter: (value: number) => (value != null && !isNaN(value)) ? value.toFixed(2) : '-',
},
},
{
@@ -333,6 +340,7 @@ const TimelineChartModal: React.FC<TimelineChartModalProps> = ({
color: '#999',
fontSize: isMobile ? 10 : 12,
formatter: (value: number) => {
if (value == null || isNaN(value)) return '-';
if (value >= 10000) {
return (value / 10000).toFixed(1) + '万';
}