F4-L1: amis-editor 页面设计器(多页入口隔离)+overlay 编辑闭环

- editor.html 独立 vite 入口,amis-editor npm 依赖与主应用本地 SDK 隔离
- 设计器:画布编辑/保存→overlay/还原标准版/预览;页面 Tab 管理员「设计」入口
- designer.spec.ts 7 用例(编辑→保存→渲染 overlay→还原,X-Schema-Layer 断言);全套 e2e 68/68

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 04:23:43 +08:00
parent 52b92f6eac
commit dc9e424d06
13 changed files with 4373 additions and 1 deletions

View File

@@ -61,3 +61,42 @@ export async function fetchSchema(templateId: string): Promise<Record<string, un
);
return data;
}
// ============================================================================
// F4-L1 overlay API(Node 侧 http 调用,供设计器 e2e 断言 X-Schema-Layer 用)
// ============================================================================
/** 获取 schema 并返回 layer 信息(overlay / standard) */
export async function fetchSchemaLayer(
templateId: string,
): Promise<{ schema: Record<string, unknown>; layer: string }> {
const resp = await http.get<Record<string, unknown>>(
`/api/page/schema/${encodeURIComponent(templateId)}`,
{ headers: { 'Cache-Control': 'no-cache' } },
);
const layer = (resp.headers['x-schema-layer'] ?? 'standard') as string;
return { schema: resp.data, layer };
}
/** 保存 overlay(仅管理员) */
export async function putOverlay(
templateId: string,
schemaJson: string,
): Promise<{ status: number; msg: string }> {
const resp = await http.put(
`/api/page/schema/${encodeURIComponent(templateId)}/overlay`,
schemaJson,
{ headers: { 'Content-Type': 'application/json' } },
);
return resp.data as { status: number; msg: string };
}
/** 还原标准版(删除 overlay,仅管理员) */
export async function restoreStandard(
templateId: string,
): Promise<{ status: number; msg: string }> {
const resp = await http.delete(
`/api/page/schema/${encodeURIComponent(templateId)}/overlay`,
);
return resp.data as { status: number; msg: string };
}