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:
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { useParams, useNavigate } from 'react-router-dom'
|
||||
import { Card, Descriptions, Button, Tag, Space, Table, message, Row, Col, Statistic, Spin } from 'antd'
|
||||
import { ArrowLeftOutlined, ReloadOutlined, DeleteOutlined, StopOutlined } from '@ant-design/icons'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -10,6 +10,7 @@ import BacktestChart from './BacktestChart'
|
||||
|
||||
const BacktestDetail: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [task, setTask] = useState<BacktestTaskDto | null>(null)
|
||||
@@ -102,7 +103,7 @@ const BacktestDetail: React.FC = () => {
|
||||
|
||||
// 返回
|
||||
const handleBack = () => {
|
||||
window.location.href = '/backtest/list'
|
||||
navigate('/backtest')
|
||||
}
|
||||
|
||||
// 停止任务
|
||||
@@ -136,7 +137,7 @@ const BacktestDetail: React.FC = () => {
|
||||
const response = await backtestService.delete({ id: parseInt(id!) })
|
||||
if (response.data.code === 0) {
|
||||
message.success(t('backtest.deleteSuccess'))
|
||||
window.location.href = '/backtest/list'
|
||||
navigate('/backtest')
|
||||
} else {
|
||||
message.error(response.data.msg || t('backtest.deleteFailed'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user