From 009e840fa7809833f12759a66a1a82f709b340e4 Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Fri, 16 Oct 2026 21:00:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(home):=20=E9=A6=96=E9=A1=B5=2010=20?= =?UTF-8?q?=E6=AE=B5=E6=94=B6=208=20=E6=AE=B5=EF=BC=88=E5=AF=B9=E6=A0=87?= =?UTF-8?q?=E6=AE=B5=E5=BA=8F=EF=BC=89+=20=E9=80=8F=E6=98=8E=E4=BF=A1?= =?UTF-8?q?=E4=BB=BB=E5=B1=82=20+=20=E5=8F=8D=E4=BC=AA=E9=80=A0=E6=88=90?= =?UTF-8?q?=E6=9E=9C=E6=8F=92=E6=A7=BD=EF=BC=9BSLA=20=E6=94=B6=E8=BF=9B?= =?UTF-8?q?=E5=8D=95=E4=B8=80=E7=9C=9F=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对标实测的首页段序(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,八段与页脚四栏链接数实测非空 --- src/app/(marketing)/home-content-v15.test.tsx | 267 ----- src/app/(marketing)/home-content-v15.tsx | 994 ------------------ src/app/(marketing)/home-content-v16.test.tsx | 250 +++++ src/app/(marketing)/home-content-v16.tsx | 478 +++++++++ src/app/(marketing)/page.test.tsx | 60 +- src/app/(marketing)/page.tsx | 57 +- src/components/detail/detail-cta-section.tsx | 3 +- src/components/detail/detail.test.tsx | 4 +- src/components/sections/case-detail-page.tsx | 3 +- src/components/sections/results-slot.test.tsx | 139 +++ src/components/sections/results-slot.tsx | 197 ++++ src/lib/constants/cases.ts | 8 + src/lib/constants/commitments.test.ts | 64 ++ src/lib/constants/commitments.ts | 75 ++ src/lib/constants/cta-labels.ts | 3 + src/lib/constants/metrics-basis.test.ts | 22 +- 16 files changed, 1342 insertions(+), 1282 deletions(-) delete mode 100644 src/app/(marketing)/home-content-v15.test.tsx delete mode 100644 src/app/(marketing)/home-content-v15.tsx create mode 100644 src/app/(marketing)/home-content-v16.test.tsx create mode 100644 src/app/(marketing)/home-content-v16.tsx create mode 100644 src/components/sections/results-slot.test.tsx create mode 100644 src/components/sections/results-slot.tsx create mode 100644 src/lib/constants/commitments.test.ts create mode 100644 src/lib/constants/commitments.ts diff --git a/src/app/(marketing)/home-content-v15.test.tsx b/src/app/(marketing)/home-content-v15.test.tsx deleted file mode 100644 index 838569b..0000000 --- a/src/app/(marketing)/home-content-v15.test.tsx +++ /dev/null @@ -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) => ( -
- {children} -
- ), - h1: ({ children, className, ...props }: any) => ( -

{children}

- ), - p: ({ children, className, ...props }: any) => ( -

{children}

- ), - span: ({ children, className, ...props }: any) => ( - {children} - ), - a: ({ children, href, className, ...props }: any) => ( - {children} - ), - }, - 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 - {alt} - ), -})); - -jest.mock('@/components/ui/scroll-reveal', () => ({ - ScrollReveal: ({ children, className }: any) => ( -
{children}
- ), - StaggerReveal: ({ children, className }: any) => ( -
{children}
- ), -})); - -jest.mock('@/components/ui/badge', () => ({ - Badge: ({ children, className }: any) => ( - {children} - ), -})); - -jest.mock('lucide-react', () => { - const mockIcon = (name: string) => { - const Icon = (props: any) => ; - 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(); - - 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(); - - 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(); - - 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(); - - 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(); - - 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(); - - // 复评 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(); - - 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(); - - 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(); - - 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(); - - expect(screen.getByTestId('news-section')).toBeInTheDocument(); - expect(screen.getByText('四川睿新致远科技有限公司正式成立')).toBeInTheDocument(); - expect(screen.getByText('查看全部新闻')).toBeInTheDocument(); - }); - - it('renders CMS-provided news when available', () => { - render(); - - 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(); - - // 空态 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(); - - // 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); - }); -}); diff --git a/src/app/(marketing)/home-content-v15.tsx b/src/app/(marketing)/home-content-v15.tsx deleted file mode 100644 index 8a9a316..0000000 --- a/src/app/(marketing)/home-content-v15.tsx +++ /dev/null @@ -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 = { - Lightbulb: , - Code: , - Server: , - Puzzle: , -}; - -// ===== 服务数据降级兜底(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: , - }, - { - subtitle: 'Software Delivery', - title: '企业软件定制开发', - desc: '基于自研产品矩阵与工程化交付流程,提供从需求分析、架构设计到持续运维的全栈软件开发服务,支撑业务数字化落地。', - highlights: ['需求分析', '架构设计', '敏捷开发', '持续运维'], - metrics: [ - { value: '6', label: '款自研产品' }, - { value: '24/7', label: '运维支持' }, - ], - href: '/services/software', - icon: , - }, - { - subtitle: 'Data Intelligence', - title: '数据智能与 AI 应用', - desc: '构建企业级数据平台与 AI 能力,打通数据孤岛,沉淀数据资产,让决策从经验驱动转向数据驱动。', - highlights: ['数据中台', 'AI 建模', '可视化分析', '预测决策'], - metrics: [ - { value: '98%', label: '数据质量达标率' }, - { value: '10x', label: '分析效率提升' }, - ], - href: '/services/data', - icon: , - }, - { - subtitle: 'Solution Delivery', - title: '行业解决方案落地', - desc: '基于核心团队的行业实践,提供从方案设计、系统开发到上线运维的一站式交付,确保数字化转型真正落地生根。', - highlights: ['行业套件', '定制开发', '系统集成', '持续运维'], - metrics: [ - { value: '6', label: '行业场景覆盖' }, - { value: '99.9%', label: '系统可用性' }, - ], - href: '/services/solutions', - icon: , - }, -]; - -// ===== 行业洞察兜底数据(对标 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; - -// 多行标题渲染:按 \n 分段,输出
换行 -function StyledTitle({ lines }: { lines: (string | undefined)[] }) { - return ( - <> - {lines.map((line, i) => ( - - {i > 0 &&
} - {line} -
- ))} - - ); -} - -// ===== 品牌 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 | null; -}) { - const containerRef = useRef(null); - const spotRef = useRef(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 ( -
{ - 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 && ( -
- ); -} - -// ===== Hero 成果带:数据指标下沉为独立带(声明先行,Glance 层滚动触发)===== -// 设计意图:hero 一屏只负责「一句话声明 + 一个行动」,硬指标移出后由滚动触发, -// 既是 Accenture「single stream 逐步展开」的落地,也避免一屏信息过载。 -function HeroStatsBand({ stats }: { stats?: Record[] }) { - const hasValidStats = stats?.length && stats[0]?.value; - const displayStats = hasValidStats ? stats!.slice(0, 3) : []; - if (displayStats.length === 0) return null; - return ( -
-
- -
- {displayStats.map((stat, i) => ( -
- - {stat.value} - - - {stat.label} - -
- ))} -
-
- s.basis))} className="mt-6" /> -
-
- ); -} - -// ===== 信任/成果区:可验证信任信号 ===== -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 ( -
-
- -
-
- - {eyebrow} - -
-

