refactor: 退役运行时视觉模块并泛化模板门禁
This commit is contained in:
1 parent
25d1fe983c
commit
e2e2340bfe
56 files changed
+290
-1037
No files matched your search
@@ -7,7 +7,6 @@ import type {
|
||||
BrandTemplateKey,
|
||||
RuntimeCapability,
|
||||
RuntimeInquiryForm,
|
||||
RuntimeModule,
|
||||
RuntimeOffering,
|
||||
ThemeManifest,
|
||||
} from "@personal-brand/types";
|
||||
@@ -219,15 +218,6 @@ 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;
|
||||
@@ -325,7 +315,6 @@ export interface PublicWorkspace {
|
||||
capabilities: string[];
|
||||
};
|
||||
capabilities: RuntimeCapability[];
|
||||
modules: RuntimeModule[];
|
||||
offerings: RuntimeOffering[];
|
||||
inquiryForms: RuntimeInquiryForm[];
|
||||
navigation: { tabs: Array<{ key: string; label: string; page: string }> };
|
||||
@@ -624,7 +613,6 @@ export class ApiClient {
|
||||
};
|
||||
runtime: {
|
||||
schemaVersion: string;
|
||||
modules: Array<{ key: string; type: string; title: string; variant: string }>;
|
||||
capabilities: Array<{ key: string; version: string }>;
|
||||
theme: unknown;
|
||||
};
|
||||
@@ -649,7 +637,6 @@ export class ApiClient {
|
||||
variants: Record<string, string>;
|
||||
} | null;
|
||||
installations: Array<{ id: string; templateKey: BrandTemplateKey; templateVersion: string }>;
|
||||
modules: BrandModule[];
|
||||
fields: BrandFieldDefinition[];
|
||||
offerings: Offering[];
|
||||
forms: unknown[];
|
||||
@@ -734,12 +721,6 @@ export class ApiClient {
|
||||
rollbackAdminTemplate(): Promise<unknown> {
|
||||
return this.request("/admin/workspace/template/rollback", { method: "POST" });
|
||||
}
|
||||
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> {
|
||||
|
||||
@@ -6,7 +6,6 @@ Page({
|
||||
trustContent: [],
|
||||
records: [],
|
||||
error: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
@@ -15,7 +14,6 @@ Page({
|
||||
brand: workspace.brand || {},
|
||||
trustContent: workspace.trustPresentation || {},
|
||||
records: [],
|
||||
navigation: workspace.navigation || [],
|
||||
}),
|
||||
)
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon",
|
||||
"profile-module": "/components/modules/profile/profile",
|
||||
"acheng-profile": "/components/templates/acheng-profile/acheng-profile"
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,6 @@ Page({
|
||||
error: "",
|
||||
offerings: [],
|
||||
filtered: [],
|
||||
modules: [],
|
||||
theme: {},
|
||||
brand: {},
|
||||
presentation: {},
|
||||
category: "all",
|
||||
@@ -39,13 +37,10 @@ Page({
|
||||
}),
|
||||
),
|
||||
],
|
||||
modules: workspace.modules || [],
|
||||
theme: workspace.theme || {},
|
||||
brand: workspace.brand || {},
|
||||
presentation: workspace.brand?.visualPresentation?.offerings || {},
|
||||
brand: workspace.brand || {},
|
||||
loadedBrandSlug: config.brandSlug,
|
||||
navigation: workspace.navigation || [],
|
||||
});
|
||||
})
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
|
||||
@@ -1,76 +1,17 @@
|
||||
export type ManifestCategory = "industry" | "visual" | "hybrid";
|
||||
|
||||
export type WorkspaceModuleType =
|
||||
| "brand-hero"
|
||||
| "founder-card"
|
||||
| "trust-proof"
|
||||
| "offering-list"
|
||||
| "offering-detail"
|
||||
| "gallery"
|
||||
| "timeline"
|
||||
| "faq"
|
||||
| "contact"
|
||||
| "inquiry"
|
||||
| "records"
|
||||
| "custom";
|
||||
|
||||
export interface ThemeManifest {
|
||||
colors: Record<string, string>;
|
||||
typography?: Record<string, string>;
|
||||
spacing?: Record<string, string>;
|
||||
radius?: Record<string, string>;
|
||||
}
|
||||
export interface LayoutManifest {
|
||||
home: string[];
|
||||
offerings: string[];
|
||||
detail: string[];
|
||||
profile: string[];
|
||||
}
|
||||
|
||||
export interface TemplateManifest {
|
||||
templateKey: string;
|
||||
version: string;
|
||||
category: ManifestCategory;
|
||||
displayName: string;
|
||||
requiredModules: readonly string[];
|
||||
optionalModules: string[];
|
||||
offeringSchema: string;
|
||||
inquirySchemas: string[];
|
||||
requiredCapabilities: string[];
|
||||
optionalCapabilities: string[];
|
||||
theme: ThemeManifest;
|
||||
}
|
||||
|
||||
export interface ModuleManifest {
|
||||
key: string;
|
||||
version: string;
|
||||
type: WorkspaceModuleType;
|
||||
propsSchema: string;
|
||||
dataSource?: string;
|
||||
variant?: string;
|
||||
visibilityRules?: VisibilityRule[];
|
||||
}
|
||||
|
||||
export interface VisibilityRule {
|
||||
field: string;
|
||||
operator: "equals" | "not-equals" | "exists" | "in";
|
||||
value?: string | number | boolean | string[];
|
||||
}
|
||||
|
||||
export interface CapabilityManifest {
|
||||
key: string;
|
||||
version: string;
|
||||
permissions: string[];
|
||||
apiContract: string;
|
||||
requiredModules: string[];
|
||||
supportedWorkflows: string[];
|
||||
}
|
||||
|
||||
export interface RuntimeModule extends ModuleManifest {
|
||||
config: Record<string, unknown>;
|
||||
source: "core" | "template" | "custom";
|
||||
}
|
||||
|
||||
export interface RuntimeOffering {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -157,7 +98,6 @@ export interface RuntimeWorkspace {
|
||||
navigation: {
|
||||
tabs: Array<{ key: string; label: string; page: string }>;
|
||||
};
|
||||
modules: RuntimeModule[];
|
||||
offerings: RuntimeOffering[];
|
||||
inquiryForms: RuntimeInquiryForm[];
|
||||
trustPresentation: TrustPresentation;
|
||||
@@ -169,10 +109,15 @@ export interface RuntimeWorkspace {
|
||||
}
|
||||
>;
|
||||
theme: ThemeManifest;
|
||||
layout?: LayoutManifest;
|
||||
}
|
||||
|
||||
export function validateTemplateManifest(manifest: TemplateManifest): string[] {
|
||||
export function validateTemplateManifest(manifest: {
|
||||
templateKey: string;
|
||||
version: string;
|
||||
displayName: string;
|
||||
offeringSchema: string;
|
||||
theme: ThemeManifest;
|
||||
}): string[] {
|
||||
const errors: string[] = [];
|
||||
if (!manifest.templateKey.trim()) errors.push("templateKey is required");
|
||||
if (!manifest.version.trim()) errors.push("version is required");
|
||||
|
||||
Reference in new issue
Block a user