提取认证页共享自适应骨架

This commit is contained in:
rain
2026-07-21 11:32:12 +08:00
parent 8f88d6ecdf
commit 40947a1fe5
6 changed files with 134 additions and 120 deletions
+13 -9
View File
@@ -31,6 +31,7 @@ function Assert-NotContains {
$root = Split-Path -Parent $PSScriptRoot
$entryPath = Join-Path $root 'pages/auth/a01-entry.vue'
$shellPath = Join-Path $root 'components/AuthPageShell.vue'
$legacyLoginPath = Join-Path $root 'pages/auth/a02-login.vue'
$pagesPath = Join-Path $root 'pages.json'
$globalStylesPath = Join-Path $root 'styles/global.scss'
@@ -54,20 +55,22 @@ if ($pages.pages.Count -ne 52) {
}
$entry = Get-Content -LiteralPath $entryPath -Raw -Encoding utf8
$shell = Get-Content -LiteralPath $shellPath -Raw -Encoding utf8
$globalStyles = Get-Content -LiteralPath $globalStylesPath -Raw -Encoding utf8
# A01 owns content in normal document flow. Decorative artwork must not become
# a second full-page coordinate system.
foreach ($required in @(
'class="auth-header"',
'class="auth-header__image"',
'class="auth-shell__header"',
'class="auth-shell__header-image"',
'a01-vnext-header-v1.png',
'mode="widthFix"',
'class="auth-paper"',
'class="auth-shell__paper"',
'auth-page-paper.jpg'
)) {
Assert-Contains -Content $entry -Expected $required -Message "A01 adaptive structure is missing: $required"
Assert-Contains -Content $shell -Expected $required -Message "A01 adaptive shell is missing: $required"
}
Assert-Contains -Content $entry -Expected '<AuthPageShell' -Message 'A01 must consume the shared adaptive shell.'
foreach ($forbidden in @(
'class="page-canvas"',
'class="page-backdrop"',
@@ -77,11 +80,12 @@ foreach ($forbidden in @(
'1665rpx'
)) {
Assert-NotContains -Content $entry -Unexpected $forbidden -Message "A01 still uses rejected page coordinates: $forbidden"
Assert-NotContains -Content $shell -Unexpected $forbidden -Message "The adaptive shell uses rejected page coordinates: $forbidden"
}
$pageRule = [regex]::Match($entry, '(?ms)^\.auth-page\s*\{(?<Body>.*?)^\}')
$headerRule = [regex]::Match($entry, '(?ms)^\.auth-header\s*\{(?<Body>.*?)^\}')
$paperRule = [regex]::Match($entry, '(?ms)^\.auth-paper\s*\{(?<Body>.*?)^\}')
$pageRule = [regex]::Match($shell, '(?ms)^\.auth-shell\s*\{(?<Body>.*?)^\}')
$headerRule = [regex]::Match($shell, '(?ms)^\.auth-shell__header\s*\{(?<Body>.*?)^\}')
$paperRule = [regex]::Match($shell, '(?ms)^\.auth-shell__paper\s*\{(?<Body>.*?)^\}')
$contentRule = [regex]::Match($entry, '(?ms)^\.login-content\s*\{(?<Body>.*?)^\}')
foreach ($rule in @($pageRule, $headerRule, $paperRule, $contentRule)) {
if (-not $rule.Success) { throw 'A01 adaptive layout rule is missing.' }
@@ -126,7 +130,7 @@ Assert-Contains -Content $dividerRule.Groups['Body'].Value -Expected 'width: 280
Assert-Contains -Content $dividerRule.Groups['Body'].Value -Expected 'height: 46rpx;' -Message 'A01 compact title divider must retain a legible knot and line weight.'
Assert-Contains -Content $dividerRule.Groups['Body'].Value -Expected 'filter: brightness(0.68) saturate(1.5) contrast(1.2);' -Message 'A01 title divider must keep sufficient contrast against the paper background.'
$brandSealRule = [regex]::Match($entry, '(?ms)^\.brand-seal\s*\{(?<Body>.*?)^\}')
$brandSealRule = [regex]::Match($shell, '(?ms)^\.auth-shell__seal\s*\{(?<Body>.*?)^\}')
if (-not $brandSealRule.Success) {
throw 'A01 is missing the brand seal style rule.'
}
@@ -153,7 +157,7 @@ foreach ($asset in @(
'a02-agreement-unchecked.png',
'a02-agreement-checked.png'
)) {
Assert-Contains -Content $entry -Expected $asset -Message "A01 is missing asset reference: $asset"
Assert-Contains -Content ($entry + $shell) -Expected $asset -Message "A01 is missing asset reference: $asset"
}
foreach ($obsoleteVisualAsset in @(
'auth-header.png',
+4 -4
View File
@@ -85,12 +85,12 @@ const run = async () => {
await send('Page.reload')
await waitForFreshDocument(send, previousTimeOrigin)
await waitFor(send, "document.querySelectorAll('.login-tab').length === 2", `A01 did not render at ${size.width}x${size.height}`)
await waitFor(send, "document.querySelector('.auth-header__image img')?.naturalWidth === 824", `A01 header did not load at ${size.width}x${size.height}`)
await waitFor(send, "document.querySelector('.auth-shell__header-image img')?.naturalWidth === 824", `A01 header did not load at ${size.width}x${size.height}`)
const metrics = await valueOf(send, `(() => {
const root = document.querySelector('.auth-page')
const header = document.querySelector('.auth-header')
const headerImage = document.querySelector('.auth-header__image img')
const paper = document.querySelector('.auth-paper')
const header = document.querySelector('.auth-shell__header')
const headerImage = document.querySelector('.auth-shell__header-image img')
const paper = document.querySelector('.auth-shell__paper')
const content = document.querySelector('.login-content')
const headerRect = header?.getBoundingClientRect()
const paperRect = paper?.getBoundingClientRect()
+4 -6
View File
@@ -29,12 +29,10 @@ foreach ($required in @(
Assert-Contains -Content $shell -Expected $required -Message "AuthPageShell is missing: $required"
}
foreach ($pageName in @('a01-entry.vue', 'a04-register.vue', 'a05-reset-password.vue', 'a06-auth-status.vue')) {
$page = Get-Content -LiteralPath (Join-Path $root "pages/auth/$pageName") -Raw -Encoding utf8
Assert-Contains -Content $page -Expected '<AuthPageShell' -Message "$pageName must consume AuthPageShell"
foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx')) {
Assert-NotContains -Content $page -Unexpected $forbidden -Message "$pageName retains rejected page coordinates: $forbidden"
}
$page = Get-Content -LiteralPath (Join-Path $root 'pages/auth/a01-entry.vue') -Raw -Encoding utf8
Assert-Contains -Content $page -Expected '<AuthPageShell' -Message 'A01 must consume AuthPageShell'
foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx')) {
Assert-NotContains -Content $page -Unexpected $forbidden -Message "A01 retains rejected page coordinates: $forbidden"
}
Write-Output 'AUTH-PAGE-SHELL-CONTRACT PASS'