- -

- - -
- {signals.map((item, i) => ( - -
-
- - {item.value} - - {item.label} -
-

{item.desc}

-
- 数据来源:{canonicalTrustSource(item.source)} -
-
-
- ))} -
-
-
- ); -} - -// ===== 章节式叙事区:问题 → 方法 → 结果(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 ( -
-
- -

- -

-
- -
- {NARRATIVE_ACTS_CMS.map((act) => ( - -
-
- -
-

- {act.title} -

-

- {act.desc} -

- -
-
- ))} -
-
-
- ); -} - -// ===== 行业洞察区(对标 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 ( -
-
-
- -
-
- - {eyebrow} - -
-

- -

-

- {desc} -

- - - - 查看全部洞察 - - - -
- - -
-
- ); -} - -// ===== 服务区:等宽三列卡片 + 兜底数据 ===== -function ServicesSection({ services, pageCopy }: { services?: Record[]; pageCopy?: HomePageCopy | null }) { - const hasValidData = services?.length && (services![0] as any)?.subtitle; - const SERVICE_ITEMS = hasValidData - ? services!.map((s: Record) => ({ - ...s, - icon: SERVICE_ICON_MAP[s.icon as string] || , - })) as Record[] - : FALLBACK_SERVICES; - const servicesTitle = (pageCopy?.servicesTitle || '从战略到落地,\n可量化的一站式服务').split('\n'); - - return ( -
- -
- ); -} - -// ===== 创始人观点区(对标 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 ( -
- {/* 背景纹理:极淡白色点阵(Bain 式深红区块 + 克制质感) */} -
-
- -
-
-
- - {eyebrow} - -
-
-
- -
-
- ); -} - -// ===== 共创流程(可验证方法论,不虚构客户)===== -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[]; 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 ( -
-
-
- -
-
- - {casesEyebrow} - -
-

