feat(challenges): 实现自定义挑战的编辑与删除功能并完善多语言支持

- 新增自定义挑战的编辑模式,支持修改挑战信息
- 在详情页为创建者添加删除(归档)挑战的功能入口
- 全面完善挑战创建页面的国际化(i18n)文案适配
- 优化个人中心页面的字体样式,统一使用 AliBold/Regular
- 更新 Store 逻辑以处理挑战更新、删除及列表数据映射调整
This commit is contained in:
richarjiang
2025-11-26 19:07:19 +08:00
parent 39671ed70f
commit 518282ecb8
6 changed files with 866 additions and 160 deletions

View File

@@ -70,8 +70,6 @@ export type ChallengeListItemDto = {
isPublic?: boolean;
maxParticipants?: number | null;
challengeState?: ChallengeState;
progressUnit?: string;
targetValue?: number;
summary?: string | null;
};
@@ -114,6 +112,17 @@ export type CreateCustomChallengePayload = {
maxParticipants?: number | null;
};
export type UpdateCustomChallengePayload = {
title?: string;
image?: string;
summary?: string;
isPublic?: boolean;
maxParticipants?: number;
highlightTitle?: string;
highlightSubtitle?: string;
ctaLabel?: string;
};
export async function listChallenges(): Promise<ChallengeListItemDto[]> {
return api.get<ChallengeListItemDto[]>('/challenges');
}
@@ -190,3 +199,14 @@ export async function regenerateChallengeShareCode(
`/challenges/custom/${encodeURIComponent(id)}/regenerate-code`
);
}
export async function updateCustomChallenge(
id: string,
payload: UpdateCustomChallengePayload
): Promise<ChallengeDetailDto> {
return api.put<ChallengeDetailDto>(`/challenges/custom/${encodeURIComponent(id)}`, payload);
}
export async function archiveCustomChallenge(id: string): Promise<boolean> {
return api.delete<boolean>(`/challenges/custom/${encodeURIComponent(id)}`);
}