v1.3 看得见:三色错题本(红/黄/绿+待做视图) + 收尾页(表扬行为) + 小狮落库(pet_stage/pet_fed_at,247 测试)
This commit is contained in:
@@ -248,3 +248,33 @@ node tools/verify_plan.mjs # → data/plan_verify.md
|
||||
OCR 缓存,所以预览过一遍之后,正式入库不会再花一次调用。
|
||||
|
||||
只有一块一道题的时候不会弹这张单子——多一次点击换不来任何信息。
|
||||
|
||||
## 十四、三色与收尾页
|
||||
|
||||
错题本原来的筛选是「七个状态」,家长看不懂「待讲清」和「会但不稳」有什么区别。
|
||||
现在默认只显示两个颜色,状态名藏到第二行里。
|
||||
|
||||
| 颜色 | 里面是哪几个状态 | 家长要做的事 |
|
||||
|---|---|---|
|
||||
| 红 | `observing`、`queued` | 还没过关,等它到期 |
|
||||
| 黄 | `unstable`、`passed_once`、`to_explain` | 今天/这几天要重做或要讲 |
|
||||
| 绿 | `graduated` | 不用再看了 |
|
||||
| 灰 | `careless` | 粗心小记,不重做 |
|
||||
|
||||
- 默认筛「待做」=红+黄;标题下一行写「还剩 7 道:红 3 · 黄 4;绿叶 2 道不用再看了。」
|
||||
- 每个 chip 后面带计数,数字由 `renderWrong()` 现算,不是写死的。
|
||||
- 第二行 chips 保留原来的状态筛选(观察中/待复习/已对一次/待讲清/会但不稳/已毕业),
|
||||
需要精确看某一类时才用。
|
||||
- 顺手修了一个真 bug:「已对一次」原来写 `data-s="recalled"`,而状态名是 `passed_once`,
|
||||
点它永远是空列表。
|
||||
|
||||
**收尾页**(`endRound()`,一轮做完之后):不再停在第 5 题的解析上,而是给三句话——
|
||||
「今天到此为止,5 道做完了」「一次就对 4 · 明天再来 1 · 今天毕业 1」,
|
||||
外加一句具体的话:
|
||||
|
||||
- 有题毕业:`你把「36 × 24 =」讲明白了——它从本子上消失了,不用再做了。`
|
||||
- 一道没对:`没关系,明天同一时间再来一次,只要 4 分钟。`
|
||||
- 中间的档:按对了几道说「今天稳住了 X 道」。
|
||||
|
||||
规矩:**表扬行为,不表扬人**(不写「你真棒」「你真聪明」),也不发积分/贴纸——
|
||||
外部奖励一停就失效,而且会和「错题变少」这个客观进度重复计量。
|
||||
|
||||
+158
-21
@@ -111,6 +111,7 @@ h1{font-size:22px;margin:0 0 4px}
|
||||
.pill{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;padding:2px 9px;border-radius:999px;
|
||||
background:var(--ochre-soft);color:var(--ochre);font-weight:600}
|
||||
.pill.c{background:var(--brand-soft);color:var(--brand-d)}
|
||||
.pill.r{background:var(--red-soft);color:var(--red)}
|
||||
.pill.g{background:var(--green-soft);color:var(--green)}
|
||||
.pill.b{background:var(--blue-soft);color:var(--blue)}
|
||||
.pill.o{background:var(--ochre-soft);color:var(--ochre)}
|
||||
@@ -224,6 +225,20 @@ td .t{font-family:"Consolas",monospace;font-size:13.5px}
|
||||
.chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}
|
||||
.chips button{border:1px solid var(--line);background:#fff;border-radius:999px;padding:7px 14px;font-size:12.5px;color:#5A5048}
|
||||
.chips button.on{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:600}
|
||||
.chips.sub{margin-top:-6px}
|
||||
.chips.sub button{padding:5px 11px;font-size:11.5px;color:#8C8175}
|
||||
|
||||
/* 收尾页:一轮做完之后的交代(W2) */
|
||||
.round{display:grid;gap:14px}
|
||||
.round .hi{font-size:19px;font-weight:700;letter-spacing:.2px}
|
||||
.round .hi b{color:var(--brand);font-size:26px;margin:0 2px}
|
||||
.round .facts{display:flex;gap:10px;flex-wrap:wrap}
|
||||
.round .fact{background:#FBF6EC;border-radius:12px;padding:10px 14px;min-width:104px}
|
||||
.round .fact i{display:block;font-style:normal;font-size:11.5px;color:#A2958A;margin-bottom:3px}
|
||||
.round .fact b{font-size:19px}
|
||||
.round .say{background:var(--green-soft);color:var(--green);border-radius:12px;padding:11px 14px;font-size:13.5px;line-height:1.7}
|
||||
.round .say.warm{background:var(--ochre-soft);color:#7A5410}
|
||||
.round .acts{display:flex;gap:10px;flex-wrap:wrap;margin-top:2px}
|
||||
|
||||
/* 学情 */
|
||||
.barlist{display:flex;flex-direction:column;gap:12px}
|
||||
@@ -723,6 +738,8 @@ td .t{font-family:"Consolas",monospace;font-size:13.5px}
|
||||
<p style="margin:14px 0 0;font-size:11.5px;color:#A2958A;line-height:1.8">
|
||||
做错的题不进「错题本」,明天再来一次;连对两次后要讲一遍,讲清才算毕业。
|
||||
</p>
|
||||
|
||||
<div id="roundDone" hidden></div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-top:14px;padding:16px 18px">
|
||||
@@ -788,16 +805,22 @@ td .t{font-family:"Consolas",monospace;font-size:13.5px}
|
||||
<!-- ======== 错题本 ======== -->
|
||||
<section class="view" id="v-wrong" hidden>
|
||||
<h1>错题本</h1>
|
||||
<p class="sub">只收「会做但错了」和「错三次以上」的题。粗心错不进来。</p>
|
||||
<p class="sub" id="wrongLeft">只收「会做但错了」和「错三次以上」的题。粗心错不进来。</p>
|
||||
<div class="chips" id="wrongChips">
|
||||
<button class="on" data-s="">全部</button>
|
||||
<button class="on" data-s="todo">待做</button>
|
||||
<button data-s="red">红的</button>
|
||||
<button data-s="amber">黄的</button>
|
||||
<button data-s="green">绿的</button>
|
||||
<button data-s="careless">粗心小记</button>
|
||||
<button data-s="">全部</button>
|
||||
</div>
|
||||
<div class="chips sub" id="wrongChips2">
|
||||
<button data-s="observing">观察中</button>
|
||||
<button data-s="queued">待复习</button>
|
||||
<button data-s="recalled">已对一次</button>
|
||||
<button data-s="passed_once">已对一次</button>
|
||||
<button data-s="to_explain">待讲清</button>
|
||||
<button data-s="unstable">会但不稳</button>
|
||||
<button data-s="graduated">已毕业</button>
|
||||
<button data-s="careless">粗心小记</button>
|
||||
</div>
|
||||
<div class="card"><div class="bd" style="padding:6px 8px"><table id="wrongTable"></table></div></div>
|
||||
</section>
|
||||
@@ -1219,6 +1242,7 @@ async function refresh() {
|
||||
S.mistakes = (m && m.items) || [];
|
||||
S.weekly = w || null;
|
||||
S.idx = 0; S.results = {};
|
||||
S.round = { n: 0, right: 0, grad: 0, careless: 0, gradStem: "" };
|
||||
renderAll();
|
||||
}
|
||||
|
||||
@@ -1856,6 +1880,7 @@ async function submit() {
|
||||
q.status_zh = r.status_zh;
|
||||
if (r.answer != null) q.answer = String(r.answer);
|
||||
if (r.judge_type) q.judge_type = r.judge_type;
|
||||
if (r.pet) { S.kid = Object.assign(S.kid || {}, { pet: r.pet }); petRender(true); }
|
||||
} catch (e) { detail = e.message; }
|
||||
}
|
||||
if (isChoice) {
|
||||
@@ -1891,6 +1916,14 @@ async function submit() {
|
||||
S.results[S.idx] = false;
|
||||
}
|
||||
petAfterSubmit(q, correct);
|
||||
if (!S.round) S.round = { n: 0, right: 0, grad: 0, careless: 0, gradStem: "" };
|
||||
S.round.n++;
|
||||
if (correct === true) S.round.right++;
|
||||
if (nextStatus === "graduated" || q.status === "graduated") {
|
||||
S.round.grad++;
|
||||
if (!S.round.gradStem) S.round.gradStem = q.stem || "";
|
||||
}
|
||||
if (nextStatus === "careless" || q.status === "careless") S.round.careless++;
|
||||
buildAnalysis(q); // 这时才拿到正确答案,答案与步骤都得重画一次
|
||||
document.getElementById("qAnalysis").classList.add("show");
|
||||
document.getElementById("btnNext").style.display = "";
|
||||
@@ -1955,33 +1988,126 @@ async function loadVariant(q, rotate) {
|
||||
}
|
||||
|
||||
function nextQ() {
|
||||
if (S.idx < S.queue.length - 1) { S.idx++; renderTrain(); renderSheet(); }
|
||||
else {
|
||||
document.getElementById("qStem").textContent = "今天的 5 道做完了 🎉";
|
||||
document.getElementById("qAnswerRow").style.display = "none";
|
||||
document.getElementById("qAnalysis").classList.remove("show");
|
||||
document.getElementById("qVariant").classList.remove("show");
|
||||
document.getElementById("btnNext").style.display = "none";
|
||||
document.getElementById("btnSubmit").style.display = "none";
|
||||
document.getElementById("qBar").style.width = "100%";
|
||||
if (S.idx < S.queue.length - 1) {
|
||||
S.idx++; renderTrain(); renderSheet();
|
||||
document.getElementById("roundDone").hidden = true;
|
||||
document.getElementById("qStem").style.display = "";
|
||||
document.getElementById("btnPrev").style.display = "";
|
||||
document.getElementById("btnSkip").style.display = "";
|
||||
} else {
|
||||
endRound();
|
||||
}
|
||||
}
|
||||
|
||||
/* 收尾页:一轮做完之后的交代。表扬必须说行为,不说「你真棒」。 */
|
||||
function endRound() {
|
||||
const d = S.round || { n: S.queue.length, right: 0, grad: 0, careless: 0, gradStem: "" };
|
||||
const total = d.n || S.queue.length;
|
||||
const again = Math.max(0, total - d.right);
|
||||
document.getElementById("qStem").style.display = "none";
|
||||
document.getElementById("qAnswerRow").style.display = "none";
|
||||
document.getElementById("qOptions").innerHTML = "";
|
||||
document.getElementById("qAnalysis").classList.remove("show");
|
||||
document.getElementById("qVariant").classList.remove("show");
|
||||
document.getElementById("qResult").className = "result";
|
||||
document.getElementById("qResult").innerHTML = "";
|
||||
document.getElementById("btnNext").style.display = "none";
|
||||
document.getElementById("btnSubmit").style.display = "none";
|
||||
document.getElementById("btnPrev").style.display = "none";
|
||||
document.getElementById("btnSkip").style.display = "none";
|
||||
document.getElementById("qBar").style.width = "100%";
|
||||
|
||||
let say, warm = false;
|
||||
if (d.grad > 0 && d.gradStem) {
|
||||
say = `你把「${esc(shortStem(d.gradStem))}」讲明白了——它从本子上消失了,不用再做了。`;
|
||||
} else if (d.right >= Math.ceil(total * 0.6)) {
|
||||
say = `今天 ${total} 道里 ${d.right} 道一次就对,这就是在变薄。`;
|
||||
} else if (d.right > 0) {
|
||||
say = `今天 ${d.right} 道一次就对,另外 ${again} 道明天再来一遍——它们还没被记住,正常。`;
|
||||
} else {
|
||||
warm = true;
|
||||
say = `今天 ${total} 道都没一次做对。没关系,明天同一时间再来一次,只要 4 分钟。`;
|
||||
}
|
||||
|
||||
document.getElementById("roundDone").hidden = false;
|
||||
document.getElementById("roundDone").innerHTML = `
|
||||
<div class="round" style="margin-top:18px;border-top:1px dashed var(--line);padding-top:16px">
|
||||
<div class="hi">今天到此为止,${total} 道做完了</div>
|
||||
<div class="facts">
|
||||
<div class="fact"><i>一次就对</i><b>${d.right}</b></div>
|
||||
<div class="fact"><i>明天再来</i><b>${again}</b></div>
|
||||
<div class="fact"><i>今天毕业</i><b>${d.grad}</b></div>
|
||||
</div>
|
||||
<div class="say ${warm ? "warm" : ""}">${say}</div>
|
||||
<div class="acts">
|
||||
<button class="btn" id="rdWeekly">看这周的那张纸</button>
|
||||
<button class="btn line" id="rdHome">回工作台</button>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById("rdWeekly").addEventListener("click", () => show("weekly"));
|
||||
document.getElementById("rdHome").addEventListener("click", () => show("home"));
|
||||
petSay("今天的活儿干完了。", "bounce", 6000);
|
||||
}
|
||||
|
||||
function norm(s) { return String(s).replace(/\s/g, "").replace(/[。,,.]/g, "").toLowerCase(); }
|
||||
|
||||
/* ---- 其他视图 ---- */
|
||||
/* 三色:红=今天就该做、黄=差一步、绿=已毕业。状态名还是原来那七个,只是不再让家长去分辨。 */
|
||||
const BUCKET = {
|
||||
red: ["observing", "queued"],
|
||||
amber: ["unstable", "passed_once", "to_explain"],
|
||||
green: ["graduated"],
|
||||
careless: ["careless"],
|
||||
};
|
||||
function statusBucket(s) {
|
||||
for (const k in BUCKET) if (BUCKET[k].indexOf(s) >= 0) return k;
|
||||
return "red";
|
||||
}
|
||||
const BUCKET_ZH = { red: "红的", amber: "黄的", green: "绿的", careless: "粗心" };
|
||||
|
||||
function renderWrong() {
|
||||
const rows = S.mistakes.filter(m => !S.wrongFilter || m.status === S.wrongFilter);
|
||||
const f = S.wrongFilter || "todo";
|
||||
const inFilter = (m) => {
|
||||
if (f === "") return true;
|
||||
if (f === "todo") { const b = statusBucket(m.status); return b === "red" || b === "amber"; }
|
||||
if (BUCKET[f]) return statusBucket(m.status) === f;
|
||||
return m.status === f; // 具体状态仍可筛
|
||||
};
|
||||
const all = S.mistakes || [];
|
||||
const n = (k) => all.filter(m => statusBucket(m.status) === k).length;
|
||||
const rows = all.filter(inFilter);
|
||||
|
||||
const left = document.getElementById("wrongLeft");
|
||||
if (left) {
|
||||
const todo = n("red") + n("amber");
|
||||
left.textContent = todo
|
||||
? `还剩 ${todo} 道:红 ${n("red")} · 黄 ${n("amber")};绿叶 ${n("green")} 道不用再看了。`
|
||||
: `没有待做的题了。已毕业 ${n("green")} 道,粗心小记 ${n("careless")} 条。`;
|
||||
}
|
||||
document.querySelectorAll("#wrongChips button,#wrongChips2 button").forEach(b => {
|
||||
const s = b.dataset.s || "";
|
||||
b.classList.toggle("on", s === f);
|
||||
const cnt = s === "todo" ? n("red") + n("amber")
|
||||
: s === "" ? all.length
|
||||
: BUCKET[s] ? n(s)
|
||||
: all.filter(m => m.status === s).length;
|
||||
const label = b.textContent.replace(/\s*\(\d+\)$/, "");
|
||||
b.textContent = cnt ? `${label} (${cnt})` : label;
|
||||
});
|
||||
|
||||
document.getElementById("wrongTable").innerHTML = `
|
||||
<tr><th>题目</th><th>科目</th><th>错因</th><th>状态</th><th>下次复习</th><th></th></tr>` +
|
||||
rows.map(m => `<tr>
|
||||
rows.map(m => {
|
||||
const b = statusBucket(m.status);
|
||||
const pill = b === "red" ? "r" : b === "amber" ? "o" : b === "green" ? "g" : "gray";
|
||||
return `<tr>
|
||||
<td class="t">${esc(m.stem)}</td>
|
||||
<td>${SUBJ[m.subject] || "数学"}</td>
|
||||
<td>${m.wrong_code ? `<span class="pill gray">${m.wrong_code}</span>` : "—"}</td>
|
||||
<td><span class="pill ${STATUS_CLS[m.status] || ""}">${m.status_zh || m.status}</span></td>
|
||||
<td><span class="pill ${pill}">${m.status_zh || m.status}</span></td>
|
||||
<td style="color:var(--muted)">${m.next_due || "—"}</td>
|
||||
<td>${m.status === "to_explain" ? `<button class="lnk ex-open" data-id="${esc(m.id)}">讲一遍</button>` : ""}</td>
|
||||
</tr>`).join("");
|
||||
</tr>`; }).join("");
|
||||
}
|
||||
|
||||
/* ---- 讲一遍(讲清才算毕业;讲不清就给「退一层」) ---- */
|
||||
@@ -2215,8 +2341,13 @@ document.getElementById("btnVCheck").addEventListener("click", () => {
|
||||
document.getElementById("btnVNext").addEventListener("click", () => { const q = curQ(); if (q) loadVariant(q, true); });
|
||||
document.getElementById("wrongChips").addEventListener("click", (e) => {
|
||||
const b = e.target.closest("button"); if (!b) return;
|
||||
document.querySelectorAll("#wrongChips button").forEach(x => x.classList.toggle("on", x === b));
|
||||
S.wrongFilter = b.dataset.s; renderWrong();
|
||||
S.wrongFilter = b.dataset.s;
|
||||
renderWrong();
|
||||
});
|
||||
document.getElementById("wrongChips2").addEventListener("click", (e) => {
|
||||
const b = e.target.closest("button"); if (!b) return;
|
||||
S.wrongFilter = b.dataset.s;
|
||||
renderWrong();
|
||||
});
|
||||
document.getElementById("wrongTable").addEventListener("click", (e) => {
|
||||
const b = e.target.closest(".ex-open"); if (!b) return;
|
||||
@@ -2296,7 +2427,11 @@ function petLoad() {
|
||||
let PET = Object.assign({ name: "", look: "star", swapped: false, off: false, collapsed: false }, petLoad());
|
||||
function petSave() { localStorage.setItem(PET_KEY, JSON.stringify(PET)); }
|
||||
function petGrad() { return (S.mistakes || []).filter(m => m.status === "graduated").length; }
|
||||
function petStage() { const g = petGrad(); return g >= 100 ? 3 : g >= 40 ? 2 : g >= 12 ? 1 : 0; }
|
||||
function petStage() {
|
||||
const sv = S.kid && S.kid.pet && typeof S.kid.pet.stage === "number" ? S.kid.pet.stage : null;
|
||||
if (!S.demo && sv !== null) return sv;
|
||||
const g = petGrad(); return g >= 100 ? 3 : g >= 40 ? 2 : g >= 12 ? 1 : 0;
|
||||
}
|
||||
function petNick() { return PET.name || "小狮"; }
|
||||
function shortStem(t) { t = String(t || ""); return t.length > 12 ? t.slice(0, 12) + "…" : t; }
|
||||
|
||||
@@ -2462,7 +2597,9 @@ function petRender(force) {
|
||||
box.classList.toggle("collapsed", !!PET.collapsed);
|
||||
document.getElementById("petName").textContent = petNick();
|
||||
const g = petGrad();
|
||||
document.getElementById("petTip").textContent = PET.collapsed ? "" : "已吃掉 " + g + " 道";
|
||||
const fed = !S.demo && S.kid && S.kid.pet && S.kid.pet.fed_today;
|
||||
document.getElementById("petTip").textContent = PET.collapsed ? ""
|
||||
: (fed ? "今天喂过了 · 已吃掉 " + g + " 道" : "已吃掉 " + g + " 道");
|
||||
document.getElementById("petInput").value = PET.name || "";
|
||||
document.querySelectorAll("#pet .lk").forEach(el => el.classList.toggle("on", el.dataset.look === PET.look));
|
||||
document.getElementById("petSwapHint").textContent = PET.swapped
|
||||
|
||||
Reference in New Issue
Block a user