- -

-

- {casesDesc} -

- - -
- {/* 背景纹理:极淡白色点阵(对标埃森哲深色 spotlight 画布) */} -
-
-
-
- - {casesEyebrow} - -
-
-
- -
-
-
- ); - } - - const [spotlightCase, ...restCases] = CASE_ITEMS; - const spotlightTestimonial = spotlightCase?.testimonial as Record | undefined; - - return ( -
-
-
- -

- -

-
- - - 查看全部案例 - - - -
- - {/* Client Spotlight 大卡:深色画布 + 客户引言 + 量化成果(对标 Accenture) */} - {spotlightCase && ( - - - {/* 背景纹理:极淡白色点阵 */} -
-
-
-
- - {spotlightCase.industry} - - {spotlightCase.verified && ( - - 已获客户授权 - - )} -
-

- {spotlightCase.title} -

- {spotlightTestimonial?.quote && ( -
-
- )} -
- - 查看完整案例 - - -
-
-
-
- {spotlightCase.metrics?.slice(0, 3).map((metric: Record, j: number) => ( -
-
- {metric.value} -
-
- {metric.label} -
-
- ))} -
-
-
-
- - )} - - {restCases.length > 0 && ( - - )} -
-
- ); -} - -// ===== 新闻动态区(对标 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 ( -
-
-
- -
-
- - {eyebrow} - -
-

- -

- - - - {ctaLabel} - - - -
- -
- {NEWS_ITEMS.map((item, i) => ( - - -
- - {item.category} - - - -
-

- {item.title} -

-

- {item.excerpt} -

-
- - 阅读全文 - - -
-
-
- ))} -
-
-
- ); -} - -// ===== CTA 区:克制强调,品牌红仅用于按钮 ===== -function CTASection({ heroData, pageCopy }: { heroData?: Record | 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 ( -
-
- -

- {ctaTitleLine1} -
- {ctaTitleLine2} -

