feat(home): 首页 10 段收 8 段(对标段序)+ 透明信任层 + 反伪造成果插槽;SLA 收进单一真源

对标实测的首页段序(Bain:洞察轮播 → 宣言 → 客户成果 → SEE ALL CLIENT RESULTS → 视频 →
Latest Insights → CTA → 招聘;Porsche:video hero → News & Trends → Industry Expertise →
4 实践 accordion → 8 个案例 → AI 专题 → 招聘 → CTA)收敛为:
以编辑内容或客户成果开场、行业成网格、能力做 accordion、成果独立成频道、CTA 安静收尾。
我们 0 案例 / 2 新闻 / 无视频 / 无招聘页,填不了其中两格,所以**取其顺序、换其内容、
并在区块标题里说明换的是什么**(决策 3 零编造透明路线)。

段序 10 → 8
- 合并 HeroStatsBand + TrustSection 为「可审计数字账本」:两段都在说"这是我们的数字",
  是冗余不是节奏。合并后按 label 去重,口径角注取**最弱**的那个 basis。
- 合并 InsightsSection + NewsSection 为「洞察」:本就同轴,且两段各自指向 /news,
  是组件层的竞争真源。
- 新增行业网格(读 solution 模型 6 行)、能力 accordion(4 条 service ⇒ 恰好 4 个实践组)。
- 整块删除 NarrativeSection(与 /methodology 重复,其 text-4xl/5xl font-black 装饰编号
  正是「装饰大字对比度裁决」要防的手法)与 FounderQuoteSection
  (全站唯一 bg-brand-section #8B1530 满幅面;实测两家都是「饱和红只做点缀、
  绝不做页面背景/阴影」,且都没有 CEO 引言带 —— 那是 Accenture 语法)。
- 删除 home-content-v15.tsx(994 行)及其测试:page.tsx 已改渲染 v16,v15 只剩自己的测试
  引用它,属 DEC-P-2 死码族。v15 的 267 行测试里可转移的意图已在 v16 测试中重写;
  其中「挂载持续漂移粒子循环」那条与 CONTEXT.md:81「禁止连续循环动画」自相矛盾,不再延续。

反伪造不变量(本次最实质的内容诚信改动)
- 新增 ResultsSlot:判别式状态 ready | authorized-pending | co-creation | empty。
  ready 必须 verified===true 且 testimonial.author 非空 且 至少一个指标 basis==='verified',
  否则**抛错而不是静默渲染**。为此给 CaseMetric 补了 basis 字段 ——
  它原本没有这个维度,等于给"案例数字"开了个不需要出处的后门。
- CaseStudy 有两份类型(cases.ts 全量 / products.ts 精简),本轮用全量那份;
  类型合并留给组件清理批次。
- 空态必须肉眼可见是空态,读者不会把共创面板误读成客户成果。11 条用例含正对照。

SLA 从四条互斥收进单一真源(闭合台账 DEC-N30)
问题不是"四选一",而是**对象没拆开**:工作日2h / <4h / <2h·7×24 抢的是同一个对象
(响应时间),48h 给的是另一个对象(交付周期)。旧写法在四处各自硬写,所以会漂。
- 新增 lib/constants/commitments.ts:一个 about 只允许一条承诺(用例钉住 + 负向自证)。
- 撤下 <4小时(与 2h 同对象冲突)、7×24(对任何一次夜间延迟都会自破、不可验证)、
  48小时给出初步方案(交付周期不用小时数承诺)。
- 顺带发现 prisma/seeds/services.ts 的三行 dataProofs **完全没有 basis**
  (该文件带 @ts-nocheck,所以没人发现)⇒ 补上 basis,并把该文件里的 <4小时 整行撤下。
- 再查出第五条同类混淆:products.ts:84 的「<2小时」是 CRM 产品能力的设计目标,
  与本公司客服承诺撞脸 ⇒ 不删(对象确实不同、已标 target),改写 description 把对象说明白。

