From 09b78369ebc9326cbbbdb26f737b93a5b4119d77 Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Tue, 3 Nov 2026 18:11:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(detail):=20=E8=AF=A6=E6=83=85=E4=BA=94?= =?UTF-8?q?=E9=A1=B5=E6=97=A7=E8=AF=AD=E6=B3=95=E6=B8=85=E8=B4=A6=EF=BC=88?= =?UTF-8?q?P4-B2=EF=BC=89+=20R16=20=E8=A1=A5=E5=86=85=E8=81=94=E9=80=9A?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 范围:products / solutions / services 详情、cases/[slug]、news 详情五页。 B1 之后棘轮剩下的存量基本都在这里。 清掉的(棘轮读数 → 实况) - R13 67→48:rounded-2xl/xl/3xl 共 19 处 → 直角 - R14 17→13:hover:-translate-y 4 处 - R15 16→13:hover:shadow-lg 3 处 - R16 22→8:bg-brand-soft 彩砖 14 处 → bg-bg-secondary;剩余 8 处为类名通道存量 - R17 43→39:font-black 4 处 → font-bold - R19 11→7:font-extrabold 4 处 → font-bold - transition-all → transition-colors(去掉位移/阴影后不该再接 all) - delay 1.2s → 0.15s;时间轴圆点 rounded-full → 直角 **R16 补上内联通道**(本批最重要的判据修复) B2 抓到一处类名通道完全看不见的违反:`case-detail-page.tsx` 把整整一个 `
` 刷成 `style={{ background: "var(--color-brand)" }}` —— 类名零命中、闸全绿、而那是 「饱和红从不用作面」最严重的一种。现在 R16 同时看两条通道: `bg-brand-(soft|section)` 类名 + `background(Color): "var(--color-brand*)"` 内联。 selftest 的 dirty 夹具已补内联样本,两条通道各自可失败。 该页顺带修掉三处 - 满幅红面 → ink 底(`bg-[#0B0A08]`,走 class 而不是内联 style) - 两枚 `rounded-full ... blur-[120px]` 白色光晕球删除(玻璃拟态/彩色光晕在禁止清单里) - 两处内联 `--color-brand-soft` 徽章改用 DESIGN 许可的双通道写法 `--color-brand-bg`(blush) + `--color-brand-ink`(红做底 / 红做字必须分通道) - 指标数字的 `group-hover:scale-110` 删除(hover 只改线/色) 验证 - check:grammar --selftest 全通过;check:grammar 19/19 EXIT=0(R16 实测 8 = 类名 8 + 内联 0) - check:accents / check:a11y / check:motion 全 EXIT=0 - type-check EXIT=0;eslint 0 error;jest 157 套件 / 1849 例全通过 - e2e(prod) @smoke|@critical chromium+chromium-mobile:39 passed / 3 skipped - 视觉 --workers=2 只读:**130 passed / 0 failed** 一条纪律被自己的顺序打脸(写进 docs/acceptance/) - 本轮先 build 再跑 @smoke(含写库用例)再跑视觉 ⇒ /news 又在 5 个 project 一致判红。 这次库里是干净的,脏的是**产物**:ISR 在测试数据存在期间重生成了 /news 并写回 dist (grep 产物 = 2 命中)。根因与「build 时脏」同源,触发点从构建期换到运行期。 ⇒ 视觉认证轮不与写库型 E2E 同轮:先 E2E、后 build、再只跑视觉;跑前先 grep 产物为 0。 --- .../visual-baselines.md | 44 +++++++++++++++++ scripts/check-visual-grammar.mjs | 29 ++++++++--- .../news/news-detail-content-v3.tsx | 4 +- .../products/product-detail-content-v3.tsx | 16 +++---- .../services/service-detail-content-v4.tsx | 20 ++++---- .../solutions/solution-detail-content-v3.tsx | 28 +++++------ src/components/sections/case-detail-page.tsx | 48 +++++-------------- 7 files changed, 113 insertions(+), 76 deletions(-) diff --git a/docs/acceptance/2026-11-03-porsche-home/visual-baselines.md b/docs/acceptance/2026-11-03-porsche-home/visual-baselines.md index 4008074c..d3702b62 100644 --- a/docs/acceptance/2026-11-03-porsche-home/visual-baselines.md +++ b/docs/acceptance/2026-11-03-porsche-home/visual-baselines.md @@ -104,3 +104,47 @@ E2E_TARGET=production ... --update-snapshots=none → 125 passed / 0 failed --workers=2 --update-snapshots=none → 125 passed / 0 failed (新增 1 个用例 × 5 project 后,全量 130 例;上面 125 是加用例之前那一轮) ``` + +--- + +## 2026-11-03 · P4-B2(详情五页)之后 + +### 同一个根因的第二次发作:这次是 **ISR 在运行期改写产物** + +顺序错了会重演:`build → 跑 @smoke(其中有用例写库建 news)→ 跑视觉` 时, +`/news` 又在 5 个 project 一致判红。但这次 `prisma/dev.db` 是**干净**的(只有 2 条真实新闻), +脏的是产物: + +``` +grep -c "E2E 测试新闻" dist/standalone/dist/server/app/news.html → 2 +``` + +即运行的 server 在测试数据存在的那段时间里重新生成了 `/news` 并**把结果写回了 dist**。 +⇒ 根因与「build 时脏」是同一条,只是触发点从构建期换成了 ISR 运行期。 +处置与上次一致:重建(产物归零)→ **只跑视觉**,不再在视觉之前跑写库 E2E。 + +**可执行纪律(两条,缺一不可)**: +1. `grep -c "E2E 测试新闻" dist/standalone/dist/server/app/news.html` 必须为 0,否则先重建; +2. 视觉认证轮不要与写库型 E2E 同轮执行 —— 先 E2E 后 build,再只跑视觉。 + +### B2 的视觉结果 + +``` +--workers=2 --update-snapshots=none → 130 passed / 0 failed +``` + +过程中 `visual-webkit-desktop › 解决方案详情-制造` 红过一次,**重跑 3 次全绿**(15.0s / 13.8s / 14.6s)。 +按已写定的判据(连跑两轮失败集不同 = 抖动;同一张两轮都红 = 真回归)判为抖动,不重采。 +另外确认了一件事:B2 在 `solution-detail-content-v3` 上改的 7 处圆角 + 9 处彩砖, +**没有改变 `/solutions/manufacturing` 的像素** —— 那些图标砖位于该行业未渲染的分支里 +(`suiteCombination` / `certifications` 需要数据)。这不代表改动没生效: +同页 HTML 实测 `bg-bg-secondary` 命中 44 次、`/products/erp` 49 次。 + +### 新增一条判据通道(R16 内联) + +B2 暴露出 R16 只看类名的盲区:`case-detail-page.tsx` 把整整一个 `
` 刷成 +`style={{ background: "var(--color-brand)" }}`,类名通道零命中。已给 R16 加**内联通道** +(`background`/`backgroundColor` 取 `var(--color-brand*)`),并把该 section 改为 ink 底、 +删掉两枚白色 `blur-[120px]` 光晕球(玻璃拟态)、两处内联彩砖改用 DESIGN 许可的 +`--color-brand-bg`(blush) + `--color-brand-ink` 双通道徽章写法。 +棘轮读数随之降到 R13 48 · R14 13 · R15 13 · R16 8(类名 8 + 内联 0)· R17 39 · R19 7。 diff --git a/scripts/check-visual-grammar.mjs b/scripts/check-visual-grammar.mjs index b586f24a..7d066dbd 100644 --- a/scripts/check-visual-grammar.mjs +++ b/scripts/check-visual-grammar.mjs @@ -100,8 +100,11 @@ const MARKETING_FLOOR = 60; * 按「只降不升」的纪律在同一提交里把上限跟着降下来(否则棘轮成了永久豁免)。 * 同日 hub 六页(P4-B1)清账后再次下调:R13 71→67 · R14 21→17 · R15 20→16 · * R16 26→22 · R17 53→43 · R19 21→11。降的是**真实存量**,不是为了让闸变绿而改数。 + * 同日详情五页(P4-B2)清账后再降:R13 67→48 · R14 17→13 · R15 16→13 · + * R16 22→8(其中 2 处来自新开的**内联通道**,见 BRAND_SURFACE_INLINE_RE)· + * R17 43→39 · R19 11→7。 */ -const MARKETING_HIT_CEILINGS = { R13: 67, R14: 17, R15: 16, R16: 22, R17: 43, R18: 0, R19: 11 }; +const MARKETING_HIT_CEILINGS = { R13: 48, R14: 13, R15: 13, R16: 8, R17: 39, R18: 0, R19: 7 }; /** * 判据正则一律**不带 g 旗标**。 @@ -115,7 +118,16 @@ const ROUNDED_UTILITY_RE = /\brounded-(?:md|lg|xl|2xl|3xl|full)\b/; const HOVER_LIFT_RE = /hover:-translate-y\b/; /** 装饰阴影:任意 hover:shadow*(含 hover:shadow-[…] 带值那族)+ lg/xl/2xl 档 */ const DECOR_SHADOW_RE = /(?:hover:shadow(?:-[a-z0-9]+)?(?::\[[^\]]+\])?|\bshadow-(?:2xl|xl|lg)\b)/; +/** + * R16 的**两条通道**。为什么必须两条:类名通道可以被内联样式整条绕过 —— + * 实测案例 `src/components/sections/case-detail-page.tsx` 把整整一个 section 刷成 + * `style={{ background: "var(--color-brand)" }}`,类名通道零命中,闸看不见, + * 而那正是「饱和红从不用作面」最严重的一种违反。 + * 内联通道只认**品牌底色**写法:`background` / `backgroundColor` 取 `var(--color-brand*)`。 + * 不认 `color:`(文字通道由 check:brand-token 管)也不认任意色值(避免与 accents 闸重叠)。 + */ const BRAND_SURFACE_RE = /\bbg-brand-(?:soft|section)\b/; +const BRAND_SURFACE_INLINE_RE = /\bbackground(?:Color)?\s*:\s*["'`]\s*var\(\s*--color-brand(?:-soft|-section)?\s*\)/; const FONT_BLACK_RE = /\bfont-black\b/; const FONT_EXTRA_BOLD_RE = /\bfont-extrabold\b/; /** @@ -442,10 +454,15 @@ function checkGrammar(rawText, rawFiles, twConfig = "", opts = {}) { // R16 饱和/浅色品牌红不得做「面」。两家实测红只出现在按钮上;本仓把它铺成图标砖 // (bg-brand-soft) 与满幅段 (bg-brand-section),是决策一「红是结论电压」最直接的稀释。 - const r16Count = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_RE), 0); - rule({ id: "R16", name: "营销面零品牌红彩色面(bg-brand-soft / bg-brand-section)", denominator: rScan, - red: r16Count > ceilings.R16 ? [`营销面彩色面 ${r16Count} 处 > 上限 ${ceilings.R16}(红只做:实心 CTA 填充 / eyebrow 短线 / hairline hover / 角牌;中性底走 bg-bg-secondary)`] : [], - note: `实测 ${r16Count} 处 · 上限 ${ceilings.R16}${r16Count < ceilings.R16 ? " ⇒ 请把上限下调" : ""}` }); + const r16ClassCount = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_RE), 0); + const r16InlineCount = marketingFiles.reduce((a, [, f]) => a + countHits(f, BRAND_SURFACE_INLINE_RE), 0); + const r16Count = r16ClassCount + r16InlineCount; + const r16InlineFiles = marketingFiles.filter(([, f]) => countHits(f, BRAND_SURFACE_INLINE_RE) > 0); + rule({ id: "R16", name: "营销面零品牌红彩色面(类名 + 内联两条通道)", denominator: rScan, + red: r16Count > ceilings.R16 + ? [`营销面彩色面 ${r16Count} 处 > 上限 ${ceilings.R16}(类名 ${r16ClassCount} + 内联 ${r16InlineCount}${r16InlineFiles.length ? ` 内联位于 ${r16InlineFiles.map(([p]) => p).join(", ")}` : ""};红只做:实心 CTA 填充 / eyebrow 短线 / hairline hover / 角牌;中性底走 bg-bg-secondary)`] + : [], + note: `实测 ${r16Count} 处(类名 ${r16ClassCount} + 内联 ${r16InlineCount})· 上限 ${ceilings.R16}${r16Count < ceilings.R16 ? " ⇒ 请把上限下调" : ""}` }); // R17 字重集合。对标实测层级来自 字号 × 字重 两轴,字重只用 400/500/700; // 本仓 53 处 font-black(900) 是「靠更粗建立层级」的单轴做法,与 statement 档冲突。 @@ -544,7 +561,7 @@ function selftest() { * 夹具一律带 `opts.floor = 0`:合成样本只有一两个文件, * 不关掉地板就会把「扫描面太小」的红混进这一维,读数不再单义。 */ - const dirty = `
`; + const dirty = `
`; const inScope = (rel) => new Map([[rel, dirty]]); const hitRed = (rel, id, ceiling) => checkGrammar(cssText, inScope(rel), "", { floor: 0, hitCeilings: { [id]: ceiling } }) diff --git a/src/app/(marketing)/news/news-detail-content-v3.tsx b/src/app/(marketing)/news/news-detail-content-v3.tsx index 539aedc3..3bb11264 100644 --- a/src/app/(marketing)/news/news-detail-content-v3.tsx +++ b/src/app/(marketing)/news/news-detail-content-v3.tsx @@ -20,7 +20,7 @@ function RelatedNewsCard({ news, index }: { news: NewsItem; index: number }) { >
@@ -150,7 +150,7 @@ export default function NewsDetailContentV3({ news, relatedNews = [] }: NewsDeta
返回新闻列表 diff --git a/src/app/(marketing)/products/product-detail-content-v3.tsx b/src/app/(marketing)/products/product-detail-content-v3.tsx index 197bccd5..daccf346 100644 --- a/src/app/(marketing)/products/product-detail-content-v3.tsx +++ b/src/app/(marketing)/products/product-detail-content-v3.tsx @@ -36,11 +36,11 @@ function DetailHero({ product }: DetailHeroProps) { transition={{ duration: 0.28, ease: EASE_OUT }} className="flex items-center gap-4 mb-8" > -
+
{productIcon}
- + {product.category}
@@ -137,10 +137,10 @@ function FeaturesSection({ features }: FeaturesSectionProps) { {features.map((feature, idx) => (
-
+

{feature}

@@ -180,10 +180,10 @@ function BenefitsSection({ benefits }: BenefitsSectionProps) { {benefits.map((benefit, idx) => (
-
+

{benefit}

@@ -233,9 +233,9 @@ function ProcessSection({ process }: ProcessSectionProps) { {process.map((step, idx) => (
-
+
{idx + 1}
diff --git a/src/app/(marketing)/services/service-detail-content-v4.tsx b/src/app/(marketing)/services/service-detail-content-v4.tsx index 3b19d198..a5eec2da 100644 --- a/src/app/(marketing)/services/service-detail-content-v4.tsx +++ b/src/app/(marketing)/services/service-detail-content-v4.tsx @@ -40,19 +40,19 @@ function DetailHero({ service }: { service: Service }) { initial={{ opacity: 0, y: 40 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.28, delay: 0.2, ease: EASE_OUT }} - className="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-black text-ink leading-[0.95] tracking-tighter mb-6 sm:mb-8" + className="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-ink leading-[0.95] tracking-tighter mb-6 sm:mb-8" >
{service.title}
- + {firstBenefit} @@ -110,7 +110,7 @@ function OverviewSection({ service }: { service: Service }) { transition={{ duration: 0.28, ease: EASE_OUT }} className="lg:col-span-5" > -

+

解决什么问题

@@ -154,7 +154,7 @@ function FeaturesSection({ service }: { service: Service }) { transition={{ duration: 0.28, ease: EASE_OUT }} className="max-w-3xl mb-16 sm:mb-20 md:mb-24" > -

+

核心能力

@@ -178,7 +178,7 @@ function FeaturesSection({ service }: { service: Service }) { delay: index * 0.06, ease: EASE_OUT, }} - className="group relative p-8 sm:p-10 transition-all duration-150 hover:bg-bg-secondary hover:shadow-lg hover:-translate-y-1 bg-bg-primary" + className="group relative p-8 sm:p-10 transition-colors duration-hover hover:bg-bg-secondary bg-bg-primary" >

@@ -214,7 +214,7 @@ function ProcessSection({ service }: { service: Service }) { transition={{ duration: 0.28, ease: EASE_OUT }} className="max-w-3xl mb-16 sm:mb-20 md:mb-24" > -

+

服务流程

@@ -236,10 +236,10 @@ function ProcessSection({ service }: { service: Service }) { delay: index * 0.06, ease: EASE_OUT, }} - className="relative group p-6 sm:p-8 bg-bg-primary hover:bg-bg-secondary hover:shadow-lg hover:-translate-y-1 transition-all duration-150" + className="relative group p-6 sm:p-8 bg-bg-primary hover:bg-bg-secondary transition-colors duration-hover" >

-

+

准备好开始了吗?

diff --git a/src/app/(marketing)/solutions/solution-detail-content-v3.tsx b/src/app/(marketing)/solutions/solution-detail-content-v3.tsx index fad1ae8e..f47a2277 100644 --- a/src/app/(marketing)/solutions/solution-detail-content-v3.tsx +++ b/src/app/(marketing)/solutions/solution-detail-content-v3.tsx @@ -64,11 +64,11 @@ function DetailHero({ solution }: DetailHeroProps) { transition={{ duration: 0.28, ease: EASE_OUT }} className="flex items-center gap-4 mb-8" > -

+
{industryIcon}
- + {solution.industry}
{solution.subtitle}
@@ -138,11 +138,11 @@ function ChallengesSection({ challenges }: ChallengesSectionProps) { {challenges.map((challenge, idx) => (
-
+
{idx + 1}

{challenge}

@@ -187,12 +187,12 @@ function SolutionsSection({ solutions }: SolutionsSectionProps) { {solutions.map((solution, idx) => (
-
+
@@ -244,11 +244,11 @@ function ValuePropositionSection({ valueProposition }: ValuePropositionProps) { return (
-
+
{icon}
@@ -297,11 +297,11 @@ function SuiteCombinationSection({ suiteCombination, products }: SuiteCombinatio {primaryProducts.map((product) => product && (
-
+
@@ -315,16 +315,16 @@ function SuiteCombinationSection({ suiteCombination, products }: SuiteCombinatio - {/* 装饰圆改方角牌:rounded-full 只留给功能性的圆(头像/开关钮/滑块), + {/* 装饰圆改方角牌:rounded-cta 只留给功能性的圆(头像/开关钮/滑块), 这是套件组合图的中心节点装饰,两家对标实测都没有装饰性圆形 */} -
+
+
-
-
+
+
diff --git a/src/components/sections/case-detail-page.tsx b/src/components/sections/case-detail-page.tsx index d2416e50..06e33a33 100644 --- a/src/components/sections/case-detail-page.tsx +++ b/src/components/sections/case-detail-page.tsx @@ -74,10 +74,10 @@ function CaseDetailHero({ data }: CaseDetailHeroProps) { transition={{ duration: 0.28, ease: EASE }} > @@ -99,7 +99,7 @@ function CaseDetailHero({ data }: CaseDetailHeroProps) { transition={{ duration: 0.28, delay: 0.1, ease: EASE }} >
{data.metrics[0]?.value} @@ -344,10 +344,10 @@ function SolutionSection({ data }: { data: CaseDetailData }) { {data.timeline.map((t, i) => (
{i + 1} @@ -421,31 +421,8 @@ function ResultsSection({ data }: { data: CaseDetailData }) { return (
- {/* Background decoration */} -
-
-
-
-
{m.highlight && ( -
+
核心指标
)} -
+
{isNumeric && inView && !shouldReduceMotion ? (
-
+