fix: 修复组件预览底部按钮溢出与咨询表单缺失
This commit is contained in:
1 parent
5b85fe769f
commit
fd2e970d8b
8 files changed
+151
-8
No files matched your search
@@ -17,7 +17,13 @@ import type { Values } from "../runtime/content";
|
||||
import { ensureSession, request, brandSlug } from "../runtime/api";
|
||||
import { takeQuery, navigate } from "../runtime/navigation";
|
||||
import "./forms.css";
|
||||
export function Inquiry({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
export function Inquiry({
|
||||
workspace,
|
||||
preview = false,
|
||||
}: {
|
||||
workspace: RuntimeWorkspace;
|
||||
preview?: boolean;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [offeringId, setOfferingId] = useState(router.params.offeringId || "");
|
||||
const form: RuntimeInquiryForm | undefined =
|
||||
@@ -28,7 +34,7 @@ export function Inquiry({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
const [sending, setSending] = useState(false);
|
||||
const busy = useRef(false);
|
||||
const p = presentation(workspace, "inquiry");
|
||||
const food = TEMPLATE_KEY === "acheng-campus-food";
|
||||
const food = workspace.brand.visualTemplateKey === "acheng-campus-food";
|
||||
useDidShow(() => {
|
||||
const query = takeQuery("inquiry");
|
||||
if (query.offeringId) setOfferingId(query.offeringId);
|
||||
@@ -40,6 +46,7 @@ export function Inquiry({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
const setValue = (key: string, value: string | string[]) =>
|
||||
setValues((current) => ({ ...current, [key]: value }));
|
||||
async function submit() {
|
||||
if (preview) return;
|
||||
if (busy.current) return;
|
||||
if (!form) {
|
||||
setError("咨询表单暂不可用,请稍后重试");
|
||||
|
||||
Reference in new issue
Block a user