diff --git a/scripts/check-visual-grammar.mjs b/scripts/check-visual-grammar.mjs index dc0998a5..1c3e81d9 100644 --- a/scripts/check-visual-grammar.mjs +++ b/scripts/check-visual-grammar.mjs @@ -96,8 +96,10 @@ const MARKETING_FLOOR = 60; * R18 是**硬禁**(0):签名件(斜线纹 / 双 V / 斜杠)在 2026-11-03 之前全仓零命中, * 没有「存量」可言 —— 登记一个非零上限等于给第二份纹样真源预开一个名额。 * R19 是棘轮(21):营销面实测 21 处 font-extrabold,先登记再随模板批逐页清。 + * R15 于 2026-11-03 由 21 下调到 20:首页 v16→v17 重写时删掉了一处装饰阴影, + * 按「只降不升」的纪律在同一提交里把上限跟着降下来(否则棘轮成了永久豁免)。 */ -const MARKETING_HIT_CEILINGS = { R13: 71, R14: 21, R15: 21, R16: 26, R17: 53, R18: 0, R19: 21 }; +const MARKETING_HIT_CEILINGS = { R13: 71, R14: 21, R15: 20, R16: 26, R17: 53, R18: 0, R19: 21 }; /** * 判据正则一律**不带 g 旗标**。 diff --git a/src/app/(marketing)/home-content-v16.tsx b/src/app/(marketing)/home-content-v16.tsx deleted file mode 100644 index e9a6d8ec..00000000 --- a/src/app/(marketing)/home-content-v16.tsx +++ /dev/null @@ -1,681 +0,0 @@ -'use client'; - -/** - * 首页 v16 —— 对标实测驱动的段序重构(10 段 → 8 段)。 - * - * 两家对标的首页段序(我自己量的,非二手描述): - * Bain :洞察报告轮播 hero → 品牌宣言 → 「Bold steps forward.」客户成果(标题即数字) - * → SEE ALL CLIENT RESULTS → 视频 → Our Latest Insights(带分页器) - * → What can we help you achieve? → 招聘带 - * 对标站点:video hero → 编辑内容(In Focus)→ 行业网格 - * → What Moves Our Clients(4 实践 accordion)→ Empowering Our Clients(8 个案例) - * → Spotlight on AI → 招聘带 → Ready for Change? - * 收敛律:**以编辑内容或客户成果开场;行业成网格;能力做成 accordion; - * 成果单独成一个频道;CTA 收尾且安静。** - * - * 我们填不了其中两格(0 条案例、2 条新闻、无视频、无招聘页),所以诚实的推导是 - * **取其顺序、换其内容、并在区块标题里说明换的是什么**(决策 3 零编造透明路线)。 - * - * 段序变化与理由: - * 1 Hero —— 保留但重设:删 HeroParticleField(两家实测都没有持续背景运动, - * 且 CONTEXT.md:81 明令禁止循环动画);min-h 90vh→70vh(我们是宣言不是影片) - * 2 数字账本 —— HeroStatsBand + TrustSection **合并**:两段都在说"这是我们的数字", - * 那是冗余不是节奏。合并后数字语法改为 text-5xl/字重500/纯黑 - * (Bain 实测;ADR-0004 决策四「超大字号+品牌色」已被证伪) - * 3 透明承诺 —— 提升既有的 L3SignalsSlot,而非新造组件 - * 4 客户成果槽 —— ResultsSlot 取代 CasesSection:留形状、写清状态 - * 5 洞察 —— InsightsSection + NewsSection **合并**(两条本就同轴, - * 且各自都指向 /news = 组件层的竞争真源) - * 6 行业网格 —— 新增,读 solution 模型 6 行(对标站点的行业专长段) - * 7 能力 accordion —— ServicesSection 转换(恰好 4 条 service ⇒ 恰好 4 个实践组) - * 8 CTA —— 保留 - * ✕ NarrativeSection 删除:01/02/03 诊断→设计→交付与 /methodology 重复, - * 其 text-4xl/5xl font-black 装饰编号正是「装饰大字对比度裁决」要防的那个手法 - * ✕ FounderQuoteSection 删除:它是全站唯一 bg-brand-section #8B1530 满幅面, - * 而实测两家都是「饱和红只做点缀、绝不做页面背景」;CEO 引言带是 Accenture 语法, - * 两家都没有。两行 pull-quote 降为第 3 段的正文 - */ -import { useState } from 'react'; -import Image from 'next/image'; -import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal'; -import { StaticLink } from '@/components/ui/static-link'; -import { CTAButton } from '@/components/ui/cta-button'; -import { SectionLabel } from '@/components/ui/page-decoration'; -import { MetricsBasisNote } from '@/components/ui/metrics-basis-note'; -import { L3SignalsSlot } from '@/components/detail/l3-signals-slot'; -import { ResultsSlot, type CoCreationStep, type ResultsSlotState } from '@/components/sections/results-slot'; -import type { CaseStudy } from '@/lib/constants/cases'; -import { weakestBasis } from '@/lib/constants/metrics-basis'; -import { INQUIRY_RESPONSE_COMMITMENT, FREE_FIRST_CONSULT } from '@/lib/constants/commitments'; -import { canonicalCtaLabel, CTA_LABELS } from '@/lib/constants/cta-labels'; -import { COMPANY_INFO } from '@/lib/constants'; -import { cn } from '@/lib/utils'; -import { Factory, ShoppingBag, GraduationCap, HeartPulse, Landmark, Truck, ArrowRight } from 'lucide-react'; -import type { NewsItem } from '@/lib/constants/news'; - -type Row = Record; - -/** - * 行业网格:6 条 solution 行的 industry + 图标 + 氛围图。 - * - * 图片是 AI 生成的**工业/建筑氛围图**,不是客户现场,也不承担任何事实主张: - * 画面里没有人物、没有可读文字、没有客户标识;行业名称与痛点仍只来自 CMS 行。 - * (DESIGN.md「零编造」禁止的是把假图当证据,不是禁止装饰性视觉。) - */ -const INDUSTRY_TILES = [ - { slug: 'manufacturing', name: '制造业', image: '/images/home/industry-manufacturing.webp', icon: Factory }, - { slug: 'retail', name: '贸易零售', image: '/images/home/industry-retail.webp', icon: ShoppingBag }, - { slug: 'education', name: '教育培训', image: '/images/home/industry-education.webp', icon: GraduationCap }, - { slug: 'healthcare', name: '医疗健康', image: '/images/home/industry-healthcare.webp', icon: HeartPulse }, - { slug: 'finance', name: '金融服务', image: '/images/home/industry-finance.webp', icon: Landmark }, - { slug: 'logistics', name: '物流运输', image: '/images/home/industry-logistics.webp', icon: Truck }, -] as const; - -/** 首页新闻卡的封面:氛围图与新闻正文解耦,CMS 里的标题/日期/摘要仍是唯一事实源 */ -const NEWS_COVERS = [ - '/images/home/insight-founding.webp', - '/images/home/insight-digital.webp', -] as const; - -/** 共创阶段的可验证事实 —— 不是案例,也不冒充案例 */ -const CO_CREATION_STEPS: CoCreationStep[] = [ - { label: '问题梳理', desc: '把业务断点写清楚,形成书面诊断' }, - { label: '小步验证', desc: '在一个可衡量的范围内先跑通' }, - { label: '交付物验收', desc: '每阶段有明确交付物与验收指标' }, - { label: '能力交接', desc: '把维护能力留在企业内部' }, -]; - -/* ───────────────────────── 1. Hero ───────────────────────── */ - -function HomeHero({ heroData }: { heroData?: Row | null }) { - const heading = (heroData?.heading as string) || (heroData?.headingBottom as string) - || '让每一家企业都拥有数据驱动的决策能力'; - const subheading = (heroData?.subheading as string) || (heroData?.description as string) || ''; - const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel as string | undefined) || CTA_LABELS.consult; - const ctaHref = (heroData?.ctaHref as string) || '/contact'; - const secondaryLabel = (heroData?.secondaryCtaLabel as string) || '看行业实践'; - const secondaryHref = (heroData?.secondaryCtaHref as string) || '/solutions'; - - return ( -
- {/* 全幅氛围图:画面无人、无可读文字,不承担任何客户/团队事实主张。 - 左侧压暗是为了让黑底内容块与白字 readable,而不是做「暗黑滤镜」。 */} - -
- ); -} - -/* ───────────────── 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 ( -
-
-
-
- ); -} - -/* ───────────────── 5. 洞察(原 Insights + News 合并)───────────────── */ - -function InsightsBlock({ news, pageCopy }: { news?: NewsItem[]; pageCopy?: Record | null }) { - const items = (news ?? []).slice(0, 4); - const [featured, ...rest] = items; - const heading = (pageCopy?.insightsTitle as string) || '我们怎么判断、怎么交付'; - - return ( -
-
- -
-
- 洞察 -

- {heading} -

-
- {/* 咨询机构式「方框箭头 + 文字」的轨:红框只在链接上出现一次,不做满屏红 */} - - - - 全部洞察 - -
-
- - {items.length === 0 ? ( -
-

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

-
- ) : ( -
- {featured && ( - - - -
- ); -} - -/* ───────────────── 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 ( -
-
-
-
- - 能力 -

- 四种陪跑方式 -

-
- -
-
- - -
-
- -
- -
- {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 ( -
- -
- ); -} - -/* ───────────────── 装配 ───────────────── */ - -export default function HomeContentV16({ - services, - solutions, - cases, - stats, - heroData, - news, - pageCopy, - trustSignals, - cmsState = 'ok', -}: { - services?: CapabilityRow[]; - solutions?: Row[]; - cases?: Row[]; - stats?: Row[]; - heroData?: Row | null; - news?: NewsItem[]; - pageCopy?: Record | null; - trustSignals?: Row[]; - /** 由 page.tsx 判定的 CMS 读数状态;视觉用例据此按名字判红,而不是猜像素差 */ - cmsState?: 'ok' | 'empty'; -}) { - const caseRows = cases ?? []; - // 判别式联合要靠显式类型标注收窄 —— 三元直接推会退化成 { kind: string }, - // 那样连编译期都保证不了「ready 一定带 caseItem」 - const resultsState: ResultsSlotState = - caseRows.length > 0 - ? { kind: 'ready', caseItem: caseRows[0] as unknown as CaseStudy } - : { kind: 'co-creation', steps: CO_CREATION_STEPS }; - - return ( -
- {/* 咨询机构的首页节拍:影像开场 → 编辑内容 → 行业网格 → 能力 - → 客户成果 → 信任 → 收尾 CTA。数字账本压成 hero 后的一条窄带, - 不抢「新闻」这一拍。段序变化只动装配顺序,各段的真源与空态判据不变。 */} - - - - - - - {/* 客户成果槽与透明承诺:两段合读才成立 —— 先说"成果这一格现在是空的、为什么空", - 再给四个可验证的信任锚点。 */} - - - - -
- ); -} diff --git a/src/app/(marketing)/home-content-v16.test.tsx b/src/app/(marketing)/home-content-v17.test.tsx similarity index 81% rename from src/app/(marketing)/home-content-v16.test.tsx rename to src/app/(marketing)/home-content-v17.test.tsx index 444ce701..9d46bdcc 100644 --- a/src/app/(marketing)/home-content-v16.test.tsx +++ b/src/app/(marketing)/home-content-v17.test.tsx @@ -1,6 +1,6 @@ -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; -import HomeContentV16 from './home-content-v16'; +import HomeContentV17 from './home-content-v17'; jest.mock('@/components/ui/scroll-reveal', () => ({ ScrollReveal: ({ children, className, ...rest }: { children: React.ReactNode; className?: string; [k: string]: unknown }) => ( @@ -74,10 +74,10 @@ const baseProps = { }; function renderHome(overrides: Partial = {}) { - return render(); + return render(); } -describe('首页 v16 段序', () => { +describe('首页 v17 段序', () => { it('八段全部在场,且删除的两段不再出现', () => { renderHome(); for (const id of ['hero-section', 'home-ledger', 'l3-signals', 'results-slot-co-creation', 'home-insights', 'home-industries', 'home-capabilities', 'home-cta']) { @@ -147,15 +147,21 @@ describe('数字账本(HeroStatsBand + TrustSection 合并)', () => { expect(screen.queryByTestId('home-ledger-signals')).toBeNull(); }); - it('每个数字都是 text-5xl + font-medium + 墨色,不再放大标红(Bain 实测 40px/500/黑)', () => { + /** + * 字重由 500 改 700 是 2026-11-03 的实测更正,不是口味: + * Bain 的成果数字是 40px/500,保时捷这一侧(本轮复刻对象)是 **40px/700**。 + * v16 这条断言背书的是前者;两侧都测过之后取当前对标对象的口径。 + * 不变的半句:数字**不许标红**(红是结论电压,不能被数据条稀释)。 + */ + it('每个数字都是 text-5xl + font-bold + 墨色,不放大标红(对标实测 40px/700/黑)', () => { renderHome(); const nums = [...screen.getByTestId('home-ledger-metrics').querySelectorAll('.text-5xl')]; expect(nums.length).toBeGreaterThan(0); for (const n of nums) { - expect(n.className).toContain('font-medium'); + expect(n.className).toContain('font-bold'); + expect(n.className).not.toContain('font-black'); expect(n.className).toContain('text-text-primary'); expect(n.className).not.toContain('text-brand'); - expect(n.className).not.toContain('font-black'); expect(n.className).toContain('tabular-nums'); } }); @@ -171,40 +177,45 @@ describe('数字账本(HeroStatsBand + TrustSection 合并)', () => { }); }); -describe('行业网格与能力 accordion', () => { - it('行业铺 6 块,链接落在既有 /solutions/{slug}(本轮不换路由)', () => { +/** + * 行业段与能力段在 v17 里换了形制,但**断言的不变量没变**: + * 行业 —— 6 个入口恒在、都落 /solutions/{slug}、痛点只来自数据; + * 能力 —— 4 条 service 全在场、都落 /services/{id}。 + * 变的是载体:行业由 3×2 卡片网格 → 横向标签 + 预览(所以断言收窄到 nav, + * 因为预览区还有一条「查看该行业解决方案」的同向链接);能力由 accordion → 滚动舞台 + * (aria-expanded 是 accordion 的语义,舞台用的是 ol/li + 活动屏切换)。 + */ +describe('行业切换与能力舞台', () => { + const industryLinks = () => + [...screen.getByTestId('home-industries').querySelectorAll('nav a')].map((a) => a.getAttribute('href')); + + it('行业 6 个入口恒在,链接落在既有 /solutions/{slug}(本轮不换路由)', () => { renderHome(); - const grid = screen.getByTestId('home-industries'); - expect(grid.querySelectorAll('a[href^="/solutions/"]').length).toBe(6); + const links = industryLinks(); + expect(links).toHaveLength(6); + expect(links.every((h) => h?.startsWith('/solutions/'))).toBe(true); // 数据来自传入的 solution 行,不是硬编码 - expect(grid.textContent).toContain('库存不透明'); + expect(screen.getByTestId('home-industries').textContent).toContain('库存不透明'); }); it('solution 缺行时仍渲染 6 个行业入口,但不编造痛点', () => { renderHome({ solutions: [] }); - const grid = screen.getByTestId('home-industries'); - expect(grid.querySelectorAll('a[href^="/solutions/"]').length).toBe(6); - expect(grid.textContent).not.toContain('库存不透明'); + expect(industryLinks()).toHaveLength(6); + expect(screen.getByTestId('home-industries').textContent).not.toContain('库存不透明'); }); - it('能力 accordion:默认展开第一项,点第二项切换,aria-expanded 随状态变', () => { + it('能力舞台:4 条 service 全在 DOM(不是只在活动屏渲染),且都是列表项', () => { renderHome(); - const first = screen.getByRole('button', { name: /战略咨询/ }); - const second = screen.getByRole('button', { name: /企业软件/ }); - expect(first).toHaveAttribute('aria-expanded', 'true'); - expect(second).toHaveAttribute('aria-expanded', 'false'); - - fireEvent.click(second); - expect(second).toHaveAttribute('aria-expanded', 'true'); - expect(first).toHaveAttribute('aria-expanded', 'false'); - // 收起后第一项的面板从 DOM 移除(不是隐藏)⇒ 用 query 而不是可见性断言 - expect(screen.queryByText('业务诊断')).not.toBeInTheDocument(); + const stage = screen.getByTestId('home-capabilities'); + expect(stage.querySelectorAll('ol > li')).toHaveLength(2); // baseProps 只给了 2 条 + const titles = [...stage.querySelectorAll('h3')].map((h) => h.textContent); + expect(titles).toEqual(['战略咨询', '企业软件']); }); it('能力项落到 /services/{id},产品入口不占一级段(矩阵在导航第二层)', () => { renderHome(); - fireEvent.click(screen.getByRole('button', { name: /战略咨询/ })); // 收起 const links = [...screen.getByTestId('home-capabilities').querySelectorAll('a')].map((a) => a.getAttribute('href')); + expect(links.length).toBeGreaterThan(0); expect(links.every((h) => h?.startsWith('/services/'))).toBe(true); }); }); diff --git a/src/app/(marketing)/home-content-v17.tsx b/src/app/(marketing)/home-content-v17.tsx new file mode 100644 index 00000000..57b8d7c2 --- /dev/null +++ b/src/app/(marketing)/home-content-v17.tsx @@ -0,0 +1,452 @@ +'use client'; + +/** + * 首页 v17 —— 复刻保时捷咨询的构图语法(P0→P2 阶段的 tracer-bullet)。 + * + * 与 v16 的差别只在**视觉语法与构图**,不在内容:文案、数据真源、空态判据、 + * 诚实语法(basis 口径、未发布明说)一字未改。段序沿用 v16 的 8 段收敛律 + * (编辑内容开场 → 行业成网格 → 能力成舞台 → 成果单独成频道 → CTA 收尾)。 + * + * 逐段改了什么(都得自 2026-11-03 对 Porsche Consulting 中国站的实测): + * 1 Hero 删黑底块 + 6px 红竖条 + 右侧蓝图叠卡 —— 实测首屏是**居中声明压在 + * 全幅影像上**,无框、无容器底、无描边。保留三段压暗(那是可读性, + * 不是滤镜)。右上角一块软版斜线纹,是全站唯一允许的「非接缝」纹理用法。 + * 2 账本 数字由 500 改 700(实测成果数字为 40/700),仍纯黑、不标红。 + * 3 洞察 改为实测的 teaser 语法:图 + 24/700 标题 + 18/400 副标 + 24×3px 红短线。 + * 4 行业 IndustryGridBlock(3×2 卡片网格)→ IndustryTabs(黑带 + 横向标签 + 预览)。 + * 5 能力 CapabilitiesAccordion → StoryStage(滚动驱动的 4 屏编辑舞台)。 + * 6 接缝 两处白↔黑交界各插一块斜线纹桥接块 —— 对标用纹理代替渐变过渡。 + * 7 空带 洞察之后、CTA 之前各一条 120px 命名空白带。 + * 8 CTA 灰带 + 字重分裂声明(64/700 → 64/400)+ 右斜线纹 + 向右双 V。 + * + * 恒久约束(未变):品牌红每页 ≥3 触达点、面积 ≤10%;动效 180–280ms / ease-ink; + * 禁循环装饰动画;未发布内容照旧用可判别空态。 + */ +import Image from 'next/image'; +import { ScrollReveal, StaggerReveal } from '@/components/ui/scroll-reveal'; +import { StaticLink } from '@/components/ui/static-link'; +import { CTAButton } from '@/components/ui/cta-button'; +import { SectionLabel } from '@/components/ui/page-decoration'; +import { MetricsBasisNote } from '@/components/ui/metrics-basis-note'; +import { DisplayStatement } from '@/components/ui/display-statement'; +import { DoubleChevron } from '@/components/ui/double-chevron'; +import { HatchField } from '@/components/ui/hatch-field'; +import { BandSpacer } from '@/components/ui/band-spacer'; +import { IndustryTabs } from '@/components/sections/industry-tabs'; +import { StoryStage } from '@/components/sections/story-stage'; +import { L3SignalsSlot } from '@/components/detail/l3-signals-slot'; +import { ResultsSlot, type CoCreationStep, type ResultsSlotState } from '@/components/sections/results-slot'; +import type { CaseStudy } from '@/lib/constants/cases'; +import { weakestBasis } from '@/lib/constants/metrics-basis'; +import { INQUIRY_RESPONSE_COMMITMENT, FREE_FIRST_CONSULT } from '@/lib/constants/commitments'; +import { canonicalCtaLabel, CTA_LABELS } from '@/lib/constants/cta-labels'; +import { COMPANY_INFO } from '@/lib/constants'; +import { cn } from '@/lib/utils'; +import { ArrowRight } from 'lucide-react'; +import type { NewsItem } from '@/lib/constants/news'; + +type Row = Record; + +/** 首页新闻卡的封面:氛围图与新闻正文解耦,CMS 里的标题/日期/摘要仍是唯一事实源 */ +const NEWS_COVERS = [ + '/images/home/insight-founding.webp', + '/images/home/insight-digital.webp', +] as const; + +/** 共创阶段的可验证事实 —— 不是案例,也不冒充案例 */ +const CO_CREATION_STEPS: CoCreationStep[] = [ + { label: '问题梳理', desc: '把业务断点写清楚,形成书面诊断' }, + { label: '小步验证', desc: '在一个可衡量的范围内先跑通' }, + { label: '交付物验收', desc: '每阶段有明确交付物与验收指标' }, + { label: '能力交接', desc: '把维护能力留在企业内部' }, +]; + +/* ───────────────────────── 1. Hero ───────────────────────── */ + +function HomeHero({ heroData }: { heroData?: Row | null }) { + const heading = (heroData?.heading as string) || (heroData?.headingBottom as string) + || '让每一家企业都拥有数据驱动的决策能力'; + const subheading = (heroData?.subheading as string) || (heroData?.description as string) || ''; + const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel as string | undefined) || CTA_LABELS.consult; + const ctaHref = (heroData?.ctaHref as string) || '/contact'; + const secondaryLabel = (heroData?.secondaryCtaLabel as string) || '看行业实践'; + const secondaryHref = (heroData?.secondaryCtaHref as string) || '/solutions'; + + return ( +
+ + {/* 压暗是为白字可读(实测两家都靠渐变保可读),不是「暗黑滤镜」 */} +
+ ); +} + +/* ───────────────── 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; + }); +} + +/** + * 是否**定量**条目:含数字,或带 % / × / 倍 / 天 / 小时 / 年 等量纲。 + * 合并的目标是「一段而不是两段」,不是把定性信号冒充成指标。 + */ +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 ( +
+
+
+
+ ); +} + +/* ───────────────── 3. 洞察(编辑内容)───────────────── */ + +function InsightsBlock({ news, pageCopy }: { news?: NewsItem[]; pageCopy?: Record | null }) { + const items = (news ?? []).slice(0, 3); + const [featured, ...rest] = items; + const heading = (pageCopy?.insightsTitle as string) || '我们怎么判断、怎么交付'; + + return ( +
+
+ +
+
+ 洞察 +

+ {heading} +

+
+ {/* 咨询机构式「方框箭头 + 文字」的轨:红框只在链接上出现一次 */} + + + + 全部洞察 + +
+
+
+ + {items.length === 0 ? ( +
+
+

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

+
+
+ ) : ( + /* 实测形制:一条灰底出血带托住三张 teaser;卡 = 图 + 24/700 标题 + 18/400 副标 + + 24×3px 红短线。不用卡片边框、不用阴影 —— 分隔交给底色与留白。 */ +
+
+
+ {featured && ( + +
+ +
+

{featured.title}

+

{featured.excerpt}

+
+ )} + +
+ {rest.map((n, i) => ( + +
+ +
+

{n.title}

+

{n.excerpt}

+
+ ))} +
+ + {/* 第三格不是新闻,是方法论入口;用品牌红实底把「编辑内容」与「我们的方法」分开 */} + + + 方法论 + +
+

四阶段推进数字化转型

+

+ 诊断评估、战略规划、落地实施、持续优化四阶段模型,确保数字化项目可衡量落地。 +

+
+ + 查看方法论 + +
+
+
+
+ )} +
+ ); +} + +/* ───────────────── 8. 收束 CTA ───────────────── */ + +function HomeCta({ heroData }: { heroData?: Row | null }) { + const ctaHref = (heroData?.ctaHref as string) || '/contact'; + return ( +
+ {/* 右半幅斜线纹:实测收束段把纹理放在灰带之外、与灰带的直角边相接 */} + +
+ +
+ {/* 字重分裂:同字号、同色,只换字重 —— 一行既响又安静(实测 64/700 + 64/400) */} + +

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

+
+ {CTA_LABELS.consult} + + + 看方法论 + +
+
+ {/* 双 V 落在灰带内、纹理的左侧:红压红纹理会互相吞掉(对标也是把它放在灰带上) */} + +
+
+
+ ); +} + +/* ───────────────── 装配 ───────────────── */ + +export default function HomeContentV17({ + services, + solutions, + cases, + stats, + heroData, + news, + pageCopy, + trustSignals, + cmsState = 'ok', +}: { + services?: Row[]; + solutions?: Row[]; + cases?: Row[]; + stats?: Row[]; + heroData?: Row | null; + news?: NewsItem[]; + pageCopy?: Record | null; + trustSignals?: Row[]; + /** 由 page.tsx 判定的 CMS 读数状态;视觉用例据此按名字判红,而不是猜像素差 */ + cmsState?: 'ok' | 'empty'; +}) { + const caseRows = cases ?? []; + // 判别式联合要靠显式类型标注收窄 —— 三元直接推会退化成 { kind: string } + const resultsState: ResultsSlotState = + caseRows.length > 0 + ? { kind: 'ready', caseItem: caseRows[0] as unknown as CaseStudy } + : { kind: 'co-creation', steps: CO_CREATION_STEPS }; + + const stageSlides = (services ?? []).slice(0, 4).map((s, i) => ({ + id: String(s.id ?? i), + title: String(s.title ?? s.name ?? ''), + description: String(s.description ?? ''), + highlights: Array.isArray(s.highlights) ? (s.highlights as unknown[]).slice(0, 3).map(String) : [], + })); + + return ( +
+ {/* 咨询机构的首页节拍:影像开场 → 数字 → 编辑内容 → 行业 → 能力舞台 + → 成果 → 信任 → 收尾 CTA。两处白↔黑接缝用斜线纹桥接,两处呼吸位用命名空白带。 */} + + + + + + + {stageSlides.length > 0 && ( + + )} + + {/* 接缝:黑底舞台 → 白底成果段。纹理块用负外边距**跨**在交界上(上一半压黑、 + 下一半压白)—— 对标用纹理接缝代替渐变,这是它最好认的一个手法。 */} + + + + + + + +
+ ); +} diff --git a/src/app/(marketing)/page.test.tsx b/src/app/(marketing)/page.test.tsx index 6648c9ae..c321c196 100644 --- a/src/app/(marketing)/page.test.tsx +++ b/src/app/(marketing)/page.test.tsx @@ -8,12 +8,12 @@ jest.mock('@/lib/cms/data-server', () => ({ getHomePageCopy: jest.fn(), })); -jest.mock('./home-content-v16', () => ({ +jest.mock('./home-content-v17', () => ({ __esModule: true, - // 改名叫 V16:page.tsx 已改渲染 v16。留 v15 的话这个 mock 就是**惰性 mock** —— - // 它会静默不拦截任何东西,测试转而渲染真实组件, + // mock 路径必须与 page.tsx 的 import **逐字一致**:留旧版本号的话这个 mock 就是 + // **惰性 mock** —— 它会静默不拦截任何东西,测试转而渲染真实组件, // 于是「home-content」这些 testid 根本不存在,断言靠偶然通过或偶然失败。 - default: function MockHomeContentV16(props: Record) { + default: function MockHomeContentV17(props: Record) { return (
{(props.services as unknown[])?.length ?? 0}
diff --git a/src/app/(marketing)/page.tsx b/src/app/(marketing)/page.tsx index a7566398..b0d7d333 100644 --- a/src/app/(marketing)/page.tsx +++ b/src/app/(marketing)/page.tsx @@ -1,7 +1,7 @@ import { getPublishedItems, getResolvedHomeZones, getHomePageCopy } from '@/lib/cms/data-server'; import type { NewsItem } from '@/lib/constants/news'; import { TRUST_SIGNALS } from '@/lib/constants/company'; -import HomeContentV16 from './home-content-v16'; +import HomeContentV17 from './home-content-v17'; export const revalidate = 3600; @@ -77,7 +77,7 @@ export default async function HomePage() { const cmsState: 'ok' | 'empty' = cmsItemCount > 0 ? 'ok' : 'empty'; return ( -