- 新增 tsconfig.json 配置 - 新增 types/ 目录(7个类型定义文件,与后端 DTO 对齐) - 迁移 vite.config.js → vite.config.ts - 迁移 main.js → main.ts - 迁移 utils/api.js → utils/api.ts(泛型化请求封装) - 迁移 utils/currency.js → utils/currency.ts - 迁移 6 个 Vue 页面组件(添加 lang="ts" 和类型注解) - 新增 TYPESCRIPT_MIGRATION.md 迁移计划文档 - 更新 todo.md 进度 收益:完整类型提示、编译时错误检查、重构安全性提升
102 lines
1.8 KiB
TypeScript
102 lines
1.8 KiB
TypeScript
/**
|
|
* 策略类型定义(与后端 DTO 对齐)
|
|
*/
|
|
|
|
// ===== 策略列表 =====
|
|
|
|
export interface StrategyItem {
|
|
id?: string;
|
|
iconChar?: string;
|
|
title?: string;
|
|
tag?: string;
|
|
desc?: string;
|
|
bgClass?: string;
|
|
tagClass?: string;
|
|
btnText?: string;
|
|
btnClass?: string;
|
|
tags?: string[];
|
|
}
|
|
|
|
export interface StrategyListResponse {
|
|
items?: StrategyItem[];
|
|
}
|
|
|
|
// ===== 策略详情 =====
|
|
|
|
export interface ParameterItem {
|
|
name?: string;
|
|
displayName?: string;
|
|
type?: string;
|
|
value?: string;
|
|
}
|
|
|
|
export interface StrategyDetailResponse {
|
|
id?: string;
|
|
iconChar?: string;
|
|
title?: string;
|
|
riskLevel?: string;
|
|
description?: string;
|
|
tags?: string[];
|
|
parameters?: ParameterItem[];
|
|
}
|
|
|
|
// ===== 创建/更新策略 =====
|
|
|
|
export interface CreateStrategyRequest {
|
|
name?: string;
|
|
type?: string;
|
|
description?: string;
|
|
riskLevel?: string;
|
|
tags?: string[];
|
|
parameters?: Record<string, any>;
|
|
}
|
|
|
|
export interface UpdateStrategyRequest {
|
|
name?: string;
|
|
type?: string;
|
|
description?: string;
|
|
riskLevel?: string;
|
|
tags?: string[];
|
|
parameters?: Record<string, any>;
|
|
}
|
|
|
|
export interface StrategyResponse {
|
|
id?: string;
|
|
title?: string;
|
|
status?: string;
|
|
}
|
|
|
|
export interface DeleteStrategyResponse {
|
|
id?: string;
|
|
status?: string;
|
|
}
|
|
|
|
// ===== 策略信号 =====
|
|
|
|
export interface SignalAction {
|
|
symbol?: string;
|
|
action?: string;
|
|
target?: number;
|
|
}
|
|
|
|
export interface StrategySignalResponse {
|
|
signal?: string;
|
|
reason?: string;
|
|
actions?: SignalAction[];
|
|
}
|
|
|
|
// ===== 策略列表项(数据库模型) =====
|
|
|
|
export interface StrategyListItemDto {
|
|
id?: string;
|
|
userId?: string;
|
|
name?: string;
|
|
type?: string;
|
|
description?: string;
|
|
tags?: string[];
|
|
riskLevel?: string;
|
|
config?: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|