顺手修掉的既有缺陷:home-solutions 与 home-news 两个 zone 在库里确有编排内容,
但 page.tsx 只读 hero/stats/services/cases 四个,这两个整个被丢弃 —— 等于后台在运营一个
页面上不存在的开关。之所以长期无人发现:v15 的 News/Insights 各自 import 了硬编码
NEWS / FALLBACK_INSIGHTS 兜底,把「zone 被忽略」渲染成了「看起来有内容」。
⇒ 兜底在这里起的是**遮蔽**作用而不是降级作用。zone 判定也从 Object.keys(zones).length>0
改成逐键 some(len>0)(home-cases 的 items 是空数组,"有键"不等于"那段有内容")。

三条由真浏览器实测推翻我自己判断的记录(jsdom + tsc 全绿时都看不见):
1. 「账本合并」我原先假设两段同类,实测发现 TRUST_SIGNALS 里 成都/全流程/共创 根本不是数字,
   全按 63px 渲染等于让全页最响的一块装三个名词 —— 恰是对标反对的数据大字报。
   ⇒ 同段内分层:定量走 .text-5xl/500/黑,定性降为 15.75px 小字行。
2. data-testid 挂到 StaggerReveal 上会被静默丢弃 —— 真实组件解构固定 prop 列表、不透传,
   而我的 mock 透传了 ⇒ 单测绿、线上找不到该容器。典型的「mock 比实现宽松」。
   ⇒ 本轮把 testid 移到外层普通 div(grid 类仍留在 StaggerReveal 上,Q-5 的教训),
     props 透传本身留给组件清理批次统一做。