- {ctaLabel} -
-
-
- ); -} - -// ===== 主页面组件 ===== -export default function HomeContentV15({ services, cases, stats, heroData, news, pageCopy }: { - services?: Record[]; - cases?: Record[]; - stats?: Record[]; - heroData?: Record | null; - news?: NewsItem[]; - pageCopy?: HomePageCopy | null; -}) { - return ( -
- {/* 1. Hero:浅色 editorial 画布 + 品牌红单电压(参考 Accenture Radical Relevance) */} - - - {/* 1.5 成果带:数据指标下沉,滚动触发(Glance 层,声明先行的承接) */} - - - {/* 2. 信任区:量化数据成果展示 */} - - - {/* 3. 章节式叙事:问题 → 方法 → 结果 */} - - - {/* 4. 行业洞察:思想领导力支柱(对标 Accenture Insights) */} - - - {/* 5. 服务区:等宽卡片 + 兜底数据 */} - - - {/* 6. 创始人观点:人格化背书(对标 Accenture CEO Quote) */} - - - {/* 7. 案例区:轻量快照卡片 */} - - - {/* 8. 新闻动态:持续动态(对标 Accenture News) */} - - - {/* 9. CTA:克制强调,品牌红仅用于按钮 */} - -
- ); -} diff --git a/src/app/(marketing)/home-content-v16.test.tsx b/src/app/(marketing)/home-content-v16.test.tsx new file mode 100644 index 0000000..444ce70 --- /dev/null +++ b/src/app/(marketing)/home-content-v16.test.tsx @@ -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 }) => ( +
{children}
+ ), + // 必须透传其余 props(尤其 data-testid)—— 只解构 children/className 的话, + // 挂在 StaggerReveal 上的 testid 会被静默丢掉,测试就找不到自己声称在验的那个容器。 + StaggerReveal: ({ children, className, ...rest }: { children: React.ReactNode; className?: string; [k: string]: unknown }) => ( +
{children}
+ ), +})); +jest.mock('@/components/ui/page-decoration', () => ({ + SectionLabel: ({ children }: { children: React.ReactNode }) => {children}, + 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 }) => ( + {children} + ), +})); +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 }) => ( + {children} + ), +})); +jest.mock('@/components/ui/metrics-basis-note', () => ({ + MetricsBasisNote: ({ basis }: { basis?: string }) => ( +

{`basis:${basis ?? 'none'}`}

+ ), +})); +jest.mock('@/components/detail/l3-signals-slot', () => ({ + L3SignalsSlot: ({ heading }: { heading?: string }) =>
{heading}
, +})); +jest.mock('@/components/sections/results-slot', () => { + const Real = jest.requireActual('@/components/sections/results-slot'); + return { + ...Real, + ResultsSlot: ({ state }: { state: { kind: string } }) => ( +
+ ), + }; +}); + +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[], + news: [{ id: 'n1', title: '动态一', excerpt: '摘要', date: '2026-08', category: '公司动态' as never, content: '', image: '' }], + pageCopy: { insightsTitle: '我们怎么判断' }, +}; + +function renderHome(overrides: Partial = {}) { + return render(); +} + +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(); + }); +}); diff --git a/src/app/(marketing)/home-content-v16.tsx b/src/app/(marketing)/home-content-v16.tsx new file mode 100644 index 0000000..b8d8ece --- /dev/null +++ b/src/app/(marketing)/home-content-v16.tsx @@ -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; + +/** 行业网格: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 ( +
+ {/* min-h 90vh → 70vh:对标两家的 hero 高 722–785px 是**图文影片**, + 我们是一句宣言,用满屏高度撑一句宣言只会读成空 */} +
+
+ {/* 朱砂条(1× 档)作唯一装饰 —— 无渐变、无圆角、无描边 */} +
+
+
+ ); +} + +/* ───────────────── 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(); + 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 ( +
+
+ {metrics.length > 0 && ( + /* testid 挂在外层普通 div 上,不挂在 StaggerReveal 上: + 真实的 StaggerReveal/ScrollReveal 解构固定 prop 列表、**不透传未知属性**, + 所以 data-* 会被静默丢弃(本轮浏览器实测抓到,而 jsdom 单测因 mock 透传了 + props 而全绿 —— 典型的「mock 比实现宽松」)。 + grid 类仍留在 StaggerReveal 上:QA Q-5 记过「grid 放外层容器会让卡片堆成单列」, + 这里外层只是打标,不参与布局。props 透传本身留给组件清理那一批统一做。 */ +
+ + {metrics.map((e) => ( +
+ {/* 实测对标:Bain 的 500+ / $300M / 2.5x 是 40px / 字重 500 / 纯黑。 + --font-size-5xl = 2.25rem,桌面根字号 18px 下正好 40.5px ⇒ 零新增 token。 + 原 v15 的 font-black + text-brand-ink 是把 ADR-0004 决策四的误读实现了出来。 */} +
+ {e.value} +
+
{e.label}
+
+ ))} +
+
+ )} + + {/* 定性信号:留在同一段内(合并的意义),但视觉重量降到配角 —— + 小字 + 分隔点,不与上面的数字争同一种强调 */} + {signals.length > 0 && ( +
    0 ? 'mt-10 pt-8 border-t border-border-primary' : 'mt-0', + )} + data-testid="home-ledger-signals" + > + {signals.map((e) => ( +
  • + {e.value} + + {e.label} +
  • + ))} +
