feat: 增加后台品牌工作空间配置页面

This commit is contained in:
que01 committed 2026-09-20 09:31:11 +08:00
1 parent 6e1aca3e27
commit 46c3e5504e
3 files changed
+252

No files matched your search

+47
View File
@@ -124,6 +124,26 @@ export interface OfferingCta {
label: string;
config?: Record<string, unknown>;
}
export interface BrandModule {
id: string;
type: string;
title: string;
isEnabled: boolean;
sortOrder: number;
source: string;
config?: Record<string, unknown> | null;
}
export interface BrandFieldDefinition {
id: string;
scope: string;
key: string;
label: string;
type: string;
required: boolean;
isVisible: boolean;
sortOrder: number;
source: string;
}
export interface Offering {
id: string;
brandId?: string;
@@ -254,6 +274,33 @@ export class ApiClient {
getPublicOffering(id: string): Promise<Offering> {
return this.request(`/public/offerings/${encodeURIComponent(id)}`);
}
getAdminWorkspace(): Promise<{
brand: BrandProfile;
installations: unknown[];
modules: BrandModule[];
fields: BrandFieldDefinition[];
offerings: Offering[];
forms: unknown[];
}> {
return this.request("/admin/workspace");
}
installAdminTemplate(templateKey: "personal" | "food"): Promise<unknown> {
return this.request("/admin/workspace/install", { method: "POST", body: { templateKey } });
}
updateAdminModule(id: string, body: Partial<BrandModule>): Promise<BrandModule> {
return this.request(`/admin/workspace/modules/${encodeURIComponent(id)}`, {
method: "PATCH",
body,
});
}
createAdminField(
body: Omit<BrandFieldDefinition, "id" | "source">,
): Promise<BrandFieldDefinition> {
return this.request("/admin/workspace/fields", { method: "POST", body });
}
deleteAdminField(id: string): Promise<{ deleted: boolean }> {
return this.request(`/admin/workspace/fields/${encodeURIComponent(id)}`, { method: "DELETE" });
}
listAdminOfferings(): Promise<Offering[]> {
return this.request("/admin/workspace/offerings");
}