3. 我在一次 Edit 里重复定义了 toLedger —— **tsc EXIT=0、jest 1834 例全过,Turbopack 却报
   「name is defined multiple times」把整页打挂**。TS 允许同名函数重声明,所以类型检查
   和单测都不代表能构建。⇒ 本批补跑 npm run build(EXIT=0,/insights 静态预渲染在场,
     并显式核对 dist/static + public 已拷入 standalone,即 N-9 那个"缺资源 Lighthouse 仍
     exit 0"的坑)。

视觉语法在首页的落地(实测浏览器读数,dark 主题):
- h1 81px / 字重 700 / **border-radius 0**;hero CTA radius 0、#C41E3A 底、15.75px、
  字重 500、**box-shadow: none**(彩色光晕已退役)
- 成果数字 63px / 字重 500 / 纸白(对暗底对比度实测 17.45:1)
- 一级导航渲染为 行业 / 能力 / 洞察 / 关于我们;移动端 tab bar 首页·行业·能力·洞察·联系
- HeroParticleField 已不在 DOM(data-testid 查询为 null)

配套门禁调整(都是让闸更准,不是放宽):
- metrics-basis 的禁词扫描器现在先剥注释(保换行 ⇒ 行号仍准)。理由与 check:grammar 同一条:
  解释「为什么禁用这句话」的注释里最容易出现这句话本身;不剥只剩"改措辞绕闸"或"闸常驻红"两条坏路。
  已双向验证:禁词塞进 JSX 文案 ⇒ 抓到并报 results-slot.tsx:130;恢复 ⇒ 16/16 通过。
- REQUIRED_ANNOTATED_SOURCES 的 home-content-v15 路径改为 v15 的替代者(否则该用例 ENOENT 而"红得没道理")。
- CONSULT_CTA_ALLOWLIST 登记「成为首批共创客户」并写明理由(白名单就是为可解释例外存在的,
  已有同族的「了解共创合作」)。

KNOWN-RED: test:visual —— 首页段序换、导航 7→4、页脚三栏改标题与取数、tab bar 换轴、
CTA 去胶囊与箭头、卡片去 hover 抬升,页面级基线大面积 churn。按计划 #10 在代码全部落地后
一次性重捕(需 AUTH-VISUAL),再跑只读 --update-snapshots=none 作为真门禁。

门禁实测:type-check EXIT=0 · **npm run build EXIT=0** · 全量 jest 148 套件 / 1834 例通过 ·
eslint --quiet 0 error · check:grammar 9/9 + selftest 9/9 · token-twins 44/44 ·
contrast 44/44 · brand-token 0 违规 · check:motion 22(未新增违规)·
dev 真实渲染:/ 与 /insights 均 HTTP 200,八段与页脚四栏链接数实测非空
This commit is contained in:
zhangxiang committed 2026-10-16 21:00:43 +08:00
1 parent 7d1a22a596
commit 009e840fa7
16 files changed
+1342 -1282

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
'use client';
import { motion } from 'framer-motion';
import { CTA_COMMITMENT_LINE } from '@/lib/constants/commitments';
import { ArrowRight, MessageCircle } from 'lucide-react';
import type { HeroTheme } from '@/lib/constants/hero-themes';
@@ -81,7 +82,7 @@ export function DetailCTASection({
transition={{ delay: 0.5, duration: 0.28 }}
className="mt-10 text-sm text-white/70"
>
平均响应时间 &lt; 2小时 · 7×24小时技术支持 · 无需预付费用
{CTA_COMMITMENT_LINE}
</motion.p>
</motion.div>
</div>
+3 -1
View File
@@ -635,7 +635,9 @@ describe('DetailCTASection', () => {
primaryAction={{ label: '联系', href: '/contact' }}
/>
);
expect(screen.getByText(/平均响应时间 < 2小时/)).toBeInTheDocument();
// SLA 文案已收进 lib/constants/commitments.ts 单一真源;旧断言硬写「< 2小时 · 7×24」
// 正是被撤下的那条不可验证承诺(7×24 对任何一次夜间延迟都会自破)。
expect(screen.getByText(/工作日 2 小时内回复您的咨询/)).toBeInTheDocument();
});
});
+2 -1
View File
@@ -1,6 +1,7 @@
"use client";
import { motion, useScroll, useTransform } from "framer-motion";
import { FREE_FIRST_CONSULT, FIRST_CONVERSATION_DELIVERY } from "@/lib/constants/commitments";
import { useRef, useState, useEffect } from "react";
import { ScrollReveal, StaggerReveal } from "@/components/ui/scroll-reveal";
import { StaticLink } from "@/components/ui/static-link";
@@ -592,7 +593,7 @@ function CTASection() {
className="text-lg md:text-xl mb-10 font-light"
style={{ color: "var(--color-text-secondary)" }}
>
免费咨询,48小时内给出初步方案建议
{`${FREE_FIRST_CONSULT.text},${FIRST_CONVERSATION_DELIVERY.text}`}
</p>
<div className="flex flex-col sm:flex-row justify-center gap-4">
<Button size="lg" asChild>
@@ -0,0 +1,139 @@
import { describe, it, expect } from '@jest/globals';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { ResultsSlot, assertCaseIsPublishable, type ResultsSlotState } from './results-slot';
import type { CaseStudy } from '@/lib/constants/cases';
jest.mock('@/components/ui/scroll-reveal', () => ({
ScrollReveal: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));
jest.mock('@/components/ui/page-decoration', () => ({
SectionLabel: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
}));
jest.mock('@/components/ui/static-link', () => ({
StaticLink: ({ children, href }: { children: React.ReactNode; href: string }) => (
<a href={href}>{children}</a>
),
}));
/** 一份「完全够格」的案例基线 —— 下面每条负例都在它身上破坏一项 */
const publishable: CaseStudy = {
id: 'c1',
slug: 'stocking-turn',
client: '某制造企业',
industry: '制造业',
companySize: '500-1000 人',
title: '库存周转从 45 天降到 28 天',
subtitle: '',
challenge: '多渠道库存不透明',
solution: '统一库存中台 + 补货策略',
result: '库存周转下降 38%',
metrics: [{ value: '38%', label: '库存周转改善', basis: 'verified' }],
timeline: [],
services: [],
color: 'brand',
verified: true,
testimonial: { quote: '第一次看清了库存到底压在哪。', author: '张三', role: '供应链总监', company: '某制造企业' },
} as unknown as CaseStudy;
describe('assertCaseIsPublishable —— 反伪造不变量(每条都必须能失败)', () => {
it('完全够格的案例通过(这是正对照,缺了它下面的红说明不了任何事)', () => {
expect(() => assertCaseIsPublishable(publishable)).not.toThrow();
});
it('未授权公开(verified 不为 true)⇒ 拒绝', () => {
expect(() =>
assertCaseIsPublishable({ ...publishable, verified: false }),
).toThrow(/未授权公开/);
expect(() =>
assertCaseIsPublishable({ ...publishable, verified: undefined }),
).toThrow(/未授权公开/);
});
it('没有可署名的证言作者 ⇒ 拒绝(空作者 / 全空格都算没有)', () => {
expect(() =>
assertCaseIsPublishable({ ...publishable, testimonial: undefined }),
).toThrow(/署名/);
expect(() =>
assertCaseIsPublishable({ ...publishable, testimonial: { ...publishable.testimonial!, author: ' ' } }),
).toThrow(/署名/);
});
it('指标全是 target 口径 ⇒ 拒绝(这是最阴的一种:数字真、出处假)', () => {
expect(() =>
assertCaseIsPublishable({
...publishable,
metrics: [
{ value: '38%', label: 'A', basis: 'target' },
{ value: '2 倍', label: 'B', basis: 'team-history' },
],
}),
).toThrow(/basis === "verified"/);
});
it('文案命中虚构佐证禁词 ⇒ 拒绝', () => {
expect(() =>
assertCaseIsPublishable({ ...publishable, result: '源自真实客户案例的成效' }),
).toThrow(/禁词/);
});
it('判据把全部原因一次报齐(只报第一条会诱导人"修一个撞下一个")', () => {
let msg = '';
try {
assertCaseIsPublishable({
...publishable,
verified: false,
testimonial: undefined,
metrics: [{ value: 'x', label: 'y', basis: 'target' }],
});
} catch (e) {
msg = String(e);
}
expect(msg).toMatch(/未授权公开/);
expect(msg).toMatch(/署名/);
expect(msg).toMatch(/basis === "verified"/);
});
});
describe('ResultsSlot 空态必须"看得出是空态"', () => {
it('co-creation 态:明说不存在可公开成果,且带独立 testid', () => {
const state: ResultsSlotState = {
kind: 'co-creation',
steps: [{ label: '诊断', desc: '梳理断点' }],
};
render(<ResultsSlot state={state} />);
expect(screen.getByTestId('results-slot-co-creation')).toBeInTheDocument();
expect(screen.getByTestId('results-slot-placeholder')).toBeInTheDocument();
expect(screen.getByText('还没有可以公开的成果')).toBeInTheDocument();
expect(screen.getByText(/没有对外可验证的客户案例,我们就不会写一个出来/)).toBeInTheDocument();
});
it('authorized-pending 态:把等待授权的对象说清楚', () => {
render(<ResultsSlot state={{ kind: 'authorized-pending', clientLabel: '某零售集团' }} />);
expect(screen.getByTestId('results-slot-authorized-pending')).toBeInTheDocument();
expect(screen.getByText(/某零售集团/)).toBeInTheDocument();
});
it('empty 态与 ready 态的 testid 不同(防止空态被当成有内容)', () => {
const { unmount } = render(<ResultsSlot state={{ kind: 'empty' }} />);
expect(screen.getByTestId('results-slot-empty')).toBeInTheDocument();
unmount();
render(<ResultsSlot state={{ kind: 'ready', caseItem: publishable }} />);
expect(screen.getByTestId('results-slot-ready')).toBeInTheDocument();
expect(screen.queryByTestId('results-slot-placeholder')).not.toBeInTheDocument();
});
it('ready 态渲染的是案例事实本身,不是占位文案', () => {
render(<ResultsSlot state={{ kind: 'ready', caseItem: publishable }} />);
expect(screen.getByText('库存周转下降 38%')).toBeInTheDocument();
expect(screen.getByText('38%')).toBeInTheDocument();
expect(screen.getByText('张三')).toBeInTheDocument();
expect(screen.queryByText(/不会写一个出来/)).not.toBeInTheDocument();
});
it('组件层再跑一次判据:直接把不合格对象塞进 ready 态会抛,不是静默渲染', () => {
expect(() =>
render(<ResultsSlot state={{ kind: 'ready', caseItem: { ...publishable, verified: false } }} />),
).toThrow(/不可发布/);
});
});
+197
View File
@@ -0,0 +1,197 @@
'use client';
/**
* ResultsSlot —— 「客户成果」槽位,可判别空态。
*
* 为什么不是"没有案例就整段不渲染":
* 对标两家都把这个位置当第二拍用(Bain 首页第 3 块 "Bold steps forward." 的标题**就是**
* 成果数字;Porsche 首页 "Empowering Our Clients" 挂 8 个具名 reference)。
* 我们 case-study 模型 0 行(prisma/seeds/case-studies.ts:11 明示「首批客户共创阶段,
* 暂无对外可验证的客户案例」),所以**不能**照搬内容,但**应该**照搬形状 ——
* 插槽留着、状态写着,真实授权案例进来当天不需要改模板。
*
* 三条在组件内强制的诚实性规则(不是约定,是会被测试打红的断言):
* 1. `ready` 必须同时满足 `verified === true` **且** `testimonial.author` 非空
* **且** 至少一个指标 `basis === 'verified'`。任一不满足直接抛错 ——
* 宁可构建期炸,也不把一个没授权的故事渲染成客户成果。
* 2. 文案不得命中 metrics-basis.ts 的 FORBIDDEN_PROOF_PHRASES(那四条禁词的存在
* 理由就是本站零可验证案例,任何「源自真实客户案例」都是编造佐证)。
* 3. 非 ready 态必须**肉眼可见是空态**:带独立 data-testid、明示"还没有可公开的成果",
* 读者不会把共创面板误读成客户案例。
*/
import { ScrollReveal } from '@/components/ui/scroll-reveal';
import { StaticLink } from '@/components/ui/static-link';
import { SectionLabel } from '@/components/ui/page-decoration';
import { FORBIDDEN_PROOF_PHRASES } from '@/lib/constants/metrics-basis';
import type { CaseStudy } from '@/lib/constants/cases';
import { ArrowRight } from 'lucide-react';
export interface CoCreationStep {
label: string;
desc: string;
}
export type ResultsSlotState =
| { kind: 'ready'; caseItem: CaseStudy }
| { kind: 'authorized-pending'; clientLabel: string }
| { kind: 'co-creation'; steps: CoCreationStep[] }
| { kind: 'empty' };
/**
* 规则 1 + 2 的强制执行点。
* 导出是为了让单测能直接喂"不该通过"的 fixture —— 判据必须可失败。
*/
export function assertCaseIsPublishable(c: CaseStudy): void {
const problems: string[] = [];
if (c.verified !== true) problems.push('verified 不为 true(客户未授权公开)');
const author = c.testimonial?.author?.trim();
if (!author) problems.push('缺少可署名的客户证言作者');
const hasVerifiedMetric = (c.metrics ?? []).some((m) => m.basis === 'verified');
if (!hasVerifiedMetric) problems.push('没有任何一个指标 basis === "verified"');
const haystack = [c.title, c.subtitle, c.result, c.testimonial?.quote ?? ''].join(' ');
const hit = FORBIDDEN_PROOF_PHRASES.find((p) => haystack.includes(p));
if (hit) problems.push(`文案命中虚构佐证禁词「${hit}」`);
if (problems.length > 0) {
throw new Error(
`ResultsSlot: 案例「${c.slug || c.id}」不可发布 —— ${problems.join(';')}。` +
'零编造原则下,缺任何一项都不该被渲染成客户成果。',
);
}
}
export function ResultsSlot({
state,
heading = '客户成果',
href = '/insights?kind=cases',
}: {
state: ResultsSlotState;
heading?: string;
href?: string;
}) {
return (
<section
aria-labelledby="results-slot-heading"
className="bg-bg-primary border-t border-border-primary"
data-testid={`results-slot-${state.kind}`}
>
<div className="container-x py-16 md:py-20">
<ScrollReveal>
<SectionLabel>{heading}</SectionLabel>
<h2
id="results-slot-heading"
className="text-2xl sm:text-3xl md:text-4xl font-bold text-text-primary tracking-tight leading-tight"
>
{state.kind === 'ready'
? // 标题即成果 —— Bain 的写法("Bold steps forward." 后面直接跟数字)
state.caseItem.result || state.caseItem.title
: '还没有可以公开的成果'}
</h2>
</ScrollReveal>
{state.kind === 'ready' ? (
<ReadyCard caseItem={state.caseItem} />
) : (
<EmptyTreatments state={state} href={href} />
)}
</div>
</section>
);
}
/** ready 态:形状照 Bain success-story 卡(行业标签 / 标题即成果 / 指标 / 证言) */
function ReadyCard({ caseItem: c }: { caseItem: CaseStudy }) {
// 渲染前再跑一次判据:组件被别处复用也不会绕过规则
assertCaseIsPublishable(c);
return (
<div className="mt-10 grid gap-8 lg:grid-cols-[5fr_3fr]">
<div className="bain-card p-8">
<div className="flex items-center gap-3 mb-5">
<span className="text-xs font-medium text-brand-ink">{c.industry}</span>
<span className="text-xs text-text-muted">{c.companySize}</span>
</div>
<h3 className="text-xl font-semibold text-text-primary leading-snug">{c.title}</h3>
<p className="mt-3 text-sm text-text-secondary leading-relaxed">{c.challenge}</p>
<p className="mt-3 text-sm text-text-secondary leading-relaxed">{c.solution}</p>
<div className="mt-7 grid grid-cols-2 sm:grid-cols-3 gap-6">
{c.metrics.map((m) => (
<div key={m.label}>
{/* 实测对标:Bain 的成果数字是 40px / 字重 500 / 纯黑,
不是本仓此前的「超大字号 + 品牌色」。故这里用 text-5xl font-medium 黑色 */}
<div className="text-2xl sm:text-3xl font-medium tabular-nums text-text-primary">
{m.value}
</div>
<div className="mt-1 text-sm text-text-muted">{m.label}</div>
</div>
))}
</div>
</div>
<figure className="bain-card p-8 flex flex-col justify-between">
<blockquote className="text-base leading-relaxed text-text-primary">
「{c.testimonial?.quote}」
</blockquote>
<figcaption className="mt-6 text-sm text-text-secondary">
<span className="block font-medium text-text-primary">{c.testimonial?.author}</span>
<span className="block mt-0.5">{c.testimonial?.role} · {c.testimonial?.company}</span>
</figcaption>
</figure>
</div>
);
}
/** 非 ready 态:三种空态各自说清"现在有什么、缺什么" */
function EmptyTreatments({
state,
href,
}: {
state: Exclude<ResultsSlotState, { kind: 'ready' }>;
href: string;
}) {
return (
<div className="mt-10">
<div className="bain-card p-8" data-testid="results-slot-placeholder">
<p className="text-sm text-text-secondary leading-relaxed">
公司 2026 年 1 月成立,现处于首批客户共创阶段。
<strong className="font-medium text-text-primary">没有对外可验证的客户案例,我们就不会写一个出来。</strong>
{state.kind === 'authorized-pending' && (
<> 已与「{state.clientLabel}」达成合作,等待对方公开授权后本节才会出数。</>
)}
</p>
{state.kind === 'co-creation' && state.steps.length > 0 && (
<ol className="mt-7 grid gap-4 sm:grid-cols-2 lg:grid-cols-4 list-none p-0 m-0">
{state.steps.map((s) => (
<li key={s.label} className="border-l-2 border-border-rule pl-4">
<div className="text-sm font-medium text-text-primary">{s.label}</div>
<div className="mt-1 text-xs text-text-muted leading-relaxed">{s.desc}</div>
</li>
))}
</ol>
)}
<div className="mt-8 flex flex-wrap gap-4">
<StaticLink
href={href}
className="inline-flex items-center gap-1 text-sm font-medium text-text-primary hover:text-brand-ink transition-colors duration-hover"
>
看我们怎么证明过程可控
<ArrowRight className="w-4 h-4" aria-hidden="true" />
</StaticLink>
<StaticLink
href="/contact"
className="inline-flex items-center gap-1 text-sm font-medium text-brand-ink hover:text-brand-ink-hover transition-colors duration-hover"
>
成为首批共创客户
</StaticLink>
</div>
</div>
</div>
);
}