...
|
...
|
@@ -20,6 +20,7 @@ class SmsLoginNew extends Page { |
|
|
countryCodeSelector: $('#countryCodeSelector'),
|
|
|
mobileInput: $('input[name=mobile]'),
|
|
|
getVerifyCodeBtn: $('#getVerifyCodeBtn'),
|
|
|
verifyCode: $('input[name=verifyCode]'),
|
|
|
smsLoginBtn: $('#smsLoginBtn')
|
|
|
};
|
|
|
|
...
|
...
|
@@ -40,6 +41,7 @@ class SmsLoginNew extends Page { |
|
|
this.selector.clearMobile.on('click', this.clearMobile.bind(this));
|
|
|
this.selector.mobileInput.bind('input', this.changeBtnStatus.bind(this));
|
|
|
this.selector.getVerifyCodeBtn.on('click', this.getVerifyCode.bind(this));
|
|
|
this.selector.verifyCode.bind('input', this.changeBtnStatus.bind(this));
|
|
|
this.selector.smsLoginBtn.on('click', this.login.bind(this));
|
|
|
}
|
|
|
|
...
|
...
|
@@ -53,13 +55,45 @@ class SmsLoginNew extends Page { |
|
|
} else {
|
|
|
this.selector.getVerifyCodeBtn.removeClass('active');
|
|
|
}
|
|
|
|
|
|
// 登录按钮
|
|
|
if (this.selector.mobileInput.val() && this.selector.verifyCode.val()) {
|
|
|
this.selector.smsLoginBtn.addClass('active');
|
|
|
} else {
|
|
|
this.selector.smsLoginBtn.removeClass('active');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 登录
|
|
|
*/
|
|
|
login() {
|
|
|
if (!this.selector.smsLoginBtn.hasClass('active')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let code = this.selector.verifyCode.val();
|
|
|
|
|
|
this.ajax({
|
|
|
url: '/passport/sms_login/check.json',
|
|
|
data: {
|
|
|
code: code
|
|
|
}
|
|
|
}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
checkPoint('YB_MOBILE_LOGIN_C'); // 埋点
|
|
|
|
|
|
if (res.newer) {
|
|
|
res.redirect = res.redirect + '®isterCode=' + res.registerCode;
|
|
|
}
|
|
|
|
|
|
location.href = res.redirect;
|
|
|
return;
|
|
|
}
|
|
|
tip.show(res.message);
|
|
|
}).catch(() => {
|
|
|
tip.show('出错了!');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -88,7 +122,7 @@ class SmsLoginNew extends Page { |
|
|
validate.type === 2 && validate.refresh();
|
|
|
if (data.code === 200) {
|
|
|
checkPoint('YB_MOBILE_NEXT_C'); // 埋点
|
|
|
location.href = data.redirect;
|
|
|
console.log(data);
|
|
|
} else {
|
|
|
(data.changeCaptcha && validate.type !== 2) && validate.refresh();
|
|
|
tip.show(data.message);
|
...
|
...
|
|