From e4f98271b62e13b07cc75172cfce732b98f7cfbe Mon Sep 17 00:00:00 2001 From: dimengzhe Date: Mon, 21 Apr 2025 22:59:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/plat/js/login.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ksafepack-admin/src/main/resources/static/plat/js/login.js b/ksafepack-admin/src/main/resources/static/plat/js/login.js index ef05a0a..39c8ca6 100644 --- a/ksafepack-admin/src/main/resources/static/plat/js/login.js +++ b/ksafepack-admin/src/main/resources/static/plat/js/login.js @@ -13,6 +13,7 @@ layui.use([ 'carousel', 'form' ], function() { timestamp = (new Date()).valueOf(); var type = system_config?.captchaType || "math"; // 默认 math var url = basePath + "/captcha/captchaImage?type=" + type + "×tamp=" + timestamp; + console.log("点击验证码啦啦啦啦啦") $(".imgcode").attr("src", url); } @@ -20,9 +21,14 @@ layui.use([ 'carousel', 'form' ], function() { refreshCaptcha(); // ✅ 页面加载手动刷新 $('#telephone').focus(); -// 点击验证码图片刷新 - $('.imgcode').off('click').on('click', refreshCaptcha); // ✅ 点击后刷新 - + // 事件委托 + 每次点击时都能绑定 + $(document).on('click', '.imgcode', function () { + console.log('验证码点击了'); + var timestamp = Date.now(); + var type = system_config?.captchaType || "math"; + var url = basePath + "/captcha/captchaImage?type=" + type + "×tamp=" + timestamp; + $(this).attr("src", url); + }); // 监听提交 form.on('submit(login_)', function(data) {