docs: 补齐响应式与界面规则,新增规则样张技能
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>规则样张</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f2f4f3; --panel: #fff; --line: #d8e2db;
|
||||
--text: #1b2a23; --muted: #5b6f63; --accent: #237556; --accent-soft: #eef9f3;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0; height: 100vh; display: flex; flex-direction: column;
|
||||
font: 14px/1.5 system-ui, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
color: var(--text); background: var(--bg);
|
||||
}
|
||||
header {
|
||||
display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
|
||||
padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
|
||||
}
|
||||
h1 { font-size: 15px; font-weight: 600; margin: 0; }
|
||||
.group { display: flex; gap: 6px; align-items: center; }
|
||||
.group-label { font-size: 12px; color: var(--muted); }
|
||||
button {
|
||||
font: inherit; font-size: 13px; padding: 5px 11px; cursor: pointer;
|
||||
color: var(--text); background: #fff;
|
||||
border: 1px solid var(--line); border-radius: 8px;
|
||||
}
|
||||
button:hover { border-color: var(--accent); }
|
||||
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
|
||||
.spacer { flex: 1; }
|
||||
.note { font-size: 12px; color: var(--muted); }
|
||||
main { flex: 1; overflow: auto; padding: 20px; }
|
||||
.stage {
|
||||
margin: 0 auto; background: #fff; overflow: hidden;
|
||||
border: 1px solid var(--line); box-shadow: 0 14px 30px rgba(19, 61, 45, .09);
|
||||
transform-origin: top left;
|
||||
}
|
||||
iframe { display: block; border: 0; background: #fff; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>规则样张</h1>
|
||||
<div class="group" id="pages"></div>
|
||||
<div class="spacer"></div>
|
||||
<span class="note">宽度</span>
|
||||
<div class="group" id="widths"></div>
|
||||
<span class="note">缩放</span>
|
||||
<div class="group" id="zooms"></div>
|
||||
</header>
|
||||
<main><div class="stage" id="stage"><iframe id="frame" title="样张页面"></iframe></div></main>
|
||||
<script>
|
||||
const pages = [
|
||||
{ id: 'w1-list', file: 'w1-list.html', label: '桌面 · 任务列表', w: 1280, h: 820 },
|
||||
{ id: 'w2-form', file: 'w2-form.html', label: '桌面 · 新建任务', w: 1280, h: 820 },
|
||||
{ id: 'm1-list', file: 'm1-list.html', label: '手机 · 任务列表', w: 390, h: 844 },
|
||||
{ id: 'm2-session', file: 'm2-session.html', label: '手机 · 学习会话', w: 390, h: 844 }
|
||||
];
|
||||
const widths = [360, 390, 768, 1024, 1280];
|
||||
const zooms = [1, 1.5];
|
||||
|
||||
const frame = document.getElementById('frame');
|
||||
const stage = document.getElementById('stage');
|
||||
|
||||
function readHash() {
|
||||
const [id, w, z] = location.hash.slice(1).split('/');
|
||||
const page = pages.find(p => p.id === id) || pages[0];
|
||||
return {
|
||||
page,
|
||||
w: Number(w) || page.w,
|
||||
zoom: Number(z) === 1.5 ? 1.5 : 1
|
||||
};
|
||||
}
|
||||
|
||||
let state = readHash();
|
||||
|
||||
function syncHash() {
|
||||
history.replaceState(null, '', '#' + [state.page.id, state.w, state.zoom].join('/'));
|
||||
}
|
||||
|
||||
function makeGroup(host, items, isActive, onPick, label) {
|
||||
host.innerHTML = '';
|
||||
items.forEach(item => {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.textContent = label(item);
|
||||
btn.setAttribute('aria-pressed', String(isActive(item)));
|
||||
btn.addEventListener('click', () => { onPick(item); render(); });
|
||||
host.appendChild(btn);
|
||||
});
|
||||
}
|
||||
|
||||
function render() {
|
||||
const { page, w, zoom } = state;
|
||||
|
||||
makeGroup(document.getElementById('pages'), pages,
|
||||
p => p.id === page.id, p => { state.page = p; state.w = p.w; },
|
||||
p => p.label);
|
||||
|
||||
makeGroup(document.getElementById('widths'), widths,
|
||||
v => v === w, v => { state.w = v; }, v => String(v));
|
||||
|
||||
makeGroup(document.getElementById('zooms'), zooms,
|
||||
v => v === zoom, v => { state.zoom = v; }, v => Math.round(v * 100) + '%');
|
||||
|
||||
const src = page.file;
|
||||
if (frame.getAttribute('src') !== src) frame.setAttribute('src', src);
|
||||
frame.style.width = w + 'px';
|
||||
frame.style.height = page.h + 'px';
|
||||
stage.style.width = w * zoom + 'px';
|
||||
stage.style.height = page.h * zoom + 'px';
|
||||
stage.style.transform = 'scale(' + zoom + ')';
|
||||
|
||||
syncHash();
|
||||
}
|
||||
|
||||
render();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
# 规则样张判定 <yyyy-mm-dd>
|
||||
|
||||
- 规则版本:提交 `<hash>`
|
||||
- 规则文件未提交改动:<无 / 列出哪几份>
|
||||
- 生成方式:<四个无上下文子代理并行 / 顺序生成>
|
||||
- 样张:`w1-list` `w2-form` `m1-list` `m2-session`,截图在 `shots/`
|
||||
|
||||
## 哪儿能用
|
||||
|
||||
<一句话。这一版整体能不能直接拿去当设计参考:能用到什么程度。>
|
||||
|
||||
## 哪儿别扭
|
||||
|
||||
<规则写了但没管住的地方。每条写:哪一份页面、哪个位置、哪条规则没管住。>
|
||||
|
||||
## 规则没管到
|
||||
|
||||
<页面这么做了、规则里没提的地方。每条写:现象、该补进哪份规则文件。这一段是本次的核心产出。>
|
||||
|
||||
## 处理
|
||||
|
||||
<当场补规则 / 记进 OPTIMIZATION_BACKLOG.md / 不改。每条一行。>
|
||||
Reference in New Issue
Block a user