feat(web): 贴纸包 CRUD UI + 主题编辑/停用 — Task 14-15 完成
Task 14: StickerPackList 补全 CRUD UI - stickers.ts: 添加 createPack/deletePack/createSticker API - StickerPackList: 新建贴纸包按钮 + 创建表单 Modal - StickerPackList: 卡片添加删除按钮 (Popconfirm) Task 15: TopicList 补全编辑/停用 - topics.ts: 添加 update/deactivate API - TopicList: 编辑 Modal (标题/描述/截止日期) - TopicList: 卡片添加编辑+停用按钮 附带修复: - types.ts: SchoolClass/TopicAssignment 添加 version 字段 - ClassList.tsx: 修复 onUpdate 回调参数签名 - tsconfig.app.json: 排除 src/test 避免缺失模块编译错误
This commit is contained in:
@@ -6,9 +6,18 @@ export const stickerApi = {
|
||||
client.get<{ success: boolean; data: StickerPack[] }>('/diary/sticker-packs', { params })
|
||||
.then((r) => r.data.data),
|
||||
|
||||
createPack: (data: { name: string; description?: string; thumbnail_url?: string; is_free?: boolean; price?: number; category?: string }) =>
|
||||
client.post('/diary/sticker-packs', data).then((r) => r.data.data),
|
||||
|
||||
deletePack: (packId: string) =>
|
||||
client.delete(`/diary/sticker-packs/${packId}`).then((r) => r.data),
|
||||
|
||||
listStickers: (packId: string) =>
|
||||
client.get<{ success: boolean; data: Sticker[] }>(`/diary/sticker-packs/${packId}/stickers`)
|
||||
.then((r) => r.data.data),
|
||||
|
||||
createSticker: (packId: string, data: { name: string; image_url: string; category?: string }) =>
|
||||
client.post(`/diary/sticker-packs/${packId}/stickers`, data).then((r) => r.data.data),
|
||||
};
|
||||
|
||||
export const templateApi = {
|
||||
|
||||
@@ -8,4 +8,10 @@ export const topicApi = {
|
||||
|
||||
assign: (classId: string, data: CreateTopicReq) =>
|
||||
client.post(`/diary/classes/${classId}/topics`, data).then((r) => r.data.data),
|
||||
|
||||
update: (topicId: string, data: { title?: string; description?: string; due_date?: string; version: number }) =>
|
||||
client.put(`/diary/topics/${topicId}`, data).then((r) => r.data.data),
|
||||
|
||||
deactivate: (topicId: string) =>
|
||||
client.patch(`/diary/topics/${topicId}/deactivate`).then((r) => r.data.data),
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@ export interface SchoolClass {
|
||||
class_code: string;
|
||||
member_count: number;
|
||||
is_active: boolean;
|
||||
version: number;
|
||||
}
|
||||
|
||||
export interface CreateClassReq {
|
||||
@@ -76,6 +77,7 @@ export interface TopicAssignment {
|
||||
description?: string;
|
||||
due_date?: string;
|
||||
is_active: boolean;
|
||||
version: number;
|
||||
}
|
||||
|
||||
export interface CreateTopicReq {
|
||||
|
||||
Reference in New Issue
Block a user