feat: add products/cases pages and lead-capture form block

- types: Product/CaseStudy page types, CaseStudyBlockValue, FormBlockValue
- services: product.service.ts, case.service.ts
- app/products, app/cases: list + detail pages
- blocks: CaseStudyCard, LeadForm (submits to /api/v1/custom/leads/)
- Header nav: add 产品/案例 links
This commit is contained in:
2026-08-06 16:04:43 +08:00
parent 7e30631c68
commit b5fe5e13ab
11 changed files with 391 additions and 1 deletions
+26
View File
@@ -0,0 +1,26 @@
import { fetchAPI } from "./api-client";
import type {
ProductPageDetail,
ProductPageSummary,
WagtailListResponse,
} from "@/types/wagtail";
/** 获取产品列表。 */
export async function getProductList(): Promise<ProductPageSummary[]> {
const res = await fetchAPI<WagtailListResponse<ProductPageSummary>>(
"/api/v2/pages/?type=products.ProductPage&fields=summary",
{ tags: ["product-list"] },
);
return res.items;
}
/** 根据 slug 获取产品详情。 */
export async function getProductBySlug(
slug: string,
): Promise<ProductPageDetail | null> {
const res = await fetchAPI<WagtailListResponse<ProductPageDetail>>(
`/api/v2/pages/?type=products.ProductPage&slug=${encodeURIComponent(slug)}&fields=body,summary&limit=1`,
{ tags: [`product:${slug}`] },
);
return res.items[0] ?? null;
}