refactor: 模板注册与默认模板收敛到目录驱动

This commit is contained in:
que01 committed 2026-10-12 10:00:46 +08:00
1 parent f87b26b201
commit 89fdfd7d83
25 files changed
+122 -96

No files matched your search

+5 -4
View File
@@ -34,7 +34,8 @@ export function Inquiry({
const [sending, setSending] = useState(false);
const busy = useRef(false);
const p = presentation(workspace, "inquiry");
const food = workspace.brand.visualTemplateKey === "acheng-campus-food";
const compactFieldKeys = new Set(["people", "date", "budget", "delivery"]);
const compactForm = Boolean(form?.fields.some((field) => compactFieldKeys.has(field.key)));
useDidShow(() => {
const query = takeQuery("inquiry");
if (query.offeringId) setOfferingId(query.offeringId);
@@ -82,7 +83,7 @@ export function Inquiry({
}
}
return (
<View className={`inquiry-page ${food ? "food-inquiry" : "editorial-inquiry"}`}>
<View className={`inquiry-page ${compactForm ? "food-inquiry" : "editorial-inquiry"}`}>
<View className="form-intro">
<Text className="eyebrow">{p.eyebrow}</Text>
<Text className="form-title">{p.title || "提交咨询"}</Text>
@@ -98,10 +99,10 @@ export function Inquiry({
const value = values[field.key];
const stringValue = typeof value === "string" ? value : "";
const chips =
food && field.key === "type" && ["select", "radio"].includes(field.type);
compactForm && field.key === "type" && ["select", "radio"].includes(field.type);
return (
<View
className={`form-field ${food && ["people", "date", "budget", "delivery"].includes(field.key) ? "half-field" : ""}`}
className={`form-field ${compactForm && compactFieldKeys.has(field.key) ? "half-field" : ""}`}
key={field.key}
data-editor-target={preview ? `inquiry-field:${field.key}` : undefined}
>