update pay ui

This commit is contained in:
2025-12-10 17:45:32 +08:00
parent 85c29483dd
commit b4791cbd4d
2 changed files with 106 additions and 9 deletions

View File

@@ -240,7 +240,7 @@ export const conceptHandlers = [
}
}),
// 获取概念相关股票
// 获取概念相关股票concept-api 路由)
http.get('/concept-api/concepts/:conceptId/stocks', async ({ params, request }) => {
await delay(300);
@@ -250,15 +250,19 @@ export const conceptHandlers = [
console.log('[Mock Concept] 获取概念相关股票:', { conceptId, limit });
// 生成模拟股票数据
// 生成模拟股票数据(确保 change_pct 是数字类型)
const stocks = [];
for (let i = 0; i < limit; i++) {
const code = 600000 + i;
stocks.push({
stock_code: `${600000 + i}`,
stock_code: `${code}.SH`,
code: `${code}.SH`,
stock_name: `股票${i + 1}`,
change_pct: (Math.random() * 10 - 2).toFixed(2),
price: (Math.random() * 100 + 10).toFixed(2),
market_cap: (Math.random() * 1000 + 100).toFixed(2)
name: `股票${i + 1}`,
change_pct: parseFloat((Math.random() * 10 - 2).toFixed(2)),
price: parseFloat((Math.random() * 100 + 10).toFixed(2)),
market_cap: parseFloat((Math.random() * 1000 + 100).toFixed(2)),
reason: '板块核心成分股'
});
}
@@ -269,6 +273,63 @@ export const conceptHandlers = [
});
}),
// 获取概念相关股票(/api/concept 路由 - 热点概览异动列表使用)
http.get('/api/concept/:conceptId/stocks', async ({ params, request }) => {
await delay(200);
const { conceptId } = params;
const url = new URL(request.url);
const limit = parseInt(url.searchParams.get('limit') || '15');
console.log('[Mock Concept] /api/concept/:conceptId/stocks:', { conceptId, limit });
// 股票池
const stockPool = [
{ code: '600519', name: '贵州茅台' },
{ code: '300750', name: '宁德时代' },
{ code: '601318', name: '中国平安' },
{ code: '002594', name: '比亚迪' },
{ code: '601012', name: '隆基绿能' },
{ code: '300274', name: '阳光电源' },
{ code: '688981', name: '中芯国际' },
{ code: '000725', name: '京东方A' },
{ code: '002230', name: '科大讯飞' },
{ code: '300124', name: '汇川技术' },
{ code: '002049', name: '紫光国微' },
{ code: '688012', name: '中微公司' },
{ code: '603501', name: '韦尔股份' },
{ code: '600036', name: '招商银行' },
{ code: '000858', name: '五粮液' },
];
// 生成模拟股票数据(确保 change_pct 是数字类型)
const stocks = [];
const count = Math.min(limit, stockPool.length);
for (let i = 0; i < count; i++) {
const stock = stockPool[i];
const suffix = stock.code.startsWith('6') ? '.SH' : '.SZ';
stocks.push({
stock_code: `${stock.code}${suffix}`,
code: `${stock.code}${suffix}`,
stock_name: stock.name,
name: stock.name,
change_pct: parseFloat((Math.random() * 12 - 3).toFixed(2)), // -3% ~ +9%
price: parseFloat((Math.random() * 100 + 10).toFixed(2)),
market_cap: parseFloat((Math.random() * 1000 + 100).toFixed(2)),
reason: '板块核心标的'
});
}
return HttpResponse.json({
success: true,
data: {
stocks,
total: stocks.length,
concept_id: conceptId
}
});
}),
// 获取最新交易日期
http.get('http://111.198.58.126:16801/price/latest', async () => {
await delay(200);