From bff48517c09a60cbf0ff9ec8c61b68a3b0ef01fd Mon Sep 17 00:00:00 2001 From: zqlit Date: Sat, 3 Oct 2026 20:37:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E6=97=B6=E9=99=8D=E7=BA=A7=E4=B8=BA?= =?UTF-8?q?=E5=8F=AF=E9=87=8D=E8=AF=95=E6=8F=90=E7=A4=BA=EF=BC=88=E4=B8=8D?= =?UTF-8?q?=E7=95=99=E7=A0=B4=E5=9B=BE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/Ying/layouts/page/comment.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/themes/Ying/layouts/page/comment.html b/themes/Ying/layouts/page/comment.html index 56687546..8fc70d90 100644 --- a/themes/Ying/layouts/page/comment.html +++ b/themes/Ying/layouts/page/comment.html @@ -283,7 +283,22 @@ ''; var img = w.querySelector('.atk-human-img'); var inp = w.querySelector('.atk-human-inp'); - function refresh() { api('/captcha').then(function (c) { if (c && c.img_data) img.src = c.img_data; }); } + function refresh() { + img.style.display = ''; + api('/captcha').then(function (c) { + if (c && c.img_data) { img.src = c.img_data; } + else { fail('验证码暂时取不到'); } + }).catch(function () { fail('验证码暂时取不到'); }); + } + // 图形验证码取不到(接口抖动/数据库不可用)时给个可重试的提示,别留一张破图 + function fail(msg) { + img.style.display = 'none'; + var t = w.querySelector('.atk-human-box-tx'); + if (t) { t.innerHTML = msg + ',点这里重试'; } + } + w.addEventListener('click', function (e) { + if (e.target && e.target.tagName === 'B') refresh(); + }); refresh(); img.onclick = refresh; function submit() {