feat: 新增隐私政策页面,Footer增加链接
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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 }}
|
||||
/>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,11 @@ export default function Footer() {
|
||||
<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>© {new Date().getFullYear()} 企业官网. All rights reserved.</p>
|
||||
<p className="mt-2">
|
||||
<a href="/privacy-policy" className="hover:text-white">
|
||||
隐私政策
|
||||
</a>
|
||||
</p>
|
||||
{/*
|
||||
合规要求:中国大陆网站需展示 ICP 备案号并链接至工信部备案查询。
|
||||
详见 documents/设计方案分析与完善版.md §2.15。
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -156,3 +156,7 @@ export interface SolutionPageSummary extends WagtailPageSummary {
|
||||
export interface SolutionPageDetail extends SolutionPageSummary {
|
||||
body: StreamFieldBlock[];
|
||||
}
|
||||
|
||||
export interface SimpleContentPageDetail extends WagtailPageSummary {
|
||||
body: string; // richtext HTML
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user