feat(home): 首屏撤下初创身份强调(用户裁定)+ 主图抽为可换常量

用户裁定:首屏不强调「首批共创 / 初创身份 / 成立时间」。这不是设计层能
判断的(属品牌定位),直接执行,并撤回同日早先的「诚实信号前置为 eyebrow」。

首屏文案
- eyebrow 由「2026 年 1 月成立 · 首批客户共创中」改为纯领域定位「企业数字化转型」
  (取 CMS `hero-banner.eyebrow`,兜底新常量 `HERO_EYEBROW`)
- 副标题去掉成立时间:新增 `canonicalHeroSubheading` 消毒 CMS 历史快照后
  回落 `COMPANY_INFO.description`。为什么必须做兜底:seed 在裁定之前已把旧文案
  写进 `hero-banner` 行,改代码常量管不到库里那份快照(与 canonicalCtaLabel 同族)
- `prisma/seed.ts` 同步(只改源码,未执行 seed —— 写库需单独授权)

主图
- 抽为 `HERO_IMAGE` 常量(第 80 行)。换图(如后续换成都双子塔)只改这一行,
  布局 / 压暗层 / 字号锚点 / 拼贴栅格一律不动
- 常量注释写明换图三条件:无人/无文字/无标识、≥1920 宽、**整体够暗**,
  并指向逐像素对比度量法(§5.55)—— 换亮图会让白字掉出 AA
- 双子塔待办落 `deliverables/hero-twin-towers-TODO.md`:生成额度已用尽
  (4008 quota exceeded,连续两次非冷却),含事实边界(注册地龙泉驿 vs 双子塔高新区,
  相距约 20 公里)与「图只承担情绪、不承载位置主张」的红线

判据
- 新增单测「首屏不强调成立时间 / 首批共创 / 初创身份」:把 seed 旧快照逐字喂进去,
  断言 hero 文本不含成立/首批/共创/初创/年份;并自证副标题确实渲染了(防「不含」
  只是「没有」)。**负对照已做**:关掉消毒器该用例转红,恢复即绿

基线
- 16 张重采(首页 3 类 × 5 project + webkit footer),与归因预测数相等
- 归因更正:webkit footer 我此前判为「并发抖动」是错的 —— 同一张连跑三次
  像素数一字不差(14128),是确定性差异;真因是本批副标题变长令页高 +34px,
  footer 元素截图滚动落点随之变化(亚像素文本重渲染)。记入 §5.59
- 独立只读复跑 **130 passed / 0 failed**

门禁:type-check / type-check:e2e / lint(0 error) / 1855 例 / grammar 20-20 + selftest /
motion / accents / brand-token / check:a11y / headings 11 页 /
test:e2e:prod 272 passed / 首屏对比度 9 视口 × 54 文字盒最低 5.84:1
This commit is contained in:
zhangxiang committed 2026-11-24 23:14:23 +08:00
1 parent 198d6a0303
commit a34bd35d8e
26 files changed
+188 -14

No files matched your search

