Compare commits

..
12 Commits
Author SHA1 Message Date
Zhengen 4bbd6947da feat: 补全剩余 6 个 StreamField Block 前端渲染 (ProductCard/Pricing/Timeline/Team/TechStack/Video)
- types/wagtail.ts 新增对应 6 个 Block 值类型接口及 StreamFieldBlock 联合类型分支
- 新建 6 个渲染组件:ProductCardGrid/Pricing/Timeline/Team/TechStack/Video,风格与既有 Block 一致
- BlockRenderer.tsx 映射表接入新组件,key 与后端 COMMON_BLOCKS 保持一致
- lint/build 均验证通过
2026-08-07 15:59:08 +08:00
Zhengen 2457d5ec69 feat: 接入预览模式(Next.js Draft Mode) 2026-08-07 15:34:59 +08:00
Zhengen 1abadd04b8 表单新增蜜罐反垃圾字段;修复 CookieConsent 的 react-hooks/set-state-in-effect lint 报错 2026-08-07 14:49:29 +08:00
Zhengen 3f05bd16e1 feat: 接入PIPL数据删除权申请/确认页面
- 新增 /privacy-policy/delete-request 页面:提交邮箱发起删除申请
- 新增 /privacy-policy/delete-confirm 页面:从邮件链接确认删除(Suspense包裹useSearchParams)
- 隐私政策页面加入删除申请入口链接
2026-08-07 13:30:12 +08:00
Zhengen 24a2311e20 feat: 接入后端全局Snippet(导航菜单/站点设置),补充团队/证言/合作伙伴 service 层
- Header 改为异步 Server Component,接入 NavigationMenu(name=main),
  接口不可用或未配置时回退静态导航项
- Footer 改为异步 Server Component,接入 SiteSettings,
  公司名/ICP备案号/备案链接优先取后台配置,缺省回退硬编码值
