Browse Source

验证码

master
dimengzhe 1 month ago
parent
commit
e4f98271b6
  1. 12
      ksafepack-admin/src/main/resources/static/plat/js/login.js

12
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 + "&timestamp=" + 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 + "&timestamp=" + timestamp;
$(this).attr("src", url);
});
// 监听提交
form.on('submit(login_)', function(data) {

Loading…
Cancel
Save