feat: 更新内容管理方案

This commit is contained in:
R524809
2026-04-29 17:47:14 +08:00
parent 63fa08ff1a
commit 2cb9ec55d6
44 changed files with 1181 additions and 625 deletions
@@ -6,6 +6,8 @@ import {
type FocusTypeConfig,
type FocusTypeAction,
} from './registry';
import { getPublishMetaByFocusState } from './focusDraw.config';
import type { DebugPublishMeta } from '../../utils/debugPublish';
const TYPE_LIST = FOCUS_TYPE_CONFIGS.map((t) => ({
id: t.id,
@@ -36,6 +38,10 @@ createFocusPage({
currentActions: [] as FocusTypeAction[],
currentMode: '',
isPreviewFavorite: false,
isDevEnv: false,
debugPublishVisible: false,
debugPublishLoading: false,
debugPublishMeta: null as DebugPublishMeta | null,
},
onLoad(options: { id?: string; mode?: string }) {
@@ -43,6 +49,8 @@ createFocusPage({
const result = findTypeByRouteId(routeId);
if (!result) return;
this.syncDebugPublishEnv();
const { typeConfig, mode } = result;
const initialMode =
options.mode || mode || typeConfig.defaultMode || '';
@@ -196,4 +204,16 @@ createFocusPage({
icon: 'none',
});
},
getPublishMeta(): DebugPublishMeta {
const meta = getPublishMetaByFocusState(
this.data.functionId,
this.data.selectedTypeId,
this.data.currentMode,
);
if (!meta) {
throw new Error('当前题型配置不存在');
}
return meta;
},
});