Browse Source

sms code send button improved

master
filesite 7 months ago
parent
commit
52366d11b3
  1. 2
      themes/tajian/views/site/login.php
  2. 2
      themes/tajian/views/site/register.php
  3. 18
      www/js/tajian.js

2
themes/tajian/views/site/login.php

@ -7,7 +7,7 @@
<div class="mb-3 twocol"> <div class="mb-3 twocol">
<label for="text_input_sm" class="form-label">验证码</label> <label for="text_input_sm" class="form-label">验证码</label>
<input id="text_input_sm" name="smscode" placeholder="输入收到的短信验证码"> <input id="text_input_sm" name="smscode" placeholder="输入收到的短信验证码">
<button disabled="disabled" class="smsbtn bt_sms_JS">发送验证码</button> <button class="smsbtn bt_sms_JS">发送验证码</button>
</div> </div>
<div class="avform_bt vercenter"> <div class="avform_bt vercenter">
<button class="jsbtn" aria-label="登录" type="button"> <button class="jsbtn" aria-label="登录" type="button">

2
themes/tajian/views/site/register.php

@ -15,7 +15,7 @@
<div class="mb-3 twocol"> <div class="mb-3 twocol">
<label for="text_input_sm" class="form-label">验证码</label> <label for="text_input_sm" class="form-label">验证码</label>
<input id="text_input_sm" name="smscode" placeholder="输入收到的短信验证码"> <input id="text_input_sm" name="smscode" placeholder="输入收到的短信验证码">
<button disabled="disabled" type="button" class="smsbtn bt_sms_JS">发送验证码</button> <button type="button" class="smsbtn bt_sms_JS">发送验证码</button>
</div> </div>
<div class="avform_bt vercenter"> <div class="avform_bt vercenter">
<button class="jsbtn" aria-label="注册" type="button"> <button class="jsbtn" aria-label="注册" type="button">

18
www/js/tajian.js

@ -208,13 +208,6 @@ if ($('.bt_kf_JS').get(0)) {
} }
} }
var smsCodeBtnHandler = function(e) {
var cellphone = $('input[name=username]').val();
if (/^1[3-9][0-9]{9}$/.test(cellphone)) {
$('.bt_sms_JS').removeAttr('disabled');
}
};
//验证码发送 //验证码发送
if ($('.bt_sms_JS').get(0)) { if ($('.bt_sms_JS').get(0)) {
var timer_restore_smsBtn = null, timer_num = 60; var timer_restore_smsBtn = null, timer_num = 60;
@ -232,6 +225,13 @@ if ($('.bt_sms_JS').get(0)) {
}; };
$('.bt_sms_JS').click(function(e) { $('.bt_sms_JS').click(function(e) {
var cellphone = $('input[name=username]').val();
if (/^1[3-9][0-9]{9}$/.test(cellphone) == false) {
alert('请填写正确的手机号码!');
$('input[name=username]').focus();
return false;
}
autoRestoreSmsBtn(); autoRestoreSmsBtn();
//调用api发送验证码 //调用api发送验证码
@ -253,8 +253,6 @@ if ($('.bt_sms_JS').get(0)) {
// 注册 // 注册
if ($('#register_form').get(0)) { if ($('#register_form').get(0)) {
$('#register_form input[name=username]').blur(smsCodeBtnHandler);
$('#register_form .jsbtn').click(function(e) { $('#register_form .jsbtn').click(function(e) {
e.preventDefault(); e.preventDefault();
@ -310,8 +308,6 @@ if ($('#register_form').get(0)) {
// 登录 // 登录
if ($('#login_form').get(0)) { if ($('#login_form').get(0)) {
$('#login_form input[name=username]').blur(smsCodeBtnHandler);
$('#login_form .jsbtn').click(function(e) { $('#login_form .jsbtn').click(function(e) {
e.preventDefault(); e.preventDefault();

Loading…
Cancel
Save