- types/wagtail.ts 新增 TeamMember/Testimonial/Partner/NavigationMenu/SiteSettings 类型
- 新增 services: team/testimonial/partner/navigation/site-settings.service.ts
- lint、build 均已验证通过
2026-08-07 13:06:45 +08:00
Zhengen 77e1208c31 feat: 新增Cookie同意条控件,Footer链接隐私政策 2026-08-07 09:37:38 +08:00
Zhengen 6c8077477a feat: 新增隐私政策页面,Footer增加链接 2026-08-06 17:22:49 +08:00
Zhengen f6ce630587 chore: 更新页脚为实际ICP备案号 冀ICP备2025130506号-1 2026-08-06 16:54:23 +08:00
Zhengen 73d2465ef2 feat: add solutions list/detail pages
- types: SolutionPageSummary/Detail
- services/solution.service.ts
- app/solutions: list + detail pages
- Header nav: add 解决方案 link
2026-08-06 16:24:08 +08:00
Zhengen b5fe5e13ab 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
2026-08-06 16:04:43 +08:00
Zhengen 7e30631c68 feat: scaffold headless frontend integration per design doc 2026-08-06 15:51:59 +08:00
Zhengen b0919bf8b5 Initial commit from Create Next App 2026-08-06 15:34:24 +08:00
67 changed files with 9155 additions and 1 deletions
+7
View File
@@ -0,0 +1,7 @@
# 复制为 .env.local 并按实际环境填写。
# Wagtail 后端 API 地址
NEXT_PUBLIC_API_URL=http://localhost:8000
# 接收后端发布 Webhook 的密钥(需与后端 REVALIDATE_SECRET 一致)
REVALIDATE_SECRET=change-me
+42
View File
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
!.env*.example
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
+35 -1
View File
@@ -1,2 +1,36 @@
# wagtailcms-frontend
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
+34
View File
@@ -0,0 +1,34 @@
import { revalidateTag } from "next/cache";
import { NextRequest, NextResponse } from "next/server";
/**
* 接收 Wagtail `page_published` signal 发出的发布通知,
* 对 fetch 缓存标签做精准失效(详见 documents/设计方案分析与完善版.md §2.7)。
*
* 后端调用示例(apps/core/signals.py):
* POST {FRONTEND_REVALIDATE_URL}
* Headers: Authorization: Bearer {REVALIDATE_SECRET}
* Body: { "tags": ["page:1", "/some/url/"] }
*/
export async function POST(request: NextRequest) {
const authHeader = request.headers.get("authorization");
const expected = `Bearer ${process.env.REVALIDATE_SECRET}`;
if (!process.env.REVALIDATE_SECRET || authHeader !== expected) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
const body = await request.json().catch(() => null);
const tags: string[] = body?.tags ?? [];
if (!Array.isArray(tags) || tags.length === 0) {
return NextResponse.json({ error: "No tags provided" }, { status: 400 });
}
for (const tag of tags) {
// Next.js 16 要求传入 cache profile"max" 表示立即使该标签下的缓存完全失效。
revalidateTag(tag, "max");
}
return NextResponse.json({ revalidated: tags });
}
+41
View File
@@ -0,0 +1,41 @@
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { getBlogBySlug } from "@/services/blog.service";
import { getPreviewOrFallback } from "@/services/preview.service";
import { BlockRenderer } from "@/blocks/BlockRenderer";
import type { BlogPageDetail } from "@/types/wagtail";
interface BlogDetailPageProps {
params: Promise<{ slug: string }>;
}
export async function generateMetadata({
params,
}: BlogDetailPageProps): Promise<Metadata> {
const { slug } = await params;
const post = await getBlogBySlug(slug).catch(() => null);
return { title: post?.title ?? "文章未找到" };
}
export default async function BlogDetailPage({ params }: BlogDetailPageProps) {
const { slug } = await params;
const post = await getPreviewOrFallback<BlogPageDetail>(
"blog.blogpage",
"body,intro,published_at",
() => getBlogBySlug(slug).catch(() => null),
);
if (!post) {
notFound();
}
return (
<article className="mx-auto max-w-3xl px-6 py-24">
<h1 className="mb-4 text-4xl font-bold text-slate-900">{post.title}</h1>
{post.published_at && (
<p className="mb-12 text-sm text-slate-500">{post.published_at}</p>
)}
<BlockRenderer blocks={post.body} />
</article>
);
}
+33
View File
@@ -0,0 +1,33 @@
import Link from "next/link";
import type { Metadata } from "next";
import { getBlogList } from "@/services/blog.service";
export const metadata: Metadata = {
title: "技术博客",
};
export default async function BlogListPage() {
const posts = await getBlogList().catch(() => []);
return (
<div className="mx-auto max-w-4xl px-6 py-24">
<h1 className="mb-12 text-4xl font-bold text-slate-900"></h1>
<ul className="space-y-6">
{posts.map((post) => (
<li key={post.id} className="border-b border-slate-100 pb-6">
<Link
href={`/blog/${post.meta.slug}`}
className="text-2xl font-semibold text-slate-900 hover:text-primary"
>
{post.title}
</Link>
{post.intro && <p className="mt-2 text-slate-600">{post.intro}</p>}
</li>
))}
{posts.length === 0 && (
<p className="text-slate-500"></p>
)}
</ul>
</div>
);
}
+44
View File
@@ -0,0 +1,44 @@
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { getCaseStudyBySlug } from "@/services/case.service";
import { getPreviewOrFallback } from "@/services/preview.service";
import { BlockRenderer } from "@/blocks/BlockRenderer";
import type { CaseStudyPageDetail } from "@/types/wagtail";
interface CaseStudyDetailPageProps {
params: Promise<{ slug: string }>;
}
export async function generateMetadata({
params,
}: CaseStudyDetailPageProps): Promise<Metadata> {
const { slug } = await params;
const item = await getCaseStudyBySlug(slug).catch(() => null);
return { title: item?.title ?? "案例未找到" };
}
export default async function CaseStudyDetailPage({
params,
}: CaseStudyDetailPageProps) {
const { slug } = await params;
const item = await getPreviewOrFallback<CaseStudyPageDetail>(
"cases.casestudypage",
"body,client_name,industry,published_at,summary",
() => getCaseStudyBySlug(slug).catch(() => null),
);
if (!item) {
notFound();
}
return (
<article className="mx-auto max-w-3xl px-6 py-24">
<h1 className="mb-2 text-4xl font-bold text-slate-900">{item.title}</h1>
<p className="mb-12 text-sm text-slate-500">
{item.client_name}
{item.industry ? ` · ${item.industry}` : ""}
</p>
<BlockRenderer blocks={item.body} />
</article>
);
}
+39
View File
@@ -0,0 +1,39 @@
import Link from "next/link";
import type { Metadata } from "next";
import { getCaseStudyList } from "@/services/case.service";
export const metadata: Metadata = {
title: "客户案例",
};
export default async function CaseStudyListPage() {
const caseStudies = await getCaseStudyList().catch(() => []);
return (
<div className="mx-auto max-w-4xl px-6 py-24">
<h1 className="mb-12 text-4xl font-bold text-slate-900"></h1>
<ul className="space-y-6">
{caseStudies.map((item) => (
<li key={item.id} className="border-b border-slate-100 pb-6">
<Link
href={`/cases/${item.meta.slug}`}
className="text-2xl font-semibold text-slate-900 hover:text-primary"
>
{item.title}
</Link>
<p className="mt-1 text-sm text-slate-500">
{item.client_name}
{item.industry ? ` · ${item.industry}` : ""}
</p>
{item.summary && (
<p className="mt-2 text-slate-600">{item.summary}</p>
)}
</li>
))}
{caseStudies.length === 0 && (
<p className="text-slate-500"></p>
)}
</ul>
</div>
);
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+30
View File
@@ -0,0 +1,30 @@
@import "tailwindcss";
:root {
--background: #ffffff;
--foreground: #171717;
/* 主色调,对应 documents/设计方案分析与完善版.md UI 风格约定 */
--color-primary: #2563eb;
--color-dark: #0f172a;
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--color-primary);
--color-dark: var(--color-dark);
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
body {
background: var(--background);
color: var(--foreground);
}
+46
View File
@@ -0,0 +1,46 @@
import type { Metadata } from "next";
import { draftMode } from "next/headers";
import "./globals.css";
import Header from "@/components/layout/Header";
import Footer from "@/components/layout/Footer";
import CookieConsent from "@/components/layout/CookieConsent";
import ReactQueryProvider from "@/providers/react-query-provider";
// 面向中国大陆用户,避免依赖 next/font/google(构建期需访问 Google 服务器)。
// 生产环境建议自托管思源黑体 / HarmonyOS Sans 子集,这里先用系统字体栈占位。
export const metadata: Metadata = {
title: {
default: "企业官网",
template: "%s | 企业官网",
},
description: "企业级 Headless CMS 驱动的现代化官网",
};
export default async function RootLayout({ children }: LayoutProps<"/">) {
const { isEnabled: isPreview } = await draftMode();
return (
<html lang="zh-hans" className="h-full antialiased">
<body className="min-h-full flex flex-col font-sans">
<ReactQueryProvider>
{isPreview && (
<div className="flex items-center justify-center gap-4 bg-amber-400 px-4 py-2 text-sm font-medium text-amber-950">
<span>稿</span>
<a
href="/preview/disable"
className="underline underline-offset-2"
>
退
</a>
</div>
)}
<Header />
<main className="flex-1">{children}</main>
<Footer />
<CookieConsent />
</ReactQueryProvider>
</body>
</html>
);
}
+33
View File
@@ -0,0 +1,33 @@
import type { Metadata } from "next";
import { getHomePage } from "@/services/page.service";
import { getPreviewOrFallback } from "@/services/preview.service";
import { BlockRenderer } from "@/blocks/BlockRenderer";
import type { HomePageDetail } from "@/types/wagtail";
export const metadata: Metadata = {
title: "首页",
};
export default async function Home() {
const homePage = await getPreviewOrFallback<HomePageDetail>(
"home.homepage",
"body,seo_title_override,seo_description_override",
() => getHomePage().catch(() => null),
);
if (!homePage) {
return (
<div className="mx-auto max-w-3xl px-6 py-32 text-center">
<h1 className="mb-4 text-3xl font-semibold text-slate-900">
Wagtail CMS
</h1>
<p className="text-slate-600">
<code>.env.local</code> {" "}
<code>NEXT_PUBLIC_API_URL</code> http://localhost:8000)。
</p>
</div>
);
}
return <BlockRenderer blocks={homePage.body} />;
}
+18
View File
@@ -0,0 +1,18 @@
import { NextRequest, NextResponse } from "next/server";
import { draftMode, cookies } from "next/headers";
import {
PREVIEW_CONTENT_TYPE_COOKIE,
PREVIEW_TOKEN_COOKIE,
} from "@/services/preview.service";
/** 退出预览模式:关闭 Draft Mode 并清除预览专用 cookie,重定向回首页。 */
export async function GET(request: NextRequest) {
const draft = await draftMode();
draft.disable();
const cookieStore = await cookies();
cookieStore.delete(PREVIEW_CONTENT_TYPE_COOKIE);
cookieStore.delete(PREVIEW_TOKEN_COOKIE);
return NextResponse.redirect(new URL("/", request.url));
}
+54
View File
@@ -0,0 +1,54 @@
import { NextRequest, NextResponse } from "next/server";
import { draftMode, cookies } from "next/headers";
import {
fetchPreviewPage,
resolvePreviewPath,
PREVIEW_CONTENT_TYPE_COOKIE,
PREVIEW_TOKEN_COOKIE,
} from "@/services/preview.service";
import type { WagtailPageSummary } from "@/types/wagtail";
/**
* Wagtail 编辑器点击"预览"后会重定向到此路由(详见 wagtailcms/settings/base.py
* 中 WAGTAIL_HEADLESS_PREVIEW.CLIENT_URLS)。校验 token 有效后开启 Next.js
* Draft Mode 并重定向到对应内容的前端路由,由页面组件通过 getPreviewOrFallback
* 拉取草稿数据渲染。
*/
export async function GET(request: NextRequest) {
const contentType = request.nextUrl.searchParams.get("content_type");
const token = request.nextUrl.searchParams.get("token");
if (!contentType || !token) {
return NextResponse.json(
{ error: "缺少 content_type 或 token 参数" },
{ status: 400 },
);
}
// 先校验 token 是否有效并取回 slug,未开启 Draft Mode,避免暴露无效预览。
const page = await fetchPreviewPage<WagtailPageSummary>(contentType, token);
const path = page ? resolvePreviewPath(contentType, page) : null;
if (!page || !path) {
return NextResponse.json(
{ error: "预览链接无效或已过期" },
{ status: 404 },
);
}
const draft = await draftMode();
draft.enable();
const isProduction = process.env.NODE_ENV === "production";
const cookieStore = await cookies();
const cookieOptions = {
httpOnly: true,
sameSite: "lax" as const,
secure: isProduction,
path: "/",
};
cookieStore.set(PREVIEW_CONTENT_TYPE_COOKIE, contentType, cookieOptions);
cookieStore.set(PREVIEW_TOKEN_COOKIE, token, cookieOptions);
return NextResponse.redirect(new URL(path, request.url));
}
@@ -0,0 +1,81 @@
"use client";
import { useState } from "react";
import { useSearchParams } from "next/navigation";
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
export default function DeleteConfirmForm() {
const searchParams = useSearchParams();
const token = searchParams.get("token");
const [status, setStatus] = useState<
"idle" | "submitting" | "done" | "error"
>("idle");
const [message, setMessage] = useState("");
async function handleConfirm() {
if (!token) return;
setStatus("submitting");
try {
const res = await fetch(
`${API_BASE_URL}/api/v1/custom/leads/deletion-requests/confirm/`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token }),
},
);
const json = await res.json();
if (!res.ok) {
setMessage(json?.error?.message ?? "确认失败,请重新申请删除。");
setStatus("error");
return;
}
setMessage(json?.message ?? "已成功删除您的个人信息。");
setStatus("done");
} catch {
setMessage("网络错误,请稍后重试。");
setStatus("error");
}
}
if (!token) {
return (
<p className="text-slate-700">
{" "}
<a
href="/privacy-policy/delete-request"
className="text-primary underline"
>
</a>{" "}
</p>
);
}
if (status === "done") {
return <p className="text-slate-700">{message}</p>;
}
if (status === "error") {
return <p className="text-red-600">{message}</p>;
}
return (
<div className="space-y-4">
<h1 className="text-2xl font-bold text-slate-900"></h1>
<p className="text-slate-700">
</p>
<button
onClick={handleConfirm}
disabled={status === "submitting"}
className="rounded-full bg-red-600 px-6 py-2 font-medium text-white disabled:opacity-50"
>
{status === "submitting" ? "处理中..." : "确认删除"}
</button>
</div>
);
}
@@ -0,0 +1,15 @@
import { Suspense } from "react";
import type { Metadata } from "next";
import DeleteConfirmForm from "./DeleteConfirmForm";
export const metadata: Metadata = { title: "确认删除个人信息" };
export default function DeleteConfirmPage() {
return (
<div className="mx-auto max-w-xl px-6 py-24">
<Suspense fallback={<p className="text-slate-500">...</p>}>
<DeleteConfirmForm />
</Suspense>
</div>
);
}
@@ -0,0 +1,72 @@
"use client";
import { useState } from "react";
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
export default function DeleteRequestPage() {
const [contact, setContact] = useState("");
const [status, setStatus] = useState<
"idle" | "submitting" | "done" | "error"
>("idle");
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setStatus("submitting");
try {
const res = await fetch(
`${API_BASE_URL}/api/v1/custom/leads/deletion-requests/`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ contact }),
},
);
if (!res.ok) throw new Error("request failed");
setStatus("done");
} catch {
setStatus("error");
}
}
if (status === "done") {
return (
<div className="mx-auto max-w-xl px-6 py-24 text-center text-slate-700">
</div>
);
}
return (
<div className="mx-auto max-w-xl px-6 py-24">
<h1 className="mb-4 text-2xl font-bold text-slate-900">
</h1>
<p className="mb-6 text-slate-700">
PIPL
使
</p>
<form onSubmit={handleSubmit} className="flex gap-2">
<input
type="email"
required
value={contact}
onChange={(e) => setContact(e.target.value)}
placeholder="请输入邮箱"
className="flex-1 rounded-lg border border-slate-200 px-4 py-2"
/>
<button
type="submit"
disabled={status === "submitting"}
className="rounded-full bg-primary px-6 py-2 font-medium text-white disabled:opacity-50"
>
{status === "submitting" ? "提交中..." : "提交申请"}
</button>
</form>
{status === "error" && (
<p className="mt-4 text-red-600"></p>
)}
</div>
);
}
+37
View File
@@ -0,0 +1,37 @@
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { getSimpleContentPageBySlug } from "@/services/legal.service";
export async function generateMetadata(): Promise<Metadata> {
const page = await getSimpleContentPageBySlug("privacy-policy").catch(() => null);
return { title: page?.title ?? "隐私政策" };
}
export default async function PrivacyPolicyPage() {
const page = await getSimpleContentPageBySlug("privacy-policy").catch(() => null);
if (!page) {
notFound();
}
return (
<article className="mx-auto max-w-3xl px-6 py-24">
<h1 className="mb-8 text-4xl font-bold text-slate-900">{page.title}</h1>
{/* page.body 为 Wagtail RichTextField 渲染出的 HTML,内容仅由后台编辑人员维护,非用户输入,可信任直接渲染 */}
<div
className="space-y-4 text-slate-700 [&_h2]:mt-8 [&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:text-slate-900 [&_ul]:list-disc [&_ul]:pl-6 [&_li]:mt-1"
dangerouslySetInnerHTML={{ __html: page.body }}
/>
<p className="mt-8 text-slate-700">
<a
href="/privacy-policy/delete-request"
className="text-primary underline"
>
</a>
</p>
</article>
);
}
+45
View File
@@ -0,0 +1,45 @@
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { getProductBySlug } from "@/services/product.service";
import { getPreviewOrFallback } from "@/services/preview.service";
import { BlockRenderer } from "@/blocks/BlockRenderer";
import type { ProductPageDetail } from "@/types/wagtail";
interface ProductDetailPageProps {
params: Promise<{ slug: string }>;
}
export async function generateMetadata({
params,
}: ProductDetailPageProps): Promise<Metadata> {
const { slug } = await params;
const product = await getProductBySlug(slug).catch(() => null);
return { title: product?.title ?? "产品未找到" };
}
export default async function ProductDetailPage({
params,
}: ProductDetailPageProps) {
const { slug } = await params;
const product = await getPreviewOrFallback<ProductPageDetail>(
"products.productpage",
"body,summary",
() => getProductBySlug(slug).catch(() => null),
);
if (!product) {
notFound();
}
return (
<article className="mx-auto max-w-3xl px-6 py-24">
<h1 className="mb-4 text-4xl font-bold text-slate-900">
{product.title}
</h1>
{product.summary && (
<p className="mb-12 text-lg text-slate-600">{product.summary}</p>
)}
<BlockRenderer blocks={product.body} />
</article>
);
}
+35
View File
@@ -0,0 +1,35 @@
import Link from "next/link";
import type { Metadata } from "next";
import { getProductList } from "@/services/product.service";
export const metadata: Metadata = {
title: "产品",
};
export default async function ProductListPage() {
const products = await getProductList().catch(() => []);
return (
<div className="mx-auto max-w-4xl px-6 py-24">
<h1 className="mb-12 text-4xl font-bold text-slate-900"></h1>
<ul className="space-y-6">
{products.map((product) => (
<li key={product.id} className="border-b border-slate-100 pb-6">
<Link
href={`/products/${product.meta.slug}`}
className="text-2xl font-semibold text-slate-900 hover:text-primary"
>
{product.title}
</Link>
{product.summary && (
<p className="mt-2 text-slate-600">{product.summary}</p>
)}
</li>
))}
{products.length === 0 && (
<p className="text-slate-500"></p>
)}
</ul>
</div>
);
}
+45
View File
@@ -0,0 +1,45 @@
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import { getSolutionBySlug } from "@/services/solution.service";
import { getPreviewOrFallback } from "@/services/preview.service";
import { BlockRenderer } from "@/blocks/BlockRenderer";
import type { SolutionPageDetail } from "@/types/wagtail";
interface SolutionDetailPageProps {
params: Promise<{ slug: string }>;
}
export async function generateMetadata({
params,
}: SolutionDetailPageProps): Promise<Metadata> {
const { slug } = await params;
const solution = await getSolutionBySlug(slug).catch(() => null);
return { title: solution?.title ?? "解决方案未找到" };
}
export default async function SolutionDetailPage({
params,
}: SolutionDetailPageProps) {
const { slug } = await params;
const solution = await getPreviewOrFallback<SolutionPageDetail>(
"solutions.solutionpage",
"body,industry,summary",
() => getSolutionBySlug(slug).catch(() => null),
);
if (!solution) {
notFound();
}
return (
<article className="mx-auto max-w-3xl px-6 py-24">
<h1 className="mb-2 text-4xl font-bold text-slate-900">
{solution.title}
</h1>
{solution.industry && (
<p className="mb-12 text-sm text-slate-500">{solution.industry}</p>
)}
<BlockRenderer blocks={solution.body} />
</article>
);
}
+38
View File
@@ -0,0 +1,38 @@
import Link from "next/link";
import type { Metadata } from "next";
import { getSolutionList } from "@/services/solution.service";
export const metadata: Metadata = {
title: "解决方案",
};
export default async function SolutionListPage() {
const solutions = await getSolutionList().catch(() => []);
return (
<div className="mx-auto max-w-4xl px-6 py-24">
<h1 className="mb-12 text-4xl font-bold text-slate-900"></h1>
<ul className="space-y-6">
{solutions.map((solution) => (
<li key={solution.id} className="border-b border-slate-100 pb-6">
<Link
href={`/solutions/${solution.meta.slug}`}
className="text-2xl font-semibold text-slate-900 hover:text-primary"
>
{solution.title}
</Link>
{solution.industry && (
<p className="mt-1 text-sm text-slate-500">{solution.industry}</p>
)}
{solution.summary && (
<p className="mt-2 text-slate-600">{solution.summary}</p>
)}
</li>
))}
{solutions.length === 0 && (
<p className="text-slate-500"></p>
)}
</ul>
</div>
);
}
+67
View File
@@ -0,0 +1,67 @@
import type { ComponentType } from "react";
import Hero from "./hero/Hero";
import Stats from "./stats/Stats";
import FeatureGrid from "./feature-grid/FeatureGrid";
import FAQ from "./faq/FAQ";
import CTA from "./cta/CTA";
import LogoCloud from "./logo-cloud/LogoCloud";
import CaseStudyCard from "./case-study/CaseStudyCard";
import LeadForm from "./form/LeadForm";
import ProductCardGrid from "./product-card/ProductCardGrid";
import Pricing from "./pricing/Pricing";
import Timeline from "./timeline/Timeline";
import Team from "./team/Team";
import TechStack from "./tech-stack/TechStack";
import Video from "./video/Video";
import type { StreamFieldBlock } from "@/types/wagtail";
/**
* StreamField
* apps/core/blocks.py COMMON_BLOCKS
* / Block
* ( documents/.md §2.6)
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const components: Record<string, ComponentType<{ value: any }>> = {
hero: Hero,
stats: Stats,
feature_grid: FeatureGrid,
faq: FAQ,
cta: CTA,
logo_cloud: LogoCloud,
case_study: CaseStudyCard,
form: LeadForm,
product_card: ProductCardGrid,
pricing: Pricing,
timeline: Timeline,
team: Team,
tech_stack: TechStack,
video: Video,
};
export function BlockRenderer({ blocks }: { blocks: StreamFieldBlock[] }) {
return (
<>
{blocks?.map((block) => {
if (block.type === "richtext") {
return (
<div
key={block.id}
className="prose mx-auto max-w-3xl px-6 py-12"
dangerouslySetInnerHTML={{ __html: block.value }}
/>
);
}
const Component = components[block.type];
if (!Component) {
if (process.env.NODE_ENV === "development") {
console.warn(`未找到 Block 类型 "${block.type}" 对应的前端组件`);
}
return null;
}
return <Component key={block.id} value={block.value} />;
})}
</>
);
}
+24
View File
@@ -0,0 +1,24 @@
import Link from "next/link";
import type { CaseStudyBlockValue } from "@/types/wagtail";
export default function CaseStudyCard({ value }: { value: CaseStudyBlockValue }) {
if (!value.case_page) {
return null;
}
return (
<div className="mx-auto max-w-3xl px-6 py-8">
<Link
href={value.case_page.meta.html_url ?? "#"}
className="block rounded-3xl border border-slate-100 p-8 shadow-sm transition hover:shadow-md"
>
<h3 className="text-xl font-semibold text-slate-900">
{value.case_page.title}
</h3>
{value.summary && (
<p className="mt-2 text-slate-600">{value.summary}</p>
)}
</Link>
</div>
);
}
+23
View File
@@ -0,0 +1,23 @@
import Link from "next/link";
import type { CTABlockValue } from "@/types/wagtail";
export default function CTA({ value }: { value: CTABlockValue }) {
return (
<section className="py-32">
<div className="mx-auto max-w-6xl px-6">
<div className="rounded-[40px] bg-gradient-to-r from-blue-600 to-cyan-500 p-20 text-center text-white">
<h2 className="mb-6 text-4xl font-bold">{value.heading}</h2>
{value.description && (
<p className="mb-10 text-xl text-blue-100">{value.description}</p>
)}
<Link
href={value.button.link}
className="inline-block rounded-2xl bg-white px-10 py-4 text-lg font-semibold text-primary"
>
{value.button.text}
</Link>
</div>
</div>
</section>
);
}
+23
View File
@@ -0,0 +1,23 @@
import type { FAQBlockValue } from "@/types/wagtail";
export default function FAQ({ value }: { value: FAQBlockValue }) {
return (
<section className="mx-auto max-w-4xl px-6 py-24">
<h2 className="mb-12 text-4xl font-bold text-slate-900"></h2>
<div className="space-y-8">
{value.items?.map((item, index) => (
<div key={`${item.question}-${index}`}>
<h3 className="mb-2 text-xl font-semibold text-slate-900">
{item.question}
</h3>
{/* answer 来自 Wagtail RichTextBlock,后端已做 bleach 白名单清洗 */}
<div
className="text-slate-600"
dangerouslySetInnerHTML={{ __html: item.answer }}
/>
</div>
))}
</div>
</section>
);
}
+26
View File
@@ -0,0 +1,26 @@
import type { FeatureGridBlockValue } from "@/types/wagtail";
export default function FeatureGrid({ value }: { value: FeatureGridBlockValue }) {
return (
<section className="bg-slate-50 py-24">
<div className="mx-auto max-w-7xl px-6">
{value.heading && (
<h2 className="mb-16 text-4xl font-bold text-slate-900">{value.heading}</h2>
)}
<div className="grid gap-8 lg:grid-cols-3">
{value.items?.map((item, index) => (
<div
key={`${item.title}-${index}`}
className="rounded-3xl bg-white p-8 shadow-sm"
>
<h3 className="mb-3 text-2xl font-semibold text-slate-900">
{item.title}
</h3>
<p className="text-slate-600">{item.description}</p>
</div>
))}
</div>
</div>
</section>
);
}
+121
View File
@@ -0,0 +1,121 @@
"use client";
import { useState } from "react";
import type { FormBlockValue } from "@/types/wagtail";
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
export default function LeadForm({ value }: { value: FormBlockValue }) {
const [values, setValues] = useState<Record<string, string>>({});
const [website, setWebsite] = useState(""); // 蜂蜜陷阱字段,正常用户不可见,只有机器人会填写
const [status, setStatus] = useState<"idle" | "submitting" | "done" | "error">(
"idle",
);
const form = value.form;
if (!form) {
return null;
}
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
setStatus("submitting");
try {
const res = await fetch(`${API_BASE_URL}/api/v1/custom/leads/`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
form_id: form!.id,
data: values,
source_url: typeof window !== "undefined" ? window.location.href : "",
website,
}),
});
if (!res.ok) throw new Error("submit failed");
setStatus("done");
} catch {
setStatus("error");
}
}
if (status === "done") {
return (
<div className="mx-auto max-w-xl px-6 py-12 text-center text-slate-700">
{form.success_message}
</div>
);
}
return (
<form
onSubmit={handleSubmit}
className="mx-auto max-w-xl space-y-4 px-6 py-12"
>
<h3 className="text-2xl font-semibold text-slate-900">{form.name}</h3>
{form.fields.map((field) => (
<div key={field.field_key}>
<label className="mb-1 block text-sm font-medium text-slate-700">
{field.label}
{field.required && <span className="text-red-500">*</span>}
</label>
{field.field_type === "textarea" ? (
<textarea
required={field.required}
className="w-full rounded-lg border border-slate-200 px-4 py-2"
rows={4}
onChange={(e) =>
setValues((v) => ({ ...v, [field.field_key]: e.target.value }))
}
/>
) : field.field_type === "select" ? (
<select
required={field.required}
className="w-full rounded-lg border border-slate-200 px-4 py-2"
onChange={(e) =>
setValues((v) => ({ ...v, [field.field_key]: e.target.value }))
}
>
<option value=""></option>
{field.choices.map((choice) => (
<option key={choice} value={choice}>
{choice}
</option>
))}
</select>
) : (
<input
type={field.field_type}
required={field.required}
className="w-full rounded-lg border border-slate-200 px-4 py-2"
onChange={(e) =>
setValues((v) => ({ ...v, [field.field_key]: e.target.value }))
}
/>
)}
</div>
))}
{/* 蜂蜜陷阱字段:离屏幕定位而非 display:none,避免部分机器人检测到隐藏属性后跳过;无需 tabIndex/aria-hidden 以外的额外依赖 */}
<input
type="text"
name="website"
value={website}
onChange={(e) => setWebsite(e.target.value)}
autoComplete="off"
tabIndex={-1}
aria-hidden="true"
className="absolute left-[-9999px] top-auto h-px w-px overflow-hidden"
/>
<button
type="submit"
disabled={status === "submitting"}
className="w-full rounded-full bg-primary px-6 py-3 font-medium text-white disabled:opacity-50"
>
{status === "submitting" ? "提交中..." : form.submit_button_text}
</button>
{status === "error" && (
<p className="text-sm text-red-500"></p>
)}
</form>
);
}
+30
View File
@@ -0,0 +1,30 @@
import Link from "next/link";
import type { HeroBlockValue } from "@/types/wagtail";
export default function Hero({ value }: { value: HeroBlockValue }) {
return (
<section className="relative overflow-hidden bg-gradient-to-b from-slate-50 to-white py-32">
<div className="mx-auto flex max-w-5xl flex-col items-center px-6 text-center">
<h1 className="mb-6 text-5xl font-bold leading-tight text-slate-900">
{value.title}
</h1>
{value.subtitle && (
<p className="mb-10 max-w-2xl text-lg leading-8 text-slate-600">
{value.subtitle}
</p>
)}
<div className="flex gap-4">
{value.buttons?.map((button, index) => (
<Link
key={`${button.link}-${index}`}
href={button.link}
className="rounded-2xl bg-primary px-8 py-4 text-white"
>
{button.text}
</Link>
))}
</div>
</div>
</section>
);
}
+28
View File
@@ -0,0 +1,28 @@
import Image from "next/image";
import type { LogoCloudBlockValue } from "@/types/wagtail";
export default function LogoCloud({ value }: { value: LogoCloudBlockValue }) {
return (
<section className="py-20">
<div className="mx-auto max-w-6xl px-6 text-center">
{value.heading && (
<h3 className="mb-10 text-lg font-semibold text-slate-500">
{value.heading}
</h3>
)}
<div className="flex flex-wrap items-center justify-center gap-10 grayscale">
{value.logos?.map((logo, index) => (
<Image
key={`${logo.url}-${index}`}
src={logo.url}
alt={logo.title}
width={120}
height={40}
className="h-10 w-auto object-contain"
/>
))}
</div>
</div>
</section>
);
}
+51
View File
@@ -0,0 +1,51 @@
import Link from "next/link";
import type { PricingBlockValue } from "@/types/wagtail";
export default function Pricing({ value }: { value: PricingBlockValue }) {
return (
<section className="bg-slate-50 py-24">
<div className="mx-auto max-w-7xl px-6">
{value.heading && (
<h2 className="mb-16 text-center text-4xl font-bold text-slate-900">
{value.heading}
</h2>
)}
<div className="grid gap-8 lg:grid-cols-3">
{value.plans?.map((plan, index) => (
<div
key={`${plan.name}-${index}`}
className={`flex flex-col rounded-3xl border p-8 shadow-sm ${
plan.highlighted
? "border-primary bg-white ring-2 ring-primary"
: "border-slate-100 bg-white"
}`}
>
<h3 className="mb-2 text-xl font-semibold text-slate-900">
{plan.name}
</h3>
<div className="mb-6 text-3xl font-bold text-primary">{plan.price}</div>
<ul className="mb-8 flex-1 space-y-3">
{plan.features?.map((feature, featureIndex) => (
<li
key={`${feature}-${featureIndex}`}
className="text-sm text-slate-600"
>
{feature}
</li>
))}
</ul>
{plan.button && (
<Link
href={plan.button.link}
className="rounded-2xl bg-primary px-6 py-3 text-center text-white"
>
{plan.button.text}
</Link>
)}
</div>
))}
</div>
</div>
</section>
);
}
+46
View File
@@ -0,0 +1,46 @@
import Link from "next/link";
import Image from "next/image";
import type { ProductCardBlockValue } from "@/types/wagtail";
export default function ProductCardGrid({ value }: { value: ProductCardBlockValue }) {
return (
<section className="py-24">
<div className="mx-auto max-w-7xl px-6">
{value.heading && (
<h2 className="mb-16 text-4xl font-bold text-slate-900">{value.heading}</h2>
)}
<div className="grid gap-8 sm:grid-cols-2 lg:grid-cols-3">
{value.items?.map((item, index) => {
const card = (
<div className="h-full rounded-3xl border border-slate-100 p-6 shadow-sm transition hover:shadow-md">
{item.image && (
<Image
src={item.image.url}
alt={item.image.title}
width={400}
height={240}
className="mb-6 h-40 w-full rounded-2xl object-cover"
/>
)}
<h3 className="mb-2 text-xl font-semibold text-slate-900">
{item.title}
</h3>
{item.description && (
<p className="text-slate-600">{item.description}</p>
)}
</div>
);
const key = `${item.title}-${index}`;
return item.link ? (
<Link key={key} href={item.link} className="block h-full">
{card}
</Link>
) : (
<div key={key}>{card}</div>
);
})}
</div>
</div>
</section>
);
}
+19
View File
@@ -0,0 +1,19 @@
import type { StatsBlockValue } from "@/types/wagtail";
export default function Stats({ value }: { value: StatsBlockValue }) {
return (
<section className="py-20">
<div className="mx-auto grid max-w-6xl grid-cols-2 gap-8 px-6 lg:grid-cols-4">
{value.items?.map((item, index) => (
<div
key={`${item.label}-${index}`}
className="rounded-3xl border border-slate-100 bg-white p-10 text-center shadow-sm"
>
<div className="mb-3 text-5xl font-bold text-primary">{item.value}</div>
<div className="text-slate-600">{item.label}</div>
</div>
))}
</div>
</section>
);
}
+40
View File
@@ -0,0 +1,40 @@
import Image from "next/image";
import type { TeamBlockValue } from "@/types/wagtail";
export default function Team({ value }: { value: TeamBlockValue }) {
return (
<section className="py-24">
<div className="mx-auto max-w-7xl px-6">
{value.heading && (
<h2 className="mb-16 text-4xl font-bold text-slate-900">{value.heading}</h2>
)}
<div className="grid gap-8 sm:grid-cols-2 lg:grid-cols-4">
{value.members?.map((member) => (
<div key={member.id} className="text-center">
{member.photo ? (
<Image
src={member.photo.url}
alt={member.photo.title}
width={200}
height={200}
className="mx-auto mb-4 h-40 w-40 rounded-full object-cover"
/>
) : (
<div className="mx-auto mb-4 h-40 w-40 rounded-full bg-slate-100" />
)}
<div className="text-lg font-semibold text-slate-900">
{member.name}
</div>
{member.role && (
<div className="mb-2 text-sm text-primary">{member.role}</div>
)}
{member.bio && (
<p className="text-sm text-slate-600">{member.bio}</p>
)}
</div>
))}
</div>
</div>
</section>
);
}
+28
View File
@@ -0,0 +1,28 @@
import type { TechStackBlockValue } from "@/types/wagtail";
export default function TechStack({ value }: { value: TechStackBlockValue }) {
return (
<section className="bg-slate-50 py-24">
<div className="mx-auto max-w-6xl px-6">
{value.heading && (
<h2 className="mb-16 text-center text-4xl font-bold text-slate-900">
{value.heading}
</h2>
)}
<div className="grid grid-cols-2 gap-6 sm:grid-cols-3 lg:grid-cols-4">
{value.items?.map((item, index) => (
<div
key={`${item.label}-${index}`}
className="flex flex-col items-center gap-3 rounded-2xl bg-white p-6 text-center shadow-sm"
>
{item.icon && <span className="text-3xl">{item.icon}</span>}
<span className="text-sm font-medium text-slate-700">
{item.label}
</span>
</div>
))}
</div>
</div>
</section>
);
}
+24
View File
@@ -0,0 +1,24 @@
import type { TimelineBlockValue } from "@/types/wagtail";
export default function Timeline({ value }: { value: TimelineBlockValue }) {
return (
<section className="py-24">
<div className="mx-auto max-w-4xl px-6">
{value.heading && (
<h2 className="mb-16 text-4xl font-bold text-slate-900">{value.heading}</h2>
)}
<ol className="relative space-y-10 border-l border-slate-200 pl-8">
{value.items?.map((item, index) => (
<li key={`${item.year}-${index}`} className="relative">
<span className="absolute -left-[2.35rem] top-1 h-3 w-3 rounded-full bg-primary" />
<div className="mb-1 text-lg font-semibold text-primary">
{item.year}
</div>
<p className="text-slate-600">{item.event}</p>
</li>
))}
</ol>
</div>
</section>
);
}
+42
View File
@@ -0,0 +1,42 @@
import type { VideoBlockValue } from "@/types/wagtail";
const DIRECT_VIDEO_EXTENSIONS = [".mp4", ".webm", ".ogg"];
export default function Video({ value }: { value: VideoBlockValue }) {
if (!value.video_url) {
return null;
}
const isDirectFile = DIRECT_VIDEO_EXTENSIONS.some((ext) =>
value.video_url.toLowerCase().includes(ext)
);
return (
<section className="py-24">
<div className="mx-auto max-w-5xl px-6">
{value.heading && (
<h2 className="mb-8 text-center text-4xl font-bold text-slate-900">
{value.heading}
</h2>
)}
<div className="overflow-hidden rounded-3xl bg-black shadow-lg">
{isDirectFile ? (
<video
src={value.video_url}
poster={value.poster?.url}
controls
className="aspect-video w-full"
/>
) : (
<iframe
src={value.video_url}
allow="autoplay; fullscreen"
allowFullScreen
className="aspect-video w-full"
/>
)}
</div>
</div>
</section>
);
}
+67
View File
@@ -0,0 +1,67 @@
"use client";
import { useEffect, useState } from "react";
import Link from "next/link";
const CONSENT_STORAGE_KEY = "cookie-consent";
export default function CookieConsent() {
const [visible, setVisible] = useState(false);
useEffect(() => {
// 仅在浏览器已明确同意/拒绝前展示,避免每次访问重复弹出。
// localStorage 只能在客户端读取,此处属于“挂载后同步一次性客户端状态”的合理用法。
const consent = window.localStorage.getItem(CONSENT_STORAGE_KEY);
if (!consent) {
// eslint-disable-next-line react-hooks/set-state-in-effect -- 首次挂载后读取 localStorage 决定是否展示横幅,属预期用法
setVisible(true);
}
}, []);
function handleChoice(choice: "accepted" | "rejected") {
window.localStorage.setItem(CONSENT_STORAGE_KEY, choice);
setVisible(false);
}
if (!visible) {
return null;
}
return (
<div
role="dialog"
aria-live="polite"
aria-label="Cookie 使用提示"
className="fixed inset-x-0 bottom-0 z-[100] border-t border-slate-800 bg-slate-950 px-6 py-4 text-sm text-slate-300"
>
<div className="mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 sm:flex-row">
<p>
使 Cookie 访{" "}
<Link
href="/privacy-policy"
className="underline underline-offset-2 hover:text-white"
>
</Link>{" "}
使 Cookie Cookie
</p>
<div className="flex shrink-0 gap-3">
<button
type="button"
onClick={() => handleChoice("rejected")}
className="rounded-md border border-slate-600 px-4 py-2 text-slate-300 hover:bg-slate-800"
>
</button>
<button
type="button"
onClick={() => handleChoice("accepted")}
className="rounded-md bg-primary px-4 py-2 font-medium text-white hover:opacity-90"
>
</button>
</div>
</div>
</div>
);
}
+41
View File
@@ -0,0 +1,41 @@
import { getSiteSettings } from "@/services/site-settings.service";
// 合规要求:中国大陆网站需展示 ICP 备案号并链接至工信部备案查询。
// 详见 documents/设计方案分析与完善版.md §2.15。
const FALLBACK_ICP_NUMBER = "冀ICP备2025130506号-1";
const FALLBACK_ICP_URL = "https://beian.miit.gov.cn/";
export default async function Footer() {
// 优先使用后台配置的站点设置(apps.core.SiteSettings),
// 接口不可用时回退到硬编码的备案信息,保证构建/渲染始终可用。
const siteSettings = await getSiteSettings();
const icpNumber = siteSettings?.icp_number || FALLBACK_ICP_NUMBER;
const icpUrl = siteSettings?.icp_url || FALLBACK_ICP_URL;
return (
<footer className="mt-auto border-t border-slate-100 bg-slate-950 py-10 text-slate-400">
<div className="mx-auto max-w-7xl px-6 text-center text-sm">
<p>
&copy; {new Date().getFullYear()}{" "}
{siteSettings?.company_name || "企业官网"}. All rights reserved.
</p>
<p className="mt-2">
<a href="/privacy-policy" className="hover:text-white">
</a>
</p>
<p className="mt-2">
<a
href={icpUrl}
target="_blank"
rel="noreferrer"
className="hover:text-white"
>
{icpNumber}
</a>
</p>
</div>
</footer>
);
}
+47
View File
@@ -0,0 +1,47 @@
import Link from "next/link";
import { getNavigationMenu } from "@/services/navigation.service";
const fallbackNavItems = [
{ title: "首页", href: "/" },
{ title: "产品", href: "/products" },
{ title: "解决方案", href: "/solutions" },
{ title: "案例", href: "/cases" },
{ title: "博客", href: "/blog" },
];
export default async function Header() {
// 优先使用后台配置的主导航(apps.core.NavigationMenuname="main"),
// 未配置或接口不可用时回退到静态导航项,保证构建/渲染始终可用。
const menu = await getNavigationMenu("main");
const navItems = menu?.items.length
? menu.items.map((item) => ({
title: item.label,
href: item.url,
newTab: item.open_in_new_tab,
}))
: fallbackNavItems.map((item) => ({ ...item, newTab: false }));
return (
<header className="sticky top-0 z-50 border-b border-slate-100 bg-white/80 backdrop-blur">
<div className="mx-auto flex h-16 max-w-7xl items-center justify-between px-6">
<Link href="/" className="text-xl font-bold text-primary">
</Link>
<nav className="flex gap-8">
{navItems.map((item) => (
<Link
key={item.href}
href={item.href}
className="text-slate-700"
target={item.newTab ? "_blank" : undefined}
rel={item.newTab ? "noreferrer" : undefined}
>
{item.title}
</Link>
))}
</nav>
</div>
</header>
);
}
+18
View File
@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);
export default eslintConfig;
+14
View File
@@ -0,0 +1,14 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
images: {
// Wagtail 后端媒体地址(开发环境 + 生产环境国内 OSS/CDN 域名)。
// 详见 documents/设计方案分析与完善版.md §2.3。
remotePatterns: [
{ protocol: "http", hostname: "localhost" },
{ protocol: "https", hostname: "**" },
],
},
};
export default nextConfig;
+6848
View File
File diff suppressed because it is too large Load Diff
+30
View File
@@ -0,0 +1,30 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"@tanstack/react-query": "^5.101.4",
"clsx": "^2.1.1",
"lucide-react": "^1.28.0",
"next": "16.3.0",
"react": "19.2.8",
"react-dom": "19.2.8",
"zustand": "^5.0.14"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.3.0",
"tailwindcss": "^4",
"typescript": "^5"
}
}
+7
View File
@@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;
+15
View File
@@ -0,0 +1,15 @@
"use client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useState } from "react";
export default function ReactQueryProvider({
children,
}: {
children: React.ReactNode;
}) {
const [queryClient] = useState(() => new QueryClient());
return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
}
+1
View File
@@ -0,0 +1 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 391 B

