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:
1 parent
7d1a22a596
commit
009e840fa7
16 files changed
+1342
-1282
No files matched your search
@@ -1,267 +0,0 @@
|
||||
import { describe, it, expect, jest } from '@jest/globals';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import HomeContentV15 from './home-content-v15';
|
||||
|
||||
jest.mock('framer-motion', () => ({
|
||||
motion: {
|
||||
div: ({ children, initial, animate, className, style, ...props }: any) => (
|
||||
<div
|
||||
data-testid="motion-div"
|
||||
data-initial={JSON.stringify(initial)}
|
||||
data-animate={JSON.stringify(animate)}
|
||||
className={className}
|
||||
style={style}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
),
|
||||
h1: ({ children, className, ...props }: any) => (
|
||||
<h1 data-testid="motion-h1" className={className} {...props}>{children}</h1>
|
||||
),
|
||||
p: ({ children, className, ...props }: any) => (
|
||||
<p data-testid="motion-p" className={className} {...props}>{children}</p>
|
||||
),
|
||||
span: ({ children, className, ...props }: any) => (
|
||||
<span data-testid="motion-span" className={className} {...props}>{children}</span>
|
||||
),
|
||||
a: ({ children, href, className, ...props }: any) => (
|
||||
<a href={href} className={className} data-testid="motion-a" {...props}>{children}</a>
|
||||
),
|
||||
},
|
||||
useInView: jest.fn(() => true),
|
||||
AnimatePresence: ({ children }: any) => <>{children}</>,
|
||||
}));
|
||||
|
||||
jest.mock('next/image', () => ({
|
||||
__esModule: true,
|
||||
default: ({ src, alt, className }: any) => (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img src={src} alt={alt} className={className} data-testid="mock-next-image" />
|
||||
),
|
||||
}));
|
||||
|
||||
jest.mock('@/components/ui/scroll-reveal', () => ({
|
||||
ScrollReveal: ({ children, className }: any) => (
|
||||
<div data-testid="scroll-reveal" className={className}>{children}</div>
|
||||
),
|
||||
StaggerReveal: ({ children, className }: any) => (
|
||||
<div data-testid="stagger-reveal" className={className}>{children}</div>
|
||||
),
|
||||
}));
|
||||
|
||||
jest.mock('@/components/ui/badge', () => ({
|
||||
Badge: ({ children, className }: any) => (
|
||||
<span data-testid="mock-badge" className={className}>{children}</span>
|
||||
),
|
||||
}));
|
||||
|
||||
jest.mock('lucide-react', () => {
|
||||
const mockIcon = (name: string) => {
|
||||
const Icon = (props: any) => <svg data-testid={`icon-${name.toLowerCase()}`} className={props.className} />;
|
||||
Icon.displayName = name;
|
||||
return Icon;
|
||||
};
|
||||
return {
|
||||
ArrowRight: mockIcon('arrow-right'),
|
||||
ArrowUpRight: mockIcon('arrow-up-right'),
|
||||
ArrowDownRight: mockIcon('arrow-down-right'),
|
||||
Lightbulb: mockIcon('lightbulb'),
|
||||
Database: mockIcon('database'),
|
||||
Layers: mockIcon('layers'),
|
||||
Code: mockIcon('code'),
|
||||
Puzzle: mockIcon('puzzle'),
|
||||
Server: mockIcon('server'),
|
||||
Quote: mockIcon('quote'),
|
||||
Newspaper: mockIcon('newspaper'),
|
||||
Calendar: mockIcon('calendar'),
|
||||
LayoutDashboard: mockIcon('layout-dashboard'),
|
||||
BarChart3: mockIcon('bar-chart3'),
|
||||
Package: mockIcon('package'),
|
||||
Users: mockIcon('users'),
|
||||
Settings: mockIcon('settings'),
|
||||
Search: mockIcon('search'),
|
||||
Bell: mockIcon('bell'),
|
||||
TrendingUp: mockIcon('trending-up'),
|
||||
AlertCircle: mockIcon('alert-circle'),
|
||||
};
|
||||
});
|
||||
|
||||
describe('HomeContentV15 - 浅色 Hero(暗黑模式 token 友好)', () => {
|
||||
it('does not repeat the brand logo inside the hero (dedup with header)', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
const hero = screen.getByTestId('hero-section');
|
||||
expect(hero).toBeInTheDocument();
|
||||
// hero 内不应再有 Logo(导航栏已展示,避免重复);slogan badge 保留
|
||||
expect(hero.querySelector('img')).toBeNull();
|
||||
});
|
||||
|
||||
it('mounts the brand-red dynamic particle layer (continuous drift loop)', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
const hero = screen.getByTestId('hero-section');
|
||||
const particles = screen.getByTestId('hero-particle-field');
|
||||
expect(particles.tagName).toBe('CANVAS');
|
||||
expect(particles).toHaveAttribute('aria-hidden', 'true');
|
||||
expect(hero.contains(particles)).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps a single primary CTA and demotes the secondary action to a text link', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
expect(screen.getByTestId('hero-primary-cta')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('hero-primary-cta')).toHaveAttribute('href', '/contact');
|
||||
expect(screen.getByTestId('hero-secondary-link')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('keeps hero declaration-first: stats sink out of hero into the results band', () => {
|
||||
render(<HomeContentV15 stats={[{ value: '100%', label: '私有化部署' }]} />);
|
||||
|
||||
const hero = screen.getByTestId('hero-section');
|
||||
// 声明先行:hero 内不再内联数据条(一屏只负责一句话声明 + 一个行动)
|
||||
expect(hero.querySelector('[data-testid="hero-stats"]')).toBeNull();
|
||||
// 数据下沉为独立成果带,仍渲染(Glance 层滚动触发)
|
||||
expect(screen.getByTestId('hero-stats')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('HomeContentV15 - 信任层与章节式叙事', () => {
|
||||
it('renders verifiable trust signals with a source annotation', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
expect(screen.getByTestId('trust-section')).toBeInTheDocument();
|
||||
expect(screen.getByText('100%')).toBeInTheDocument();
|
||||
expect(screen.getByText('成都')).toBeInTheDocument();
|
||||
// 可验证来源标注存在(每个数据卡一个)
|
||||
expect(screen.getAllByText(/数据来源:/i).length).toBeGreaterThanOrEqual(4);
|
||||
});
|
||||
|
||||
it('consolidates the co-creation pitch into the cases dark card (no duplicated TrustSection banner)', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
// 复评 P1:早鸟横幅曾与案例深色卡、洞察卡三处重复共创主张,现收敛为唯一深色卡
|
||||
expect(screen.queryByTestId('early-access-banner')).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId('cases-co-creation-cta')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('首批客户共创中').length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
it('renders the problem-method-result narrative with chapter numbers', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
expect(screen.getByTestId('narrative-section')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('01').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('02').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('03').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText(/从问题到结果/).length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('HomeContentV15 - 行业洞察区(对标 Accenture Insights)', () => {
|
||||
it('renders the insights pillar with typed tags and verifiable methodology content', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
expect(screen.getByTestId('insights-section')).toBeInTheDocument();
|
||||
// 类型标签(对标 Research Report / Perspective / Case Study)
|
||||
expect(screen.getAllByText('方法论').length).toBeGreaterThanOrEqual(2);
|
||||
expect(screen.getByText('观点')).toBeInTheDocument();
|
||||
// 全部链接真实页面,不虚构研究报告
|
||||
expect(screen.getByText('数字化转型诊断:从哪里开始,如何衡量')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('HomeContentV15 - 创始人观点区(对标 Accenture CEO Quote)', () => {
|
||||
it('renders the founder quote with attribution (no fabricated persona)', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
expect(screen.getByTestId('founder-quote-section')).toBeInTheDocument();
|
||||
expect(screen.getByText(/数字化不是一次性项目/)).toBeInTheDocument();
|
||||
expect(screen.getByText('睿新致远创始团队')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('HomeContentV15 - 新闻动态区(对标 Accenture News)', () => {
|
||||
it('renders the news section with latest items and a view-all entry', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
expect(screen.getByTestId('news-section')).toBeInTheDocument();
|
||||
expect(screen.getByText('四川睿新致远科技有限公司正式成立')).toBeInTheDocument();
|
||||
expect(screen.getByText('查看全部新闻')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders CMS-provided news when available', () => {
|
||||
render(<HomeContentV15 news={[{
|
||||
id: 'cms-news-1',
|
||||
title: 'CMS 新闻条目',
|
||||
excerpt: 'CMS 提供的新闻摘要',
|
||||
date: '2026-08-30',
|
||||
category: '研发动态',
|
||||
image: '',
|
||||
content: '',
|
||||
}]} />);
|
||||
|
||||
expect(screen.getByText('CMS 新闻条目')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('HomeContentV15 - 案例区 Client Spotlight(对标 Accenture Client Spotlight)', () => {
|
||||
it('renders a co-creation spotlight card (verifiable, no fabricated clients) when no cases exist', () => {
|
||||
render(<HomeContentV15 />);
|
||||
|
||||
// 空态 spotlight:共创流程 3 步 + 深色卡 CTA
|
||||
expect(screen.getAllByText('首批客户共创中').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByText('业务诊断').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getByText('方案共创')).toBeInTheDocument();
|
||||
expect(screen.getByText('验证发布')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('01').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getByTestId('cases-co-creation-cta')).toHaveAttribute('href', '/contact');
|
||||
});
|
||||
|
||||
it('renders a dark spotlight card with metrics for the featured case when data exists', () => {
|
||||
const mockCases = [
|
||||
{
|
||||
slug: 'spotlight-demo',
|
||||
industry: '制造业',
|
||||
title: 'Spotlight 案例标题',
|
||||
href: '/cases/spotlight-demo',
|
||||
verified: true,
|
||||
testimonial: {
|
||||
quote: '这是一段客户引言,用于验证 spotlight 渲染。',
|
||||
author: '客户 CIO',
|
||||
role: '某制造企业',
|
||||
},
|
||||
metrics: [
|
||||
{ value: '38%', label: '交付效率提升' },
|
||||
{ value: '2x', label: '数据查询提速' },
|
||||
{ value: '3周', label: '上线周期' },
|
||||
],
|
||||
},
|
||||
{
|
||||
slug: 'secondary-case',
|
||||
industry: '贸易零售',
|
||||
title: '次要案例标题',
|
||||
href: '/cases/secondary-case',
|
||||
metrics: [
|
||||
{ value: '15%', label: '库存周转改善' },
|
||||
{ value: '4h', label: '对账耗时' },
|
||||
{ value: '9成', label: '预测准确率' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
render(<HomeContentV15 cases={mockCases as any} />);
|
||||
|
||||
// spotlight 大卡:深色画布 + 引言 + 授权 badge + 量化指标
|
||||
expect(screen.getByText('Spotlight 案例标题')).toBeInTheDocument();
|
||||
expect(screen.getByText('这是一段客户引言,用于验证 spotlight 渲染。')).toBeInTheDocument();
|
||||
expect(screen.getByText('已获客户授权')).toBeInTheDocument();
|
||||
expect(screen.getByText('38%')).toBeInTheDocument();
|
||||
expect(screen.getByText('查看完整案例')).toBeInTheDocument();
|
||||
|
||||
// 次要案例保持轻量卡片
|
||||
expect(screen.getByText('次要案例标题')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('了解详情').length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
});
|
||||
@@ -1,994 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useRef } from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { StaticLink } from '@/components/ui/static-link';
|
||||
import { HeroParticleField, type HeroVariant } from '@/components/sections/hero-particle-field';
|
||||
import { ArrowRight, Lightbulb, Database, Layers, Code, Puzzle, Server, Quote, Calendar } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { EASE_OUT } from '@/components/ui/page-decoration';
|
||||
import { CTAButton } from '@/components/ui/cta-button';
|
||||
import { MetricsBasisNote } from '@/components/ui/metrics-basis-note';
|
||||
import { COMPANY_INFO, TRUST_SIGNALS, EARLY_ACCESS } from '@/lib/constants';
|
||||
import { canonicalCtaLabel, CTA_LABELS } from '@/lib/constants/cta-labels';
|
||||
import { canonicalTrustSource } from '@/lib/constants/company';
|
||||
import { weakestBasis } from '@/lib/constants/metrics-basis';
|
||||
import { useSiteConfig } from '@/lib/site-config';
|
||||
import { useReducedMotion } from '@/hooks/use-reduced-motion';
|
||||
import { type NewsItem } from '@/lib/constants/news';
|
||||
import { NEWS } from '@/lib/constants/news';
|
||||
|
||||
// ===== 服务图标映射:将字符串键名映射为 Lucide 组件 =====
|
||||
const SERVICE_ICON_MAP: Record<string, React.ReactNode> = {
|
||||
Lightbulb: <Lightbulb className="w-7 h-7" />,
|
||||
Code: <Code className="w-7 h-7" />,
|
||||
Server: <Server className="w-7 h-7" />,
|
||||
Puzzle: <Puzzle className="w-7 h-7" />,
|
||||
};
|
||||
|
||||
// ===== 服务数据降级兜底(4 条,保证 sm:grid-cols-2 网格完整,避免孤儿格)=====
|
||||
const FALLBACK_SERVICES = [
|
||||
{
|
||||
subtitle: 'Strategy Consulting',
|
||||
title: '数字化转型战略咨询',
|
||||
desc: '从业务诊断到数字化路线图,帮助企业识别高价值场景,规划可落地的转型路径,确保每一分投入都能产生可衡量的业务回报。',
|
||||
highlights: ['业务诊断', '数字化蓝图', '实施路线图', 'ROI 评估'],
|
||||
metrics: [
|
||||
{ value: '40%', label: '平均运营效率提升' },
|
||||
{ value: '6个月', label: '战略到试点周期' },
|
||||
],
|
||||
href: '/services/consulting',
|
||||
icon: <Lightbulb className="w-7 h-7" />,
|
||||
},
|
||||
{
|
||||
subtitle: 'Software Delivery',
|
||||
title: '企业软件定制开发',
|
||||
desc: '基于自研产品矩阵与工程化交付流程,提供从需求分析、架构设计到持续运维的全栈软件开发服务,支撑业务数字化落地。',
|
||||
highlights: ['需求分析', '架构设计', '敏捷开发', '持续运维'],
|
||||
metrics: [
|
||||
{ value: '6', label: '款自研产品' },
|
||||
{ value: '24/7', label: '运维支持' },
|
||||
],
|
||||
href: '/services/software',
|
||||
icon: <Code className="w-7 h-7" />,
|
||||
},
|
||||
{
|
||||
subtitle: 'Data Intelligence',
|
||||
title: '数据智能与 AI 应用',
|
||||
desc: '构建企业级数据平台与 AI 能力,打通数据孤岛,沉淀数据资产,让决策从经验驱动转向数据驱动。',
|
||||
highlights: ['数据中台', 'AI 建模', '可视化分析', '预测决策'],
|
||||
metrics: [
|
||||
{ value: '98%', label: '数据质量达标率' },
|
||||
{ value: '10x', label: '分析效率提升' },
|
||||
],
|
||||
href: '/services/data',
|
||||
icon: <Database className="w-7 h-7" />,
|
||||
},
|
||||
{
|
||||
subtitle: 'Solution Delivery',
|
||||
title: '行业解决方案落地',
|
||||
desc: '基于核心团队的行业实践,提供从方案设计、系统开发到上线运维的一站式交付,确保数字化转型真正落地生根。',
|
||||
highlights: ['行业套件', '定制开发', '系统集成', '持续运维'],
|
||||
metrics: [
|
||||
{ value: '6', label: '行业场景覆盖' },
|
||||
{ value: '99.9%', label: '系统可用性' },
|
||||
],
|
||||
href: '/services/solutions',
|
||||
icon: <Layers className="w-7 h-7" />,
|
||||
},
|
||||
];
|
||||
|
||||
// ===== 行业洞察兜底数据(对标 Accenture Insights:类型标签 + 卡片)=====
|
||||
// 零编造原则:全部为可验证的方法论/观点类内容,链接真实页面;不做虚构研究报告
|
||||
const FALLBACK_INSIGHTS = [
|
||||
{
|
||||
tag: '方法论',
|
||||
title: '数字化转型诊断:从哪里开始,如何衡量',
|
||||
desc: '从业务目标出发的四步诊断法——梳理断点、量化差距、排定优先级、定义验收指标。',
|
||||
date: '2026-08',
|
||||
href: '/methodology',
|
||||
},
|
||||
{
|
||||
tag: '观点',
|
||||
title: '私有化部署:为什么核心数据需要留在企业内',
|
||||
desc: '合规要求之外,数据主权正在成为企业数字化决策的第一优先级。',
|
||||
date: '2026-08',
|
||||
href: '/services/data',
|
||||
},
|
||||
{
|
||||
tag: '方法论',
|
||||
title: '从需求到交付:全流程陪伴式实施如何降低转型风险',
|
||||
desc: '诊断 → 设计 → 交付 → 运维,每一阶段都有明确的交付物与衡量指标。',
|
||||
date: '2026-07',
|
||||
href: '/services/software',
|
||||
},
|
||||
];
|
||||
|
||||
// ===== 创始人观点兜底(对标 Accenture CEO Quote,人格化背书)=====
|
||||
// 零编造原则:不虚构具体人名/原话;姓名职务为空时仅展示观点立场,真实引言可在 CMS page-copy 配置
|
||||
const FALLBACK_FOUNDER_QUOTE = {
|
||||
// 排版约束:3 行均势(17 / 18 / 13 字),避开"量。"孤儿字。
|
||||
// 配合 blockquote 的 whitespace-pre-line 渲染换行。
|
||||
text: '我们相信,数字化不是一次性项目,\n而是持续迭代的能力建设。\n每一份投入,都应当经得起衡量。',
|
||||
name: '睿新致远创始团队',
|
||||
role: '技术咨询 · 数字化转型同行者',
|
||||
};
|
||||
|
||||
// ===== 首页结构性文案类型(page-copy CMS 覆盖,未配置时走硬编码兜底)=====
|
||||
type HomePageCopy = Record<string, any>;
|
||||
|
||||
// 多行标题渲染:按 \n 分段,输出 <br/> 换行
|
||||
function StyledTitle({ lines }: { lines: (string | undefined)[] }) {
|
||||
return (
|
||||
<>
|
||||
{lines.map((line, i) => (
|
||||
<span key={i}>
|
||||
{i > 0 && <br />}
|
||||
{line}
|
||||
</span>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 品牌 CTA 按钮已抽离为可复用 UI 组件:@/components/ui/cta-button =====
|
||||
|
||||
// ===== Hero 区:浅色画布 + 精密工程网格科技感 + 品牌红单电压 =====
|
||||
// 设计方向(2026-08-31 重设计,参考 Accenture Radical Relevance;2026-09-01 科技感升级):
|
||||
// - 声明先行:H1 → 主张 → CTA,一屏只负责「一句话说清你是谁 + 一个行动」
|
||||
// - 数据指标下沉为独立成果带(HeroStatsBand),由滚动触发(Glance 层),不再挤在 hero 内
|
||||
// - 单一电压:hero 内只有品牌红一个彩色;连线走墨色(浅底)/中性灰(深底),不抢品牌红
|
||||
// - 字重收敛:大标题 700(原 900),对齐 Accenture「字重 9→3」的克制
|
||||
// - 科技感引擎:HeroParticleField 变体(固定种子、reduced-motion/自动化降级 → 快照零漂移)
|
||||
//
|
||||
// ===== HERO_VARIANT 观感开关(默认 'grid':浅色底 + 工程网格科技感)=====
|
||||
// 定调:Hero 保持浅色背景(与全站浅色咨询风一致),科技感由「精密工程网格 + 动态粒子 + 墨色细连线」承担,
|
||||
// 不做深色 Hero。深色变体保留待选(改这一行即生效,无需改其它代码):
|
||||
// 'grid' 浅色工程网格 + 品牌红漂移节点 + 墨色细连线 ← 默认落地
|
||||
// 'network' 深色节点网络(品牌红节点 + 中性灰连线)
|
||||
// 'constellation' 深色数据星图(品牌红脉冲节点 + 暗白次级点 + 竖向数据流)
|
||||
// 'spotlight' 深色聚光 + 粒子 + 工程网格(纵深最强,复用 L2 光标聚光)
|
||||
const HERO_VARIANT: HeroVariant = 'grid';
|
||||
|
||||
function HeroSection({ heroData }: {
|
||||
heroData?: Record<string, any> | null;
|
||||
}) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const spotRef = useRef<HTMLDivElement>(null);
|
||||
const siteConfig = useSiteConfig();
|
||||
const reduceMotion = useReducedMotion();
|
||||
|
||||
// 科技感变体开关(见文件顶部 HERO_VARIANT 注释):深色变体统一走深色画布 + 主题感知文字
|
||||
const dark = HERO_VARIANT !== 'grid';
|
||||
const showGrid = HERO_VARIANT === 'constellation' || HERO_VARIANT === 'spotlight'; // 深色工程网格
|
||||
const showLightGrid = HERO_VARIANT === 'grid'; // 浅色工程网格(墨色 hairline,精密质感)
|
||||
const showCursorGlow = HERO_VARIANT === 'spotlight';
|
||||
|
||||
const heading = heroData?.heading || heroData?.headingBottom || '让每一家企业都拥有数据驱动的决策能力';
|
||||
const subheading = heroData?.subheading || heroData?.description || '';
|
||||
const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel) || CTA_LABELS.consult;
|
||||
const ctaHref = heroData?.ctaHref || '/contact';
|
||||
const secondaryCtaLabel = heroData?.secondaryCtaLabel || '查看产品矩阵';
|
||||
const secondaryCtaHref = heroData?.secondaryCtaHref || '/products';
|
||||
const slogan = siteConfig.slogan || COMPANY_INFO.slogan;
|
||||
|
||||
// reduced-motion 守卫:与 ScrollReveal 同范式——reduce 时传空 initial/animate,
|
||||
// 元素直接以自然(可见)状态渲染,零位移/淡入;默认(非 reduce,含首帧 null)正常动画。
|
||||
const rise = (y: number, delay: number, duration = 0.3) => ({
|
||||
initial: reduceMotion ? {} : { opacity: 0, y },
|
||||
animate: reduceMotion ? {} : { opacity: 1, y: 0 },
|
||||
transition: { duration: reduceMotion ? 0 : duration, delay: reduceMotion ? 0 : delay, ease: EASE_OUT },
|
||||
});
|
||||
|
||||
return (
|
||||
<section
|
||||
ref={containerRef}
|
||||
className={`relative min-h-[90vh] flex items-center overflow-hidden ${dark ? 'bg-dark-bg text-white' : 'bg-bg-primary'}`}
|
||||
data-testid="hero-section"
|
||||
onPointerMove={(e) => {
|
||||
if (!spotRef.current || !containerRef.current) return;
|
||||
const rect = containerRef.current.getBoundingClientRect();
|
||||
spotRef.current.style.setProperty('--spot-x', `${e.clientX - rect.left}px`);
|
||||
spotRef.current.style.setProperty('--spot-y', `${e.clientY - rect.top}px`);
|
||||
}}
|
||||
>
|
||||
{/* L1 工程网格:浅底墨色 hairline(grid)/ 深底白色 hairline(constellation、spotlight) */}
|
||||
{showLightGrid && (
|
||||
<div className="absolute inset-0 pointer-events-none hero-grid-overlay--light" aria-hidden="true" />
|
||||
)}
|
||||
{showGrid && (
|
||||
<div className="absolute inset-0 pointer-events-none hero-grid-overlay--dark" aria-hidden="true" />
|
||||
)}
|
||||
{/* L2 品牌红光标聚光(仅 spotlight 变体 + 非 reduced-motion):跟随鼠标,仅写 2 个 CSS 变量,无 canvas、无逐帧 JS */}
|
||||
{showCursorGlow && !reduceMotion && (
|
||||
<div ref={spotRef} className="absolute inset-0 pointer-events-none hero-spot-glow opacity-70" aria-hidden="true" />
|
||||
)}
|
||||
{/* L3 动态粒子(品牌红点缀 + 科技感变体):rAF 持续循环漂移;
|
||||
reduced-motion / 自动化环境下降级为一次性静态帧(连线/星图位置由固定种子复现 → 快照零漂移) */}
|
||||
<HeroParticleField variant={HERO_VARIANT} dark={dark} />
|
||||
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10 w-full py-16 sm:py-20 md:py-24 lg:py-24">
|
||||
<div className="grid items-center gap-16">
|
||||
<div className="max-w-4xl">
|
||||
{/* 品牌口号 Badge:画布上的品牌红信号(深底走 brand-light 保证对比度;hero 不重复渲染 Logo,避免与导航栏重复) */}
|
||||
{slogan && (
|
||||
<motion.div
|
||||
{...rise(20, 0.03)}
|
||||
className="mb-6"
|
||||
>
|
||||
<span className={`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium border ${dark ? 'bg-brand/10 text-brand-light border-brand/30' : 'bg-brand/5 text-brand-ink border-brand/15'}`}>
|
||||
{slogan}
|
||||
</span>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{/* 主标题:大胆、直接(深底白色 / 浅底墨色,随 HERO_VARIANT 切换) */}
|
||||
<motion.h1
|
||||
{...rise(40, 0.06, 0.45)}
|
||||
className={`text-4xl sm:text-5xl md:text-6xl lg:text-6xl 2xl:text-7xl font-bold leading-[1.05] tracking-tight mb-7 sm:mb-8 ${dark ? 'text-white' : 'text-ink'}`}
|
||||
>
|
||||
{heading}
|
||||
</motion.h1>
|
||||
|
||||
{/* 主张:紧随声明之后,回答「凭什么信你」(声明先行,数据下沉至成果带) */}
|
||||
{subheading && (
|
||||
<motion.p
|
||||
{...rise(30, 0.16)}
|
||||
className={`text-lg sm:text-xl max-w-2xl leading-relaxed mb-10 ${dark ? 'text-white/70' : 'text-text-secondary'}`}
|
||||
>
|
||||
{subheading}
|
||||
</motion.p>
|
||||
)}
|
||||
|
||||
{/* CTA 按钮组 */}
|
||||
<motion.div
|
||||
{...rise(30, 0.24)}
|
||||
className="flex flex-col sm:flex-row sm:items-center gap-4 sm:gap-6"
|
||||
>
|
||||
<CTAButton href={ctaHref} dataTestId="hero-primary-cta">{ctaLabel}</CTAButton>
|
||||
{secondaryCtaLabel && (
|
||||
<a
|
||||
href={secondaryCtaHref}
|
||||
data-testid="hero-secondary-link"
|
||||
className={`group inline-flex items-center gap-2 text-sm font-medium transition-colors duration-200 py-4 ${dark ? 'text-white/70 hover:text-white' : 'text-text-secondary hover:text-ink'}`}
|
||||
>
|
||||
{secondaryCtaLabel}
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</a>
|
||||
)}
|
||||
</motion.div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== Hero 成果带:数据指标下沉为独立带(声明先行,Glance 层滚动触发)=====
|
||||
// 设计意图:hero 一屏只负责「一句话声明 + 一个行动」,硬指标移出后由滚动触发,
|
||||
// 既是 Accenture「single stream 逐步展开」的落地,也避免一屏信息过载。
|
||||
function HeroStatsBand({ stats }: { stats?: Record<string, any>[] }) {
|
||||
const hasValidStats = stats?.length && stats[0]?.value;
|
||||
const displayStats = hasValidStats ? stats!.slice(0, 3) : [];
|
||||
if (displayStats.length === 0) return null;
|
||||
return (
|
||||
<section
|
||||
data-testid="hero-stats"
|
||||
aria-label="关键成果指标"
|
||||
className="relative border-t border-border-primary bg-bg-primary"
|
||||
>
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 py-12 sm:py-16">
|
||||
<ScrollReveal>
|
||||
<div className="flex flex-wrap gap-8 sm:gap-12 md:gap-16">
|
||||
{displayStats.map((stat, i) => (
|
||||
<div key={i} className="flex items-baseline gap-2">
|
||||
<span className={cn(
|
||||
'text-3xl sm:text-4xl md:text-5xl font-mono font-bold tabular-nums leading-none',
|
||||
i === 0 ? 'text-brand-ink' : 'text-ink'
|
||||
)}>
|
||||
{stat.value}
|
||||
</span>
|
||||
<span className="text-sm text-text-secondary whitespace-nowrap">
|
||||
{stat.label}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
<MetricsBasisNote basis={weakestBasis(displayStats.map((s) => s.basis))} className="mt-6" />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 信任/成果区:可验证信任信号 =====
|
||||
function TrustSection({ pageCopy }: { pageCopy?: HomePageCopy | null }) {
|
||||
const eyebrow = pageCopy?.trustEyebrow || '值得信赖';
|
||||
const titleLines = (pageCopy?.trustTitle || '以可衡量的成果\n赢得长期信任').split('\n');
|
||||
const signals = (pageCopy?.trustSignals?.length ? pageCopy.trustSignals : TRUST_SIGNALS) as typeof TRUST_SIGNALS;
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-secondary" data-testid="trust-section">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<ScrollReveal className="mb-16 sm:mb-20">
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="w-10 h-px bg-brand" />
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-ink">
|
||||
{eyebrow}
|
||||
</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05]">
|
||||
<StyledTitle lines={titleLines} />
|
||||
</h2>
|
||||
</ScrollReveal>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-10">
|
||||
{signals.map((item, i) => (
|
||||
<StaggerReveal key={i} staggerDelay={0.06}>
|
||||
<div className="bain-card p-6 sm:p-7 h-full flex flex-col">
|
||||
<div className="flex items-baseline gap-2 mb-3">
|
||||
<span className="text-xl sm:text-2xl font-black text-ink leading-none">
|
||||
{item.value}
|
||||
</span>
|
||||
<span className="text-sm font-semibold text-text-secondary">{item.label}</span>
|
||||
</div>
|
||||
<p className="text-sm text-text-secondary leading-relaxed mb-4 flex-1">{item.desc}</p>
|
||||
<div className="text-xs text-text-muted border-t border-border-primary pt-3">
|
||||
数据来源:{canonicalTrustSource(item.source)}
|
||||
</div>
|
||||
</div>
|
||||
</StaggerReveal>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 章节式叙事区:问题 → 方法 → 结果(Storytelling-Driven)=====
|
||||
const NARRATIVE_ACTS = [
|
||||
{
|
||||
number: '01',
|
||||
title: '诊断现状',
|
||||
desc: '从业务目标出发,梳理流程断点、数据孤岛与瓶颈环节,形成可量化的诊断结论。',
|
||||
href: '/services/consulting',
|
||||
cta: '了解诊断方法',
|
||||
},
|
||||
{
|
||||
number: '02',
|
||||
title: '设计路径',
|
||||
desc: '基于诊断结论设计系统架构与实施路线图,明确每一阶段的交付物与衡量指标。',
|
||||
href: '/services/solutions',
|
||||
cta: '查看方案设计',
|
||||
},
|
||||
{
|
||||
number: '03',
|
||||
title: '交付成果',
|
||||
desc: '以自研产品组合与专业实施团队完成交付,用真实运营数据验证业务改善,持续迭代。',
|
||||
href: '/products',
|
||||
cta: '浏览产品矩阵',
|
||||
},
|
||||
];
|
||||
|
||||
function NarrativeSection({ pageCopy }: { pageCopy?: HomePageCopy | null }) {
|
||||
const narrativeTitle = (pageCopy?.narrativeTitle || '从问题到结果,\n一条可量化的路径').split('\n');
|
||||
const NARRATIVE_ACTS_CMS = (pageCopy?.narrativeActs?.length ? pageCopy.narrativeActs : NARRATIVE_ACTS) as Array<{
|
||||
number: string;
|
||||
title: string;
|
||||
desc: string;
|
||||
href: string;
|
||||
cta: string;
|
||||
}>;
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-primary" data-testid="narrative-section">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<ScrollReveal className="mb-16 sm:mb-20">
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05]">
|
||||
<StyledTitle lines={narrativeTitle} />
|
||||
</h2>
|
||||
</ScrollReveal>
|
||||
|
||||
<div className="grid md:grid-cols-3 gap-px bg-border-primary">
|
||||
{NARRATIVE_ACTS_CMS.map((act) => (
|
||||
<StaggerReveal key={act.number} staggerDelay={0.05}>
|
||||
<div className="group relative h-full bg-bg-primary p-8 sm:p-10 md:p-12 transition-colors duration-normal hover:bg-bg-secondary">
|
||||
<div className="flex items-start justify-between mb-8">
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="text-4xl sm:text-5xl font-black text-text-hint tabular-nums leading-none"
|
||||
>
|
||||
{act.number}
|
||||
</span>
|
||||
</div>
|
||||
<h3 className="text-xl lg:text-2xl font-bold text-ink mb-4 group-hover:text-brand-ink transition-colors duration-normal">
|
||||
{act.title}
|
||||
</h3>
|
||||
<p className="text-text-secondary leading-relaxed mb-8 text-sm">
|
||||
{act.desc}
|
||||
</p>
|
||||
<div className="pt-6 border-t border-border-primary">
|
||||
<a
|
||||
href={act.href}
|
||||
className="group/link inline-flex items-center min-h-6 gap-2 text-sm font-semibold text-text-secondary group-hover:text-brand-ink transition-colors"
|
||||
>
|
||||
<span>{act.cta}</span>
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover/link:translate-x-1" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</StaggerReveal>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 行业洞察区(对标 Accenture Insights:类型标签 + 内容卡片,思想领导力支柱)=====
|
||||
function InsightsSection({ pageCopy }: { pageCopy?: HomePageCopy | null }) {
|
||||
const eyebrow = (pageCopy?.insightsEyebrow as string) || 'Insights';
|
||||
const titleLines = ((pageCopy?.insightsTitle as string) || '我们的思考,\n以实践为锚').split('\n');
|
||||
const desc = (pageCopy?.insightsDescription as string) || '方法论、观点与共创进展——可验证的思考,不空谈趋势。';
|
||||
const items = (pageCopy?.insightsItems?.length ? pageCopy.insightsItems : FALLBACK_INSIGHTS) as Array<{
|
||||
tag: string;
|
||||
title: string;
|
||||
desc: string;
|
||||
date?: string;
|
||||
href: string;
|
||||
}>;
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-primary" data-testid="insights-section">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<div className="flex flex-col md:flex-row md:items-end md:justify-between gap-8 mb-16 sm:mb-20">
|
||||
<ScrollReveal className="md:max-w-3xl">
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="w-10 h-px bg-brand" />
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-ink">
|
||||
{eyebrow}
|
||||
</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05]">
|
||||
<StyledTitle lines={titleLines} />
|
||||
</h2>
|
||||
<p className="mt-6 text-base sm:text-lg text-text-secondary leading-relaxed max-w-2xl">
|
||||
{desc}
|
||||
</p>
|
||||
</ScrollReveal>
|
||||
<ScrollReveal delay={0.1}>
|
||||
<StaticLink
|
||||
href="/news"
|
||||
className="group inline-flex items-center min-h-6 gap-3 text-ink font-semibold text-sm"
|
||||
>
|
||||
查看全部洞察
|
||||
<ArrowRight className="w-4 h-5 transition-transform duration-normal group-hover:translate-x-2 text-text-secondary group-hover:text-brand-ink" />
|
||||
</StaticLink>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-px bg-border-primary border border-border-primary">
|
||||
{items.slice(0, 4).map((insight, i) => (
|
||||
<StaggerReveal key={i} staggerDelay={0.05}>
|
||||
<a
|
||||
href={insight.href}
|
||||
className="group flex flex-col h-full bg-bg-primary p-8 sm:p-10 md:p-12 transition-colors duration-normal hover:bg-bg-secondary"
|
||||
>
|
||||
<div className="flex items-center justify-between mb-8">
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-ink">
|
||||
{insight.tag}
|
||||
</span>
|
||||
{insight.date && (
|
||||
<span className="text-xs text-text-muted tabular-nums">{insight.date}</span>
|
||||
)}
|
||||
</div>
|
||||
<h3 className="text-xl lg:text-2xl font-bold text-ink mb-4 leading-[1.25] group-hover:text-brand-ink transition-colors duration-normal">
|
||||
{insight.title}
|
||||
</h3>
|
||||
<p className="text-text-secondary leading-relaxed mb-8 text-sm flex-1">
|
||||
{insight.desc}
|
||||
</p>
|
||||
<div className="pt-6 border-t border-border-primary">
|
||||
<span className="inline-flex items-center gap-2 text-sm font-semibold text-text-secondary group-hover:text-brand-ink transition-colors">
|
||||
了解详情
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</StaggerReveal>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 服务区:等宽三列卡片 + 兜底数据 =====
|
||||
function ServicesSection({ services, pageCopy }: { services?: Record<string, any>[]; pageCopy?: HomePageCopy | null }) {
|
||||
const hasValidData = services?.length && (services![0] as any)?.subtitle;
|
||||
const SERVICE_ITEMS = hasValidData
|
||||
? services!.map((s: Record<string, any>) => ({
|
||||
...s,
|
||||
icon: SERVICE_ICON_MAP[s.icon as string] || <Server className="w-7 h-7" />,
|
||||
})) as Record<string, any>[]
|
||||
: FALLBACK_SERVICES;
|
||||
const servicesTitle = (pageCopy?.servicesTitle || '从战略到落地,\n可量化的一站式服务').split('\n');
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-secondary">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<div className="max-w-3xl mb-16 sm:mb-20">
|
||||
<ScrollReveal>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05]">
|
||||
<StyledTitle lines={servicesTitle} />
|
||||
</h2>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6 sm:grid-cols-2">
|
||||
{SERVICE_ITEMS.map((service, i) => (
|
||||
<StaggerReveal key={i} staggerDelay={0.05}>
|
||||
<a href={service.href} className="group bain-card block p-8 sm:p-10 md:p-12 h-full flex flex-col">
|
||||
<div className="flex flex-col flex-1">
|
||||
<div className="flex items-start justify-between mb-10">
|
||||
<div className="w-12 h-12 flex items-center justify-center bg-bg-secondary text-text-secondary" aria-hidden="true">
|
||||
{service.icon}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-6">
|
||||
<span className="block text-sm text-text-muted mb-3 font-medium">{service.subtitle}</span>
|
||||
<h3 className="text-xl lg:text-2xl font-bold text-ink">{service.title}</h3>
|
||||
</div>
|
||||
<p className="text-text-secondary leading-relaxed mb-8 text-sm">{service.desc}</p>
|
||||
<div className="flex flex-wrap gap-2 mb-8">
|
||||
{(Array.isArray(service.highlights) ? service.highlights : []).map((h: string, j: number) => (
|
||||
<span key={j} className="px-3 py-1.5 text-xs text-text-muted border border-border-primary font-medium">
|
||||
{h}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{(service as any).metrics && (
|
||||
<div className="mb-8 pb-8 border-b border-border-primary">
|
||||
<div className="flex gap-6 mb-2">
|
||||
{(service as any).metrics.map((m: any, j: number) => (
|
||||
<div key={j}>
|
||||
<div className="text-2xl sm:text-3xl font-black text-ink leading-none mb-1">{m.value}</div>
|
||||
<div className="text-xs text-text-muted font-medium">{m.label}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<MetricsBasisNote basis={weakestBasis(((service as any).metrics as any[]).map((m) => m.basis))} />
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-auto pt-2">
|
||||
<div className="inline-flex items-center gap-2 text-sm font-semibold text-text-secondary group-hover:text-brand-ink transition-colors">
|
||||
<span>了解详情</span>
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</StaggerReveal>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 创始人观点区(对标 Accenture CEO Quote:大引言 + 署名,人格化背书)=====
|
||||
function FounderQuoteSection({ pageCopy }: { pageCopy?: HomePageCopy | null }) {
|
||||
const eyebrow = (pageCopy?.founderQuoteEyebrow as string) || '创始团队观点';
|
||||
const quoteText = (pageCopy?.founderQuoteText as string) || FALLBACK_FOUNDER_QUOTE.text;
|
||||
const quoteName = (pageCopy?.founderQuoteName as string) || FALLBACK_FOUNDER_QUOTE.name;
|
||||
const quoteRole = (pageCopy?.founderQuoteRole as string) || FALLBACK_FOUNDER_QUOTE.role;
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-brand-section" data-testid="founder-quote-section">
|
||||
{/* 背景纹理:极淡白色点阵(Bain 式深红区块 + 克制质感) */}
|
||||
<div className="absolute inset-0 pointer-events-none opacity-[0.05]"
|
||||
style={{
|
||||
backgroundImage: `radial-gradient(circle at 75% 25%, rgba(255,255,255,0.5) 1px, transparent 1px)`,
|
||||
backgroundSize: '48px 48px',
|
||||
}}
|
||||
/>
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<ScrollReveal className="max-w-4xl mx-auto text-center">
|
||||
<div className="bg-bg-primary/95 rounded-2xl p-8 sm:p-10 md:p-12 max-w-3xl mx-auto shadow-sm border border-brand/10">
|
||||
<div className="flex items-center justify-center gap-3 mb-8">
|
||||
<div className="w-10 h-px bg-brand/40" />
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-ink">
|
||||
{eyebrow}
|
||||
</span>
|
||||
<div className="w-10 h-px bg-brand/40" />
|
||||
</div>
|
||||
<Quote className="w-10 h-10 mx-auto mb-8 text-brand-ink/40" aria-hidden="true" />
|
||||
<blockquote className="text-base sm:text-xl md:text-[28px] font-medium text-ink leading-[1.7] mb-10 border-l-0 pl-0 m-0 max-w-[640px] mx-auto whitespace-pre-line">
|
||||
{quoteText}
|
||||
</blockquote>
|
||||
{(quoteName || quoteRole) && (
|
||||
<div className="flex flex-col items-center gap-1">
|
||||
{quoteName && (
|
||||
<div className="text-base font-semibold text-ink">{quoteName}</div>
|
||||
)}
|
||||
{quoteRole && (
|
||||
<div className="text-sm text-text-secondary">{quoteRole}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 共创流程(可验证方法论,不虚构客户)=====
|
||||
const CO_CREATION_STEPS = [
|
||||
{ step: '01', title: '业务诊断', desc: '深入理解业务场景,识别高价值切入点' },
|
||||
{ step: '02', title: '方案共创', desc: '与核心团队共同设计解决方案与实施路径' },
|
||||
{ step: '03', title: '验证发布', desc: '以真实运营数据验证成效,经授权后公开案例' },
|
||||
];
|
||||
|
||||
// ===== 案例区:Client Spotlight(对标 Accenture:深色大卡 spotlight + 其余小卡)=====
|
||||
function CasesSection({ cases, pageCopy }: { cases?: Record<string, any>[]; pageCopy?: HomePageCopy | null }) {
|
||||
const hasValidData = cases?.length && cases[0]?.metrics;
|
||||
const CASE_ITEMS = hasValidData ? cases! : [];
|
||||
const casesEyebrow = pageCopy?.casesEyebrow || '共创进行时';
|
||||
const casesTitleLines = (pageCopy?.casesTitle || '每一个项目,\n都以业务改善为衡量标准').split('\n');
|
||||
const casesDesc = pageCopy?.casesDescription || '我们正与首批客户共同打磨产品与方案,以真实运营数据验证业务改善。';
|
||||
const earlyLabel = pageCopy?.earlyAccessLabel || EARLY_ACCESS.label;
|
||||
const earlyDesc = pageCopy?.earlyAccessDesc || EARLY_ACCESS.desc;
|
||||
|
||||
if (CASE_ITEMS.length === 0) {
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-primary">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<div className="grid lg:grid-cols-2 gap-12 items-center">
|
||||
<ScrollReveal>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="w-10 h-px bg-brand" />
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-ink">
|
||||
{casesEyebrow}
|
||||
</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05] mb-8">
|
||||
<StyledTitle lines={casesTitleLines} />
|
||||
</h2>
|
||||
<p className="text-text-secondary leading-relaxed text-lg">
|
||||
{casesDesc}
|
||||
</p>
|
||||
</ScrollReveal>
|
||||
<ScrollReveal delay={0.15}>
|
||||
<div className="relative overflow-hidden rounded-[2rem] bg-dark-bg p-10 sm:p-12 h-full flex flex-col shadow-card">
|
||||
{/* 背景纹理:极淡白色点阵(对标埃森哲深色 spotlight 画布) */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none opacity-[0.05]"
|
||||
style={{
|
||||
backgroundImage: `radial-gradient(circle at 75% 25%, rgba(255,255,255,0.5) 1px, transparent 1px)`,
|
||||
backgroundSize: '48px 48px',
|
||||
}}
|
||||
/>
|
||||
<div className="relative z-10 flex flex-col h-full">
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="w-10 h-px bg-brand" />
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-light">
|
||||
{casesEyebrow}
|
||||
</span>
|
||||
</div>
|
||||
<Quote className="w-8 h-8 mb-6 text-white/30" aria-hidden="true" />
|
||||
<div className="text-4xl sm:text-5xl font-black text-white tabular-nums leading-none mb-4">
|
||||
{earlyLabel}
|
||||
</div>
|
||||
<p className="text-white/70 leading-relaxed mb-10">{earlyDesc}</p>
|
||||
<ol className="space-y-5 mb-10">
|
||||
{CO_CREATION_STEPS.map((s) => (
|
||||
<li key={s.step} className="flex items-start gap-4">
|
||||
<span className="text-sm font-black text-brand-light tabular-nums leading-6 shrink-0">
|
||||
{s.step}
|
||||
</span>
|
||||
<div>
|
||||
<div className="text-sm font-semibold text-white mb-0.5">{s.title}</div>
|
||||
<div className="text-sm text-white/60 leading-relaxed">{s.desc}</div>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<div className="mt-auto">
|
||||
<CTAButton href="/contact" dataTestId="cases-co-creation-cta">
|
||||
{CTA_LABELS.consult}
|
||||
</CTAButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const [spotlightCase, ...restCases] = CASE_ITEMS;
|
||||
const spotlightTestimonial = spotlightCase?.testimonial as Record<string, any> | undefined;
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-primary">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<div className="flex flex-col md:flex-row md:items-end md:justify-between gap-8 mb-16 sm:mb-20">
|
||||
<ScrollReveal className="md:max-w-3xl">
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05]">
|
||||
<StyledTitle lines={casesTitleLines} />
|
||||
</h2>
|
||||
</ScrollReveal>
|
||||
<ScrollReveal delay={0.1}>
|
||||
<StaticLink
|
||||
href="/cases"
|
||||
className="group inline-flex items-center min-h-6 gap-3 text-ink font-semibold text-sm"
|
||||
>
|
||||
查看全部案例
|
||||
<ArrowRight className="w-4 h-5 transition-transform duration-normal group-hover:translate-x-2 text-text-secondary group-hover:text-brand-ink" />
|
||||
</StaticLink>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
|
||||
{/* Client Spotlight 大卡:深色画布 + 客户引言 + 量化成果(对标 Accenture) */}
|
||||
{spotlightCase && (
|
||||
<ScrollReveal className="mb-6">
|
||||
<a
|
||||
href={spotlightCase.href || `/cases/${spotlightCase.slug || ''}`}
|
||||
className="group relative block overflow-hidden rounded-[2rem] bg-dark-bg p-10 sm:p-14 h-full flex flex-col shadow-card"
|
||||
>
|
||||
{/* 背景纹理:极淡白色点阵 */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none opacity-[0.05]"
|
||||
style={{
|
||||
backgroundImage: `radial-gradient(circle at 75% 25%, rgba(255,255,255,0.5) 1px, transparent 1px)`,
|
||||
backgroundSize: '48px 48px',
|
||||
}}
|
||||
/>
|
||||
<div className="relative z-10 flex flex-col lg:flex-row lg:items-stretch gap-10 lg:gap-16">
|
||||
<div className="flex flex-col flex-1">
|
||||
<div className="flex items-center gap-3 mb-8">
|
||||
<Badge className="bg-white/10 text-white border-transparent">
|
||||
{spotlightCase.industry}
|
||||
</Badge>
|
||||
{spotlightCase.verified && (
|
||||
<Badge className="bg-brand/15 text-brand-light border-brand/30">
|
||||
已获客户授权
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<h3 className="text-2xl sm:text-3xl lg:text-4xl font-black text-white leading-[1.15] mb-8">
|
||||
{spotlightCase.title}
|
||||
</h3>
|
||||
{spotlightTestimonial?.quote && (
|
||||
<blockquote className="max-w-2xl">
|
||||
<Quote className="w-6 h-6 text-brand-light mb-4" aria-hidden="true" />
|
||||
<p className="text-white/80 text-lg leading-relaxed">
|
||||
{spotlightTestimonial.quote}
|
||||
</p>
|
||||
{(spotlightTestimonial.author || spotlightTestimonial.name) && (
|
||||
<footer className="mt-4 text-sm text-white/60">
|
||||
{spotlightTestimonial.author || spotlightTestimonial.name}
|
||||
{spotlightTestimonial.role && ` · ${spotlightTestimonial.role}`}
|
||||
</footer>
|
||||
)}
|
||||
</blockquote>
|
||||
)}
|
||||
<div className="mt-auto pt-6 border-t border-white/10 flex items-center justify-between gap-6 flex-wrap">
|
||||
<span className="inline-flex items-center gap-2 text-sm font-semibold text-white group-hover:text-brand-light transition-colors">
|
||||
查看完整案例
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="lg:w-[38%] shrink-0">
|
||||
<div className="grid grid-cols-3 lg:grid-cols-1 gap-6 lg:gap-8 h-full">
|
||||
{spotlightCase.metrics?.slice(0, 3).map((metric: Record<string, any>, j: number) => (
|
||||
<div key={j} className={cn('lg:py-4', j < 2 && 'lg:border-b lg:border-white/10')}>
|
||||
<div className={cn(
|
||||
'text-3xl sm:text-4xl font-black leading-none mb-2 tabular-nums',
|
||||
j === 0 ? 'text-brand-light' : 'text-white'
|
||||
)}>
|
||||
{metric.value}
|
||||
</div>
|
||||
<div className="text-sm text-white/60 font-medium leading-tight">
|
||||
{metric.label}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</ScrollReveal>
|
||||
)}
|
||||
|
||||
{restCases.length > 0 && (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{restCases.map((caseItem, i) => (
|
||||
<ScrollReveal key={i} delay={i * 0.1}>
|
||||
<a
|
||||
href={caseItem.href || `/cases/${caseItem.slug || ''}`}
|
||||
className="group bain-card block p-8 sm:p-10 h-full flex flex-col"
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-8">
|
||||
<Badge className="bg-bg-secondary text-ink border-transparent">
|
||||
{caseItem.industry}
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
<h3 className="text-xl lg:text-2xl font-bold text-ink mb-8 leading-[1.2]">
|
||||
{caseItem.title}
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-3 gap-4 mb-8">
|
||||
{(Array.isArray(caseItem.metrics) ? caseItem.metrics : []).slice(0, 3).map((metric: Record<string, any>, j: number) => (
|
||||
<div key={j}>
|
||||
<div className={cn(
|
||||
'text-xl sm:text-2xl font-black leading-none mb-2',
|
||||
j === 0 ? 'text-brand-ink' : 'text-ink'
|
||||
)}>
|
||||
{metric.value}
|
||||
</div>
|
||||
<div className="text-xs text-text-secondary font-medium leading-tight">
|
||||
{metric.label}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto pt-4 border-t border-border-primary">
|
||||
<div className="inline-flex items-center gap-2 text-sm font-semibold text-text-secondary group-hover:text-brand-ink transition-colors">
|
||||
<span>了解详情</span>
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</ScrollReveal>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 新闻动态区(对标 Accenture News:最近 3 条 + 查看全部入口)=====
|
||||
function NewsSection({ news, pageCopy }: { news?: NewsItem[]; pageCopy?: HomePageCopy | null }) {
|
||||
const eyebrow = (pageCopy?.newsEyebrow as string) || '新闻动态';
|
||||
const titleLines = ((pageCopy?.newsTitle as string) || '公司要闻\n与研发动态').split('\n');
|
||||
const ctaLabel = (pageCopy?.newsCtaLabel as string) || '查看全部新闻';
|
||||
const NEWS_ITEMS = (news?.length ? news.slice(0, 3) : NEWS.slice(0, 3)) as NewsItem[];
|
||||
|
||||
return (
|
||||
<section className="relative py-20 sm:py-28 md:py-36 overflow-hidden bg-bg-secondary" data-testid="news-section">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<div className="flex flex-col md:flex-row md:items-end md:justify-between gap-8 mb-16 sm:mb-20">
|
||||
<ScrollReveal className="md:max-w-3xl">
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="w-10 h-px bg-brand" />
|
||||
<span className="text-[13px] tracking-[0.12em] font-semibold text-brand-ink">
|
||||
{eyebrow}
|
||||
</span>
|
||||
</div>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05]">
|
||||
<StyledTitle lines={titleLines} />
|
||||
</h2>
|
||||
</ScrollReveal>
|
||||
<ScrollReveal delay={0.1}>
|
||||
<StaticLink
|
||||
href="/news"
|
||||
className="group inline-flex items-center min-h-6 gap-3 text-ink font-semibold text-sm"
|
||||
>
|
||||
{ctaLabel}
|
||||
<ArrowRight className="w-4 h-5 transition-transform duration-normal group-hover:translate-x-2 text-text-secondary group-hover:text-brand-ink" />
|
||||
</StaticLink>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
{NEWS_ITEMS.map((item, i) => (
|
||||
<ScrollReveal key={item.id} delay={i * 0.1}>
|
||||
<StaticLink
|
||||
href={`/news/${item.id}`}
|
||||
className="group bain-card block p-8 sm:p-9 h-full flex flex-col"
|
||||
>
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<Badge variant="outline" className="text-xs border-brand/30 text-brand-ink">
|
||||
{item.category}
|
||||
</Badge>
|
||||
<span className="flex items-center gap-1.5 text-xs text-text-muted">
|
||||
<Calendar className="w-3.5 h-3.5" aria-hidden="true" />
|
||||
{item.date}
|
||||
</span>
|
||||
</div>
|
||||
<h3 className="text-lg lg:text-xl font-bold text-ink mb-4 leading-[1.3] line-clamp-2 group-hover:text-brand-ink transition-colors duration-normal">
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="text-sm text-text-secondary leading-relaxed mb-6 line-clamp-2 flex-1">
|
||||
{item.excerpt}
|
||||
</p>
|
||||
<div className="pt-4 border-t border-border-primary">
|
||||
<span className="inline-flex items-center gap-2 text-sm font-semibold text-text-secondary group-hover:text-brand-ink transition-colors">
|
||||
阅读全文
|
||||
<ArrowRight className="w-4 h-4 transition-transform duration-normal group-hover:translate-x-1" />
|
||||
</span>
|
||||
</div>
|
||||
</StaticLink>
|
||||
</ScrollReveal>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== CTA 区:克制强调,品牌红仅用于按钮 =====
|
||||
function CTASection({ heroData, pageCopy }: { heroData?: Record<string, any> | null; pageCopy?: HomePageCopy | null }) {
|
||||
const ctaTitleLine1 = heroData?.ctaTitleLine1 || pageCopy?.ctaTitleLine1 || '准备好开始了吗?';
|
||||
const ctaTitleLine2 = heroData?.ctaTitleLine2 || pageCopy?.ctaTitleLine2 || '让数据真正转化为业务增长';
|
||||
const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel || (pageCopy?.ctaLabel as string)) || CTA_LABELS.consult;
|
||||
const ctaHref = heroData?.ctaHref || '/contact';
|
||||
|
||||
return (
|
||||
<section className="relative py-24 sm:py-32 md:py-40 overflow-hidden bg-bg-secondary">
|
||||
<div className="max-w-container mx-auto px-4 sm:px-6 lg:px-10 relative z-10">
|
||||
<ScrollReveal className="max-w-3xl">
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-black text-ink tracking-tight leading-[1.05] mb-10 sm:mb-14">
|
||||
{ctaTitleLine1}
|
||||
<br />
|
||||
{ctaTitleLine2}
|
||||
</h2>
|
||||
<CTAButton href={ctaHref}>{ctaLabel}</CTAButton>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 主页面组件 =====
|
||||
export default function HomeContentV15({ services, cases, stats, heroData, news, pageCopy }: {
|
||||
services?: Record<string, any>[];
|
||||
cases?: Record<string, any>[];
|
||||
stats?: Record<string, any>[];
|
||||
heroData?: Record<string, any> | null;
|
||||
news?: NewsItem[];
|
||||
pageCopy?: HomePageCopy | null;
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
{/* 1. Hero:浅色 editorial 画布 + 品牌红单电压(参考 Accenture Radical Relevance) */}
|
||||
<HeroSection heroData={heroData} />
|
||||
|
||||
{/* 1.5 成果带:数据指标下沉,滚动触发(Glance 层,声明先行的承接) */}
|
||||
<HeroStatsBand stats={stats} />
|
||||
|
||||
{/* 2. 信任区:量化数据成果展示 */}
|
||||
<TrustSection pageCopy={pageCopy} />
|
||||
|
||||
{/* 3. 章节式叙事:问题 → 方法 → 结果 */}
|
||||
<NarrativeSection pageCopy={pageCopy} />
|
||||
|
||||
{/* 4. 行业洞察:思想领导力支柱(对标 Accenture Insights) */}
|
||||
<InsightsSection pageCopy={pageCopy} />
|
||||
|
||||
{/* 5. 服务区:等宽卡片 + 兜底数据 */}
|
||||
<ServicesSection services={services} pageCopy={pageCopy} />
|
||||
|
||||
{/* 6. 创始人观点:人格化背书(对标 Accenture CEO Quote) */}
|
||||
<FounderQuoteSection pageCopy={pageCopy} />
|
||||
|
||||
{/* 7. 案例区:轻量快照卡片 */}
|
||||
<CasesSection cases={cases} pageCopy={pageCopy} />
|
||||
|
||||
{/* 8. 新闻动态:持续动态(对标 Accenture News) */}
|
||||
<NewsSection news={news} pageCopy={pageCopy} />
|
||||
|
||||
{/* 9. CTA:克制强调,品牌红仅用于按钮 */}
|
||||
<CTASection heroData={heroData} pageCopy={pageCopy} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import HomeContentV16 from './home-content-v16';
|
||||
|
||||
jest.mock('@/components/ui/scroll-reveal', () => ({
|
||||
ScrollReveal: ({ children, className, ...rest }: { children: React.ReactNode; className?: string; [k: string]: unknown }) => (
|
||||
<div className={className} {...rest}>{children}</div>
|
||||
),
|
||||
// 必须透传其余 props(尤其 data-testid)—— 只解构 children/className 的话,
|
||||
// 挂在 StaggerReveal 上的 testid 会被静默丢掉,测试就找不到自己声称在验的那个容器。
|
||||
StaggerReveal: ({ children, className, ...rest }: { children: React.ReactNode; className?: string; [k: string]: unknown }) => (
|
||||
<div className={className} {...rest}>{children}</div>
|
||||
),
|
||||
}));
|
||||
jest.mock('@/components/ui/page-decoration', () => ({
|
||||
SectionLabel: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
|
||||
EASE_OUT: [0.22, 1, 0.36, 1],
|
||||
}));
|
||||
jest.mock('@/components/ui/static-link', () => ({
|
||||
StaticLink: ({ children, href, ...rest }: { children: React.ReactNode; href: string; [k: string]: unknown }) => (
|
||||
<a href={href} {...rest}>{children}</a>
|
||||
),
|
||||
}));
|
||||
jest.mock('@/components/ui/cta-button', () => ({
|
||||
// mock 必须复现真实组件的 variant 默认值('primary'),否则不传 variant 的主动作
|
||||
// 会渲染成 data-variant={undefined},下面「恰好一个主动作」的计数就永远是 0 ——
|
||||
// 那是测试替身造假,不是实现有问题。
|
||||
CTAButton: ({ children, href, variant = 'primary', dataTestId }: { children: React.ReactNode; href: string; variant?: string; dataTestId?: string }) => (
|
||||
<a href={href} data-variant={variant} data-testid={dataTestId ?? 'cta-button'}>{children}</a>
|
||||
),
|
||||
}));
|
||||
jest.mock('@/components/ui/metrics-basis-note', () => ({
|
||||
MetricsBasisNote: ({ basis }: { basis?: string }) => (
|
||||
<p data-testid="metrics-basis-note">{`basis:${basis ?? 'none'}`}</p>
|
||||
),
|
||||
}));
|
||||
jest.mock('@/components/detail/l3-signals-slot', () => ({
|
||||
L3SignalsSlot: ({ heading }: { heading?: string }) => <div data-testid="l3-signals">{heading}</div>,
|
||||
}));
|
||||
jest.mock('@/components/sections/results-slot', () => {
|
||||
const Real = jest.requireActual('@/components/sections/results-slot');
|
||||
return {
|
||||
...Real,
|
||||
ResultsSlot: ({ state }: { state: { kind: string } }) => (
|
||||
<div data-testid={`results-slot-${state.kind}`} />
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
const heroData = { heading: '测试主张', subheading: '副文', ctaLabel: '预约咨询', ctaHref: '/contact', secondaryCtaLabel: '看行业实践', secondaryCtaHref: '/solutions' };
|
||||
|
||||
const baseProps = {
|
||||
heroData,
|
||||
services: [
|
||||
{ id: 'consulting', title: '战略咨询', description: '规划', highlights: ['业务诊断', '蓝图'] },
|
||||
{ id: 'software', title: '企业软件', description: '交付', highlights: ['架构'] },
|
||||
],
|
||||
solutions: [
|
||||
{ id: 'manufacturing', title: '制造业', painPoints: ['库存不透明', '排产靠经验'] },
|
||||
{ id: 'retail', title: '贸易零售', painPoints: ['多渠道割裂'] },
|
||||
],
|
||||
stats: [
|
||||
{ value: '6', label: '款自研产品', basis: 'team-history' },
|
||||
{ value: '40%', label: '平均效率提升', basis: 'target' },
|
||||
],
|
||||
trustSignals: [
|
||||
{ value: '100%', label: '私有化部署', basis: 'target' },
|
||||
// 与 stats 里同 label ⇒ 合并必须去重,否则"合并"就变成"两份真源并排显示"
|
||||
{ value: '9.9%', label: '平均效率提升', basis: 'verified' },
|
||||
],
|
||||
cases: [] as Record<string, unknown>[],
|
||||
news: [{ id: 'n1', title: '动态一', excerpt: '摘要', date: '2026-08', category: '公司动态' as never, content: '', image: '' }],
|
||||
pageCopy: { insightsTitle: '我们怎么判断' },
|
||||
};
|
||||
|
||||
function renderHome(overrides: Partial<typeof baseProps> = {}) {
|
||||
return render(<HomeContentV16 {...baseProps} {...overrides} />);
|
||||
}
|
||||
|
||||
describe('首页 v16 段序', () => {
|
||||
it('八段全部在场,且删除的两段不再出现', () => {
|
||||
renderHome();
|
||||
for (const id of ['hero-section', 'home-ledger', 'l3-signals', 'results-slot-co-creation', 'home-insights', 'home-industries', 'home-capabilities', 'home-cta']) {
|
||||
expect(screen.getByTestId(id)).toBeInTheDocument();
|
||||
}
|
||||
// NarrativeSection / FounderQuoteSection 已整块删除
|
||||
expect(screen.queryByText(/问题 → 方法 → 结果/)).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[data-testid="founder-quote"]')).toBeNull();
|
||||
});
|
||||
|
||||
it('Hero 不再挂持续粒子层(两家对标实测都没有背景循环运动,CONTEXT.md:81 也禁止)', () => {
|
||||
renderHome();
|
||||
expect(document.querySelector('[data-testid="hero-particle-field"]')).toBeNull();
|
||||
});
|
||||
|
||||
it('Hero 主张先行 + 一个主动作 + 一个次动作,且不在 hero 内塞数字', () => {
|
||||
renderHome();
|
||||
expect(screen.getByRole('heading', { level: 1 }).textContent).toBe('测试主张');
|
||||
const hero = screen.getByTestId('hero-section');
|
||||
expect(hero.querySelectorAll('[data-variant="primary"]').length).toBe(1);
|
||||
expect(hero.querySelectorAll('[data-variant="secondary"]').length).toBe(1);
|
||||
expect(hero.textContent).not.toContain('40%');
|
||||
});
|
||||
|
||||
it('承诺句用单一真源,hero 里不出现 7×24 这类不可验证承诺', () => {
|
||||
renderHome();
|
||||
const text = document.body.textContent ?? '';
|
||||
expect(text).toContain('工作日 2 小时内回复您的咨询');
|
||||
expect(text).not.toMatch(/7\s*[×x]\s*24/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('数字账本(HeroStatsBand + TrustSection 合并)', () => {
|
||||
it('两段合并后按 label 去重 —— 同 label 只留先出现的那条', () => {
|
||||
renderHome();
|
||||
const ledger = screen.getByTestId('home-ledger');
|
||||
expect(ledger.textContent).toContain('款自研产品');
|
||||
expect(ledger.textContent).toContain('私有化部署');
|
||||
expect(ledger.textContent).not.toContain('9.9%');
|
||||
});
|
||||
|
||||
/**
|
||||
* 浏览器实测逼出来的分层:TRUST_SIGNALS 里有 成都 / 全流程 / 共创 这种**不是数字**的条目,
|
||||
* 全按 63px 成果数字渲染会让全页最响的一块装着三个名词 —— 正是对标反对的数据大字报。
|
||||
* 合并的目标是"一段而不是两段",不是"把定性信号冒充成指标"。
|
||||
*/
|
||||
it('定量条目走大数字,定性条目降级成小字行 —— 两者不再抢同一种强调', () => {
|
||||
renderHome({
|
||||
stats: [{ value: '40%', label: '效率提升', basis: 'target' }],
|
||||
trustSignals: [
|
||||
{ value: '成都', label: '本地化服务', basis: 'team-history' },
|
||||
{ value: '全流程', label: '陪伴式交付', basis: 'target' },
|
||||
],
|
||||
});
|
||||
const big = [...screen.getByTestId('home-ledger-metrics').querySelectorAll('.text-5xl')];
|
||||
expect(big.map((n) => n.textContent)).toEqual(['40%']);
|
||||
|
||||
const signals = screen.getByTestId('home-ledger-signals');
|
||||
expect(signals.textContent).toContain('成都');
|
||||
expect(signals.textContent).toContain('全流程');
|
||||
// 定性条目绝不允许拿到 .text-5xl 那一档
|
||||
expect(signals.querySelectorAll('.text-5xl')).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('全是数字时不渲染定性那一行(不留一个空的 hr)', () => {
|
||||
renderHome({ trustSignals: [{ value: '99.9%', label: '可用性', basis: 'target' }] });
|
||||
expect(screen.queryByTestId('home-ledger-signals')).toBeNull();
|
||||
});
|
||||
|
||||
it('每个数字都是 text-5xl + font-medium + 墨色,不再放大标红(Bain 实测 40px/500/黑)', () => {
|
||||
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('text-text-primary');
|
||||
expect(n.className).not.toContain('text-brand');
|
||||
expect(n.className).not.toContain('font-black');
|
||||
expect(n.className).toContain('tabular-nums');
|
||||
}
|
||||
});
|
||||
|
||||
it('口径角注取**最弱**的那个 basis(混合时不能拿最强的口径给整段背书)', () => {
|
||||
renderHome();
|
||||
expect(screen.getByTestId('metrics-basis-note')).toHaveTextContent('basis:target');
|
||||
});
|
||||
|
||||
it('无数字可用时整段不渲染(不端出一个空的账本)', () => {
|
||||
renderHome({ stats: [], trustSignals: [] });
|
||||
expect(screen.queryByTestId('home-ledger')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('行业网格与能力 accordion', () => {
|
||||
it('行业铺 6 块,链接落在既有 /solutions/{slug}(本轮不换路由)', () => {
|
||||
renderHome();
|
||||
const grid = screen.getByTestId('home-industries');
|
||||
expect(grid.querySelectorAll('a[href^="/solutions/"]').length).toBe(6);
|
||||
// 数据来自传入的 solution 行,不是硬编码
|
||||
expect(grid.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('库存不透明');
|
||||
});
|
||||
|
||||
it('能力 accordion:默认展开第一项,点第二项切换,aria-expanded 随状态变', () => {
|
||||
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();
|
||||
});
|
||||
|
||||
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.every((h) => h?.startsWith('/services/'))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('洞察与成果槽', () => {
|
||||
it('洞察段渲染传入的 news,并给 /insights 的总入口', () => {
|
||||
renderHome();
|
||||
expect(screen.getByText('动态一')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('home-insights').textContent).toContain('我们怎么判断');
|
||||
expect(screen.getByRole('link', { name: /全部洞察/ })).toHaveAttribute('href', '/insights');
|
||||
});
|
||||
|
||||
it('无 news ⇒ 看得见的空态 + 指向方法论,不拿硬编码假洞察顶替', () => {
|
||||
renderHome({ news: [] });
|
||||
expect(screen.getByTestId('home-insights-empty')).toBeInTheDocument();
|
||||
expect(screen.getByText(/公开写作还在积累/)).toBeInTheDocument();
|
||||
expect(screen.queryByText('数字化转型诊断:从哪里开始,如何衡量')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('cases 为 0 行 ⇒ 成果槽落 co-creation,而不是编一个客户', () => {
|
||||
renderHome({ cases: [] });
|
||||
expect(screen.getByTestId('results-slot-co-creation')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('results-slot-ready')).toBeNull();
|
||||
});
|
||||
|
||||
it('有 cases ⇒ 落 ready(由 ResultsSlot 内部的反伪造判据决定是否真能渲染)', () => {
|
||||
const verifiedCase = {
|
||||
id: 'c1', slug: 'x', client: '某制造', industry: '制造业', companySize: '500人',
|
||||
title: '库存周转下降', subtitle: '', challenge: '', solution: '', result: '下降 38%',
|
||||
metrics: [{ value: '38%', label: '周转', basis: 'verified' as const }],
|
||||
timeline: [], services: [], color: 'brand' as const, verified: true,
|
||||
testimonial: { quote: '好', author: '张三', role: '总监', company: '某制造' },
|
||||
};
|
||||
// results-slot 被 mock 成按 kind 出 testid,所以这里只验装配逻辑
|
||||
renderHome({ cases: [verifiedCase] });
|
||||
expect(screen.getByTestId('results-slot-ready')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('透明承诺段在场(提升既有 L3SignalsSlot,不新造组件)', () => {
|
||||
renderHome();
|
||||
expect(screen.getByTestId('l3-signals')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,478 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* 首页 v16 —— 对标实测驱动的段序重构(10 段 → 8 段)。
|
||||
*
|
||||
* 两家对标的首页段序(我自己量的,非二手描述):
|
||||
* Bain :洞察报告轮播 hero → 品牌宣言 → 「Bold steps forward.」客户成果(标题即数字)
|
||||
* → SEE ALL CLIENT RESULTS → 视频 → Our Latest Insights(带分页器)
|
||||
* → What can we help you achieve? → 招聘带
|
||||
* Porsche:video hero → In Focus: News & Trends → Our Industry Expertise(行业网格)
|
||||
* → 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 行(Porsche 的 Our Industry Expertise)
|
||||
* 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 { 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 + 图标。纯读取,不新增数据源 */
|
||||
const INDUSTRY_TILES = [
|
||||
{ slug: 'manufacturing', name: '制造业', icon: Factory },
|
||||
{ slug: 'retail', name: '贸易零售', icon: ShoppingBag },
|
||||
{ slug: 'education', name: '教育培训', icon: GraduationCap },
|
||||
{ slug: 'healthcare', name: '医疗健康', icon: HeartPulse },
|
||||
{ slug: 'finance', name: '金融服务', icon: Landmark },
|
||||
{ slug: 'logistics', name: '物流运输', icon: Truck },
|
||||
] 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="bg-bg-primary border-b border-border-primary"
|
||||
data-testid="hero-section"
|
||||
>
|
||||
{/* min-h 90vh → 70vh:对标两家的 hero 高 722–785px 是**图文影片**,
|
||||
我们是一句宣言,用满屏高度撑一句宣言只会读成空 */}
|
||||
<div className="container-x min-h-[70vh] flex items-center py-20">
|
||||
<div className="max-w-4xl">
|
||||
{/* 朱砂条(1× 档)作唯一装饰 —— 无渐变、无圆角、无描边 */}
|
||||
<span className="block w-10 h-[3px] bg-brand mb-7" aria-hidden="true" />
|
||||
<h1 className="text-4xl sm:text-5xl md:text-6xl font-bold text-text-primary leading-tight tracking-tight">
|
||||
{heading}
|
||||
</h1>
|
||||
{subheading && (
|
||||
<p className="mt-6 text-base md:text-lg text-text-secondary leading-relaxed max-w-2xl">
|
||||
{subheading}
|
||||
</p>
|
||||
)}
|
||||
<div className="mt-10 flex flex-wrap items-center gap-4">
|
||||
<CTAButton href={ctaHref} dataTestId="hero-cta">{ctaLabel}</CTAButton>
|
||||
<CTAButton href={secondaryHref} variant="secondary">{secondaryLabel}</CTAButton>
|
||||
</div>
|
||||
{/* 承诺句走单一真源,不在此硬写数字 */}
|
||||
<p className="mt-8 text-sm text-text-muted">
|
||||
{INQUIRY_RESPONSE_COMMITMENT.text} · {FREE_FIRST_CONSULT.text}
|
||||
</p>
|
||||
</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">
|
||||
{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 eyebrow = '洞察';
|
||||
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>
|
||||
<SectionLabel>{eyebrow}</SectionLabel>
|
||||
<div className="flex flex-wrap items-end justify-between gap-4 mt-4">
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold text-text-primary tracking-tight leading-tight max-w-3xl">
|
||||
{heading}
|
||||
</h2>
|
||||
<StaticLink
|
||||
href="/insights"
|
||||
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>
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
|
||||
{items.length === 0 ? (
|
||||
<div className="bain-card p-8 mt-10" 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>
|
||||
) : (
|
||||
<StaggerReveal className="grid gap-4 md:grid-cols-2 mt-10">
|
||||
{items.map((n) => (
|
||||
<StaticLink
|
||||
key={n.id}
|
||||
href={`/news/${n.id}`}
|
||||
className="bain-card block p-7 transition-colors duration-hover hover:border-border-rule"
|
||||
>
|
||||
<div className="flex items-center gap-3 text-xs text-text-muted mb-3">
|
||||
<span className="text-brand-ink font-medium">{n.category}</span>
|
||||
<span className="tabular-nums">{n.date}</span>
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold text-text-primary leading-snug">{n.title}</h3>
|
||||
<p className="mt-2 text-sm text-text-secondary leading-relaxed">{n.excerpt}</p>
|
||||
</StaticLink>
|
||||
))}
|
||||
</StaggerReveal>
|
||||
)}
|
||||
</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>
|
||||
<SectionLabel>行业</SectionLabel>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold text-text-primary tracking-tight leading-tight mt-4 max-w-3xl">
|
||||
按行业的问题空间,不是按我们的产品线
|
||||
</h2>
|
||||
</ScrollReveal>
|
||||
|
||||
<StaggerReveal className="grid grid-cols-2 md:grid-cols-3 gap-px mt-10 bg-border-primary">
|
||||
{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="bg-bg-primary p-6 transition-colors duration-hover hover:bg-bg-tertiary"
|
||||
>
|
||||
<Icon className="w-5 h-5 text-brand-ink" aria-hidden="true" />
|
||||
<div className="mt-4 text-base font-semibold text-text-primary">{tile.name}</div>
|
||||
{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 text-text-muted leading-relaxed">
|
||||
{String(p)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</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">
|
||||
<ScrollReveal>
|
||||
<SectionLabel>能力</SectionLabel>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold text-text-primary tracking-tight leading-tight mt-4 max-w-3xl">
|
||||
四种陪跑方式
|
||||
</h2>
|
||||
<p className="mt-4 text-base text-text-secondary leading-relaxed max-w-2xl">
|
||||
对标 Porsche Consulting 的「What Moves Our Clients」:能力用 accordion 承载,
|
||||
而不是四张等宽卡片 —— 卡片把四件事压成同一视觉重量,accordion 允许逐个展开。
|
||||
</p>
|
||||
</ScrollReveal>
|
||||
|
||||
<div className="mt-10 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="w-full flex items-center justify-between gap-6 py-6 text-left transition-colors duration-hover hover:text-brand-ink min-h-[64px]"
|
||||
>
|
||||
<span className="flex items-baseline gap-5">
|
||||
<span className="text-sm font-medium tabular-nums text-text-muted" aria-hidden="true">
|
||||
{String(i + 1).padStart(2, '0')}
|
||||
</span>
|
||||
<span className="text-lg md:text-xl font-semibold text-text-primary">{title}</span>
|
||||
</span>
|
||||
<span className={cn('text-2xl leading-none text-text-muted transition-transform duration-hover', open && 'rotate-45')} aria-hidden="true">
|
||||
+
|
||||
</span>
|
||||
</button>
|
||||
{open && (
|
||||
<div id={`cap-panel-${id}`} role="region" className="pb-8 pl-[3.25rem] pr-2">
|
||||
<p className="text-sm text-text-secondary leading-relaxed max-w-2xl">
|
||||
{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 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>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/* ───────────────── 8. CTA ───────────────── */
|
||||
|
||||
function HomeCta({ heroData }: { heroData?: Row | null }) {
|
||||
const ctaHref = (heroData?.ctaHref as string) || '/contact';
|
||||
return (
|
||||
<section className="bg-bg-secondary border-t border-border-primary" data-testid="home-cta">
|
||||
<div className="container-x py-20 md:py-28 text-center">
|
||||
<ScrollReveal>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold text-text-primary tracking-tight leading-tight">
|
||||
现在有什么卡住你了?
|
||||
</h2>
|
||||
<p className="mt-4 text-base text-text-secondary max-w-2xl mx-auto leading-relaxed">
|
||||
{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">看方法论</CTAButton>
|
||||
</div>
|
||||
</ScrollReveal>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/* ───────────────── 装配 ───────────────── */
|
||||
|
||||
export default function HomeContentV16({
|
||||
services,
|
||||
solutions,
|
||||
cases,
|
||||
stats,
|
||||
heroData,
|
||||
news,
|
||||
pageCopy,
|
||||
trustSignals,
|
||||
}: {
|
||||
services?: CapabilityRow[];
|
||||
solutions?: Row[];
|
||||
cases?: Row[];
|
||||
stats?: Row[];
|
||||
heroData?: Row | null;
|
||||
news?: NewsItem[];
|
||||
pageCopy?: Record<string, unknown> | null;
|
||||
trustSignals?: Row[];
|
||||
}) {
|
||||
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>
|
||||
<HomeHero heroData={heroData} />
|
||||
<NumberLedger stats={stats} trustSignals={trustSignals} />
|
||||
|
||||
{/* 3 透明承诺 + 4 客户成果槽:两段合读才成立 —— 先说"我们用什么建立信任",
|
||||
再明说"成果这一格现在是空的、为什么空" */}
|
||||
<L3SignalsSlot
|
||||
heading="在数据之外,我们用透明度建立信任"
|
||||
description="客户案例与资质认证需获得授权后才能公开;在那之前,以下四个锚点是我们可验证的承诺。"
|
||||
/>
|
||||
<ResultsSlot state={resultsState} />
|
||||
|
||||
<InsightsBlock news={news} pageCopy={pageCopy} />
|
||||
<IndustryGridBlock solutions={solutions} />
|
||||
<CapabilitiesAccordion services={services} />
|
||||
<HomeCta heroData={heroData} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,13 +8,18 @@ jest.mock('@/lib/cms/data-server', () => ({
|
||||
getHomePageCopy: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('./home-content-v15', () => ({
|
||||
jest.mock('./home-content-v16', () => ({
|
||||
__esModule: true,
|
||||
default: function MockHomeContentV15(props: Record<string, unknown>) {
|
||||
// 改名叫 V16:page.tsx 已改渲染 v16。留 v15 的话这个 mock 就是**惰性 mock** ——
|
||||
// 它会静默不拦截任何东西,测试转而渲染真实组件,
|
||||
// 于是「home-content」这些 testid 根本不存在,断言靠偶然通过或偶然失败。
|
||||
default: function MockHomeContentV16(props: Record<string, unknown>) {
|
||||
return (
|
||||
<div data-testid="home-content">
|
||||
<div data-testid="services-count">{(props.services as unknown[])?.length ?? 0}</div>
|
||||
<div data-testid="cases-count">{(props.cases as unknown[])?.length ?? 0}</div>
|
||||
<div data-testid="solutions-count">{(props.solutions as unknown[])?.length ?? 0}</div>
|
||||
<div data-testid="trust-count">{(props.trustSignals as unknown[])?.length ?? 0}</div>
|
||||
<div data-testid="stats-count">{(props.stats as unknown[])?.length ?? 0}</div>
|
||||
<div data-testid="news-count">{(props.news as unknown[])?.length ?? 0}</div>
|
||||
<div data-testid="hero-data">{props.heroData ? JSON.stringify(props.heroData) : 'null'}</div>
|
||||
@@ -105,6 +110,57 @@ describe('HomePage', () => {
|
||||
expect(screen.getByTestId('news-count')).toHaveTextContent('1');
|
||||
});
|
||||
|
||||
/**
|
||||
* 本轮修掉的既有缺陷的回归锁:库里 home-solutions 与 home-news 两个 zone **确有编排内容**,
|
||||
* 旧 page.tsx 只读 hero/stats/services/cases 四个,把这两个整个丢弃 ——
|
||||
* 等于后台在运营一个页面上不存在的开关。之所以长期没被发现,是因为 v15 的
|
||||
* NewsSection / InsightsSection 各自 import 了硬编码 NEWS / FALLBACK_INSIGHTS 兜底,
|
||||
* 把「zone 被忽略」渲染成了「看起来有内容」:兜底在这里起的是遮蔽作用,不是降级作用。
|
||||
*/
|
||||
it('solutions 与 news 两个 zone 必须真的透传到首页(旧实装丢弃了它们)', async () => {
|
||||
mockedGetResolvedHomeZones.mockResolvedValue({
|
||||
hero: [createMockItem('hero-banner', { heading: 'H' })],
|
||||
solutions: [
|
||||
createMockItem('solution', { id: 'manufacturing', title: '制造业' }),
|
||||
createMockItem('solution', { id: 'retail', title: '贸易零售' }),
|
||||
],
|
||||
news: [createMockItem('news', { id: 'n1', title: '动态一' })],
|
||||
});
|
||||
|
||||
const page = await HomePage();
|
||||
render(page);
|
||||
|
||||
expect(screen.getByTestId('solutions-count')).toHaveTextContent('2');
|
||||
expect(screen.getByTestId('news-count')).toHaveTextContent('1');
|
||||
});
|
||||
|
||||
it('有 zone 但只配了 cases 之外的段 ⇒ 仍走 zone 分支(不能因为 cases 空就整体回退)', async () => {
|
||||
// resolver 会为每个已配置的 zone 建键,home-cases 的 items 是空数组(case-study 0 行)。
|
||||
// 若用 `Object.keys(zones).length > 0` 判定,"有键但那段为空"会被当成"有编排";
|
||||
// 若反过来用 some(len>0),则必须保证非空段仍走 zone 分支 —— 这条钉住后者。
|
||||
mockedGetResolvedHomeZones.mockResolvedValue({
|
||||
hero: [],
|
||||
stats: [],
|
||||
services: [],
|
||||
cases: [],
|
||||
solutions: [createMockItem('solution', { id: 'finance', title: '金融服务' })],
|
||||
news: [],
|
||||
});
|
||||
|
||||
const page = await HomePage();
|
||||
render(page);
|
||||
expect(screen.getByTestId('solutions-count')).toHaveTextContent('1');
|
||||
// 走 zone 分支时不该再去查直连模型
|
||||
expect(mockedGetPublishedItems).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('后台没配 trustSignals ⇒ 回落到 constants 里那份带 source 的真实信号,而不是空数组', async () => {
|
||||
mockedGetResolvedHomeZones.mockResolvedValue({ hero: [createMockItem('hero-banner', { heading: 'H' })] });
|
||||
const page = await HomePage();
|
||||
render(page);
|
||||
expect(Number(screen.getByTestId('trust-count').textContent)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('handles empty zones gracefully', async () => {
|
||||
mockedGetResolvedHomeZones.mockResolvedValue({
|
||||
hero: [],
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
import { getPublishedItems, getResolvedHomeZones, getHomePageCopy } from '@/lib/cms/data-server';
|
||||
import type { NewsItem } from '@/lib/constants/news';
|
||||
import HomeContentV15 from './home-content-v15';
|
||||
import { TRUST_SIGNALS } from '@/lib/constants/company';
|
||||
import HomeContentV16 from './home-content-v16';
|
||||
|
||||
export const revalidate = 3600;
|
||||
|
||||
/** zone key → 首页那一段。六个 zone 全部读齐是本轮修掉的既有缺陷(见下方注释) */
|
||||
const ZONE_KEYS = ['hero', 'stats', 'services', 'solutions', 'cases', 'news'] as const;
|
||||
|
||||
export default async function HomePage() {
|
||||
const zones = await getResolvedHomeZones();
|
||||
const hasZones = Object.keys(zones).length > 0;
|
||||
// 逐键判定而非 `Object.keys(zones).length > 0`:
|
||||
// resolver 会给每个已配置的 zone 建键,**home-cases 的 items 是空数组**
|
||||
// (case-study 0 行),所以"有键"不等于"那段有内容"。
|
||||
const hasZones = ZONE_KEYS.some((k) => (zones[k]?.length ?? 0) > 0);
|
||||
|
||||
let services: Record<string, unknown>[] = [];
|
||||
let solutions: Record<string, unknown>[] = [];
|
||||
let cases: Record<string, unknown>[] = [];
|
||||
let stats: Record<string, unknown>[] = [];
|
||||
let heroData: Record<string, unknown> | null = null;
|
||||
@@ -16,12 +24,15 @@ export default async function HomePage() {
|
||||
|
||||
if (hasZones) {
|
||||
services = zones.services?.map((item) => item.data) ?? [];
|
||||
solutions = zones.solutions?.map((item) => item.data) ?? [];
|
||||
cases = zones.cases?.map((item) => item.data) ?? [];
|
||||
stats = zones.stats?.map((item) => item.data) ?? [];
|
||||
heroData = zones.hero?.[0]?.data ?? null;
|
||||
news = zones.news?.map((item) => item.data as unknown as NewsItem) ?? [];
|
||||
} else {
|
||||
const [serviceItems, caseItems, statItems, heroItems, newsItems] = await Promise.all([
|
||||
const [serviceItems, solutionItems, caseItems, statItems, heroItems, newsItems] = await Promise.all([
|
||||
getPublishedItems('service'),
|
||||
getPublishedItems('solution'),
|
||||
getPublishedItems('case-study'),
|
||||
getPublishedItems('stat-item'),
|
||||
getPublishedItems('hero-banner'),
|
||||
@@ -29,21 +40,41 @@ export default async function HomePage() {
|
||||
]);
|
||||
|
||||
services = serviceItems.map((item) => item.data);
|
||||
solutions = solutionItems.map((item) => item.data);
|
||||
cases = caseItems.map((item) => item.data);
|
||||
stats = statItems.map((item) => item.data);
|
||||
heroData = heroItems[0]?.data ?? null;
|
||||
news = newsItems.map((item) => item.data as unknown as NewsItem);
|
||||
}
|
||||
|
||||
// 首页各章节结构性文案(信任信号/叙事情节/标题/CTA),CMS 未配置时为 null(组件内部兜底)
|
||||
const homePageCopy = await getHomePageCopy().catch(() => null);
|
||||
/**
|
||||
* 修掉的既有缺陷(2026-10-16 查出):
|
||||
* 旧实现只读了 hero / stats / services / cases 四个 zone,**home-solutions 与 home-news
|
||||
* 两个 zone 在库里确有编排内容**(home-news 挂了 2 条、home-solutions 挂了多条),
|
||||
* 却被整个丢弃 —— 等于后台在运营一个页面上不存在的开关。
|
||||
* 之所以一直没被发现:v15 的 NewsSection 与 InsightsSection 各自 import 了硬编码的
|
||||
* NEWS / FALLBACK_INSIGHTS 兜底,把"zone 被忽略"这件事渲染成了"看起来有内容"。
|
||||
* ⇒ 兜底数据在这里起的是**遮蔽**作用,不是降级作用。
|
||||
*/
|
||||
|
||||
return <HomeContentV15
|
||||
services={services}
|
||||
cases={cases}
|
||||
stats={stats}
|
||||
heroData={heroData}
|
||||
news={news}
|
||||
pageCopy={homePageCopy?.data ?? null}
|
||||
/>;
|
||||
const homePageCopy = await getHomePageCopy().catch(() => null);
|
||||
const copyData = (homePageCopy?.data ?? null) as Record<string, unknown> | null;
|
||||
|
||||
// 信任信号:后台可覆盖,未配置则回到 constants 里那份带 source 的真实信号
|
||||
const trustSignals = Array.isArray(copyData?.trustSignals)
|
||||
? (copyData!.trustSignals as Record<string, unknown>[])
|
||||
: [...TRUST_SIGNALS]; // 常量是 as const 只读元组,转成可变数组喂给 Row[]
|
||||
|
||||
return (
|
||||
<HomeContentV16
|
||||
services={services}
|
||||
solutions={solutions}
|
||||
cases={cases}
|
||||
stats={stats}
|
||||
heroData={heroData}
|
||||
news={news}
|
||||
pageCopy={copyData}
|
||||
trustSignals={trustSignals}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -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"
|
||||
>
|
||||
平均响应时间 < 2小时 · 7×24小时技术支持 · 无需预付费用
|
||||
{CTA_COMMITMENT_LINE}
|
||||
</motion.p>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -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(/不可发布/);
|
||||
});
|
||||
});
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,15 @@
|
||||
import type { MetricBasis } from './metrics-basis';
|
||||
export interface CaseMetric {
|
||||
value: string;
|
||||
label: string;
|
||||
highlight?: boolean;
|
||||
/**
|
||||
* 佐证口径(2026-10-16 新增)。原本这个类型**没有 basis 字段** ——
|
||||
* 而仓库早有 metrics-basis 契约(target / team-history / verified + MetricsBasisNote),
|
||||
* 案例指标却是全站最容易被当成"已发生事实"的数字,缺这一维等于开了个编造的后门。
|
||||
* ResultsSlot 的 ready 态要求**至少一个指标 basis === 'verified'**,靠的就是这里。
|
||||
*/
|
||||
basis?: MetricBasis;
|
||||
}
|
||||
|
||||
export interface CaseTimelinePhase {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { describe, it, expect } from '@jest/globals';
|
||||
import {
|
||||
SERVICE_COMMITMENTS,
|
||||
INQUIRY_RESPONSE_COMMITMENT,
|
||||
CTA_COMMITMENT_LINE,
|
||||
type Commitment,
|
||||
} from './commitments';
|
||||
|
||||
/**
|
||||
* DEC-N30 的结构性闭合:不是「挑一条留下」,而是让
|
||||
* 「同一件事被写成两个不同数字」在类型层就不可能发生。
|
||||
* 每条用例都要能失败 —— 见文件末尾的负向自证。
|
||||
*/
|
||||
describe('服务承诺单一真源', () => {
|
||||
it('每个承诺对象至多一条(这条就是"四条互斥 SLA"的根治)', () => {
|
||||
const abouts = SERVICE_COMMITMENTS.map((c) => c.about);
|
||||
expect(new Set(abouts).size).toBe(abouts.length);
|
||||
});
|
||||
|
||||
it('响应时间只允许出现一个数字', () => {
|
||||
const responseClaims = SERVICE_COMMITMENTS.filter((c) => c.about === 'inquiry-response');
|
||||
expect(responseClaims).toHaveLength(1);
|
||||
const numbers = responseClaims[0]!.text.match(/\d+\s*(小时|分钟|天)/g) ?? [];
|
||||
expect(numbers).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('禁止 7×24 类不可验证承诺(小团队在任何一次夜间延迟上都会自破)', () => {
|
||||
const text = SERVICE_COMMITMENTS.map((c) => c.text).join('');
|
||||
expect(text).not.toMatch(/7\s*[×x]\s*24/i);
|
||||
expect(text).not.toMatch(/24\s*小时(在线|支持|不间断)/);
|
||||
});
|
||||
|
||||
it('交付周期不许用小时数承诺(排期未定,承诺数字等于编数字)', () => {
|
||||
const delivery = SERVICE_COMMITMENTS.filter((c) => c.about === 'proposal-delivery');
|
||||
for (const d of delivery) {
|
||||
expect(d.text).not.toMatch(/\d+\s*(小时|分钟)/);
|
||||
}
|
||||
});
|
||||
|
||||
it('响应承诺必须带 basis: target(前瞻承诺 ≠ 历史统计)', () => {
|
||||
expect(INQUIRY_RESPONSE_COMMITMENT.basis).toBe('target');
|
||||
for (const c of SERVICE_COMMITMENTS) {
|
||||
expect(['target', 'team-history', 'verified']).toContain(c.basis);
|
||||
}
|
||||
});
|
||||
|
||||
it('CTA 那一行由清单拼出,不再硬写', () => {
|
||||
expect(CTA_COMMITMENT_LINE).toBe(SERVICE_COMMITMENTS.map((c) => c.text).join(' · '));
|
||||
expect(CTA_COMMITMENT_LINE).toContain('工作日 2 小时内回复');
|
||||
});
|
||||
|
||||
/**
|
||||
* 负向自证:把「同一对象写两个数」这个缺陷喂给同一个判据,它必须失败。
|
||||
* 不失败就说明上面那些断言只是在给现状打气。
|
||||
*/
|
||||
it('负向自证:重复对象会被第一条判据抓住', () => {
|
||||
const broken: Commitment[] = [
|
||||
INQUIRY_RESPONSE_COMMITMENT,
|
||||
{ ...INQUIRY_RESPONSE_COMMITMENT, id: 'dup', text: '平均响应时间 <4小时' },
|
||||
];
|
||||
const abouts = broken.map((c) => c.about);
|
||||
expect(new Set(abouts).size).toBeLessThan(abouts.length);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 服务承诺的**单一真源**。
|
||||
*
|
||||
* 为什么要新建这个文件(qa-tracker DEC-N30,本批闭合):
|
||||
* 此前同一件事在四处各自硬写,且彼此冲突 ——
|
||||
* 1. prisma/seed.ts:861,865 「工作日 2 小时内快速响应」
|
||||
* 2. prisma/seeds/services.ts:129 「平均响应时间 <4小时 · 工作日技术支持」
|
||||
* 3. src/components/sections/case-detail-page.tsx:595 「48小时内给出初步方案建议」
|
||||
* 4. src/components/detail/detail-cta-section.tsx:84 「平均响应时间 <2小时 · 7×24小时技术支持」
|
||||
* 台账把这条记为「四条互斥 SLA 留哪一条」。**但四件事并不互斥,问题在于对象没拆开:**
|
||||
* - (1)(2)(4) 说的是**响应时间**,三个数(2h 工作日 / <4h 工作日 / <2h 且 7×24)互相矛盾;
|
||||
* 其中 (4) 最糟:它既不限定工作日、又叠一个 7×24 —— 小团队在任何一次夜间延迟上都会自破。
|
||||
* - (3) 说的是**交付周期**(首次沟通后给出初步建议),这是另一件事,用小时数承诺它
|
||||
* 要为一个还没排期的项目背书。
|
||||
* 所以正确解法不是"四选一",而是:**一个对象只留一个承诺,其余撤下**。
|
||||
*
|
||||
* 保留:响应时间 = 工作日 2 小时内回复(basis: target —— 这是对未来的承诺,
|
||||
* 不是对既成事实的统计,因此可以诚实地写;用 MetricsBasisNote 标明口径)。
|
||||
* 撤下:<4小时(与 2h 同对象冲突)、7×24(不可验证且必然自破)、
|
||||
* 48 小时给出初步方案(交付周期不用小时数承诺)。
|
||||
*
|
||||
* ⚠ 文案改在这里改,**不要**在各页面各写一遍 —— 那正是本轮 drift 的成因。
|
||||
*/
|
||||
|
||||
export type CommitmentBasis = 'target' | 'team-history' | 'verified';
|
||||
|
||||
export interface Commitment {
|
||||
id: string;
|
||||
/** 用户可见的承诺句 */
|
||||
text: string;
|
||||
/** 承诺的对象,用于防止同一件事被写成两个不同数字 */
|
||||
about: 'inquiry-response' | 'proposal-delivery' | 'pricing';
|
||||
basis: CommitmentBasis;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应承诺 —— 全站唯一一条。
|
||||
* `basis: 'target'`:这是前瞻承诺,不是历史统计,因此必须走 MetricsBasisNote 的「目标口径」标注。
|
||||
*/
|
||||
export const INQUIRY_RESPONSE_COMMITMENT: Commitment = {
|
||||
id: 'inquiry-response',
|
||||
text: '工作日 2 小时内回复您的咨询',
|
||||
about: 'inquiry-response',
|
||||
basis: 'target',
|
||||
};
|
||||
|
||||
/** 首次沟通后的交付承诺 —— 刻意不给小时数(排期未定,承诺数字等于编数字) */
|
||||
export const FIRST_CONVERSATION_DELIVERY: Commitment = {
|
||||
id: 'proposal-delivery',
|
||||
text: '首次沟通后,给出问题梳理与初步判断',
|
||||
about: 'proposal-delivery',
|
||||
basis: 'target',
|
||||
};
|
||||
|
||||
/** 费用承诺 —— 与「无需预付费用」「首次咨询免费」原表述合并,去掉重复 */
|
||||
export const FREE_FIRST_CONSULT: Commitment = {
|
||||
id: 'pricing',
|
||||
text: '首次咨询免费,无需预付费用',
|
||||
about: 'pricing',
|
||||
basis: 'target',
|
||||
};
|
||||
|
||||
/**
|
||||
* 对外展示用的承诺清单(顺序即展示顺序)。
|
||||
* 每个 `about` **至多一条** —— 这条不变式由 commitments.test.ts 钉住,
|
||||
* 目的是让「同一件事出现两个不同数字」在代码层就不可能。
|
||||
*/
|
||||
export const SERVICE_COMMITMENTS: readonly Commitment[] = [
|
||||
INQUIRY_RESPONSE_COMMITMENT,
|
||||
FIRST_CONVERSATION_DELIVERY,
|
||||
FREE_FIRST_CONSULT,
|
||||
] as const;
|
||||
|
||||
/** 详情页 CTA 下方那一行的拼接(原来在这里硬写 2h + 7×24) */
|
||||
export const CTA_COMMITMENT_LINE: string = SERVICE_COMMITMENTS.map((c) => c.text).join(' · ');
|
||||
@@ -47,5 +47,8 @@ export const CONSULT_CTA_ALLOWLIST: ReadonlySet<string> = new Set([
|
||||
'预约免费诊断',
|
||||
'联系我们的技术团队',
|
||||
'了解共创合作',
|
||||
// 首页/详情页 ResultsSlot 空态的第二动作:它不是通用预约,而是"报名成为共创客户",
|
||||
// 语义与上面的「了解共创合作」同族。登记而非改文案 —— 白名单就是为可解释的例外存在的。
|
||||
'成为首批共创客户',
|
||||
]);
|
||||
|
||||
@@ -28,13 +28,28 @@ 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-v15.tsx',
|
||||
'src/app/(marketing)/home-content-v16.tsx',
|
||||
// 详情页同样以大数字样式渲染 dataProofs,不得裸奔
|
||||
'src/components/content/sections.tsx',
|
||||
'src/components/detail/detail-trust-section.tsx',
|
||||
'src/components/detail/detail-product-value.tsx',
|
||||
];
|
||||
|
||||
/**
|
||||
* 剥注释但**保留换行条数**,使报出的行号仍指向原文件那一行。
|
||||
*
|
||||
* 为什么必须剥:禁词表的存在前提是「本站零可验证案例,所以任何『源自真实客户案例』式的
|
||||
* 措辞都是编造」—— 那是针对**用户可见文案**的规则。注释不会被用户看到,
|
||||
* 而解释「为什么禁用这句话」的注释里恰恰最容易出现这句话本身。
|
||||
* 不剥注释就只有两条出路:改措辞去绕闸(等于放弃把理由写进代码的能力),
|
||||
* 或者让闸常驻一条已知红。两者都比剥掉差。与 check:grammar 用的是同一条纪律。
|
||||
*/
|
||||
function stripComments(text: string): string {
|
||||
return text
|
||||
.replace(/\/\*[\s\S]*?\*\//g, (m2) => '\n'.repeat((m2.match(/\n/g) ?? []).length))
|
||||
.replace(/(^|[^:'"`\\])\/\/[^\n]*/g, '$1');
|
||||
}
|
||||
|
||||
function collectSourceFiles(dir: string, acc: string[] = []): string[] {
|
||||
for (const entry of readdirSync(dir)) {
|
||||
const full = join(dir, entry);
|
||||
@@ -77,7 +92,7 @@ describe('结果型数字口径角注防线', () => {
|
||||
for (const root of SOURCE_ROOTS) {
|
||||
for (const file of collectSourceFiles(root)) {
|
||||
if (file.endsWith('lib/constants/metrics-basis.ts')) continue;
|
||||
const lines = readFileSync(file, 'utf-8').split('\n');
|
||||
const lines = stripComments(readFileSync(file, 'utf-8')).split('\n');
|
||||
lines.forEach((line, i) => {
|
||||
if (line.includes(METRICS_BASIS_NOTE)) {
|
||||
violations.push(`${file}:${i + 1}`);
|
||||
@@ -171,7 +186,8 @@ describe('虚构佐证禁词防线', () => {
|
||||
const violations: string[] = [];
|
||||
for (const root of SOURCE_ROOTS) {
|
||||
for (const file of collectSourceFiles(root)) {
|
||||
const lines = readFileSync(file, 'utf-8').split('\n');
|
||||
// 只看代码:注释里解释「为什么禁用这句话」时最容易出现这句话本身(详见 stripComments 注释)
|
||||
const lines = stripComments(readFileSync(file, 'utf-8')).split('\n');
|
||||
lines.forEach((line, i) => {
|
||||
const hit = FORBIDDEN_PROOF_PHRASES.find((p) => line.includes(p));
|
||||
if (hit) violations.push(`${file}:${i + 1} ${hit}`);
|
||||
|
||||
Reference in new issue
Block a user