评论验证码取不到时降级为可重试提示(不留破图)
Deploy to Production / pre-check (push) Successful in 59s
Deploy to Production / build (push) Successful in 4m42s
Deploy to Production / deploy-edgeone (push) Successful in 4m0s
Deploy to Production / finalize (push) Successful in 31s
Deploy to Production / notify-failure (push) Skipped
Deploy to Production / pre-check (push) Successful in 59s
Deploy to Production / build (push) Successful in 4m42s
Deploy to Production / deploy-edgeone (push) Successful in 4m0s
Deploy to Production / finalize (push) Successful in 31s
Deploy to Production / notify-failure (push) Skipped
This commit is contained in:
1 parent
8535f759f4
commit
bff48517c0
1 file changed
+16
-1
@@ -283,7 +283,22 @@
|
||||
'<button class="atk-human-btn" type="button">确认</button>';
|
||||
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 + ',<b style="cursor:pointer;text-decoration:underline">点这里重试</b>'; }
|
||||
}
|
||||
w.addEventListener('click', function (e) {
|
||||
if (e.target && e.target.tagName === 'B') refresh();
|
||||
});
|
||||
refresh();
|
||||
img.onclick = refresh;
|
||||
function submit() {
|
||||
|
||||
Reference in new issue
Block a user