feat: 完善后台可视化模板编辑与区域绑定
This commit is contained in:
1 parent
0b14b5a814
commit
5b85fe769f
18 files changed
+1620
-239
No files matched your search
@@ -0,0 +1,21 @@
|
||||
export type PreviewSelection = { targetKey: string; recordId?: string };
|
||||
|
||||
export type PreviewTarget = {
|
||||
key: string;
|
||||
label: string;
|
||||
source: "brand" | "offering" | "trust" | "inquiry";
|
||||
page: string;
|
||||
};
|
||||
|
||||
export function resolvePreviewSelection(
|
||||
targetKey: string,
|
||||
recordId: string | undefined,
|
||||
targets: PreviewTarget[],
|
||||
page: string,
|
||||
): PreviewSelection | undefined {
|
||||
const target = targets.find((item) => item.key === targetKey && item.page === page);
|
||||
if (!target) return undefined;
|
||||
if (recordId && target.source !== "offering" && target.source !== "trust") return undefined;
|
||||
if (!recordId && (target.source === "offering" || target.source === "trust")) return undefined;
|
||||
return recordId ? { targetKey, recordId } : { targetKey };
|
||||
}
|
||||
Reference in new issue
Block a user