From 30b0e0b62cb0c42915072bfe1f280bd5c0b83b29 Mon Sep 17 00:00:00 2001 From: Tory Date: Tue, 17 Nov 2026 09:55:43 +0800 Subject: [PATCH] =?UTF-8?q?Issue#6=C2=B7P3=C2=B7C5:=20=E5=85=A8=E7=AB=99?= =?UTF-8?q?=E6=94=B6=E5=8F=A3+=E5=8F=8C=E4=B8=BB=E9=A2=98=E5=A5=91?= =?UTF-8?q?=E7=BA=A6=E9=AA=8C=E6=94=B6=E2=80=94=E2=80=94=E2=91=A0=E6=97=A7?= =?UTF-8?q?=E5=80=BC=E6=B8=85=E9=9B=B6:LoginView=20aurora=20=E5=85=89?= =?UTF-8?q?=E6=96=91=E9=80=80=E5=BD=B9+=E6=81=92=E6=9A=97=20token=20?= =?UTF-8?q?=E5=88=87=20slate=20=E5=A5=91=E7=BA=A6(=E9=A1=B5=E5=BA=95=20sla?= =?UTF-8?q?te-950)/ReleaseLog=20=E6=97=A7=20teal=20=E5=AD=97=E9=9D=A2?= =?UTF-8?q?=E9=87=8F=E2=86=92token/DashboardView=20=E6=97=A7=20red=203=20?= =?UTF-8?q?=E5=A4=84=E2=86=92=E6=96=B0=20red=20rgba(239,68,68);=E2=91=A1ve?= =?UTF-8?q?rify-layout=202=20=E9=A1=B9=E5=80=BC=E6=96=AD=E8=A8=80=E7=BB=AD?= =?UTF-8?q?=E5=A5=91=E7=BA=A6=E5=8F=A3=E5=BE=84(224/64=E2=86=92256/72,31/3?= =?UTF-8?q?1=20=E5=85=A8=E7=BB=BF,=E7=BB=93=E6=9E=84+=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E9=9B=B6=E9=87=8D=E5=86=99=3D=E7=B1=BB?= =?UTF-8?q?=E5=90=8D=E9=94=9A=E7=82=B9=E7=AD=96=E7=95=A5=E5=85=91=E7=8E=B0?= =?UTF-8?q?);=E2=91=A2=E6=96=B0=E5=A2=9E=20scripts/verify-p3-contract.mjs(?= =?UTF-8?q?30=20=E9=A1=B9=E5=8F=8C=E4=B8=BB=E9=A2=98=20DOM=20=E6=96=AD?= =?UTF-8?q?=E8=A8=80:body=2014/lh1.65/=E4=BA=AE=20gray-50/=E6=9A=97=20slat?= =?UTF-8?q?e-950/=E4=BE=A7=E6=A0=8F=20256=C2=B7=E6=8A=98=E5=8F=A0=2072/?= =?UTF-8?q?=E9=A1=B6=E6=A0=8F=2064=20glass=20blur20/=E8=8F=9C=E5=8D=95=201?= =?UTF-8?q?4=C2=B7icon20/=E6=BF=80=E6=B4=BB=20teal-50=20=E5=BA=95/?= =?UTF-8?q?=E9=A1=B5=E6=A0=87=E9=A2=98=2024/main=2032/card=20r16=C2=B7shad?= =?UTF-8?q?ow-sm/logo=2036=20r12/=E5=93=81=E7=89=8C=2018/=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=BE=BD=E7=AB=A0=E5=93=81=E7=89=8C=E4=B8=8B=E6=96=B9?= =?UTF-8?q?/=E6=9A=97=20slate-900=C2=B7800/=E6=BF=80=E6=B4=BB=20teal-400/?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E9=9A=90=E8=97=8F=E5=93=81=E7=89=8C)?= =?UTF-8?q?=E2=80=94=E2=80=9430/30=20PASS;=E2=91=A3=E5=9B=9B=E9=97=A8?= =?UTF-8?q?=E7=A6=81=3Deslint=200/vue-tsc=200/vitest=20182/build=20?= =?UTF-8?q?=E2=9C=93;=E5=9D=91=E7=95=99=E7=97=95:s2demo=20localStorage=20?= =?UTF-8?q?=E6=9A=97=E8=89=B2=E6=AE=8B=E7=95=99=E2=86=92=E5=A5=91=E7=BA=A6?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E8=84=9A=E6=9C=AC=E9=A1=BB=E5=BD=92=E4=B8=80?= =?UTF-8?q?=E8=B5=B7=E5=A7=8B=E4=B8=BB=E9=A2=98;#020617=20hex=E2=86=92dec?= =?UTF-8?q?=20rgb(2,6,23)=20=E7=AC=94=E8=AF=AF=E5=AE=9E=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/verify-p3-contract.mjs | 51 ++++++++++++++++++++++++++++ web/scripts/verify-layout.mjs | 4 +-- web/src/views/home/DashboardView.vue | 8 ++--- web/src/views/login/LoginView.vue | 16 ++++----- web/src/views/system/ReleaseLog.vue | 2 +- 5 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 scripts/verify-p3-contract.mjs diff --git a/scripts/verify-p3-contract.mjs b/scripts/verify-p3-contract.mjs new file mode 100644 index 00000000..078d9c7e --- /dev/null +++ b/scripts/verify-p3-contract.mjs @@ -0,0 +1,51 @@ +// Issue#6 P3 契约值断言(chrome-session 惯例:独立 launch+单 page,channel:'chrome') +import { chromium } from '/data/go-sms-v2/web/node_modules/playwright/index.mjs' +const ARGS=['--no-sandbox','--disable-gpu','--disable-dev-shm-usage'] +const fails=[]; const ok=(c,m,v)=>{console.log((c?'✓':'✗')+' '+m+(v!==undefined?` = ${v}`:''));if(!c)fails.push(m)} +const cs=async(s,prop,pseudo)=>{try{return await page.$eval(s,(el,[pr,ps])=>ps?getComputedStyle(el,ps)[pr]:getComputedStyle(el)[pr],[prop,pseudo??null])}catch(e){return 'ERR:'+e.message.slice(0,40)}} +const browser=await chromium.launch({channel:'chrome',args:ARGS}) +const page=await browser.newPage({viewport:{width:1440,height:900}}) +await page.goto('http://127.0.0.1:5173/login',{waitUntil:'networkidle'}) +await page.getByTestId('login-username').fill('s2demo') +await page.getByTestId('login-password').fill('S2demo@2026') +await page.getByTestId('login-submit').click() +await page.waitForURL('**/home',{timeout:15000}) +await page.waitForTimeout(800) +// 归一起始主题:localStorage 残留暗色时先切亮(s2demo 会话偏好不可控) +if (await page.evaluate(() => document.documentElement.classList.contains('dark'))) { + await page.getByTestId('dark-toggle').click(); await page.waitForTimeout(500) +} +ok(!(await page.evaluate(() => document.documentElement.classList.contains('dark'))), '起始=亮色') +console.log('--- 亮色 ---') +ok((await cs('body','fontSize'))==='14px','body 14px',await cs('body','fontSize')) +ok(Math.abs(parseFloat(await cs('body','lineHeight'))-23.1)<0.5,'body lh≈1.65(23.1px)',await cs('body','lineHeight')) +ok((await cs('body','backgroundColor'))==='rgb(249, 250, 251)','亮页底 gray-50',await cs('body','backgroundColor')) +ok(Math.round((await page.locator('aside.sidebar').boundingBox()).width)===256,'sidebar 256',Math.round((await page.locator('aside.sidebar').boundingBox()).width)) +ok((await cs('.topbar','height'))==='64px','topbar 64',await cs('.topbar','height')) +ok((await cs('header.topbar','backdropFilter')).includes('blur'),'topbar glass blur',await cs('header.topbar','backdropFilter')) +ok((await cs('.nav-item','fontSize'))==='14px','菜单 14px',await cs('.nav-item','fontSize')) +ok((await cs('.nav-item .ic svg','width'))==='20px','菜单 icon 20',(await cs('.nav-item .ic svg','width'))) +ok((await cs('.page-head h2','fontSize'))==='24px','页标题 24',await cs('.page-head h2','fontSize')) +ok((await cs('main.main','paddingTop'))==='32px','main padding 32',await cs('main.main','paddingTop')) +ok((await cs('.card','borderRadius'))==='16px','card r16',await cs('.card','borderRadius')) +ok((await cs('.card','boxShadow')).includes('rgba(0, 0, 0, 0.04)'),'card shadow-sm 双层',(await cs('.card','boxShadow')).slice(0,40)) +ok((await cs('.nav-item.active','backgroundColor'))==='rgb(240, 253, 250)','激活底 teal-50',await cs('.nav-item.active','backgroundColor')) +const bm=await page.locator('.brand .brand-mark').boundingBox() +ok(bm&&bm.width===36&&bm.height===36,'brand-mark 36×36',bm&&`${bm.width}×${bm.height}`) +ok((await cs('.brand .brand-mark','borderRadius'))==='12px','logo r12',await cs('.brand .brand-mark','borderRadius')) +ok((await cs('.brand-name','fontSize'))==='18px','品牌 18px',await cs('.brand-name','fontSize')) +ok(await page.locator('.sidebar-header .ver-badge').count()===1,'版本徽章在品牌下方') +ok((await cs('.top-title','fontSize'))==='16px','顶栏页标题 16px',await cs('.top-title','fontSize')) +console.log('--- 暗色(切换) ---') +await page.getByTestId('dark-toggle').click(); await page.waitForTimeout(500) +ok((await cs('body','backgroundColor'))==='rgb(2, 6, 23)','暗页底 slate-950',await cs('body','backgroundColor')) +ok((await cs('aside.sidebar','backgroundColor'))==='rgb(15, 23, 42)','侧栏 slate-900',await cs('aside.sidebar','backgroundColor')) +ok((await cs('.card','backgroundColor'))==='rgb(30, 41, 59)','卡 slate-800',await cs('.card','backgroundColor')) +ok((await cs('.nav-item.active','color')).includes('45, 212, 191'),'激活字 teal-400(暗)',await cs('.nav-item.active','color')) +// 折叠 72 +await page.getByTestId('sidebar-collapse-btn').click(); await page.waitForTimeout(500) +ok(Math.abs((await page.locator('aside.sidebar').boundingBox()).width-72)<2,'折叠 72',(await page.locator('aside.sidebar').boundingBox()).width) +ok(await page.locator('.sidebar .brand-name:visible').count()===0,'折叠态品牌/徽章隐藏') +await browser.close() +console.log(fails.length?`\n✗ ${fails.length} 项失败`:'\n✓ P3 契约值断言全通过') +process.exit(fails.length?1:0) diff --git a/web/scripts/verify-layout.mjs b/web/scripts/verify-layout.mjs index edae0f67..5de56533 100644 --- a/web/scripts/verify-layout.mjs +++ b/web/scripts/verify-layout.mjs @@ -40,11 +40,11 @@ ok(await page.getByTestId('sidebar-collapse-btn').isVisible(), '桌面显示侧 await page.getByTestId('sidebar-collapse-btn').click() await page.waitForTimeout(300) const wAfter = (await sidebar.boundingBox())?.width -ok(wBefore === 224 && wAfter === 64, `收起 224→64(实际 ${wBefore}→${wAfter})`) +ok(Math.round(wBefore) === 256 && Math.abs(wAfter - 72) < 2, `收起 256→72(实际 ${wBefore}→${wAfter})`) ok(await page.locator('.sidebar.collapsed').count() === 1, 'collapsed 类挂载') await page.getByTestId('sidebar-collapse-btn').click() await page.waitForTimeout(300) -ok((await sidebar.boundingBox())?.width === 224, '再点展开恢复 224') +ok(Math.abs(((await sidebar.boundingBox())?.width ?? 0) - 256) < 2, '再点展开恢复 256') // H2:侧栏滚动条视觉消除(滚动能力保留;W6 起滚动职责在 .nav-scroll,sidebar 本体 overflow:hidden) const sw = await page.evaluate(() => getComputedStyle(document.querySelector('aside.sidebar .nav-scroll')).scrollbarWidth) ok(sw === 'none', `侧栏滚动区 scrollbar-width === none(实际 ${sw})`) diff --git a/web/src/views/home/DashboardView.vue b/web/src/views/home/DashboardView.vue index 4b58d682..2a6579ca 100644 --- a/web/src/views/home/DashboardView.vue +++ b/web/src/views/home/DashboardView.vue @@ -439,7 +439,7 @@ watch(trend, () => { hoverIdx.value = -1 }) background: var(--gosms-primary-soft); color: var(--gosms-primary); } .hero--warn .hero-ic { background: rgba(251, 191, 36, 0.1); color: var(--gosms-amber); } -.hero--err .hero-ic { background: rgba(248, 113, 113, 0.1); color: var(--gosms-red); } +.hero--err .hero-ic { background: rgba(239, 68, 68, 0.1); color: var(--gosms-red); } .hero--dim .hero-ic { background: var(--gosms-input-veil); color: var(--gosms-text-muted); } .hero-body { min-width: 0; flex: 1; } .hero-text { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--gosms-text-bright); } @@ -459,7 +459,7 @@ watch(trend, () => { hoverIdx.value = -1 }) .qic--hot { background: rgba(251, 191, 36, 0.1); color: var(--gosms-amber); } /* ---- 走势:teal 光晕描边 + P3 hover 十字线/气泡 ---- */ -.trend-line { filter: drop-shadow(0 0 6px rgba(45, 212, 191, 0.4)); } +.trend-line { filter: drop-shadow(0 0 6px var(--gosms-glow)); } .trend-cursor { stroke: var(--gosms-primary); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; } .trend-tip rect { fill: var(--gosms-glass); stroke: var(--gosms-border); } .trend-tip text { fill: var(--gosms-text); font-size: 11px; font-family: var(--gosms-font); } @@ -470,8 +470,8 @@ watch(trend, () => { hoverIdx.value = -1 }) .live-chip { border: none; cursor: pointer; font-family: inherit; } .live-chip.stale { color: var(--gosms-amber); background: rgba(251, 191, 36, 0.1); } .live-chip.stale i { background: var(--gosms-amber); box-shadow: 0 0 8px rgba(251, 191, 36, 0.45); } -.live-chip.dead { color: var(--gosms-red); background: rgba(248, 113, 113, 0.1); } -.live-chip.dead i { background: var(--gosms-red); box-shadow: 0 0 8px rgba(248, 113, 113, 0.45); animation: none; } +.live-chip.dead { color: var(--gosms-red); background: rgba(239, 68, 68, 0.1); } +.live-chip.dead i { background: var(--gosms-red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.45); animation: none; } /* ---- 通道表(配置域快照) ---- */ .ch-scroll { overflow-x: auto; } diff --git a/web/src/views/login/LoginView.vue b/web/src/views/login/LoginView.vue index d9cc1d24..26ace4fe 100644 --- a/web/src/views/login/LoginView.vue +++ b/web/src/views/login/LoginView.vue @@ -1,6 +1,5 @@