Browse Source

手机验证码

Signed-off-by: chenshihai <chenshh@pcl.ac.cn>
tags/v1.22.7.1
chenshihai 3 years ago
parent
commit
c990a850cb
1 changed files with 22 additions and 3 deletions
  1. +22
    -3
      templates/user/auth/phone_verify.tmpl

+ 22
- 3
templates/user/auth/phone_verify.tmpl View File

@@ -195,7 +195,7 @@
</select> </select>
</div> </div>
<div class="field phone-num-c"> <div class="field phone-num-c">
<input class="phoneNumber" name="phoneNumber" placeholder="手机号码" required />
<input class="phoneNumber" name="phone_number" placeholder="手机号码" required />
</div> </div>
</div> </div>
<div class="slide-bar-c"> <div class="slide-bar-c">
@@ -210,7 +210,7 @@
</div> </div>
<div class="verify-code-c"> <div class="verify-code-c">
<div class="verify-code-num-c"> <div class="verify-code-num-c">
<input class="verifyCode" name="verifyCode" placeholder="请输入短信验证码" required />
<input class="verifyCode" name="verify_code" placeholder="请输入短信验证码" required />
</div> </div>
<div class="verify-code-send"> <div class="verify-code-send">
<div class="verify-code-send-btn __disabled">获取验证码</div> <div class="verify-code-send-btn __disabled">获取验证码</div>
@@ -295,7 +295,7 @@
x: parseInt(self.dom.find('.slide-image-small').position().left) x: parseInt(self.dom.find('.slide-image-small').position().left)
}, },
success: function(res) { success: function(res) {
if (res && res.code === 0) {
if (res && res.Code === 0) {
self.verifySucess = true; self.verifySucess = true;
self.canSendCode = true; self.canSendCode = true;
self.dom.find('.slide-bar').addClass('sucess'); self.dom.find('.slide-bar').addClass('sucess');
@@ -338,9 +338,28 @@
var phoneNumber = self.dom.find('.phone-num-c input').val(); var phoneNumber = self.dom.find('.phone-num-c input').val();
if (!/^1[3578]\d{9}$/.test(phoneNumber)) { if (!/^1[3578]\d{9}$/.test(phoneNumber)) {
self.dom.find('.phone-num-c').addClass('error'); self.dom.find('.phone-num-c').addClass('error');
return;
} else { } else {
self.dom.find('.phone-num-c').removeClass('error'); self.dom.find('.phone-num-c').removeClass('error');
self.countDown(); self.countDown();
$.ajax({
url: '/sendVerifyCode',
type: 'post',
dataType: 'json',
data: {
phone_number: phoneNumber,
mode: 0, // 0注册,1登录 ,2修改手机号,3找回密码
slide_id: self.imgID,
},
success: function(res) {
if (res && res.code === 0) {
console.log(res);
}
},
error: function(err) {
console.log(err);
}
});
} }
}); });
}; };


Loading…
Cancel
Save