+ )} + + +
+
+ ); +} + +/* ───────────────── 5. 洞察(原 Insights + News 合并)───────────────── */ + +function InsightsBlock({ news, pageCopy }: { news?: NewsItem[]; pageCopy?: Record | null }) { + const items = (news ?? []).slice(0, 4); + const eyebrow = '洞察'; + const heading = (pageCopy?.insightsTitle as string) || '我们怎么判断、怎么交付'; + + return ( +
+
+ + {eyebrow} +
+

+ {heading} +

+ + 全部洞察 + +
+
+ + {items.length === 0 ? ( +
+

+ 公开写作还在积累。可以先看{' '} + + 方法论 + + ,它说明我们怎么工作。 +

+
+ ) : ( + + {items.map((n) => ( + +
+ {n.category} + {n.date} +
+

{n.title}

+

{n.excerpt}

+
+ ))} +
+ )} +
+
+ ); +} + +/* ───────────────── 6. 行业网格 ───────────────── */ + +function IndustryGridBlock({ solutions }: { solutions?: Row[] }) { + const bySlug = new Map((solutions ?? []).map((s) => [String(s.id ?? s.slug ?? ''), s])); + + return ( +
+
+ + 行业 +

+ 按行业的问题空间,不是按我们的产品线 +

+
+ + + {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 ( + + + ); + })} + +
+
+ ); +} + +/* ───────────────── 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(rows[0]?.id ?? null); + + if (rows.length === 0) return null; + + return ( +
+
+ + 能力 +

+ 四种陪跑方式 +

+

+ 对标 Porsche Consulting 的「What Moves Our Clients」:能力用 accordion 承载, + 而不是四张等宽卡片 —— 卡片把四件事压成同一视觉重量,accordion 允许逐个展开。 +

+
+ +
+ {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 ( +
+ + {open && ( +
+

+ {String(s.description ?? '')} +

+ {highlights.length > 0 && ( +
    + {highlights.map((h) => ( +
  • {h}
  • + ))} +
+ )} + + 了解这一能力 + +
+ )} +
+ ); + })} +
+
+
+ ); +} + +/* ───────────────── 8. CTA ───────────────── */ + +function HomeCta({ heroData }: { heroData?: Row | null }) { + const ctaHref = (heroData?.ctaHref as string) || '/contact'; + return ( +
+
+ +

+ 现在有什么卡住你了? +

+

+ {COMPANY_INFO.displayName}的定位是伙伴而非供应商 —— 把问题带来,我们先给判断。 +

+
+ {CTA_LABELS.consult} + 看方法论 +
+
+
+
+ ); +} + +/* ───────────────── 装配 ───────────────── */ + +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 | 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 ( +
+ + + + {/* 3 透明承诺 + 4 客户成果槽:两段合读才成立 —— 先说"我们用什么建立信任", + 再明说"成果这一格现在是空的、为什么空" */} + + + + + + + +
+ ); +} diff --git a/src/app/(marketing)/page.test.tsx b/src/app/(marketing)/page.test.tsx index 1e6ef91..0921680 100644 --- a/src/app/(marketing)/page.test.tsx +++ b/src/app/(marketing)/page.test.tsx @@ -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) { + // 改名叫 V16:page.tsx 已改渲染 v16。留 v15 的话这个 mock 就是**惰性 mock** —— + // 它会静默不拦截任何东西,测试转而渲染真实组件, + // 于是「home-content」这些 testid 根本不存在,断言靠偶然通过或偶然失败。 + default: function MockHomeContentV16(props: Record) { return (
{(props.services as unknown[])?.length ?? 0}
{(props.cases as unknown[])?.length ?? 0}
+
{(props.solutions as unknown[])?.length ?? 0}
+
{(props.trustSignals as unknown[])?.length ?? 0}
{(props.stats as unknown[])?.length ?? 0}
{(props.news as unknown[])?.length ?? 0}
{props.heroData ? JSON.stringify(props.heroData) : 'null'}
@@ -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: [], diff --git a/src/app/(marketing)/page.tsx b/src/app/(marketing)/page.tsx index 8efd722..01541e1 100644 --- a/src/app/(marketing)/page.tsx +++ b/src/app/(marketing)/page.tsx @@ -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[] = []; + let solutions: Record[] = []; let cases: Record[] = []; let stats: Record[] = []; let heroData: Record | 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 ; + const homePageCopy = await getHomePageCopy().catch(() => null); + const copyData = (homePageCopy?.data ?? null) as Record | null; + + // 信任信号:后台可覆盖,未配置则回到 constants 里那份带 source 的真实信号 + const trustSignals = Array.isArray(copyData?.trustSignals) + ? (copyData!.trustSignals as Record[]) + : [...TRUST_SIGNALS]; // 常量是 as const 只读元组,转成可变数组喂给 Row[] + + return ( + + ); } diff --git a/src/components/detail/detail-cta-section.tsx b/src/components/detail/detail-cta-section.tsx index 0d6d4c4..d263a1e 100644 --- a/src/components/detail/detail-cta-section.tsx +++ b/src/components/detail/detail-cta-section.tsx @@ -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}
diff --git a/src/components/detail/detail.test.tsx b/src/components/detail/detail.test.tsx index 7424f8c..f1a0bd0 100644 --- a/src/components/detail/detail.test.tsx +++ b/src/components/detail/detail.test.tsx @@ -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(); }); }); diff --git a/src/components/sections/case-detail-page.tsx b/src/components/sections/case-detail-page.tsx index 6685d6a..d2416e5 100644 --- a/src/components/sections/case-detail-page.tsx +++ b/src/components/sections/case-detail-page.tsx @@ -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}`}