后端变更: - 添加最大仓位金额(maxPositionValue)和最大仓位数量(maxPositionCount)配置字段 - 实现按市场检查仓位限制的过滤逻辑 - 添加数据库迁移脚本 V11__add_max_position_config.sql 前端变更: - 重构账户导入和Leader添加为可复用组件(AccountImportForm, LeaderAddForm) - 在CopyTradingAdd页面集成账户导入和Leader添加Modal - 在CopyTradingAdd/CopyTradingEdit页面添加最大仓位限制配置项 - 补充所有多语言文件中的缺失键,确保zh-CN/zh-TW/en三种语言文件一致 功能说明: - 支持设置单个市场的最大仓位金额限制(USDC) - 支持设置单个市场的最大仓位数量限制 - 两个限制可以同时启用,下单前会检查当前市场仓位是否超过限制
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { useNavigate } from 'react-router-dom'
|
|
import { Card, Form, Button, Typography } from 'antd'
|
|
import { ArrowLeftOutlined } from '@ant-design/icons'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { message } from 'antd'
|
|
import LeaderAddForm from '../components/LeaderAddForm'
|
|
|
|
const { Title } = Typography
|
|
|
|
const LeaderAdd: React.FC = () => {
|
|
const { t } = useTranslation()
|
|
const navigate = useNavigate()
|
|
const [form] = Form.useForm()
|
|
|
|
const handleSuccess = async () => {
|
|
message.success(t('leaderAdd.addSuccess') || '添加 Leader 成功')
|
|
navigate('/leaders')
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<div style={{ marginBottom: '16px' }}>
|
|
<Button
|
|
icon={<ArrowLeftOutlined />}
|
|
onClick={() => navigate('/leaders')}
|
|
style={{ marginBottom: '16px' }}
|
|
>
|
|
{t('leaderAdd.back') || '返回'}
|
|
</Button>
|
|
<Title level={2} style={{ margin: 0 }}>{t('leaderAdd.title') || '添加 Leader'}</Title>
|
|
</div>
|
|
|
|
<Card>
|
|
<LeaderAddForm
|
|
form={form}
|
|
onSuccess={handleSuccess}
|
|
onCancel={() => navigate('/leaders')}
|
|
showCancelButton={true}
|
|
/>
|
|
</Card>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default LeaderAdd
|
|
|