9ed5190bfe
主要变更: 1. 关键字过滤功能 - 添加关键字过滤模式(白名单/黑名单/禁用) - 支持关键字列表配置(JSON 存储) - 实现关键字匹配逻辑(不区分大小写) - 数据库迁移:V20__add_keyword_filter.sql 2. 市场 slug 优化 - 区分显示用 slug 和跳转用 eventSlug - 添加 event_slug 字段到 markets 表(V21__add_event_slug_to_markets.sql) - 从 events[0].slug 获取跳转用的 slug 并存入数据库 - 减少 API 请求,提高性能 3. UI 优化 - 将创建/编辑跟单配置改为 Modal 方式 - 删除独立的 CopyTradingAdd 和 CopyTradingEdit 页面 - 更新前端跳转逻辑,优先使用 eventSlug 4. API 响应优化 - 更新 MarketResponse 添加 events 字段 - 统一从 events[0].slug 获取跳转用的 slug - 更新所有相关服务使用新的 slug 获取逻辑
Polymarket 跟单系统前端
技术栈
- 框架: React 18 + TypeScript
- 构建工具: Vite
- UI 库: Ant Design + Ant Design Mobile
- HTTP 客户端: axios
- 状态管理: Zustand
- 路由: React Router
- 以太坊库: ethers.js
功能特性
- ✅ 账户管理(通过私钥导入,支持多账户)
- ✅ Leader 管理(被跟单者管理)
- ✅ 跟单配置管理
- ✅ 订单管理
- ✅ 统计信息
- ✅ 移动端适配
开发
# 安装依赖
npm install
# 启动开发服务器
npm run dev
# 构建生产版本
npm run build
项目结构
frontend/
├── src/
│ ├── components/ # 公共组件
│ │ └── Layout.tsx # 布局组件(支持移动端)
│ ├── pages/ # 页面组件
│ │ ├── AccountList.tsx
│ │ ├── AccountImport.tsx
│ │ ├── LeaderList.tsx
│ │ ├── LeaderAdd.tsx
│ │ ├── ConfigPage.tsx
│ │ ├── OrderList.tsx
│ │ └── Statistics.tsx
│ ├── services/ # API 服务
│ │ └── api.ts
│ ├── store/ # 状态管理
│ │ └── accountStore.ts
│ ├── types/ # TypeScript 类型定义
│ │ └── index.ts
│ ├── utils/ # 工具函数
│ │ └── ethers.ts
│ ├── styles/ # 样式文件
│ │ └── index.css
│ ├── App.tsx # 根组件
│ └── main.tsx # 入口文件
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
移动端适配
- 使用
react-responsive检测设备类型 - 移动端使用 Ant Design Mobile 组件
- 响应式布局(移动端 < 768px,桌面端 >= 768px)
- 触摸友好的按钮尺寸(>= 44x44px)