## Home 模块三栏 VCHSM 重组
- 按渲染归属重新分配文件:ModelSelector/TaskHistory → left/,ModelInputForm/widgets → center/,OutputPreview → right/
- BannerCarousel 移至 shared/views/(全局组件)
- controls/ → widgets/ 重命名,消除与 controllers/ 的命名歧义
- 新增 barrel 文件(left/center/right/shared 各级 index.ts)
## Services 层迁回 src/services/modules/
- 全部 API 类型定义与请求函数从 modules/*/controllers/ 迁回 services/modules/{domain}/
- 恢复原始文件名(model-api.ts → models.ts,task-api.ts → task.ts 等)
- 新增 domain 子文件夹(home/auth/announcement/account)
- 更新全局 ~70 处导入路径
## TaskHistory 提取 Controller + Hook 层
- 新建 left/controllers/task-table-config.ts(常量 + 纯工具函数,零 React 依赖)
- 新建 left/hooks/useTaskTable.tsx(状态管理 + 数据获取 + 列定义 + 滚动同步)
- TaskHistory.tsx 从 915 行精简为 265 行纯视图
## 右键菜单体系完善
- 共享 <ContextMenu> 组件(antd Dropdown 封装,防 Select 冲突)
- 四组菜单定义:任务列表 / 文本输入 / 媒体参考 / 预览区域
- 统一的 ContextMenuItems → AntD MenuProps 转换
## 公告功能修复
- useAnnouncements 增加 isLoggedIn 登录门控,避免未登录时 401 双重请求
- 抽屉打开时触发 refetch(),确保拿到最新数据
Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
// ============================================================
|
|
// Banner 模块 — 首页轮播图 API
|
|
// GET /api/v1/banners
|
|
// ============================================================
|
|
|
|
import {get} from '@/services/request';
|
|
|
|
// ---------- 路由常量 ----------
|
|
|
|
const BannerUrlObj = {
|
|
list: '/api/v1/creatives',
|
|
} as const;
|
|
|
|
// ---------- 类型 ----------
|
|
|
|
// ============================================================
|
|
// Banner 分类常量
|
|
// ============================================================
|
|
|
|
export const BannerCategoryEnum = {
|
|
Promotion: "promotion",
|
|
Banner: "banner",
|
|
} as const;
|
|
|
|
export type BannerCategoryValue = typeof BannerCategoryEnum[keyof typeof BannerCategoryEnum];
|
|
|
|
export const BannerCategoryLabelMap: Record<BannerCategoryValue, string> = {
|
|
[BannerCategoryEnum.Promotion]: "推广",
|
|
[BannerCategoryEnum.Banner]: "轮播",
|
|
};
|
|
|
|
/** 单条 Banner */
|
|
export interface Banner {
|
|
id: number;
|
|
title: string;
|
|
content: "真人素材提示";
|
|
image_url: string;
|
|
link_url?: string;
|
|
category: BannerCategoryValue;
|
|
vip_level_id?: number;
|
|
sort_order: number;
|
|
is_active: boolean;
|
|
created_by: string;
|
|
created_at: Date;
|
|
updated_at: Date;
|
|
}
|
|
|
|
/** Banner 列表响应 */
|
|
export type BannerListResponse = Banner[];
|
|
|
|
// ---------- API ----------
|
|
|
|
/**
|
|
* 获取 Banner 轮播图列表
|
|
* GET /api/v1/banners
|
|
*/
|
|
export function fetchBanners(signal?: AbortSignal): Promise<BannerListResponse> {
|
|
return get<BannerListResponse>(BannerUrlObj.list, undefined, { signal });
|
|
}
|