Files
suixinkan_uikit/docs/9.9.1/review/build-report.cjs
T

12 lines
4.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const fs=require('fs');
const path=require('path');
const b=__dirname;
const manifest=JSON.parse(fs.readFileSync(path.join(b,'manifest.json'),'utf8'));
const fragment=fs.readFileSync(path.join(b,'state-flows.html'),'utf8');
let content=fs.readFileSync(path.join(b,'review-content.html'),'utf8');
const links=manifest.flows.map(f=>`<details ${f.id==='01-sales'||f.id==='02-shooting'?'open':''}><summary>${f.name} · ${f.states.length} 个状态</summary><p>${f.note}</p><a href="${f.imagePath||`flows/${f.id}.png`}" target="_blank"><img loading="lazy" class="sheet" src="${f.imagePath||`flows/${f.id}.png`}" alt="${f.name},各界面按从左到右排列"></a><p class="muted">${f.states.map(s=>s.label).join(' | ')}</p><a href="${f.imagePath||`flows/${f.id}.png`}" target="_blank">查看高清整图</a></details>`).join('\n');
content=content.replace('<div id="flow-index"></div>',`<div id="flow-index">${links}</div>`).replace('<div id="prototype-slot"></div>',fragment);
const css=`*{box-sizing:border-box}body{margin:0;background:#f3f6fa;color:#1b2c45;font-family:-apple-system,BlinkMacSystemFont,'PingFang SC',sans-serif;font-size:15px;line-height:1.8}.review{max-width:1240px;padding:50px 36px;margin:auto}.review header{padding:30px 0 24px}.review h1{font-size:34px;line-height:1.4;letter-spacing:-.6px;margin:10px 0 20px;max-width:920px}.review h2{font-size:23px;margin:0 0 18px;line-height:1.5}.review p{margin:10px 0}.eyebrow{color:#0073ff;font-size:13px;letter-spacing:1px;font-weight:600}.muted{color:#637188;font-size:13px}.review section{padding:30px 0;border-bottom:1px solid #dee6f0;scroll-margin-top:20px}.review a{color:#006ce9;text-decoration:none}.review a:hover{text-decoration:underline}.reportnav{display:flex;flex-wrap:wrap;gap:10px 22px;border-top:1px solid #dce5ef;border-bottom:1px solid #dce5ef;padding:17px 0}.chain{padding:22px;background:#e7f1ff;color:#17558f;border-radius:12px;line-height:2.1}.callout{padding:15px 18px;background:#fff3e0;color:#88571f;border-radius:10px}.review table{width:100%;border-collapse:collapse;background:#fff;margin:14px 0;line-height:1.8;font-size:14px}.review th,.review td{padding:13px 15px;text-align:left;vertical-align:top;border-bottom:1px solid #e5ebf3}.review th{background:#eaf0f7;font-weight:600}.review td:first-child{min-width:150px}.review li{margin:9px 0}.review code{font-size:12px;overflow-wrap:anywhere;white-space:normal}.review details{margin-bottom:20px;border:1px solid #dce6f2;padding:15px;border-radius:12px;background:#fff}.review summary{color:#173d71;font-weight:600;cursor:pointer}.sheet{display:block;width:100%;height:auto;margin:14px 0;border:1px solid #e1e8f2;border-radius:7px}.review footer{padding-top:25px;color:#6b7d94;font-size:12px}.review #sxk991{color:#18243a}.review #sxk991 .form-select{font:inherit;padding:8px 10px;border:1px solid #ccd9e8;border-radius:6px;background:#fff;color:#183357}.review #sxk991 .form-label{font-size:14px}.review #sxk991 .strip{background-image:radial-gradient(#cdd7e3 .6px,transparent .6px);background-size:12px 12px} @media(max-width:700px){.review{padding:22px 16px}.review h1{font-size:25px}.review h2{font-size:21px}.review table{font-size:12px}.review td,.review th{padding:9px 8px}.review td:first-child{min-width:80px}.review section{overflow-x:auto}.review header{padding:15px 0}.review #sxk991{min-width:0}}@media print{body{background:white}.review{padding:0;max-width:none}.reportnav,#interactive{display:none}.review section{break-inside:avoid}.review details{break-inside:avoid}a{color:inherit}}`;
fs.writeFileSync(path.join(b,'review.html'),`<!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>随心瞰 9.9.1 · 需求流程评审与横向状态截图</title><style>${css}</style></head><body><main class="review">${content}</main></body></html>`);
console.log(JSON.stringify({report:path.join(b,'review.html'),flows:manifest.flowCount,screens:manifest.screenCount,bytes:fs.statSync(path.join(b,'review.html')).size}));