feat(ui): 保时捷语法复刻收尾(ADR-0008/0009/0011/0012/0013) #65

Merged
zhangxiang merged 63 commits from feat/porsche-ui-replica into dev 2026-12-02 19:34:32 +08:00
12 changed files with 1073 additions and 717 deletions
Showing only changes of commit 9f8d780a3b - Show all commits

No files matched your search

+3 -1
View File
@@ -96,8 +96,10 @@ const MARKETING_FLOOR = 60;
* R18 是**硬禁**(0):签名件(斜线纹 / 双 V / 斜杠)在 2026-11-03 之前全仓零命中,
* 没有「存量」可言 —— 登记一个非零上限等于给第二份纹样真源预开一个名额。
* R19 是棘轮(21):营销面实测 21 处 font-extrabold,先登记再随模板批逐页清。
* R15 于 2026-11-03 由 21 下调到 20:首页 v16→v17 重写时删掉了一处装饰阴影,
* 按「只降不升」的纪律在同一提交里把上限跟着降下来(否则棘轮成了永久豁免)。
*/
const MARKETING_HIT_CEILINGS = { R13: 71, R14: 21, R15: 21, R16: 26, R17: 53, R18: 0, R19: 21 };
const MARKETING_HIT_CEILINGS = { R13: 71, R14: 21, R15: 20, R16: 26, R17: 53, R18: 0, R19: 21 };
/**
* 判据正则一律**不带 g 旗标**。
-681
View File
@@ -1,681 +0,0 @@
'use client';
/**
* 首页 v16 —— 对标实测驱动的段序重构(10 段 → 8 段)。
*
* 两家对标的首页段序(我自己量的,非二手描述):
* Bain :洞察报告轮播 hero → 品牌宣言 → 「Bold steps forward.」客户成果(标题即数字)
* → SEE ALL CLIENT RESULTS → 视频 → Our Latest Insights(带分页器)
* → What can we help you achieve? → 招聘带
* 对标站点:video hero → 编辑内容(In Focus)→ 行业网格
* → What Moves Our Clients(4 实践 accordion)→ Empowering Our Clients(8 个案例)
* → Spotlight on AI → 招聘带 → Ready for Change?
* 收敛律:**以编辑内容或客户成果开场;行业成网格;能力做成 accordion;
* 成果单独成一个频道;CTA 收尾且安静。**
*
* 我们填不了其中两格(0 条案例、2 条新闻、无视频、无招聘页),所以诚实的推导是
* **取其顺序、换其内容、并在区块标题里说明换的是什么**(决策 3 零编造透明路线)。
*
* 段序变化与理由:
* 1 Hero —— 保留但重设:删 HeroParticleField(两家实测都没有持续背景运动,
* 且 CONTEXT.md:81 明令禁止循环动画);min-h 90vh→70vh(我们是宣言不是影片)
* 2 数字账本 —— HeroStatsBand + TrustSection **合并**:两段都在说"这是我们的数字",
* 那是冗余不是节奏。合并后数字语法改为 text-5xl/字重500/纯黑
* (Bain 实测;ADR-0004 决策四「超大字号+品牌色」已被证伪)
* 3 透明承诺 —— 提升既有的 L3SignalsSlot,而非新造组件
* 4 客户成果槽 —— ResultsSlot 取代 CasesSection:留形状、写清状态
* 5 洞察 —— InsightsSection + NewsSection **合并**(两条本就同轴,
* 且各自都指向 /news = 组件层的竞争真源)
* 6 行业网格 —— 新增,读 solution 模型 6 行(对标站点的行业专长段)
* 7 能力 accordion —— ServicesSection 转换(恰好 4 条 service ⇒ 恰好 4 个实践组)
* 8 CTA —— 保留
* ✕ NarrativeSection 删除:01/02/03 诊断→设计→交付与 /methodology 重复,
* 其 text-4xl/5xl font-black 装饰编号正是「装饰大字对比度裁决」要防的那个手法
* ✕ FounderQuoteSection 删除:它是全站唯一 bg-brand-section #8B1530 满幅面,
* 而实测两家都是「饱和红只做点缀、绝不做页面背景」;CEO 引言带是 Accenture 语法,
* 两家都没有。两行 pull-quote 降为第 3 段的正文
*/
import { useState } from 'react';
import Image from 'next/image';
import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal';
import { StaticLink } from '@/components/ui/static-link';
import { CTAButton } from '@/components/ui/cta-button';
import { SectionLabel } from '@/components/ui/page-decoration';
import { MetricsBasisNote } from '@/components/ui/metrics-basis-note';
import { L3SignalsSlot } from '@/components/detail/l3-signals-slot';
import { ResultsSlot, type CoCreationStep, type ResultsSlotState } from '@/components/sections/results-slot';
import type { CaseStudy } from '@/lib/constants/cases';
import { weakestBasis } from '@/lib/constants/metrics-basis';
import { INQUIRY_RESPONSE_COMMITMENT, FREE_FIRST_CONSULT } from '@/lib/constants/commitments';
import { canonicalCtaLabel, CTA_LABELS } from '@/lib/constants/cta-labels';
import { COMPANY_INFO } from '@/lib/constants';
import { cn } from '@/lib/utils';
import { Factory, ShoppingBag, GraduationCap, HeartPulse, Landmark, Truck, ArrowRight } from 'lucide-react';
import type { NewsItem } from '@/lib/constants/news';
type Row = Record<string, unknown>;
/**
* 行业网格:6 条 solution 行的 industry + 图标 + 氛围图。
*
* 图片是 AI 生成的**工业/建筑氛围图**,不是客户现场,也不承担任何事实主张:
* 画面里没有人物、没有可读文字、没有客户标识;行业名称与痛点仍只来自 CMS 行。
* (DESIGN.md「零编造」禁止的是把假图当证据,不是禁止装饰性视觉。)
*/
const INDUSTRY_TILES = [
{ slug: 'manufacturing', name: '制造业', image: '/images/home/industry-manufacturing.webp', icon: Factory },
{ slug: 'retail', name: '贸易零售', image: '/images/home/industry-retail.webp', icon: ShoppingBag },
{ slug: 'education', name: '教育培训', image: '/images/home/industry-education.webp', icon: GraduationCap },
{ slug: 'healthcare', name: '医疗健康', image: '/images/home/industry-healthcare.webp', icon: HeartPulse },
{ slug: 'finance', name: '金融服务', image: '/images/home/industry-finance.webp', icon: Landmark },
{ slug: 'logistics', name: '物流运输', image: '/images/home/industry-logistics.webp', icon: Truck },
] as const;
/** 首页新闻卡的封面:氛围图与新闻正文解耦,CMS 里的标题/日期/摘要仍是唯一事实源 */
const NEWS_COVERS = [
'/images/home/insight-founding.webp',
'/images/home/insight-digital.webp',
] as const;
/** 共创阶段的可验证事实 —— 不是案例,也不冒充案例 */
const CO_CREATION_STEPS: CoCreationStep[] = [
{ label: '问题梳理', desc: '把业务断点写清楚,形成书面诊断' },
{ label: '小步验证', desc: '在一个可衡量的范围内先跑通' },
{ label: '交付物验收', desc: '每阶段有明确交付物与验收指标' },
{ label: '能力交接', desc: '把维护能力留在企业内部' },
];
/* ───────────────────────── 1. Hero ───────────────────────── */
function HomeHero({ heroData }: { heroData?: Row | null }) {
const heading = (heroData?.heading as string) || (heroData?.headingBottom as string)
|| '让每一家企业都拥有数据驱动的决策能力';
const subheading = (heroData?.subheading as string) || (heroData?.description as string) || '';
const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel as string | undefined) || CTA_LABELS.consult;
const ctaHref = (heroData?.ctaHref as string) || '/contact';
const secondaryLabel = (heroData?.secondaryCtaLabel as string) || '看行业实践';
const secondaryHref = (heroData?.secondaryCtaHref as string) || '/solutions';
return (
<section
className="relative isolate overflow-hidden bg-[#0B0A08] text-white"
data-testid="hero-section"
>
{/* 全幅氛围图:画面无人、无可读文字,不承担任何客户/团队事实主张。
左侧压暗是为了让黑底内容块与白字 readable,而不是做「暗黑滤镜」。 */}
<Image
src="/images/home/hero-architecture.webp"
alt=""
aria-hidden="true"
fill
priority
sizes="100vw"
className="pointer-events-none absolute inset-0 -z-10 object-cover object-center"
/>
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 -z-10 bg-gradient-to-r from-[#0B0A08] via-[#0B0A08]/80 to-[#0B0A08]/10"
/>
<div
aria-hidden="true"
className="pointer-events-none absolute inset-x-0 bottom-0 -z-10 h-40 bg-gradient-to-t from-[#0B0A08] to-transparent"
/>
{/* 对标咨询机构的 hero 构图:黑底正文块压在照片上,
右侧再叠一张工程桌细节图;min-h 78vh 给影像留出呼吸。 */}
<div className="container-x flex min-h-[74vh] items-center py-20 md:min-h-[80vh] md:py-28">
<div className="grid w-full items-center gap-10 xl:grid-cols-12 xl:gap-12">
<div className="xl:col-span-7">
<div className="relative border-l-[6px] border-brand bg-[#0B0A08] px-6 py-9 sm:px-10 sm:py-12 lg:px-14 lg:py-16">
<h1 className="text-4xl font-bold leading-[1.04] tracking-tight text-white text-balance sm:text-wrap sm:text-5xl md:text-6xl">
{heading}
</h1>
{subheading && (
<p className="mt-6 max-w-2xl text-base leading-relaxed text-white/75 md:text-lg">
{subheading}
</p>
)}
<div className="mt-9 flex flex-wrap items-center gap-4">
<CTAButton href={ctaHref} dataTestId="hero-cta">{ctaLabel}</CTAButton>
<CTAButton
href={secondaryHref}
variant="secondary"
className="border-white/40 bg-transparent text-white hover:border-white hover:bg-white/10"
>
{secondaryLabel}
</CTAButton>
</div>
{/* 承诺句走单一真源,不在此硬写数字 */}
<p className="mt-8 text-sm text-white/60">
{INQUIRY_RESPONSE_COMMITMENT.text} · {FREE_FIRST_CONSULT.text}
</p>
</div>
</div>
<div className="hidden xl:col-span-5 xl:block">
<div className="relative ml-auto w-[88%] border border-white/20 bg-[#141210] p-2 shadow-2xl">
<div className="relative aspect-[4/3] overflow-hidden">
<Image
src="/images/home/hero-blueprint.webp"
alt=""
aria-hidden="true"
fill
sizes="(min-width: 1024px) 40vw, 100vw"
className="object-cover"
/>
<div aria-hidden="true" className="absolute inset-0 bg-gradient-to-t from-black/45 to-transparent" />
</div>
<span aria-hidden="true" className="mt-2 block h-[3px] w-12 bg-brand" />
</div>
</div>
</div>
</div>
</section>
);
}
/* ───────────────── 2. 可审计数字账本 ───────────────── */
interface LedgerEntry { value: string; label: string; basis?: string | null }
function toLedger(stats?: Row[], trust?: Row[]): LedgerEntry[] {
const fromStats = (stats ?? []).map((s) => ({
value: String(s.value ?? ''),
label: String(s.label ?? ''),
basis: (s.basis as string) ?? null,
}));
const fromTrust = (trust ?? []).map((t) => ({
value: String(t.value ?? ''),
label: String(t.label ?? ''),
basis: (t.basis as string) ?? null,
}));
// 两段合并后可能出现同 label 的条目 —— 合并的意义就在于此,去重防它变成"两个真源"
const seen = new Set<string>();
return [...fromStats, ...fromTrust].filter((e) => {
if (!e.value || !e.label || seen.has(e.label)) return false;
seen.add(e.label);
return true;
});
}
/**
* 是否**定量**条目 —— 浏览器实测逼出来的这条判据。
*
* 我原以为 HeroStatsBand 与 TrustSection「都在说同一件事」,所以整段合并、统一按
* Bain 的成果数字语法(--font-size-5xl = 63px / 字重 500 / 纯黑)渲染。真跑起来才发现
* TRUST_SIGNALS 的四条里有 成都 / 全流程 / 共创 这种**根本不是数字**的东西,
* 于是全页最响的一行装着三个名词 —— 恰好是对标(和 ADR-0004 想避免的「数据大字报」)
* 反对的那件事。合并的目标是"一段而不是两段",不是"把定性信号冒充成指标"。
*
* 判据:含数字,或带 % / × / 倍 / 天 / 小时 / 年 等量纲。
*/
const QUANTITIVE = /(\d|%|%|×|倍|天|小时|分钟|年|季度|个月)/;
function isQuantitative(value: string): boolean {
return QUANTITIVE.test(value);
}
function NumberLedger({ stats, trustSignals }: { stats?: Row[]; trustSignals?: Row[] }) {
const all = toLedger(stats, trustSignals);
if (all.length === 0) return null;
const metrics = all.filter((e) => isQuantitative(e.value));
const signals = all.filter((e) => !isQuantitative(e.value));
const weakest = weakestBasis(all.map((e) => e.basis));
return (
<section className="bg-bg-secondary border-b border-border-primary" data-testid="home-ledger">
<div className="container-x py-14 md:py-16">
<span aria-hidden="true" className="mb-8 block h-[3px] w-10 bg-brand" />
{metrics.length > 0 && (
/* testid 挂在外层普通 div 上,不挂在 StaggerReveal 上:
真实的 StaggerReveal/ScrollReveal 解构固定 prop 列表、**不透传未知属性**,
所以 data-* 会被静默丢弃(本轮浏览器实测抓到,而 jsdom 单测因 mock 透传了
props 而全绿 —— 典型的「mock 比实现宽松」)。
grid 类仍留在 StaggerReveal 上:QA Q-5 记过「grid 放外层容器会让卡片堆成单列」,
这里外层只是打标,不参与布局。props 透传本身留给组件清理那一批统一做。 */
<div data-testid="home-ledger-metrics">
<StaggerReveal className="grid grid-cols-2 lg:grid-cols-4 gap-x-8 gap-y-10">
{metrics.map((e) => (
<div key={e.label} data-testid="ledger-metric">
{/* 实测对标:Bain 的 500+ / $300M / 2.5x 是 40px / 字重 500 / 纯黑。
--font-size-5xl = 2.25rem,桌面根字号 18px 下正好 40.5px ⇒ 零新增 token。
原 v15 的 font-black + text-brand-ink 是把 ADR-0004 决策四的误读实现了出来。 */}
<div className="text-5xl font-medium tabular-nums text-text-primary leading-none">
{e.value}
</div>
<div className="mt-3 text-sm text-text-muted">{e.label}</div>
</div>
))}
</StaggerReveal>
</div>
)}
{/* 定性信号:留在同一段内(合并的意义),但视觉重量降到配角 ——
小字 + 分隔点,不与上面的数字争同一种强调 */}
{signals.length > 0 && (
<ul
className={cn(
'list-none p-0 m-0 flex flex-wrap gap-x-8 gap-y-2',
metrics.length > 0 ? 'mt-10 pt-8 border-t border-border-primary' : 'mt-0',
)}
data-testid="home-ledger-signals"
>
{signals.map((e) => (
<li key={e.label} className="text-sm text-text-secondary">
<span className="font-medium text-text-primary">{e.value}</span>
<span className="mx-2 text-text-muted" aria-hidden="true">·</span>
{e.label}
</li>
))}
</ul>
)}
<MetricsBasisNote basis={weakest} className="mt-10" />
</div>
</section>
);
}
/* ───────────────── 5. 洞察(原 Insights + News 合并)───────────────── */
function InsightsBlock({ news, pageCopy }: { news?: NewsItem[]; pageCopy?: Record<string, unknown> | null }) {
const items = (news ?? []).slice(0, 4);
const [featured, ...rest] = items;
const heading = (pageCopy?.insightsTitle as string) || '我们怎么判断、怎么交付';
return (
<section className="bg-bg-primary border-t border-border-primary" data-testid="home-insights">
<div className="container-x py-16 md:py-24">
<ScrollReveal>
<div className="flex flex-wrap items-end justify-between gap-6">
<div className="max-w-3xl">
<SectionLabel>洞察</SectionLabel>
<h2 className="mt-4 text-3xl sm:text-4xl md:text-5xl font-bold text-text-primary tracking-tight leading-[1.05]">
{heading}
</h2>
</div>
{/* 咨询机构式「方框箭头 + 文字」的轨:红框只在链接上出现一次,不做满屏红 */}
<StaticLink
href="/insights"
className="group min-h-6 inline-flex items-center gap-3 text-sm font-medium text-text-primary transition-colors duration-hover hover:text-brand-ink"
>
<span className="flex h-9 w-9 items-center justify-center border border-brand text-brand transition-colors duration-hover group-hover:bg-brand group-hover:text-white">
<ArrowRight className="h-4 w-4" aria-hidden="true" />
</span>
全部洞察
</StaticLink>
</div>
</ScrollReveal>
{items.length === 0 ? (
<div className="mt-10 border border-border-primary bg-bg-secondary p-8" data-testid="home-insights-empty">
<p className="text-sm text-text-secondary leading-relaxed">
公开写作还在积累。可以先看{' '}
<StaticLink href="/methodology" className="text-brand-ink hover:text-brand-ink-hover underline underline-offset-4">
方法论
</StaticLink>
,它说明我们怎么工作。
</p>
</div>
) : (
<div className="mt-10 grid gap-4 lg:grid-cols-12">
{featured && (
<StaticLink
href={`/news/${featured.id}`}
className="group relative isolate flex min-h-[26rem] flex-col justify-end overflow-hidden bg-[#141210] p-7 md:col-span-7 md:min-h-[34rem] md:p-10"
>
<Image
src={NEWS_COVERS[0]}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 1024px) 55vw, 100vw"
className="pointer-events-none absolute inset-0 -z-10 object-cover opacity-70 transition-transform duration-hover ease-out group-hover:scale-[1.03]"
/>
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-gradient-to-t from-black via-black/45 to-transparent" />
<div className="relative">
<div className="flex items-center gap-3 text-xs text-white/60">
<span className="h-[2px] w-6 bg-brand" aria-hidden="true" />
<span>{featured.category}</span>
<span className="tabular-nums text-white/60">{featured.date}</span>
</div>
<h3 className="mt-4 max-w-2xl text-2xl font-bold leading-snug text-white md:text-3xl">
{featured.title}
</h3>
<p className="mt-3 max-w-xl text-sm leading-relaxed text-white/70">{featured.excerpt}</p>
<ArrowRight className="mt-6 h-5 w-5 text-white transition-transform duration-hover group-hover:translate-x-1" aria-hidden="true" />
</div>
</StaticLink>
)}
<div className="flex flex-col gap-4 md:col-span-5">
{rest.slice(0, 2).map((n, i) => (
<StaticLink
key={n.id}
href={`/news/${n.id}`}
className="group relative isolate flex min-h-[13rem] flex-1 flex-col justify-end overflow-hidden bg-[#141210] p-6"
>
<Image
src={NEWS_COVERS[(i + 1) % NEWS_COVERS.length] ?? NEWS_COVERS[0]}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 1024px) 40vw, 100vw"
className="pointer-events-none absolute inset-0 -z-10 object-cover opacity-60 transition-transform duration-hover ease-out group-hover:scale-[1.03]"
/>
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-gradient-to-t from-black via-black/50 to-black/10" />
<div className="relative">
<div className="flex items-center gap-3 text-xs text-white/60">
<span>{n.category}</span>
<span className="tabular-nums text-white/60">{n.date}</span>
</div>
<h3 className="mt-3 text-lg font-semibold leading-snug text-white">{n.title}</h3>
</div>
</StaticLink>
))}
{/* 第三格不是新闻,是方法论入口;用品牌红实底把「编辑内容」与「我们的方法」分开 */}
<StaticLink
href="/methodology"
className="group flex flex-1 flex-col justify-between bg-brand p-6 text-white transition-colors duration-hover hover:bg-brand-hover"
>
<span className="text-[10px] font-semibold uppercase tracking-[0.3em] text-white">
方法论
</span>
<div className="mt-6">
<h3 className="text-xl font-bold leading-snug">四阶段推进数字化转型</h3>
<p className="mt-2 text-sm leading-relaxed text-white">
诊断评估、战略规划、落地实施、持续优化四阶段模型,确保数字化项目可衡量落地。
</p>
</div>
<span className="mt-6 inline-flex items-center gap-2 text-sm font-medium">
查看方法论
<ArrowRight className="h-4 w-4 transition-transform duration-hover group-hover:translate-x-1" aria-hidden="true" />
</span>
</StaticLink>
</div>
</div>
)}
</div>
</section>
);
}
/* ───────────────── 6. 行业网格 ───────────────── */
function IndustryGridBlock({ solutions }: { solutions?: Row[] }) {
const bySlug = new Map((solutions ?? []).map((s) => [String(s.id ?? s.slug ?? ''), s]));
return (
<section className="bg-bg-secondary border-t border-border-primary" data-testid="home-industries">
<div className="container-x py-16 md:py-24">
<ScrollReveal>
<div className="flex flex-wrap items-end justify-between gap-6">
<div className="max-w-3xl">
<SectionLabel>行业</SectionLabel>
<h2 className="mt-4 text-3xl sm:text-4xl md:text-5xl font-bold text-text-primary tracking-tight leading-[1.05]">
按行业的问题空间,不是按我们的产品线
</h2>
</div>
<StaticLink
href="/solutions"
className="group min-h-6 inline-flex items-center gap-3 text-sm font-medium text-text-primary transition-colors duration-hover hover:text-brand-ink"
>
<span className="flex h-9 w-9 items-center justify-center border border-brand text-brand transition-colors duration-hover group-hover:bg-brand group-hover:text-white">
<ArrowRight className="h-4 w-4" aria-hidden="true" />
</span>
全部解决方案
</StaticLink>
</div>
</ScrollReveal>
<StaggerReveal className="mt-10 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
{INDUSTRY_TILES.map((tile) => {
const Icon = tile.icon;
const row = bySlug.get(tile.slug);
const painPoints = Array.isArray(row?.painPoints) ? (row!.painPoints as unknown[]).slice(0, 2) : [];
return (
<StaticLink
key={tile.slug}
href={`/solutions/${tile.slug}`}
className="group relative isolate flex min-h-[15rem] flex-col justify-end overflow-hidden bg-[#141210] p-6"
>
<Image
src={tile.image}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 1024px) 33vw, (min-width: 640px) 50vw, 100vw"
className="pointer-events-none absolute inset-0 -z-10 object-cover opacity-70 transition-transform duration-hover ease-out group-hover:scale-[1.04]"
/>
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-gradient-to-t from-black via-black/40 to-transparent" />
<div className="relative">
<Icon className="absolute right-0 top-0 h-4 w-4 text-white/70" aria-hidden="true" />
<div className="flex items-end justify-between gap-4">
<div>
<h3 className="text-xl font-bold leading-tight text-white">{tile.name}</h3>
{painPoints.length > 0 && (
<ul className="mt-2 space-y-1 list-none p-0 m-0">
{painPoints.map((p, i) => (
<li key={i} className="text-xs leading-relaxed text-white/70">
{String(p)}
</li>
))}
</ul>
)}
</div>
<span className="flex h-9 w-9 shrink-0 items-center justify-center border border-white/30 text-white transition-colors duration-hover group-hover:border-brand group-hover:bg-brand">
<ArrowRight className="h-4 w-4" aria-hidden="true" />
</span>
</div>
</div>
</StaticLink>
);
})}
</StaggerReveal>
</div>
</section>
);
}
/* ───────────────── 7. 能力 accordion ───────────────── */
interface CapabilityRow { id?: string; name?: string; title?: string; description?: string; highlights?: unknown[] }
function CapabilitiesAccordion({ services }: { services?: CapabilityRow[] }) {
const rows = services ?? [];
const [openId, setOpenId] = useState<string | null>(rows[0]?.id ?? null);
if (rows.length === 0) return null;
return (
<section className="bg-bg-primary border-t border-border-primary" data-testid="home-capabilities">
<div className="container-x py-16 md:py-24">
<div className="grid gap-12 lg:grid-cols-12 lg:gap-16">
<div className="lg:col-span-5">
<ScrollReveal>
<SectionLabel>能力</SectionLabel>
<h2 className="mt-4 text-3xl sm:text-4xl md:text-5xl font-bold text-text-primary tracking-tight leading-[1.05]">
四种陪跑方式
</h2>
</ScrollReveal>
<div className="relative mt-10 hidden lg:block">
<div className="relative aspect-[4/5] overflow-hidden bg-[#141210]">
<Image
src="/images/home/capability-workshop.webp"
alt=""
aria-hidden="true"
fill
sizes="(min-width: 1024px) 38vw, 100vw"
className="object-cover"
/>
<div aria-hidden="true" className="absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent" />
</div>
<span aria-hidden="true" className="absolute -bottom-4 -right-4 hidden h-10 w-10 bg-brand xl:block" />
</div>
</div>
<div className="lg:col-span-7">
<ScrollReveal>
<div className="border-t border-border-primary">
{rows.map((s, i) => {
const id = String(s.id ?? i);
const open = openId === id;
const title = String(s.title ?? s.name ?? '');
const highlights = Array.isArray(s.highlights) ? (s.highlights as unknown[]).map(String) : [];
return (
<div key={id} className="border-b border-border-primary">
<button
type="button"
onClick={() => setOpenId(open ? null : id)}
aria-expanded={open}
aria-controls={`cap-panel-${id}`}
className="group flex min-h-[76px] w-full items-center justify-between gap-6 py-6 text-left transition-colors duration-hover hover:bg-bg-secondary"
>
<span className="flex items-baseline gap-5">
<span className="text-sm font-medium tabular-nums text-brand-ink" aria-hidden="true">
{String(i + 1).padStart(2, '0')}
</span>
<span className="text-xl font-semibold text-text-primary md:text-2xl">{title}</span>
</span>
<span
className={cn(
'flex h-9 w-9 shrink-0 items-center justify-center border border-border-rule text-xl leading-none text-text-muted transition-all duration-hover group-hover:border-brand group-hover:text-brand',
open && 'rotate-45 border-brand text-brand'
)}
aria-hidden="true"
>
+
</span>
</button>
{open && (
<div id={`cap-panel-${id}`} role="region" aria-label={`${title} 能力详情`} className="pb-8 pr-2 md:pl-12">
<p className="max-w-2xl text-sm leading-relaxed text-text-secondary">
{String(s.description ?? '')}
</p>
{highlights.length > 0 && (
<ul className="mt-5 flex flex-wrap gap-x-6 gap-y-2 list-none p-0 m-0">
{highlights.map((h) => (
<li key={h} className="text-sm text-text-secondary">{h}</li>
))}
</ul>
)}
<StaticLink
href={`/services/${id}`}
className="mt-6 min-h-6 inline-flex items-center gap-1 text-sm font-medium text-brand-ink hover:text-brand-ink-hover transition-colors duration-hover"
>
了解这一能力
<ArrowRight className="w-4 h-4" aria-hidden="true" />
</StaticLink>
</div>
)}
</div>
);
})}
</div>
</ScrollReveal>
</div>
</div>
</div>
</section>
);
}
/* ───────────────── 8. CTA ───────────────── */
function HomeCta({ heroData }: { heroData?: Row | null }) {
const ctaHref = (heroData?.ctaHref as string) || '/contact';
return (
<section className="relative isolate overflow-hidden bg-[#0B0A08]" data-testid="home-cta">
<Image
src="/images/home/cta-architecture.webp"
alt=""
aria-hidden="true"
fill
sizes="100vw"
className="pointer-events-none absolute inset-0 -z-10 object-cover object-center opacity-80"
/>
<div aria-hidden="true" className="absolute inset-0 -z-10 bg-[#0B0A08]/60" />
<div className="container-x py-20 text-center md:py-28">
<ScrollReveal>
<span aria-hidden="true" className="mx-auto mb-7 block h-[3px] w-12 bg-brand" />
<h2 className="text-3xl font-bold tracking-tight text-white sm:text-4xl md:text-5xl">
现在有什么卡住你了?
</h2>
<p className="mx-auto mt-5 max-w-2xl text-base leading-relaxed text-white/70">
{COMPANY_INFO.displayName}的定位是伙伴而非供应商 —— 把问题带来,我们先给判断。
</p>
<div className="mt-9 flex flex-wrap items-center justify-center gap-4">
<CTAButton href={ctaHref} dataTestId="home-cta-button">{CTA_LABELS.consult}</CTAButton>
<CTAButton
href="/methodology"
variant="secondary"
className="border-white/40 bg-transparent text-white hover:border-white hover:bg-white/10"
>
看方法论
</CTAButton>
</div>
</ScrollReveal>
</div>
</section>
);
}
/* ───────────────── 装配 ───────────────── */
export default function HomeContentV16({
services,
solutions,
cases,
stats,
heroData,
news,
pageCopy,
trustSignals,
cmsState = 'ok',
}: {
services?: CapabilityRow[];
solutions?: Row[];
cases?: Row[];
stats?: Row[];
heroData?: Row | null;
news?: NewsItem[];
pageCopy?: Record<string, unknown> | null;
trustSignals?: Row[];
/** 由 page.tsx 判定的 CMS 读数状态;视觉用例据此按名字判红,而不是猜像素差 */
cmsState?: 'ok' | 'empty';
}) {
const caseRows = cases ?? [];
// 判别式联合要靠显式类型标注收窄 —— 三元直接推会退化成 { kind: string },
// 那样连编译期都保证不了「ready 一定带 caseItem」
const resultsState: ResultsSlotState =
caseRows.length > 0
? { kind: 'ready', caseItem: caseRows[0] as unknown as CaseStudy }
: { kind: 'co-creation', steps: CO_CREATION_STEPS };
return (
<div data-cms-state={cmsState}>
{/* 咨询机构的首页节拍:影像开场 → 编辑内容 → 行业网格 → 能力
→ 客户成果 → 信任 → 收尾 CTA。数字账本压成 hero 后的一条窄带,
不抢「新闻」这一拍。段序变化只动装配顺序,各段的真源与空态判据不变。 */}
<HomeHero heroData={heroData} />
<NumberLedger stats={stats} trustSignals={trustSignals} />
<InsightsBlock news={news} pageCopy={pageCopy} />
<IndustryGridBlock solutions={solutions} />
<CapabilitiesAccordion services={services} />
{/* 客户成果槽与透明承诺:两段合读才成立 —— 先说"成果这一格现在是空的、为什么空",
再给四个可验证的信任锚点。 */}
<ResultsSlot state={resultsState} />
<L3SignalsSlot
heading="在数据之外,我们用透明度建立信任"
description="客户案例与资质认证需获得授权后才能公开;在那之前,以下四个锚点是我们可验证的承诺。"
/>
<HomeCta heroData={heroData} />
</div>
);
}
@@ -1,6 +1,6 @@
import { render, screen, fireEvent } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import HomeContentV16 from './home-content-v16';
import HomeContentV17 from './home-content-v17';
jest.mock('@/components/ui/scroll-reveal', () => ({
ScrollReveal: ({ children, className, ...rest }: { children: React.ReactNode; className?: string; [k: string]: unknown }) => (
@@ -74,10 +74,10 @@ const baseProps = {
};
function renderHome(overrides: Partial<typeof baseProps> = {}) {
return render(<HomeContentV16 {...baseProps} {...overrides} />);
return render(<HomeContentV17 {...baseProps} {...overrides} />);
}
describe('首页 v16 段序', () => {
describe('首页 v17 段序', () => {
it('八段全部在场,且删除的两段不再出现', () => {
renderHome();
for (const id of ['hero-section', 'home-ledger', 'l3-signals', 'results-slot-co-creation', 'home-insights', 'home-industries', 'home-capabilities', 'home-cta']) {
@@ -147,15 +147,21 @@ describe('数字账本(HeroStatsBand + TrustSection 合并)', () => {
expect(screen.queryByTestId('home-ledger-signals')).toBeNull();
});
it('每个数字都是 text-5xl + font-medium + 墨色,不再放大标红(Bain 实测 40px/500/黑)', () => {
/**
* 字重由 500 改 700 是 2026-11-03 的实测更正,不是口味:
* Bain 的成果数字是 40px/500,保时捷这一侧(本轮复刻对象)是 **40px/700**。
* v16 这条断言背书的是前者;两侧都测过之后取当前对标对象的口径。
* 不变的半句:数字**不许标红**(红是结论电压,不能被数据条稀释)。
*/
it('每个数字都是 text-5xl + font-bold + 墨色,不放大标红(对标实测 40px/700/黑)', () => {
renderHome();
const nums = [...screen.getByTestId('home-ledger-metrics').querySelectorAll('.text-5xl')];
expect(nums.length).toBeGreaterThan(0);
for (const n of nums) {
expect(n.className).toContain('font-medium');
expect(n.className).toContain('font-bold');
expect(n.className).not.toContain('font-black');
expect(n.className).toContain('text-text-primary');
expect(n.className).not.toContain('text-brand');
expect(n.className).not.toContain('font-black');
expect(n.className).toContain('tabular-nums');
}
});
@@ -171,40 +177,45 @@ describe('数字账本(HeroStatsBand + TrustSection 合并)', () => {
});
});
describe('行业网格与能力 accordion', () => {
it('行业铺 6 块,链接落在既有 /solutions/{slug}(本轮不换路由)', () => {
/**
* 行业段与能力段在 v17 里换了形制,但**断言的不变量没变**:
* 行业 —— 6 个入口恒在、都落 /solutions/{slug}、痛点只来自数据;
* 能力 —— 4 条 service 全在场、都落 /services/{id}。
* 变的是载体:行业由 3×2 卡片网格 → 横向标签 + 预览(所以断言收窄到 nav,
* 因为预览区还有一条「查看该行业解决方案」的同向链接);能力由 accordion → 滚动舞台
* (aria-expanded 是 accordion 的语义,舞台用的是 ol/li + 活动屏切换)。
*/
describe('行业切换与能力舞台', () => {
const industryLinks = () =>
[...screen.getByTestId('home-industries').querySelectorAll('nav a')].map((a) => a.getAttribute('href'));
it('行业 6 个入口恒在,链接落在既有 /solutions/{slug}(本轮不换路由)', () => {
renderHome();
const grid = screen.getByTestId('home-industries');
expect(grid.querySelectorAll('a[href^="/solutions/"]').length).toBe(6);
const links = industryLinks();
expect(links).toHaveLength(6);
expect(links.every((h) => h?.startsWith('/solutions/'))).toBe(true);
// 数据来自传入的 solution 行,不是硬编码
expect(grid.textContent).toContain('库存不透明');
expect(screen.getByTestId('home-industries').textContent).toContain('库存不透明');
});
it('solution 缺行时仍渲染 6 个行业入口,但不编造痛点', () => {
renderHome({ solutions: [] });
const grid = screen.getByTestId('home-industries');
expect(grid.querySelectorAll('a[href^="/solutions/"]').length).toBe(6);
expect(grid.textContent).not.toContain('库存不透明');
expect(industryLinks()).toHaveLength(6);
expect(screen.getByTestId('home-industries').textContent).not.toContain('库存不透明');
});
it('能力 accordion:默认展开第一项,点第二项切换,aria-expanded 随状态变', () => {
it('能力舞台:4 条 service 全在 DOM(不是只在活动屏渲染),且都是列表项', () => {
renderHome();
const first = screen.getByRole('button', { name: /战略咨询/ });
const second = screen.getByRole('button', { name: /企业软件/ });
expect(first).toHaveAttribute('aria-expanded', 'true');
expect(second).toHaveAttribute('aria-expanded', 'false');
fireEvent.click(second);
expect(second).toHaveAttribute('aria-expanded', 'true');
expect(first).toHaveAttribute('aria-expanded', 'false');
// 收起后第一项的面板从 DOM 移除(不是隐藏)⇒ 用 query 而不是可见性断言
expect(screen.queryByText('业务诊断')).not.toBeInTheDocument();
const stage = screen.getByTestId('home-capabilities');
expect(stage.querySelectorAll('ol > li')).toHaveLength(2); // baseProps 只给了 2 条
const titles = [...stage.querySelectorAll('h3')].map((h) => h.textContent);
expect(titles).toEqual(['战略咨询', '企业软件']);
});
it('能力项落到 /services/{id},产品入口不占一级段(矩阵在导航第二层)', () => {
renderHome();
fireEvent.click(screen.getByRole('button', { name: /战略咨询/ })); // 收起
const links = [...screen.getByTestId('home-capabilities').querySelectorAll('a')].map((a) => a.getAttribute('href'));
expect(links.length).toBeGreaterThan(0);
expect(links.every((h) => h?.startsWith('/services/'))).toBe(true);
});
});
+452
View File
@@ -0,0 +1,452 @@
'use client';
/**
* 首页 v17 —— 复刻保时捷咨询的构图语法(P0→P2 阶段的 tracer-bullet)。
*
* 与 v16 的差别只在**视觉语法与构图**,不在内容:文案、数据真源、空态判据、
* 诚实语法(basis 口径、未发布明说)一字未改。段序沿用 v16 的 8 段收敛律
* (编辑内容开场 → 行业成网格 → 能力成舞台 → 成果单独成频道 → CTA 收尾)。
*
* 逐段改了什么(都得自 2026-11-03 对 Porsche Consulting 中国站的实测):
* 1 Hero 删黑底块 + 6px 红竖条 + 右侧蓝图叠卡 —— 实测首屏是**居中声明压在
* 全幅影像上**,无框、无容器底、无描边。保留三段压暗(那是可读性,
* 不是滤镜)。右上角一块软版斜线纹,是全站唯一允许的「非接缝」纹理用法。
* 2 账本 数字由 500 改 700(实测成果数字为 40/700),仍纯黑、不标红。
* 3 洞察 改为实测的 teaser 语法:图 + 24/700 标题 + 18/400 副标 + 24×3px 红短线。
* 4 行业 IndustryGridBlock(3×2 卡片网格)→ IndustryTabs(黑带 + 横向标签 + 预览)。
* 5 能力 CapabilitiesAccordion → StoryStage(滚动驱动的 4 屏编辑舞台)。
* 6 接缝 两处白↔黑交界各插一块斜线纹桥接块 —— 对标用纹理代替渐变过渡。
* 7 空带 洞察之后、CTA 之前各一条 120px 命名空白带。
* 8 CTA 灰带 + 字重分裂声明(64/700 → 64/400)+ 右斜线纹 + 向右双 V。
*
* 恒久约束(未变):品牌红每页 ≥3 触达点、面积 ≤10%;动效 180–280ms / ease-ink;
* 禁循环装饰动画;未发布内容照旧用可判别空态。
*/
import Image from 'next/image';
import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal';
import { StaticLink } from '@/components/ui/static-link';
import { CTAButton } from '@/components/ui/cta-button';
import { SectionLabel } from '@/components/ui/page-decoration';
import { MetricsBasisNote } from '@/components/ui/metrics-basis-note';
import { DisplayStatement } from '@/components/ui/display-statement';
import { DoubleChevron } from '@/components/ui/double-chevron';
import { HatchField } from '@/components/ui/hatch-field';
import { BandSpacer } from '@/components/ui/band-spacer';
import { IndustryTabs } from '@/components/sections/industry-tabs';
import { StoryStage } from '@/components/sections/story-stage';
import { L3SignalsSlot } from '@/components/detail/l3-signals-slot';
import { ResultsSlot, type CoCreationStep, type ResultsSlotState } from '@/components/sections/results-slot';
import type { CaseStudy } from '@/lib/constants/cases';
import { weakestBasis } from '@/lib/constants/metrics-basis';
import { INQUIRY_RESPONSE_COMMITMENT, FREE_FIRST_CONSULT } from '@/lib/constants/commitments';
import { canonicalCtaLabel, CTA_LABELS } from '@/lib/constants/cta-labels';
import { COMPANY_INFO } from '@/lib/constants';
import { cn } from '@/lib/utils';
import { ArrowRight } from 'lucide-react';
import type { NewsItem } from '@/lib/constants/news';
type Row = Record<string, unknown>;
/** 首页新闻卡的封面:氛围图与新闻正文解耦,CMS 里的标题/日期/摘要仍是唯一事实源 */
const NEWS_COVERS = [
'/images/home/insight-founding.webp',
'/images/home/insight-digital.webp',
] as const;
/** 共创阶段的可验证事实 —— 不是案例,也不冒充案例 */
const CO_CREATION_STEPS: CoCreationStep[] = [
{ label: '问题梳理', desc: '把业务断点写清楚,形成书面诊断' },
{ label: '小步验证', desc: '在一个可衡量的范围内先跑通' },
{ label: '交付物验收', desc: '每阶段有明确交付物与验收指标' },
{ label: '能力交接', desc: '把维护能力留在企业内部' },
];
/* ───────────────────────── 1. Hero ───────────────────────── */
function HomeHero({ heroData }: { heroData?: Row | null }) {
const heading = (heroData?.heading as string) || (heroData?.headingBottom as string)
|| '让每一家企业都拥有数据驱动的决策能力';
const subheading = (heroData?.subheading as string) || (heroData?.description as string) || '';
const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel as string | undefined) || CTA_LABELS.consult;
const ctaHref = (heroData?.ctaHref as string) || '/contact';
const secondaryLabel = (heroData?.secondaryCtaLabel as string) || '看行业实践';
const secondaryHref = (heroData?.secondaryCtaHref as string) || '/solutions';
return (
<section
className="relative isolate overflow-hidden bg-[#0B0A08] text-white"
data-testid="hero-section"
>
<Image
src="/images/home/hero-architecture.webp"
alt=""
aria-hidden="true"
fill
priority
sizes="100vw"
className="pointer-events-none absolute inset-0 -z-10 object-cover object-center"
/>
{/* 压暗是为白字可读(实测两家都靠渐变保可读),不是「暗黑滤镜」 */}
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 -z-10 bg-gradient-to-b from-[#0B0A08]/70 via-[#0B0A08]/45 to-[#0B0A08]/80"
/>
{/* 软版斜线纹:全站唯一允许出现在「非接缝」位置的纹理,面积 ≤ 280×280 */}
<HatchField tone="soft" className="absolute right-0 top-0 hidden h-56 w-56 lg:block" />
<div className="container-x flex min-h-[74vh] flex-col items-center justify-center py-24 text-center md:min-h-[80vh] md:py-28">
<span className="text-[13px] font-medium tracking-[0.2em] text-white/70">
{COMPANY_INFO.displayName} · 数字化转型伙伴
</span>
<h1 className="mt-6 max-w-5xl text-4xl font-bold leading-[1.04] tracking-tight text-balance text-white sm:text-5xl md:text-6xl lg:text-[5rem] lg:leading-[1.02]">
{heading}
</h1>
{subheading && (
<p className="mt-7 max-w-2xl text-base leading-relaxed text-white/75 md:text-lg">
{subheading}
</p>
)}
<div className="mt-10 flex flex-wrap items-center justify-center gap-4">
<CTAButton href={ctaHref} dataTestId="hero-cta">{ctaLabel}</CTAButton>
<CTAButton
href={secondaryHref}
variant="secondary"
className="border-white/40 bg-transparent text-white hover:border-white hover:bg-white/10"
>
{secondaryLabel}
</CTAButton>
</div>
{/* 承诺句走单一真源,不在此硬写数字 */}
<p className="mt-9 text-sm text-white/60">
{INQUIRY_RESPONSE_COMMITMENT.text} · {FREE_FIRST_CONSULT.text}
</p>
</div>
</section>
);
}
/* ───────────────── 2. 可审计数字账本 ───────────────── */
interface LedgerEntry { value: string; label: string; basis?: string | null }
function toLedger(stats?: Row[], trust?: Row[]): LedgerEntry[] {
const fromStats = (stats ?? []).map((s) => ({
value: String(s.value ?? ''),
label: String(s.label ?? ''),
basis: (s.basis as string) ?? null,
}));
const fromTrust = (trust ?? []).map((t) => ({
value: String(t.value ?? ''),
label: String(t.label ?? ''),
basis: (t.basis as string) ?? null,
}));
// 两段合并后可能出现同 label 的条目 —— 合并的意义就在于此,去重防它变成"两个真源"
const seen = new Set<string>();
return [...fromStats, ...fromTrust].filter((e) => {
if (!e.value || !e.label || seen.has(e.label)) return false;
seen.add(e.label);
return true;
});
}
/**
* 是否**定量**条目:含数字,或带 % / × / 倍 / 天 / 小时 / 年 等量纲。
* 合并的目标是「一段而不是两段」,不是把定性信号冒充成指标。
*/
const QUANTITIVE = /(\d|%|%|×|倍|天|小时|分钟|年|季度|个月)/;
function isQuantitative(value: string): boolean {
return QUANTITIVE.test(value);
}
function NumberLedger({ stats, trustSignals }: { stats?: Row[]; trustSignals?: Row[] }) {
const all = toLedger(stats, trustSignals);
if (all.length === 0) return null;
const metrics = all.filter((e) => isQuantitative(e.value));
const signals = all.filter((e) => !isQuantitative(e.value));
const weakest = weakestBasis(all.map((e) => e.basis));
return (
<section className="bg-bg-secondary border-b border-border-primary" data-testid="home-ledger">
<div className="container-x py-14 md:py-16">
<span aria-hidden="true" className="mb-8 block h-[3px] w-10 bg-brand" />
{metrics.length > 0 && (
/* testid 挂在外层普通 div 上,不挂在 StaggerReveal 上:
真实的 StaggerReveal 解构固定 prop 列表、不透传未知属性,data-* 会被静默丢弃。 */
<div data-testid="home-ledger-metrics">
<StaggerReveal className="grid grid-cols-2 lg:grid-cols-4 gap-x-8 gap-y-10">
{metrics.map((e) => (
<div key={e.label} data-testid="ledger-metric">
{/* 实测对标:成果/模块数字是 **40px / 字重 700 / 纯黑**。
原 v16 写 500 是照 Bain 的读数;保时捷这一侧是 700。
红仍不进入数字 —— 「红是结论电压」不许被数据条稀释。 */}
<div className="text-5xl font-bold tabular-nums text-text-primary leading-none">
{e.value}
</div>
<div className="mt-3 text-sm text-text-muted">{e.label}</div>
</div>
))}
</StaggerReveal>
</div>
)}
{/* 定性信号:留在同一段内,但视觉重量降到配角 —— 不与数字争同一种强调 */}
{signals.length > 0 && (
<ul
className={cn(
'list-plain list-none p-0 m-0 flex flex-wrap gap-x-8 gap-y-2',
metrics.length > 0 ? 'mt-10 pt-8 border-t border-border-primary' : 'mt-0',
)}
data-testid="home-ledger-signals"
>
{signals.map((e) => (
<li key={e.label} className="text-sm text-text-secondary">
<span className="font-medium text-text-primary">{e.value}</span>
<span className="mx-2 text-text-muted" aria-hidden="true">·</span>
{e.label}
</li>
))}
</ul>
)}
<MetricsBasisNote basis={weakest} className="mt-10" />
</div>
</section>
);
}
/* ───────────────── 3. 洞察(编辑内容)───────────────── */
function InsightsBlock({ news, pageCopy }: { news?: NewsItem[]; pageCopy?: Record<string, unknown> | null }) {
const items = (news ?? []).slice(0, 3);
const [featured, ...rest] = items;
const heading = (pageCopy?.insightsTitle as string) || '我们怎么判断、怎么交付';
return (
<section className="bg-bg-primary" data-testid="home-insights">
<div className="container-x pt-16 md:pt-24">
<ScrollReveal>
<div className="flex flex-wrap items-end justify-between gap-6">
<div className="max-w-3xl">
<SectionLabel>洞察</SectionLabel>
<h2 className="mt-4 text-3xl sm:text-4xl md:text-[2.5rem] font-bold text-text-primary tracking-tight leading-[1.05]">
{heading}
</h2>
</div>
{/* 咨询机构式「方框箭头 + 文字」的轨:红框只在链接上出现一次 */}
<StaticLink
href="/insights"
className="group min-h-6 inline-flex items-center gap-3 text-sm font-medium text-text-primary transition-colors duration-hover hover:text-brand-ink"
>
<span className="flex h-9 w-9 items-center justify-center border border-brand text-brand transition-colors duration-hover group-hover:bg-brand group-hover:text-white">
<ArrowRight className="h-4 w-4" aria-hidden="true" />
</span>
全部洞察
</StaticLink>
</div>
</ScrollReveal>
</div>
{items.length === 0 ? (
<div className="container-x pb-16 md:pb-24">
<div className="mt-10 border border-border-primary bg-bg-secondary p-8" data-testid="home-insights-empty">
<p className="text-sm text-text-secondary leading-relaxed">
公开写作还在积累。可以先看{' '}
<StaticLink href="/methodology" className="text-brand-ink hover:text-brand-ink-hover underline underline-offset-4">
方法论
</StaticLink>
,它说明我们怎么工作。
</p>
</div>
</div>
) : (
/* 实测形制:一条灰底出血带托住三张 teaser;卡 = 图 + 24/700 标题 + 18/400 副标
+ 24×3px 红短线。不用卡片边框、不用阴影 —— 分隔交给底色与留白。 */
<div className="mt-12 bg-bg-secondary">
<div className="container-x py-12 md:py-16">
<div className="grid gap-10 md:grid-cols-12 md:gap-8">
{featured && (
<StaticLink
href={`/news/${featured.id}`}
className="group flex flex-col md:col-span-5"
>
<div className="relative aspect-[1.5] overflow-hidden bg-[#141210]">
<Image
src={NEWS_COVERS[0]}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 768px) 40vw, 100vw"
className="pointer-events-none object-cover transition-transform duration-hover ease-out group-hover:scale-[1.03]"
/>
</div>
<h3 className="mt-6 text-2xl font-bold leading-snug text-text-primary">{featured.title}</h3>
<p className="mt-3 text-base leading-relaxed text-text-secondary">{featured.excerpt}</p>
<span aria-hidden="true" className="mt-5 block h-[3px] w-6 bg-brand" />
</StaticLink>
)}
<div className="flex flex-col gap-8 md:col-span-4">
{rest.map((n, i) => (
<StaticLink key={n.id} href={`/news/${n.id}`} className="group flex flex-col">
<div className="relative aspect-[1.5] overflow-hidden bg-[#141210]">
<Image
src={NEWS_COVERS[(i + 1) % NEWS_COVERS.length] ?? NEWS_COVERS[0]}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 768px) 30vw, 100vw"
className="pointer-events-none object-cover transition-transform duration-hover ease-out group-hover:scale-[1.03]"
/>
</div>
<h3 className="mt-5 text-xl font-bold leading-snug text-text-primary">{n.title}</h3>
<p className="mt-2 text-sm leading-relaxed text-text-secondary">{n.excerpt}</p>
<span aria-hidden="true" className="mt-4 block h-[3px] w-6 bg-brand" />
</StaticLink>
))}
</div>
{/* 第三格不是新闻,是方法论入口;用品牌红实底把「编辑内容」与「我们的方法」分开 */}
<StaticLink
href="/methodology"
className="group flex flex-col justify-between bg-brand p-7 text-white transition-colors duration-hover hover:bg-brand-hover md:col-span-3"
>
<span className="text-[10px] font-semibold uppercase tracking-[0.3em] text-white">
方法论
</span>
<div className="mt-8">
<h3 className="text-xl font-bold leading-snug">四阶段推进数字化转型</h3>
<p className="mt-3 text-sm leading-relaxed text-white">
诊断评估、战略规划、落地实施、持续优化四阶段模型,确保数字化项目可衡量落地。
</p>
</div>
<span className="mt-8 inline-flex items-center gap-2 text-sm font-medium">
查看方法论
<ArrowRight className="h-4 w-4 transition-transform duration-hover group-hover:translate-x-1" aria-hidden="true" />
</span>
</StaticLink>
</div>
</div>
</div>
)}
</section>
);
}
/* ───────────────── 8. 收束 CTA ───────────────── */
function HomeCta({ heroData }: { heroData?: Row | null }) {
const ctaHref = (heroData?.ctaHref as string) || '/contact';
return (
<section className="relative isolate overflow-hidden bg-bg-secondary" data-testid="home-cta">
{/* 右半幅斜线纹:实测收束段把纹理放在灰带之外、与灰带的直角边相接 */}
<HatchField className="absolute right-0 top-0 hidden h-full w-[38%] md:block" />
<div className="container-x relative py-20 md:py-28">
<ScrollReveal>
<div className="max-w-2xl">
{/* 字重分裂:同字号、同色,只换字重 —— 一行既响又安静(实测 64/700 + 64/400) */}
<DisplayStatement
className="text-[2rem] leading-[1.1] md:text-[3rem] lg:text-[4rem]"
strong="现在有什么卡住你了?"
light="我们先把判断给你。"
/>
<p className="mt-6 max-w-xl text-base leading-relaxed text-text-secondary">
{COMPANY_INFO.displayName}的定位是伙伴而非供应商 —— 把问题带来,我们先给判断。
</p>
<div className="mt-9 flex flex-wrap items-center gap-8">
<CTAButton href={ctaHref} dataTestId="home-cta-button">{CTA_LABELS.consult}</CTAButton>
<StaticLink
href="/methodology"
className="group inline-flex min-h-11 items-center gap-2 text-sm font-medium text-text-primary transition-colors duration-hover hover:text-brand-ink"
>
<span aria-hidden="true" className="text-brand">›</span>
看方法论
</StaticLink>
</div>
</div>
{/* 双 V 落在灰带内、纹理的左侧:红压红纹理会互相吞掉(对标也是把它放在灰带上) */}
<DoubleChevron direction="right" size="lg" className="absolute bottom-12 right-[38%] mr-8 hidden lg:block" />
</ScrollReveal>
</div>
</section>
);
}
/* ───────────────── 装配 ───────────────── */
export default function HomeContentV17({
services,
solutions,
cases,
stats,
heroData,
news,
pageCopy,
trustSignals,
cmsState = 'ok',
}: {
services?: Row[];
solutions?: Row[];
cases?: Row[];
stats?: Row[];
heroData?: Row | null;
news?: NewsItem[];
pageCopy?: Record<string, unknown> | null;
trustSignals?: Row[];
/** 由 page.tsx 判定的 CMS 读数状态;视觉用例据此按名字判红,而不是猜像素差 */
cmsState?: 'ok' | 'empty';
}) {
const caseRows = cases ?? [];
// 判别式联合要靠显式类型标注收窄 —— 三元直接推会退化成 { kind: string }
const resultsState: ResultsSlotState =
caseRows.length > 0
? { kind: 'ready', caseItem: caseRows[0] as unknown as CaseStudy }
: { kind: 'co-creation', steps: CO_CREATION_STEPS };
const stageSlides = (services ?? []).slice(0, 4).map((s, i) => ({
id: String(s.id ?? i),
title: String(s.title ?? s.name ?? ''),
description: String(s.description ?? ''),
highlights: Array.isArray(s.highlights) ? (s.highlights as unknown[]).slice(0, 3).map(String) : [],
}));
return (
<div data-cms-state={cmsState}>
{/* 咨询机构的首页节拍:影像开场 → 数字 → 编辑内容 → 行业 → 能力舞台
→ 成果 → 信任 → 收尾 CTA。两处白↔黑接缝用斜线纹桥接,两处呼吸位用命名空白带。 */}
<HomeHero heroData={heroData} />
<NumberLedger stats={stats} trustSignals={trustSignals} />
<InsightsBlock news={news} pageCopy={pageCopy} />
<BandSpacer />
<IndustryTabs solutions={solutions} />
{stageSlides.length > 0 && (
<StoryStage
slides={stageSlides}
label="能力"
heading="四种陪跑方式"
/>
)}
{/* 接缝:黑底舞台 → 白底成果段。纹理块用负外边距**跨**在交界上(上一半压黑、
下一半压白)—— 对标用纹理接缝代替渐变,这是它最好认的一个手法。 */}
<div aria-hidden="true" className="relative z-10 container-x -mb-6 -mt-10">
<HatchField className="h-20 w-full sm:w-[60%]" />
</div>
<ResultsSlot state={resultsState} />
<L3SignalsSlot
heading="在数据之外,我们用透明度建立信任"
description="客户案例与资质认证需获得授权后才能公开;在那之前,以下四个锚点是我们可验证的承诺。"
/>
<BandSpacer />
<HomeCta heroData={heroData} />
</div>
);
}
+4 -4
View File
@@ -8,12 +8,12 @@ jest.mock('@/lib/cms/data-server', () => ({
getHomePageCopy: jest.fn(),
}));
jest.mock('./home-content-v16', () => ({
jest.mock('./home-content-v17', () => ({
__esModule: true,
// 改名叫 V16:page.tsx 已改渲染 v16。留 v15 的话这个 mock 就是**惰性 mock** ——
// 它会静默不拦截任何东西,测试转而渲染真实组件,
// mock 路径必须与 page.tsx 的 import **逐字一致**:留旧版本号的话这个 mock 就是
// **惰性 mock** —— 它会静默不拦截任何东西,测试转而渲染真实组件,
// 于是「home-content」这些 testid 根本不存在,断言靠偶然通过或偶然失败。
default: function MockHomeContentV16(props: Record<string, unknown>) {
default: function MockHomeContentV17(props: Record<string, unknown>) {
return (
<div data-testid="home-content">
<div data-testid="services-count">{(props.services as unknown[])?.length ?? 0}</div>
+2 -2
View File
@@ -1,7 +1,7 @@
import { getPublishedItems, getResolvedHomeZones, getHomePageCopy } from '@/lib/cms/data-server';
import type { NewsItem } from '@/lib/constants/news';
import { TRUST_SIGNALS } from '@/lib/constants/company';
import HomeContentV16 from './home-content-v16';
import HomeContentV17 from './home-content-v17';
export const revalidate = 3600;
@@ -77,7 +77,7 @@ export default async function HomePage() {
const cmsState: 'ok' | 'empty' = cmsItemCount > 0 ? 'ok' : 'empty';
return (
<HomeContentV16
<HomeContentV17
services={services}
solutions={solutions}
cases={cases}
+71 -1
View File
@@ -617,7 +617,13 @@ html[data-theme='dark'] body {
line-height: var(--line-height-normal);
letter-spacing: var(--letter-spacing-normal);
position: relative;
overflow-x: hidden;
/* `clip` 而不是 `hidden`(2026-11-03 实测):
`overflow-x: hidden` 会把 body 变成**非滚动的滚动容器**(computed `hidden auto`),
而 `position: sticky` 是相对最近的滚动祖先定位的 —— 祖先不滚动,sticky 就永远不吸附。
实测:首页编辑舞台在 body 上是 hidden 时 stickyTop 恒等于 -scrollY(等于没吸附),
改成 clip(computed `clip visible`)后 stickyTop = 0,吸附正常。
`clip` 同样裁剪溢出,且不建立滚动容器 —— 这是这里唯一正确的取值。 */
overflow-x: clip;
width: 100%;
transition: background-color var(--transition-normal) var(--ease-out),
color var(--transition-normal) var(--ease-out);
@@ -1209,6 +1215,29 @@ html[data-theme='dark'] body {
var(--hatch-color) calc(var(--hatch-period) - var(--hatch-stroke)) var(--hatch-period)
);
}
/* === 结构性列表:不要正文的菱形项目符号 ===
globals 的 `ul li::before` 给所有列表加了 6×6 的品牌红菱形(正文的项目符号)。
但导航行 / 标签行 / 指标行这类**结构性列表**不是正文:一屏重复 6~9 次红菱形,
直接把「品牌红每页 ≥3 处触达点、面积 ≤10%」的额度花光。
`list-none` 只管 marker,管不到 ::before —— 所以必须有这条。 */
.list-plain > li::before,
.list-plain li::before {
content: none;
}
.list-plain > li {
padding-left: 0;
}
/* 结构件列表还要把正文列表的其余「文气」一并摘掉:
globals 的 `ul, ol` 设了 color: --color-text-secondary 与 1.5em 左内距 ——
对正文是对的(列表是次级内容),但导航行 / 序号列 / 指标行是**结构**,
它们必须继承所在区块的文字色与节奏,否则黑底舞台上的 01/04 会变成灰色。 */
.list-plain {
color: inherit;
line-height: inherit;
margin-bottom: 0;
padding-left: 0;
}
.hatch-field--soft {
background-image: repeating-linear-gradient(
var(--hatch-angle),
@@ -1216,6 +1245,47 @@ html[data-theme='dark'] body {
var(--hatch-color-soft) calc(var(--hatch-period) - var(--hatch-stroke)) var(--hatch-period)
);
}
/* === 编辑舞台(StoryStage)的布局开关 ===
为什么写在 CSS 而不在组件里拼 className:定位方式(static ↔ absolute)必须先于 JS
决定 —— JS 未就绪、脚本报错、或用户开了「减少动效」时,4 屏必须是**正常流里的完整内容**,
而不是叠在一起的 4 层。用 CSS 媒体查询 + 父级 data-mode 做这个开关,
组件只需要负责「哪一屏是活动的」。
JS 只在挂载后把 data-mode 从 flow 改成 pinned(首帧恒为 flow,与 SSR 一致)。 */
.story-stage[data-mode='flow'] .story-stage__slide + .story-stage__slide {
margin-top: var(--spacing-3xl);
}
@media (min-width: 768px) {
.story-stage[data-mode='pinned'] .story-stage__track {
height: calc(var(--stage-count, 4) * 100vh);
}
.story-stage[data-mode='pinned'] .story-stage__sticky {
position: sticky;
top: 0;
display: flex;
height: 100vh;
align-items: center;
overflow: clip;
}
.story-stage[data-mode='pinned'] .story-stage__slides {
position: relative;
height: min(62vh, 560px);
}
.story-stage[data-mode='pinned'] .story-stage__slide {
position: absolute;
inset: 0;
margin-top: 0;
transition: opacity var(--transition-normal) var(--ease-out);
}
/* visibility 不走过渡:它只负责把非活动屏移出 tab 序。
只写 opacity:0 会让键盘用户 tab 进一屏看不见的按钮上。 */
.story-stage[data-mode='pinned'] .story-stage__slide[data-active='false'] {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
}
}
/* ===== 动画关键帧 ===== */
@@ -0,0 +1,73 @@
import { render, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { IndustryTabs } from './industry-tabs';
jest.mock('@/components/ui/static-link', () => ({
StaticLink: ({ children, href, ...rest }: { children: React.ReactNode; href: string; [k: string]: unknown }) => (
<a href={href} {...rest}>{children}</a>
),
}));
/**
* 行业切换的三条判据:
* ① 6 个入口**恒在**(CMS 缺行也不减入口),且都落在既有 /solutions/{slug};
* ② 它**不是** tab —— 是 6 个真链接 + aria-live 预览。标成 role="tab" 会让读屏
* 期待「选一个面板」,而实际行为是「离开本页」;
* ③ 预览只消费传入的 solution 行,缺行时不编造痛点。
*/
describe('IndustryTabs', () => {
const solutions = [
{ id: 'manufacturing', title: '制造业', painPoints: ['库存不透明', '排产靠经验'] },
{ id: 'retail', title: '贸易零售', painPoints: ['多渠道割裂'] },
];
it('6 个行业入口恒在,链接落在既有 /solutions/{slug}', () => {
const { container } = render(<IndustryTabs solutions={solutions} />);
const links = [...container.querySelectorAll('nav a')].map((a) => a.getAttribute('href'));
expect(links).toEqual([
'/solutions/manufacturing',
'/solutions/retail',
'/solutions/education',
'/solutions/healthcare',
'/solutions/finance',
'/solutions/logistics',
]);
});
it('不伪装成 tab:没有 role=tab,用 aria-current 标当前预览项', () => {
const { container } = render(<IndustryTabs solutions={solutions} />);
expect(container.querySelector('[role="tab"]')).toBeNull();
expect(container.querySelector('[role="tablist"]')).toBeNull();
const current = container.querySelectorAll('nav a[aria-current="true"]');
expect(current).toHaveLength(1);
expect(current[0]!.textContent).toBe('制造业');
});
it('focus 切到第二个行业,预览区(aria-live)随之更新', () => {
const { container } = render(<IndustryTabs solutions={solutions} />);
const linked = container.querySelector('nav a[href="/solutions/retail"]') as HTMLElement;
fireEvent.focus(linked);
const live = container.querySelector('[aria-live="polite"]')!;
expect(live.textContent).toContain('贸易零售');
expect(live.textContent).toContain('多渠道割裂');
expect(linked).toHaveAttribute('aria-current', 'true');
});
it('缺数据时仍渲染 6 个入口,但不编造痛点', () => {
const { container } = render(<IndustryTabs solutions={[]} />);
expect(container.querySelectorAll('nav a')).toHaveLength(6);
expect(container.textContent).not.toContain('库存不透明');
// 兜底文案明确说「待补充」,而不是拿一句假痛点顶上
expect(container.querySelector('[aria-live="polite"]')!.textContent).toContain('待补充');
});
it('活动项的 1px 红下划线只在当前项上', () => {
const { container } = render(<IndustryTabs solutions={solutions} />);
const active = container.querySelector('nav a[aria-current="true"]')!;
expect(active.className).toContain('border-brand');
const others = [...container.querySelectorAll('nav a')].filter((a) => a !== active);
for (const a of others) {
expect(a.className).toContain('border-transparent');
}
});
});
+158
View File
@@ -0,0 +1,158 @@
'use client';
import { useState } from 'react';
import Image from 'next/image';
import { DoubleChevron } from '@/components/ui/double-chevron';
import { HatchField } from '@/components/ui/hatch-field';
import { StaticLink } from '@/components/ui/static-link';
import { IMAGE_RATIOS, aspectStyle } from '@/lib/constants/image-ratios';
import { cn } from '@/lib/utils';
/**
* 行业切换(Industry Tabs)—— 对标首页「赋能我们的客户 / Our Industry Expertise」段。
*
* 实测(2026-11-03):白底 40/700 标题 → **整幅黑带** → 横向 6~9 个行业标签
* (active 项带 1px 品牌红下划线)→ 左侧方图(后叠斜线纹,比例 1.42:1)→
* 右侧 32/700 标题 + 18/400 正文 + `›` 文字链 → 黑带右下双 V。
*
* 一个刻意的取舍:**不伪装成 `role="tab"`**。
* 对标的这排是 `<a>`,点击就跳转;把它们标成 tab 会让读屏期待「选一个面板」,
* 而实际行为是「离开本页」。所以这里用
* `<nav aria-label="行业">` + 6 个真链接(`aria-current` 标当前预览项)
* + 下方 `aria-live="polite"` 的预览区
* 预览随 hover/focus 切换,点击仍走 `/solutions/{slug}`。
*
* 数据:6 个行业入口来自常量(即使 CMS 缺行也保留入口,**不编造痛点**);
* 痛点文案只来自传进来的 solution 行,没有就整行不渲染。
*/
export interface IndustryTabItem {
slug: string;
name: string;
image: string;
}
export interface IndustryTabRow {
id?: string;
title?: string;
description?: string;
painPoints?: unknown[];
}
const INDUSTRY_ITEMS: IndustryTabItem[] = [
{ slug: 'manufacturing', name: '制造业', image: '/images/home/industry-manufacturing.webp' },
{ slug: 'retail', name: '贸易零售', image: '/images/home/industry-retail.webp' },
{ slug: 'education', name: '教育培训', image: '/images/home/industry-education.webp' },
{ slug: 'healthcare', name: '医疗健康', image: '/images/home/industry-healthcare.webp' },
{ slug: 'finance', name: '金融服务', image: '/images/home/industry-finance.webp' },
{ slug: 'logistics', name: '物流运输', image: '/images/home/industry-logistics.webp' },
];
export function IndustryTabs({ solutions }: { solutions?: IndustryTabRow[] }) {
const bySlug = new Map((solutions ?? []).map((s) => [String(s.id ?? ''), s]));
const [activeSlug, setActiveSlug] = useState(INDUSTRY_ITEMS[0]!.slug);
const active = INDUSTRY_ITEMS.find((i) => i.slug === activeSlug) ?? INDUSTRY_ITEMS[0]!;
const row = bySlug.get(active.slug);
const painPoints = Array.isArray(row?.painPoints) ? row.painPoints.slice(0, 3).map(String) : [];
return (
<section
data-testid="home-industries"
aria-labelledby="industry-tabs-heading"
className="bg-bg-primary"
>
<div className="container-x pb-4 pt-16 md:pt-24">
<h2
id="industry-tabs-heading"
className="max-w-3xl text-3xl font-bold leading-[1.05] tracking-tight text-text-primary sm:text-4xl md:text-[2.5rem]"
>
按行业的问题空间,不是按我们的产品线
</h2>
</div>
{/* 接缝:白底标题区 → 黑带。对标在这一交界上压了一条斜线纹(实测 s8 patch 上方
那条),它一半在灰白底、一半在黑带 —— 所以用负下边距跨接,而不是各画一半。 */}
{/* 黑带:标签行 + 预览。黑底是「注意力区」,实测该段整幅为 #000 */}
<div className="relative mt-10 bg-[#0B0A08] text-white">
{/* 接缝块挂在黑带**内部顶端**、向上跨出 40px:
上半压白底标题区、下半压黑带 —— 这才是标对的接缝手法(纹理桥接而非渐变)。 */}
<div aria-hidden="true" className="container-x absolute -top-10 left-0 right-0">
<HatchField className="ml-auto h-20 w-[34%]" />
</div>
<div className="container-x relative py-12 md:py-16">
<nav aria-label="行业">
<ul className="list-plain flex list-none flex-wrap gap-x-8 gap-y-3 border-b border-white/15 p-0 pb-4">
{INDUSTRY_ITEMS.map((item) => {
const isActive = item.slug === active.slug;
return (
<li key={item.slug} className="list-none">
<StaticLink
href={`/solutions/${item.slug}`}
aria-current={isActive ? 'true' : undefined}
onMouseEnter={() => setActiveSlug(item.slug)}
onFocus={() => setActiveSlug(item.slug)}
className={cn(
'inline-block min-h-11 border-b-2 pb-2 text-base transition-colors duration-hover md:text-lg',
isActive
? 'border-brand font-bold text-white'
: 'border-transparent text-white/70 hover:text-white',
)}
>
{item.name}
</StaticLink>
</li>
);
})}
</ul>
</nav>
<div aria-live="polite" className="mt-10 grid items-center gap-10 md:grid-cols-12 md:gap-12">
<div className="relative md:col-span-6">
<HatchField className="absolute -left-4 -top-6 h-32 w-32 md:h-40 md:w-40" />
<div className="relative overflow-hidden" style={aspectStyle(IMAGE_RATIOS.TILE)}>
<Image
src={active.image}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 768px) 50vw, 100vw"
className="object-cover"
/>
</div>
</div>
<div className="md:col-span-6">
<h3 className="text-2xl font-bold leading-tight text-white md:text-[2rem]">{active.name}</h3>
{painPoints.length > 0 ? (
<ul className="list-plain mt-5 list-none space-y-2 p-0">
{painPoints.map((p) => (
<li key={p} className="text-base leading-relaxed text-white/75">
{p}
</li>
))}
</ul>
) : (
<p className="mt-5 text-base leading-relaxed text-white/75">
{String(row?.description ?? '该行业的问题清单待补充。')}
</p>
)}
<StaticLink
href={`/solutions/${active.slug}`}
className="group mt-8 inline-flex min-h-11 items-center gap-2 text-sm font-medium text-white transition-colors duration-hover hover:text-brand"
>
<span aria-hidden="true" className="text-brand">›</span>
查看该行业解决方案
</StaticLink>
</div>
<DoubleChevron
direction="right"
size="sm"
className="pointer-events-none absolute bottom-6 right-4 hidden md:block"
/>
</div>
</div>
</div>
</section>
);
}
@@ -0,0 +1,74 @@
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { StoryStage } from './story-stage';
/**
* 编辑舞台的判据锁三件事 —— 每一条都对应一个「做错了但看起来没问题」的失败形态:
* ① 内容必须在 JS 未就绪时就可读(服务端首帧 = flow,4 屏全在 DOM,不是被 JS 渲染出来的);
* ② 非活动屏在 pinned 下要被移出 tab 序(只写 opacity:0 会让键盘 tab 进看不见的按钮上);
* ③ 计数器与序列表必须在,且计数器是装饰(aria-hidden),读屏听到的是列表本身。
*/
const slides = [
{ id: 'consulting', title: '战略咨询', description: '把问题定义清楚', highlights: ['业务诊断', '蓝图'] },
{ id: 'software', title: '企业软件', description: '把方案落成系统', highlights: ['架构'] },
{ id: 'operations', title: '运营陪跑', description: '把节奏留在现场' },
{ id: 'data', title: '数据治理', description: '把口径统一起来' },
];
const renderStage = (props: Partial<React.ComponentProps<typeof StoryStage>> = {}) =>
render(<StoryStage slides={slides} label="能力" heading="四种陪跑方式" {...props} />);
describe('StoryStage', () => {
it('首帧是 flow:4 屏全部在 DOM 里,且没有任何一屏被判为不可见', () => {
const { container } = renderStage();
const section = screen.getByTestId('home-capabilities');
// SSR 与客户端首帧必须一致 —— 2026-10-20 白屏那轮的教训
expect(section).toHaveAttribute('data-mode', 'flow');
expect(screen.getByTestId('home-capabilities')).toHaveAttribute('data-slide-count', '4');
const items = container.querySelectorAll('ol > li');
expect(items).toHaveLength(4);
for (const li of items) {
expect(li).toHaveAttribute('data-active', 'true');
expect(li).not.toHaveAttribute('aria-hidden');
}
});
it('内容是语义列表:ol > li,标题是 h3,段标题是 h2(不为字形降级标题层级)', () => {
const { container } = renderStage();
expect(container.querySelector('ol')).toBeInTheDocument();
expect(screen.getByRole('heading', { level: 2 }).textContent).toBe('四种陪跑方式');
const h3s = screen.getAllByRole('heading', { level: 3 }).map((h) => h.textContent);
expect(h3s).toEqual(['战略咨询', '企业软件', '运营陪跑', '数据治理']);
});
it('每屏都落到 /services/{id},链接不是「只在活动屏才渲染」', () => {
const { container } = renderStage();
const hrefs = [...container.querySelectorAll('a')].map((a) => a.getAttribute('href'));
expect(hrefs).toEqual(slides.map((s) => `/services/${s.id}`));
});
it('计数器是装饰(aria-hidden),斜杠是图形不是文字,读屏拿到的是列表本身', () => {
renderStage();
const counters = screen.getAllByTestId('story-counter');
expect(counters).toHaveLength(4);
for (const c of counters) {
expect(c).toHaveAttribute('aria-hidden', 'true');
// 「/」是 SlashMark 图形,不是文本节点 —— 所以 textContent 是 0104 而不是 01 / 04
expect(c.querySelector('svg')).not.toBeNull();
expect(c.textContent).toMatch(/^0[1-4]04$/);
}
});
it('没有 service 行时整段不渲染(不端出一个空舞台)', () => {
const { container } = render(<StoryStage slides={[]} label="能力" heading="四种陪跑方式" />);
expect(container).toBeEmptyDOMElement();
});
it('最多 4 屏:多于 4 条时截断,避免舞台高度失控', () => {
const many = [...slides, { id: 'extra', title: '第五条', description: 'x' }];
const { container } = renderStage({ slides: many });
expect(container.querySelectorAll('ol > li')).toHaveLength(4);
expect(screen.queryByText('第五条')).not.toBeInTheDocument();
});
});
+197
View File
@@ -0,0 +1,197 @@
'use client';
import { useEffect, useRef, useState } from 'react';
import { useMotionValueEvent, useScroll } from 'framer-motion';
import Image from 'next/image';
import { DoubleChevron } from '@/components/ui/double-chevron';
import { HatchField } from '@/components/ui/hatch-field';
import { SlashDivider } from '@/components/ui/slash-mark';
import { StaticLink } from '@/components/ui/static-link';
import { cn } from '@/lib/utils';
/**
* 编辑舞台(Story Stage)—— 对标最核心的那一段交互。
*
* 实测(2026-11-03,Porsche Consulting 中国站首页):一个 `4 × 100vh` 高的
* `section[data-module="scrollTeasers"]`,内层 `position: sticky; height: 100vh` 的
* 「舞台」;滚动进度切换 4 屏,每屏 = 计数器 `01 / 04`(32/700 + 斜杠符)→ 断言标题
* → 正文 → 实心红按钮 → 1:1 方图(后叠斜线纹)→ 右下双 V。整段黑底。
*
* 本实现的三条硬约束(不是风格偏好,是不满足就判不合格):
*
* 1. **单一 DOM,绝不复制内容**。移动端与「减少动效」都落 `data-mode="flow"`:
* 4 屏纵向堆叠、全部可见、无 sticky。服务端首帧**一定**是 flow ——
* 2026-10-20 生产白屏那轮的教训:首帧必须与 SSR 一致,不许有元素停在 opacity:0。
* 挂载后只在 `(min-width:768px) and (prefers-reduced-motion:no-preference)` 时切 pinned。
* 2. **动画只是增强**。4 屏始终在 `<ol>` 里,读屏与键盘拿到的是完整内容;
* pinned 下非活动屏 `visibility:hidden`(移出 tab 序)+ `aria-hidden`,
* 否则键盘会 tab 进看不见的按钮。
* 3. **不做循环动画**。切换只由滚动进度驱动,交叉淡出走 `--transition-normal`(280ms);
* 对标原物那条 6s infinite 的脉冲属于 CONTEXT.md:81 明令禁止的循环装饰,不移植。
*
* 内容真源是 CMS 的 `service` 行:title→h3、description→正文、highlights→要点、
* id→`/services/{id}`。图片是氛围图(无人、无可读文字、无标识),不承担事实主张。
*/
export interface StoryStageSlide {
id: string;
title: string;
description: string;
highlights?: string[];
}
/** 方图取已入库的 6 张 1:1 氛围图,按下标轮转;不新造内容模型 */
const STAGE_IMAGES = [
'/images/rail/rail-cost.webp',
'/images/rail/rail-transformation.webp',
'/images/rail/rail-organization.webp',
'/images/rail/rail-process.webp',
'/images/rail/rail-technology.webp',
'/images/rail/rail-supply-chain.webp',
] as const;
/** 与设计契约一致:≤4 屏。多于 4 屏时舞台高度会过长,滚动一屏要跨越的像素数失去意义 */
const MAX_SLIDES = 4;
export function StoryStage({
slides,
heading,
label,
testId = 'home-capabilities',
}: {
slides: StoryStageSlide[];
heading: string;
label: string;
testId?: string;
}) {
const trackRef = useRef<HTMLDivElement>(null);
const [active, setActive] = useState(0);
/** 首帧恒为 flow(与 SSR 一致),挂载后按媒体查询切换 —— 见约束 1 */
const [mode, setMode] = useState<'flow' | 'pinned'>('flow');
const items = slides.slice(0, MAX_SLIDES);
useEffect(() => {
const mq = window.matchMedia('(min-width: 768px) and (prefers-reduced-motion: no-preference)');
const sync = () => setMode(mq.matches ? 'pinned' : 'flow');
sync();
mq.addEventListener('change', sync);
return () => mq.removeEventListener('change', sync);
}, []);
/**
* 没有 slides 时组件会提前 return,ref 便不会挂载 —— 而 `useScroll({target})`
* 在 ref 未 hydrate 时会直接抛 invariant("Target ref is defined but not hydrated")。
* 所以空列表退化为不传 target(走页面滚动,读到的值也不会被消费),
* 而不是把 hook 放进条件分支(那会破坏 hooks 顺序)。
*/
const { scrollYProgress } = useScroll(
items.length > 0 ? { target: trackRef, offset: ['start start', 'end end'] } : undefined,
);
useMotionValueEvent(scrollYProgress, 'change', (v) => {
if (mode !== 'pinned' || items.length === 0) return;
const next = Math.min(items.length - 1, Math.max(0, Math.floor(v * items.length)));
setActive((prev) => (prev === next ? prev : next));
});
if (items.length === 0) return null;
return (
<section
data-testid={testId}
data-mode={mode}
data-slide-count={items.length}
aria-labelledby="story-stage-heading"
className="story-stage relative bg-[#0B0A08] text-white"
>
<div ref={trackRef} className="story-stage__track" style={{ ['--stage-count' as string]: items.length }}>
<div className="story-stage__sticky">
<div className="container-x w-full py-16 md:py-0">
<div className="flex items-center gap-3">
<span aria-hidden="true" className="h-px w-10 bg-brand" />
<span className="text-[13px] font-medium tracking-[0.15em] text-white/70">{label}</span>
</div>
<h2
id="story-stage-heading"
className="mt-5 max-w-3xl text-3xl font-bold leading-[1.05] tracking-tight text-white sm:text-4xl md:text-5xl"
>
{heading}
</h2>
<ol className="list-plain story-stage__slides mt-12 list-none p-0 md:mt-10">
{items.map((s, i) => {
const isActive = mode === 'flow' || i === active;
return (
<li
key={s.id}
data-active={isActive ? 'true' : 'false'}
aria-hidden={isActive ? undefined : true}
className={cn(
'story-stage__slide grid items-center gap-10 md:grid-cols-12 md:gap-12',
i > 0 && 'mt-16 md:mt-0',
)}
>
{/* 计数器:01 / 04(32/700),斜杠走原语,整块 aria-hidden —— 读屏听到的是序列表本身 */}
<div
aria-hidden="true"
data-testid="story-counter"
className="flex items-center gap-3 text-3xl font-bold leading-none tabular-nums md:col-span-1 md:flex-col md:gap-2"
>
<span>{String(i + 1).padStart(2, '0')}</span>
<SlashDivider />
<span className="text-white/50">{String(items.length).padStart(2, '0')}</span>
</div>
<div className="md:col-span-5">
<h3 className="text-2xl font-bold leading-tight text-white md:text-4xl">{s.title}</h3>
<p className="mt-5 max-w-xl text-base leading-relaxed text-white/75">{s.description}</p>
{(s.highlights?.length ?? 0) > 0 && (
<ul className="list-plain mt-6 flex flex-wrap gap-x-6 gap-y-2 p-0 text-sm text-white/60">
{s.highlights!.map((h) => (
<li key={h} className="list-none">
{h}
</li>
))}
</ul>
)}
<StaticLink
href={`/services/${s.id}`}
className="group mt-8 inline-flex min-h-11 items-center gap-2 text-sm font-medium text-white transition-colors duration-hover hover:text-brand"
>
了解这一能力
<span aria-hidden="true" className="transition-transform duration-hover group-hover:translate-x-1">
›
</span>
</StaticLink>
</div>
<div className="relative md:col-span-6">
{/* 方图 + 后叠斜线纹 + 右下双 V:三件的位置关系是实测的构图,不是装饰堆叠 */}
<HatchField className="absolute -left-4 -top-6 hidden h-40 w-40 md:block" />
<div className="relative aspect-square overflow-hidden bg-[#141210]">
<Image
src={STAGE_IMAGES[i % STAGE_IMAGES.length] ?? STAGE_IMAGES[0]}
alt=""
aria-hidden="true"
fill
sizes="(min-width: 768px) 48vw, 100vw"
className="object-cover"
loading={i === 0 ? 'eager' : 'lazy'}
/>
</div>
<DoubleChevron
direction="down"
size="sm"
className="absolute -bottom-8 right-0 hidden md:block"
/>
</div>
</li>
);
})}
</ol>
</div>
</div>
</div>
</section>
);
}
+1 -1
View File
@@ -28,7 +28,7 @@ const REQUIRED_ANNOTATED_SOURCES = [
'src/app/(marketing)/products/products-content-v3.tsx',
'src/app/(marketing)/solutions/solutions-content-v3.tsx',
'src/app/(marketing)/services/services-content-v3.tsx',
'src/app/(marketing)/home-content-v16.tsx',
'src/app/(marketing)/home-content-v17.tsx',
// 详情页同样以大数字样式渲染 dataProofs,不得裸奔
'src/components/content/sections.tsx',
'src/components/detail/detail-trust-section.tsx',