+31 -1
View File
@@ -47,7 +47,9 @@ jest.mock('@/components/sections/results-slot', () => {
};
});
const heroData = { heading: '测试主张', subheading: '副文', ctaLabel: '预约咨询', ctaHref: '/contact', secondaryCtaLabel: '看行业实践', secondaryCtaHref: '/solutions' };
// `eyebrow` 是 CMS `hero-banner` 的既有字段(seed 里写的是「企业数字化转型」),
// 首屏 eyebrow 现在读它 —— fixture 带上它,才能覆盖「CMS 有值」这条真实路径。
const heroData = { heading: '测试主张', subheading: '副文', eyebrow: '企业数字化转型', ctaLabel: '预约咨询', ctaHref: '/contact', secondaryCtaLabel: '看行业实践', secondaryCtaHref: '/solutions' };
const baseProps = {
heroData,
@@ -102,6 +104,34 @@ describe('首页 v17 段序', () => {
expect(hero.textContent).not.toContain('40%');
});
/**
* 2026-11-24 裁定:**首屏不强调初创身份与成立时间**(用户明确要求)。
* 这条断言把裁定钉在渲染层,防止后续有人「顺手把共创状态加回首屏」——
* 那正是本仓最容易复发的一类改动(文案层的「更诚实」直觉往往指向前置短板)。
*
* 同时覆盖兜底路径:CMS 里那条历史快照(含「公司成立于 2026 年 1 月」)必须被
* `canonicalHeroSubheading` 消毒,否则库里的快照会绕过代码常量直接显示。
*/
it('首屏不强调成立时间 / 首批共创 / 初创身份(含 CMS 历史快照的兜底消毒)', () => {
renderHome({
heroData: {
...heroData,
// 逐字复刻 prisma/seed.ts 改动前写入库的那条快照 —— 判据对这一串永不失敏
subheading: '公司成立于 2026 年 1 月,核心团队专注企业数字化,从战略规划到系统落地,致力于陪伴客户实现可衡量的业务改善。',
eyebrow: '企业数字化转型',
},
});
const hero = screen.getByTestId('hero-section');
const text = hero.textContent ?? '';
expect(text).not.toContain('成立');
expect(text).not.toContain('首批');
expect(text).not.toContain('共创');
expect(text).not.toContain('初创');
expect(text).not.toMatch(/20\d{2}\s*年/);
// 前提自证:hero 里确实渲染了副标题(否则上面「不含」可能只是「没有副标题」)
expect(hero.querySelector('p')?.textContent?.length ?? 0).toBeGreaterThan(10);
});
it('承诺句用单一真源,hero 里不出现 7×24 这类不可验证承诺', () => {
renderHome();
const text = document.body.textContent ?? '';
+31 -6
View File
@@ -40,7 +40,7 @@ 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, EARLY_ACCESS } from '@/lib/constants';
import { COMPANY_INFO, HERO_EYEBROW, canonicalHeroSubheading } from '@/lib/constants';
import { cn } from '@/lib/utils';
import { ArrowRight } from 'lucide-react';
import type { NewsItem } from '@/lib/constants/news';
@@ -63,6 +63,24 @@ const CO_CREATION_STEPS: CoCreationStep[] = [
/* ───────────────────────── 1. Hero ───────────────────────── */
/**
* 首屏主图 —— **唯一可换的就是这一行**。
*
* 为什么抽成常量而不是直接写在 JSX 里:这张图是首屏最贵的一块视觉资产,
* 换图(例如换成成都金融城双子塔的城市天际线)时不应碰到任何布局代码,
* 也不应让「换图」顺带改到压暗层、字号锚点或拼贴栅格 —— 那三样都是量出来的。
*
* 约束(换图时必须同时满足,DESIGN.md「氛围图边界」):
* - 无人物、无可读文字、无客户或第三方标识;一律 `aria-hidden`,不进入证据位;
* - 横向至少 1920px 宽(`fill` + `object-cover`,1920×765 ≈ 2.51:1 是当前取景比);
* - **整体要够暗**:首屏白字的对比度靠这层压暗 + 图上亮度共同决定。换一张亮图
* (例如明亮天光的天际线)会让 `text-white/75` 掉到 AA 以下 —— 实测旧图上
* 最亮底色曾让 `/70` 只剩 2.44:1。换图后**必须重跑逐像素对比度量法**(见 lessons §5.55)。
*/
const HERO_IMAGE = '/images/home/hero-architecture.webp';
/**
* 首屏 —— **拼贴构图**(2026-11-24 重做,替换「居中巨型声明」)。
*
@@ -90,7 +108,12 @@ const CO_CREATION_STEPS: CoCreationStep[] = [
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) || '';
// ⚠ 2026-11-24 裁定:首屏不强调初创身份与成立时间。
// CMS 里那条历史快照(「公司成立于 2026 年 1 月……」)由 canonicalHeroSubheading 消毒后
// 回落 COMPANY_INFO.description —— 后者本身也不含成立时间,且是 site-config 的兜底真源。
// 改代码常量管不到库里的快照,所以兜底必须落在渲染入口(同 canonicalCtaLabel 的做法)。
const rawSubheading = (heroData?.subheading as string) || (heroData?.description as string) || '';
const subheading = canonicalHeroSubheading(rawSubheading) || COMPANY_INFO.description;
const ctaLabel = canonicalCtaLabel(heroData?.ctaLabel as string | undefined) || CTA_LABELS.consult;
const ctaHref = (heroData?.ctaHref as string) || '/contact';
const secondaryLabel = (heroData?.secondaryCtaLabel as string) || '看行业实践';
@@ -102,7 +125,7 @@ function HomeHero({ heroData }: { heroData?: Row | null }) {
data-testid="hero-section"
>
<Image
src="/images/home/hero-architecture.webp"
src={HERO_IMAGE}
alt=""
aria-hidden="true"
fill
@@ -138,12 +161,14 @@ function HomeHero({ heroData }: { heroData?: Row | null }) {
computed 却是 rgba(0,0,0,0) —— 面板整块透明,白字直接压在图与亮窗上。
结构性守卫:`npm run check:grammar` 的 **R20**(任意值 alpha 必须落在 scale 内)。 */}
<div className="bg-transparent p-7 sm:p-9 md:bg-[#0B0A08]/95 md:p-10 lg:p-12">
{/* eyebrow:把「你是谁、到哪一步」前移到首屏,走与「内测中 / 共创中」
同一族的状态签语法。两项都取常量单一真源,不在此硬写日期或状态。 */}
{/* eyebrow:只作领域定位(「企业数字化转型」),**不写成立时间与共创阶段**。
2026-11-24 裁定:首屏不强调初创身份 —— 那两项已由
`EARLY_ACCESS` / `foundedFull` 降级为「在需要的地方如实呈现」,
不再占首屏最贵的一行。值取 CMS `hero-banner.eyebrow`,兜底 HERO_EYEBROW。 */}
<div className="flex items-center gap-3">
<span aria-hidden="true" className="h-px w-8 shrink-0 bg-brand" />
<span className="text-[13px] font-medium tracking-[0.15em] text-white/75">
{COMPANY_INFO.foundedFull}成立 · {EARLY_ACCESS.label}
{(heroData?.eyebrow as string) || HERO_EYEBROW}
</span>
</div>