feat: 支持创作入口公告配置
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { requestJson } from './apiClient';
|
||||
|
||||
/** 后端下发的单个创作类型入口配置,前端只据此展示和分流。 */
|
||||
export type CreationEntryTypeConfig = {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -16,6 +17,7 @@ export type CreationEntryTypeConfig = {
|
||||
unifiedCreationSpec?: UnifiedCreationSpec | null;
|
||||
};
|
||||
|
||||
/** 统一创作工作台字段契约,用于表单型玩法的最小输入描述。 */
|
||||
export type UnifiedCreationField = {
|
||||
id: string;
|
||||
kind: 'text' | 'select' | 'image' | 'audio';
|
||||
@@ -23,6 +25,7 @@ export type UnifiedCreationField = {
|
||||
required: boolean;
|
||||
};
|
||||
|
||||
/** 统一创作工作台契约,把入口类型映射到工作台、生成页和结果页阶段。 */
|
||||
export type UnifiedCreationSpec = {
|
||||
playId: 'puzzle' | 'match3d' | 'jump-hop' | 'wooden-fish';
|
||||
title: string;
|
||||
@@ -44,6 +47,19 @@ export type UnifiedCreationSpec = {
|
||||
fields: UnifiedCreationField[];
|
||||
};
|
||||
|
||||
/** 创作入口公告位配置,HTML 模式仅用于沙箱预览,结构化字段保留旧数据兼容。 */
|
||||
export type CreationEntryEventBannerConfig = {
|
||||
title: string;
|
||||
description: string;
|
||||
coverImageSrc: string;
|
||||
prizePoolMudPoints: number;
|
||||
startsAtText: string;
|
||||
endsAtText: string;
|
||||
renderMode?: 'structured' | 'html';
|
||||
htmlCode?: string | null;
|
||||
};
|
||||
|
||||
/** 创作入口页完整配置;前端只展示后端事实源,不内置入口默认值。 */
|
||||
export type CreationEntryConfig = {
|
||||
startCard: {
|
||||
title: string;
|
||||
@@ -55,17 +71,14 @@ export type CreationEntryConfig = {
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
eventBanner: {
|
||||
title: string;
|
||||
description: string;
|
||||
coverImageSrc: string;
|
||||
prizePoolMudPoints: number;
|
||||
startsAtText: string;
|
||||
endsAtText: string;
|
||||
};
|
||||
/** 旧单条公告位兼容字段,新代码优先读取 eventBanners。 */
|
||||
eventBanner: CreationEntryEventBannerConfig;
|
||||
/** 底部加号创作入口页的多公告轮播配置。 */
|
||||
eventBanners?: CreationEntryEventBannerConfig[];
|
||||
creationTypes: CreationEntryTypeConfig[];
|
||||
};
|
||||
|
||||
/** 拉取底部加号创作入口配置;所有入口和公告都以后端事实源为准。 */
|
||||
export async function fetchCreationEntryConfig(): Promise<CreationEntryConfig> {
|
||||
return requestJson<CreationEntryConfig>(
|
||||
'/api/creation-entry/config',
|
||||
|
||||
@@ -815,6 +815,7 @@ function resolveElapsedActiveStepProgressRatio(
|
||||
);
|
||||
}
|
||||
|
||||
/** 计算拼图生成总进度,后端里程碑决定跨步骤,当前步骤内使用平滑假进度。 */
|
||||
function resolvePuzzleOverallProgress(
|
||||
state: MiniGameDraftGenerationState,
|
||||
activeStepProgressRatio: number,
|
||||
|
||||
Reference in New Issue
Block a user