联系官方销售客服
1835022288
028-61286886
这是原文档:https://www.xunruicms.com/doc/501.html
<button class="btn blue" onclick="dr_ajax_url('/index.php?s=member&c=api&m=login_code&id='+$('#dr_phone').val()+'&code='+$('#dr_code').val())" type="button">获取手机验证码</button>
改为
<button id="sms_code" onclick="dr_ajax_sms('/index.php?s=member&c=api&m=login_code&id='+$('#dr_phone').val()+'&code='+$('#dr_code').val())" type="button">获取手机验证码</button>
<script> var countdown = 60; function setCountdown() { if (countdown == 0) { $('#sms_code').prop('disabled', false); $('#sms_code').text('获取验证码'); countdown = 60; } else { $('#sms_code').prop('disabled', true); $('#sms_code').text(countdown + '秒'); countdown--; setTimeout(setCountdown, 1000); } } // ajax操作 function dr_ajax_sms(url) { var index = layer.load(2, { shade: [0.3,'#fff'], //0.1透明度的白色背景 time: 100000000 }); $.ajax({ type: "GET", url: url, dataType: "json", success: function (json) { layer.close(index); if (json.code == 0) { $('.fc-code img').click(); if (json.data.field) { $('#dr_row_'+json.data.field).addClass('has-error'); $('#dr_'+json.data.field).focus(); } } // 在成功回调函数中 if (json.code == 1) { setCountdown(); } dr_cmf_tips(json.code, json.msg, json.data.time); if (json.data.url) { setTimeout("window.location.href = '"+json.data.url+"'", 2000); } }, error: function(HttpRequest, ajaxOptions, thrownError) { dr_ajax_alert_error(HttpRequest, this, thrownError); } }); } </script>
正好用到,学习一下