feat(idiom): disable answer button after question is solved
This commit is contained in:
@@ -75,6 +75,15 @@ function handleIdiomGameAnswered(e) {
|
|||||||
color: "#16a34a",
|
color: "#16a34a",
|
||||||
duration: 6000,
|
duration: 6000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ── 标记所有对应 round_id 的【答题】按钮为已答 ──
|
||||||
|
document.querySelectorAll(`[data-idiom-answer-btn="${round_id}"]`).forEach((btn) => {
|
||||||
|
btn.dataset.idiomAnswered = "1";
|
||||||
|
btn.textContent = "✅ 已答";
|
||||||
|
btn.style.background = "#9ca3af";
|
||||||
|
btn.style.cursor = "default";
|
||||||
|
btn.style.opacity = "0.6";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -227,6 +236,18 @@ export function bindIdiomQuizControls() {
|
|||||||
const btn = e.target.closest("[data-idiom-answer-btn]");
|
const btn = e.target.closest("[data-idiom-answer-btn]");
|
||||||
if (!btn) return;
|
if (!btn) return;
|
||||||
|
|
||||||
|
// 已答完的按钮不可点击
|
||||||
|
if (btn.dataset.idiomAnswered === "1") {
|
||||||
|
window.chatToast?.show({
|
||||||
|
title: "🧩 猜成语",
|
||||||
|
message: "这道题已被答过了,等下一题吧!",
|
||||||
|
icon: "😅",
|
||||||
|
color: "#9ca3af",
|
||||||
|
duration: 3000,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const roundId = parseInt(btn.dataset.idiomAnswerBtn || "0", 10);
|
const roundId = parseInt(btn.dataset.idiomAnswerBtn || "0", 10);
|
||||||
const hint = btn.dataset.idiomHint || "";
|
const hint = btn.dataset.idiomHint || "";
|
||||||
const rewardGold = parseInt(btn.dataset.idiomGold || "0", 10);
|
const rewardGold = parseInt(btn.dataset.idiomGold || "0", 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user