Authored by 郭成尧

login-ok

... ... @@ -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 + '&registerCode=' + 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);
... ...
... ... @@ -8,6 +8,10 @@ $top-bar-font-color: #444;
.sms-login-new-page {
@extend padding-75;
.active {
background-color: #444 !important;
}
.iconfont {
color: #444;
}
... ... @@ -114,17 +118,13 @@ $top-bar-font-color: #444;
float: right;
margin-top: -8px;
}
> .active {
background-color: #444;
}
}
.sms-login-btn {
width: 600px;
height: 70px;
border-radius: 4px;
background-color: #444;
background-color: #e0e0e0;
margin-top: 100px;
font-size: 32px;
color: #fff;
... ...