fix: 优化回测功能UI和修复问题

## 主要修改

### UI 优化
- 将回测功能移到跟单交易菜单下作为子菜单
- 创建回测改为使用 Modal 方式(移除独立页面)
- 优化导航路径,使用 useNavigate 替代 window.location.href

### 功能修复
- 修复 API 路径问题:移除重复的 /api 前缀(/api/backtest -> /backtest)
- 修复 copyRatio 输入框单位:改为百分比输入(100 表示 100%),与跟单配置保持一致
- 修复回测列表中 leader 列显示为空的问题:优先显示 leaderName,为空时显示 leaderAddress

### 多语言完善
- 补充缺失的多语言 key:
  - common.ascending / common.descending / common.day
  - backtest.sortBy / backtest.sortOrder / backtest.createdAt
  - backtest.copyRatioTooltip / backtest.copyRatioPlaceholder
  - 以及其他表单验证相关的 key
- 为中文简体、中文繁体、英文三种语言都添加了完整的翻译

## 修改的文件
- frontend/src/App.tsx - 移除 BacktestCreate 路由
- frontend/src/components/Layout.tsx - 调整菜单结构
- frontend/src/pages/BacktestList.tsx - Modal 创建、修复 leader 显示
- frontend/src/pages/BacktestDetail.tsx - 优化导航
- frontend/src/pages/BacktestCreate.tsx - 同步 copyRatio 修改
- frontend/src/services/api.ts - 修复 API 路径
- frontend/src/locales/* - 补充多语言配置
This commit is contained in:
WrBug
2026-01-31 07:46:16 +08:00
parent cdd02e9f3d
commit fd25821e39
9 changed files with 514 additions and 39 deletions
+24 -2
View File
@@ -34,7 +34,10 @@
"previous": "Previous",
"next": "Next",
"page": "Page",
"pageOf": "Page"
"pageOf": "Page",
"ascending": "Ascending",
"descending": "Descending",
"day": "day"
},
"account": {
"title": "Account Management",
@@ -1326,6 +1329,25 @@
"starting": "Starting...",
"stopping": "Stopping...",
"errorOccurred": "Error occurred",
"retry": "Retry"
"retry": "Retry",
"taskNameRequired": "Please enter task name",
"leaderRequired": "Please select Leader",
"initialBalanceRequired": "Please enter initial balance",
"initialBalanceInvalid": "Initial balance must be greater than 0",
"backtestDaysRequired": "Please enter backtest days",
"backtestDaysInvalid": "Backtest days must be between 1-15",
"copyRatioRequired": "Please enter copy ratio",
"copyRatioInvalid": "Copy ratio must be between 0.01-10000",
"copyRatioPlaceholder": "For example: 100 means 100% (1:1 copy), default 100%",
"copyRatioTooltip": "Copy ratio represents the percentage of copy amount relative to Leader order amount. For example: 100% means 1:1 copy, 50% means half position copy, 200% means double copy",
"fixedAmountRequired": "Please enter fixed amount",
"fixedAmountInvalid": "Fixed amount must be greater than 0",
"advancedFilters": "Advanced Filters",
"keywordsPlaceholder": "Please enter keywords, press Enter to add",
"delaySecondsHint": "Delay execution to simulate real copy trading delay",
"supportSellHint": "Whether to follow Leader's sell operations",
"sortBy": "Sort By",
"sortOrder": "Sort Order",
"createdAt": "Created At"
}
}