Authored by 王水玲

bug 修改

... ... @@ -248,8 +248,17 @@ const sendBindMsg = (req, res, next) => {
let mobile = req.body.mobile;
let area = req.body.area;
if (req.session.autouserinfoMobile && req.session.autouserinfoMobile !== mobile) {
req.session.autouserinfoMobile = '';
req.session.captcha = '';
return res.json({
code: 400,
message: '验证码失效'
});
}
BindService.sendBindMsgAsync(area, mobile).then(result => {
if (result && result.code) {
req.session.autouserinfoMobile = mobile;
req.session.thirdBind = {
mobile: mobile
};
... ...
... ... @@ -60,6 +60,15 @@ function disableSMSBtn() {
}
}
// 刷新图形验证码
function refreshImgCaptcha() {
var time = new Date(),
$captchaImg = $('.img-captcha'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
}
// 发送短信验证码
function sendSMSCaptcha() {
return $.ajax({
... ... @@ -69,18 +78,15 @@ function sendSMSCaptcha() {
mobile: $phoneNumInput.val(),
area: $regionCodeText.text().replace('+', '')
}
}).then(function(ret) {
if (ret && ret.code === 400) {
errTip($imgCaptchaInput, ret.message);
refreshImgCaptcha();
ep.emit('img-captcha', false);
}
});
}
// 刷新图形验证码
function refreshImgCaptcha() {
var time = new Date(),
$captchaImg = $('.img-captcha'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
}
// 异步验证图形码
function validateImgCaptchaAsync() {
return $.ajax({
... ... @@ -268,10 +274,17 @@ $smsCaptchaCtrl.on('click', function() {
return;
}
$smsCaptchaCtrl.addClass('disable');
disableSMSBtn();
sendSMSCaptcha();
validateImgCaptchaAsync().then(function(result) {
if (result.code === 200) {
$smsCaptchaCtrl.addClass('disable');
disableSMSBtn();
sendSMSCaptcha();
} else {
ep.emit('img-captcha', false);
errTip($imgCaptchaInput, '图形验证码错误');
refreshImgCaptcha();
}
});
});
// 统一设置用户信息
... ...