+1
View File
@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 128 B

+1
View File
@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

After

Width:  |  Height:  |  Size: 385 B

+38
View File
@@ -0,0 +1,38 @@
/**
* Wagtail API v2
* documents/.md §2.7 Headless API
*/
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
export class ApiError extends Error {
constructor(
message: string,
public status: number,
) {
super(message);
this.name = "ApiError";
}
}
interface FetchOptions {
/** ISR 重新验证秒数,默认 60s。传 0 表示不缓存(用于预览)。 */
revalidate?: number;
/** 关联的缓存标签,供 revalidateTag 精准失效使用。 */
tags?: string[];
}
export async function fetchAPI<T>(
path: string,
{ revalidate = 60, tags }: FetchOptions = {},
): Promise<T> {
const res = await fetch(`${API_BASE_URL}${path}`, {
next: { revalidate, tags },
});
if (!res.ok) {
throw new ApiError(`API request failed: ${path}`, res.status);
}
return res.json() as Promise<T>;
}
+28
View File
@@ -0,0 +1,28 @@
import { fetchAPI } from "./api-client";
import type {
BlogPageDetail,
BlogPageSummary,
WagtailListResponse,
} from "@/types/wagtail";
/**
*
*/
export async function getBlogList(): Promise<BlogPageSummary[]> {
const res = await fetchAPI<WagtailListResponse<BlogPageSummary>>(
"/api/v2/pages/?type=blog.BlogPage&fields=intro,published_at&order=-published_at",
{ tags: ["blog-list"] },
);
return res.items;
}
/**
* slug
*/
export async function getBlogBySlug(slug: string): Promise<BlogPageDetail | null> {
const res = await fetchAPI<WagtailListResponse<BlogPageDetail>>(
`/api/v2/pages/?type=blog.BlogPage&slug=${encodeURIComponent(slug)}&fields=body,intro,published_at&limit=1`,
{ tags: [`blog:${slug}`] },
);
return res.items[0] ?? null;
}
+26
View File
@@ -0,0 +1,26 @@
import { fetchAPI } from "./api-client";
import type {
CaseStudyPageDetail,
CaseStudyPageSummary,
WagtailListResponse,
} from "@/types/wagtail";
/** 获取客户案例列表(按发布时间倒序)。 */
export async function getCaseStudyList(): Promise<CaseStudyPageSummary[]> {
const res = await fetchAPI<WagtailListResponse<CaseStudyPageSummary>>(
"/api/v2/pages/?type=cases.CaseStudyPage&fields=client_name,industry,published_at,summary&order=-published_at",
{ tags: ["case-study-list"] },
);
return res.items;
}
/** 根据 slug 获取客户案例详情。 */
export async function getCaseStudyBySlug(
slug: string,
): Promise<CaseStudyPageDetail | null> {
const res = await fetchAPI<WagtailListResponse<CaseStudyPageDetail>>(
`/api/v2/pages/?type=cases.CaseStudyPage&slug=${encodeURIComponent(slug)}&fields=body,client_name,industry,published_at,summary&limit=1`,
{ tags: [`case-study:${slug}`] },
);
return res.items[0] ?? null;
}
+16
View File
@@ -0,0 +1,16 @@
import { fetchAPI } from "./api-client";
import type { SimpleContentPageDetail, WagtailListResponse } from "@/types/wagtail";
/**
* slug apps.core.SimpleContentPage
* /
*/
export async function getSimpleContentPageBySlug(
slug: string,
): Promise<SimpleContentPageDetail | null> {
const res = await fetchAPI<WagtailListResponse<SimpleContentPageDetail>>(
`/api/v2/pages/?type=core.SimpleContentPage&slug=${encodeURIComponent(slug)}&fields=body&limit=1`,
{ tags: [`legal-page:${slug}`] },
);
return res.items[0] ?? null;
}
+19
View File
@@ -0,0 +1,19 @@
import { fetchAPI } from "./api-client";
import type { NavigationMenuValue } from "@/types/wagtail";
/**
* name main / footerapps.core.NavigationMenu Snippet
* null退
*/
export async function getNavigationMenu(
name: string,
): Promise<NavigationMenuValue | null> {
try {
return await fetchAPI<NavigationMenuValue>(
`/api/v1/custom/core/navigation/?name=${encodeURIComponent(name)}`,
{ tags: [`navigation:${name}`] },
);
} catch {
return null;
}
}
+13
View File
@@ -0,0 +1,13 @@
import { fetchAPI } from "./api-client";
import type { HomePageDetail, WagtailListResponse } from "@/types/wagtail";
/**
* home.HomePage
*/
export async function getHomePage(): Promise<HomePageDetail | null> {
const res = await fetchAPI<WagtailListResponse<HomePageDetail>>(
"/api/v2/pages/?type=home.HomePage&fields=body,seo_title_override,seo_description_override&limit=1",
{ tags: ["home-page"] },
);
return res.items[0] ?? null;
}
+11
View File
@@ -0,0 +1,11 @@
import { fetchAPI } from "./api-client";
import type { PartnerValue } from "@/types/wagtail";
/** 获取合作伙伴/客户 Logo 列表(apps.core.Partner Snippet)。 */
export async function getPartners(): Promise<PartnerValue[]> {
const res = await fetchAPI<{ items: PartnerValue[] }>(
"/api/v1/custom/core/partners/",
{ tags: ["partners"] },
);
return res.items;
}
+81
View File
@@ -0,0 +1,81 @@
import { draftMode, cookies } from "next/headers";
import { fetchAPI } from "./api-client";
import type { WagtailPageSummary } from "@/types/wagtail";
/**
* Wagtail wagtail_headless_preview + Next.js Draft Mode
* documents/.md §2.16 apps/api/urls.py
* PagePreviewAPIViewSet /api/v2/page_preview/
*/
export const PREVIEW_CONTENT_TYPE_COOKIE = "wagtail_preview_content_type";
export const PREVIEW_TOKEN_COOKIE = "wagtail_preview_token";
/** content_type`app_label.model`,小写)→ 对应前端路由的解析函数 */
const PREVIEW_PATH_RESOLVERS: Record<
string,
(page: WagtailPageSummary) => string
> = {
"home.homepage": () => "/",
"blog.blogpage": (page) => `/blog/${page.meta.slug}`,
"products.productpage": (page) => `/products/${page.meta.slug}`,
"cases.casestudypage": (page) => `/cases/${page.meta.slug}`,
"solutions.solutionpage": (page) => `/solutions/${page.meta.slug}`,
};
/** 根据 content_type 解析预览内容应跳转到的前端路径,未知类型返回 null。 */
export function resolvePreviewPath(
contentType: string,
page: WagtailPageSummary,
): string | null {
const resolver = PREVIEW_PATH_RESOLVERS[contentType];
return resolver ? resolver(page) : null;
}
/**
* 稿`fields` Wagtail API meta.slug/meta.type
* /preview token
*/
export async function fetchPreviewPage<T extends WagtailPageSummary>(
contentType: string,
token: string,
fields?: string,
): Promise<T | null> {
const query = new URLSearchParams({ content_type: contentType, token });
if (fields) {
query.set("fields", fields);
}
try {
return await fetchAPI<T>(`/api/v2/page_preview/?${query.toString()}`, {
revalidate: 0,
});
} catch {
return null;
}
}
/**
* Draft Mode cookie content_type
* 稿退 `fallback()`
*/
export async function getPreviewOrFallback<T extends WagtailPageSummary>(
expectedContentType: string,
fields: string,
fallback: () => Promise<T | null>,
): Promise<T | null> {
const { isEnabled } = await draftMode();
if (!isEnabled) {
return fallback();
}
const cookieStore = await cookies();
const contentType = cookieStore.get(PREVIEW_CONTENT_TYPE_COOKIE)?.value;
const token = cookieStore.get(PREVIEW_TOKEN_COOKIE)?.value;
if (contentType !== expectedContentType || !token) {
return fallback();
}
const preview = await fetchPreviewPage<T>(expectedContentType, token, fields);
return preview ?? fallback();
}
+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;
}
+14
View File
@@ -0,0 +1,14 @@
import { fetchAPI } from "./api-client";
import type { SiteSettingsValue } from "@/types/wagtail";
/** 获取站点全局配置(apps.core.SiteSettingswagtail.contrib.settings)。 */
export async function getSiteSettings(): Promise<SiteSettingsValue | null> {
try {
return await fetchAPI<SiteSettingsValue>(
"/api/v1/custom/core/site-settings/",
{ tags: ["site-settings"] },
);
} catch {
return null;
}
}
+26
View File
@@ -0,0 +1,26 @@
import { fetchAPI } from "./api-client";
import type {
SolutionPageDetail,
SolutionPageSummary,
WagtailListResponse,
} from "@/types/wagtail";
/** 获取解决方案列表。 */
export async function getSolutionList(): Promise<SolutionPageSummary[]> {
const res = await fetchAPI<WagtailListResponse<SolutionPageSummary>>(
"/api/v2/pages/?type=solutions.SolutionPage&fields=industry,summary",
{ tags: ["solution-list"] },
);
return res.items;
}
/** 根据 slug 获取解决方案详情。 */
export async function getSolutionBySlug(
slug: string,
): Promise<SolutionPageDetail | null> {
const res = await fetchAPI<WagtailListResponse<SolutionPageDetail>>(
`/api/v2/pages/?type=solutions.SolutionPage&slug=${encodeURIComponent(slug)}&fields=body,industry,summary&limit=1`,
{ tags: [`solution:${slug}`] },
);
return res.items[0] ?? null;
}
+11
View File
@@ -0,0 +1,11 @@
import { fetchAPI } from "./api-client";
import type { TeamMemberValue } from "@/types/wagtail";
/** 获取团队成员列表(apps.core.TeamMember Snippet)。 */
export async function getTeamMembers(): Promise<TeamMemberValue[]> {
const res = await fetchAPI<{ items: TeamMemberValue[] }>(
"/api/v1/custom/core/team/",
{ tags: ["team"] },
);
return res.items;
}
+11
View File
@@ -0,0 +1,11 @@
import { fetchAPI } from "./api-client";
import type { TestimonialValue } from "@/types/wagtail";
/** 获取客户证言列表(apps.core.Testimonial Snippet)。 */
export async function getTestimonials(): Promise<TestimonialValue[]> {
const res = await fetchAPI<{ items: TestimonialValue[] }>(
"/api/v1/custom/core/testimonials/",
{ tags: ["testimonials"] },
);
return res.items;
}
+11
View File
@@ -0,0 +1,11 @@
import { create } from "zustand";
interface AppState {
theme: "light" | "dark";
setTheme: (theme: "light" | "dark") => void;
}
export const useAppStore = create<AppState>((set) => ({
theme: "light",
setTheme: (theme) => set({ theme }),
}));
+34
View File
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"
],
"exclude": ["node_modules"]
}
+282
View File
@@ -0,0 +1,282 @@
/**
* Wagtail API v2
* apps/core/blocks.py StreamField Block
* documents/.md §2.6
*/
export interface WagtailMeta {
type: string;
detail_url: string;
html_url: string | null;
slug: string;
first_published_at: string | null;
}
export interface WagtailPageSummary {
id: number;
meta: WagtailMeta;
title: string;
}
export interface WagtailListResponse<T> {
meta: { total_count: number };
items: T[];
}
export interface CTAButtonValue {
text: string;
link: string;
}
export interface StatItemValue {
value: string;
label: string;
}
export interface FeatureItemValue {
icon?: string;
title: string;
description: string;
}
export interface FAQItemValue {
question: string;
answer: string; // richtext HTML
}
export interface HeroBlockValue {
title: string;
subtitle?: string;
background_image?: { url: string; title: string } | null;
buttons: CTAButtonValue[];
}
export interface StatsBlockValue {
items: StatItemValue[];
}
export interface FeatureGridBlockValue {
heading?: string;
items: FeatureItemValue[];
}
export interface FAQBlockValue {
items: FAQItemValue[];
}
export interface CTABlockValue {
heading: string;
description?: string;
button: CTAButtonValue;
}
export interface LogoCloudBlockValue {
heading?: string;
logos: { url: string; title: string }[];
}
export interface CaseStudyBlockValue {
case_page: WagtailPageSummary | null;
summary?: string;
}
/** 与后端 apps/forms/models.py FIELD_TYPE_CHOICES 保持一致 */
export type FormFieldType = "text" | "textarea" | "email" | "tel" | "select";
export interface FormFieldDef {
label: string;
field_key: string;
field_type: FormFieldType;
required: boolean;
choices: string[];
}
export interface FormDefinitionValue {
id: number;
name: string;
submit_button_text: string;
success_message: string;
fields: FormFieldDef[];
}
export interface FormBlockValue {
form: FormDefinitionValue | null;
}
export interface ProductCardItemValue {
title: string;
description?: string;
image?: { url: string; title: string } | null;
link?: string;
}
export interface ProductCardBlockValue {
heading?: string;
items: ProductCardItemValue[];
}
export interface PricingPlanValue {
name: string;
price: string;
features: string[];
highlighted?: boolean;
button?: CTAButtonValue | null;
}
export interface PricingBlockValue {
heading?: string;
plans: PricingPlanValue[];
}
export interface TimelineItemValue {
year: string;
event: string;
}
export interface TimelineBlockValue {
heading?: string;
items: TimelineItemValue[];
}
export interface TeamMemberBlockValue {
id: number;
name: string;
role: string;
bio: string;
photo: { url: string; title: string } | null;
}
export interface TeamBlockValue {
heading?: string;
members: TeamMemberBlockValue[];
}
export interface TechStackItemValue {
icon?: string;
label: string;
}
export interface TechStackBlockValue {
heading?: string;
items: TechStackItemValue[];
}
export interface VideoBlockValue {
heading?: string;
video_url: string;
poster?: { url: string; title: string } | null;
}
export type StreamFieldBlock =
| { id: string; type: "hero"; value: HeroBlockValue }
| { id: string; type: "stats"; value: StatsBlockValue }
| { id: string; type: "feature_grid"; value: FeatureGridBlockValue }
| { id: string; type: "faq"; value: FAQBlockValue }
| { id: string; type: "cta"; value: CTABlockValue }
| { id: string; type: "logo_cloud"; value: LogoCloudBlockValue }
| { id: string; type: "case_study"; value: CaseStudyBlockValue }
| { id: string; type: "form"; value: FormBlockValue }
| { id: string; type: "product_card"; value: ProductCardBlockValue }
| { id: string; type: "pricing"; value: PricingBlockValue }
| { id: string; type: "timeline"; value: TimelineBlockValue }
| { id: string; type: "team"; value: TeamBlockValue }
| { id: string; type: "tech_stack"; value: TechStackBlockValue }
| { id: string; type: "video"; value: VideoBlockValue }
| { id: string; type: "richtext"; value: string };
export interface HomePageDetail extends WagtailPageSummary {
body: StreamFieldBlock[];
seo_title_override?: string;
seo_description_override?: string;
}
export interface BlogPageSummary extends WagtailPageSummary {
intro?: string;
published_at?: string;
}
export interface BlogPageDetail extends BlogPageSummary {
body: StreamFieldBlock[];
}
export interface ProductPageSummary extends WagtailPageSummary {
summary?: string;
}
export interface ProductPageDetail extends ProductPageSummary {
body: StreamFieldBlock[];
}
export interface CaseStudyPageSummary extends WagtailPageSummary {
client_name: string;
industry?: string;
published_at?: string;
summary?: string;
}
export interface CaseStudyPageDetail extends CaseStudyPageSummary {
body: StreamFieldBlock[];
}
export interface SolutionPageSummary extends WagtailPageSummary {
industry?: string;
summary?: string;
}
export interface SolutionPageDetail extends SolutionPageSummary {
body: StreamFieldBlock[];
}
export interface SimpleContentPageDetail extends WagtailPageSummary {
body: string; // richtext HTML
}
/**
* Snippet apps/core/models.py
* /api/v1/custom/core/... Wagtail Page API
*/
export interface TeamMemberValue {
id: number;
name: string;
role: string;
bio: string;
photo: { url: string; title: string } | null;
}
export interface TestimonialValue {
id: number;
quote: string;
author_name: string;
author_title: string;
author_photo: { url: string; title: string } | null;
}
export interface PartnerValue {
id: number;
name: string;
website_url: string;
logo: { url: string; title: string } | null;
}
export interface NavigationMenuItemValue {
label: string;
url: string;
open_in_new_tab: boolean;
}
export interface NavigationMenuValue {
name: string;
items: NavigationMenuItemValue[];
}
export interface SiteSettingsValue {
company_name: string;
contact_phone: string;
contact_email: string;
address: string;
icp_number: string;
icp_url: string;
wechat_account: string;
weibo_url: string;
wechat_qrcode: { url: string; title: string } | null;
}