fix: 修复移动端 TODO 催促功能无法调出验证码
- 在移动端 TODO 容器中添加验证码输入区域 - 为 mobileTodoConfig 添加验证码相关配置项 - 实现移动端数学验证码输入和提交逻辑 - 实现移动端极验验证码支持 - 添加催促成功/失败的 Toast 提示 - 验证码错误时自动刷新并聚焦输入框 - 催促成功后同步状态到桌面端
This commit is contained in:
27
sidebar.php
27
sidebar.php
@@ -217,6 +217,25 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php
|
||||
// 移动端验证码容器
|
||||
if (!$mobile_is_author && argon_is_todo_captcha_enabled()) :
|
||||
$mobile_captcha_type = get_option('argon_captcha_type', 'math');
|
||||
?>
|
||||
<div class="mobile-todo-captcha-container" style="display:none; margin-top: 10px; padding: 10px; background: var(--color-foreground); border-radius: 10px;">
|
||||
<?php if ($mobile_captcha_type == 'geetest') : ?>
|
||||
<p style="font-size: 12px; color: #666; margin: 0 0 8px;"><?php _e('请完成验证', 'argon'); ?></p>
|
||||
<?php else : ?>
|
||||
<div style="display: flex; align-items: center; gap: 8px;">
|
||||
<span class="mobile-todo-captcha-text" style="font-family: monospace; font-size: 14px; background: #f0f0f0; padding: 6px 10px; border-radius: 6px; letter-spacing: 2px;"><?php echo argon_generate_captcha(); ?></span>
|
||||
<input type="text" id="mobile-todo-captcha-input" placeholder="<?php _e('验证码', 'argon'); ?>" maxlength="10" style="flex: 1; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 13px; background: var(--color-background);">
|
||||
<button type="button" id="mobile-todo-captcha-submit" style="padding: 8px 12px; background: var(--themecolor); color: #fff; border: none; border-radius: 8px; font-size: 12px; cursor: pointer;">
|
||||
<?php _e('确认', 'argon'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -225,10 +244,16 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
var mobileNonce = '<?php echo $mobile_todo_nonce; ?>';
|
||||
var mobileAjaxUrl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
||||
var mobileIsAuthor = <?php echo $mobile_is_author ? 'true' : 'false'; ?>;
|
||||
var mobileNeedCaptcha = <?php echo (!$mobile_is_author && argon_is_todo_captcha_enabled()) ? 'true' : 'false'; ?>;
|
||||
var mobileCaptchaType = '<?php echo get_option('argon_captcha_type', 'math'); ?>';
|
||||
var mobileGeetestId = '<?php echo get_option('argon_geetest_captcha_id', ''); ?>';
|
||||
window.mobileTodoConfig = {
|
||||
nonce: mobileNonce,
|
||||
ajaxUrl: mobileAjaxUrl,
|
||||
isAuthor: mobileIsAuthor
|
||||
isAuthor: mobileIsAuthor,
|
||||
needCaptcha: mobileNeedCaptcha,
|
||||
captchaType: mobileCaptchaType,
|
||||
geetestId: mobileGeetestId
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user