...
|
...
|
@@ -4,7 +4,14 @@ import Page from 'yoho-page'; |
|
|
import api from '../api';
|
|
|
import dialog from 'plugin/dialog';
|
|
|
import bindDialogHbs from 'passport/bind-dialog-tip.hbs';
|
|
|
import Validate from 'plugin/validata';
|
|
|
|
|
|
const validate = new Validate('#js-img-check', {
|
|
|
useREM: {
|
|
|
rootFontSize: 40,
|
|
|
picWidth: 150
|
|
|
}
|
|
|
});
|
|
|
const showErrTip = tip.show;
|
|
|
|
|
|
class EmailBindMobile extends Page {
|
...
|
...
|
@@ -19,12 +26,17 @@ class EmailBindMobile extends Page { |
|
|
verifyCodeInput: $('.mobile-form-login input.verify-code-input'),
|
|
|
verifyCodeBtn: $('.mobile-form-login .get-verify-code'),
|
|
|
loginBtn: $('.mobile-form-login .sms-login-btn'),
|
|
|
$captcha: $('#js-img-check')
|
|
|
};
|
|
|
|
|
|
this.init();
|
|
|
}
|
|
|
|
|
|
init() {
|
|
|
if (this.selector.$captcha.data('userverify')) {
|
|
|
validate.init();
|
|
|
}
|
|
|
|
|
|
this.bindEvents();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -134,27 +146,37 @@ class EmailBindMobile extends Page { |
|
|
|
|
|
this.selector.verifyCodeBtn.data('oneClick', true);
|
|
|
|
|
|
let params = {
|
|
|
area: area.replace('+', ''),
|
|
|
mobile: pn
|
|
|
};
|
|
|
validate.getResults().then(result => {
|
|
|
let params = {
|
|
|
area: area.replace('+', ''),
|
|
|
mobile: pn
|
|
|
};
|
|
|
|
|
|
this.ajax({
|
|
|
url: '/passport/bind/forceSendMsg',
|
|
|
type: 'POST',
|
|
|
data: params
|
|
|
}).then(codeResult => {
|
|
|
this.selector.verifyCodeBtn.data('oneClick', false);
|
|
|
$.extend(params, result);
|
|
|
|
|
|
if (codeResult.code === 200) {
|
|
|
this.countDown();
|
|
|
return;
|
|
|
} else {
|
|
|
showErrTip(codeResult.message);
|
|
|
}
|
|
|
this.ajax({
|
|
|
url: '/passport/bind/forceSendMsg',
|
|
|
type: 'POST',
|
|
|
data: params
|
|
|
}).then(codeResult => {
|
|
|
this.selector.verifyCodeBtn.data('oneClick', false);
|
|
|
validate.type === 2 && validate.refresh();
|
|
|
|
|
|
if (codeResult.code === 200) {
|
|
|
this.countDown();
|
|
|
return;
|
|
|
} else {
|
|
|
showErrTip(codeResult.message);
|
|
|
}
|
|
|
|
|
|
(codeResult.changeCaptcha && validate.type !== 2) && validate.refresh();
|
|
|
}).catch(() => {
|
|
|
this.selector.verifyCodeBtn.data('oneClick', false);
|
|
|
showErrTip('出错了,请重试');
|
|
|
validate.refresh();
|
|
|
});
|
|
|
}).catch(() => {
|
|
|
this.selector.verifyCodeBtn.data('oneClick', false);
|
|
|
showErrTip('出错了,请重试');
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -173,8 +195,6 @@ class EmailBindMobile extends Page { |
|
|
return showErrTip('手机号格式不正确,请重新输入');
|
|
|
}
|
|
|
|
|
|
this.selector.loginBtn.data('oneClick', true);
|
|
|
|
|
|
let params = {
|
|
|
area: area.replace('+', ''),
|
|
|
mobile: pn,
|
...
|
...
|
@@ -186,8 +206,6 @@ class EmailBindMobile extends Page { |
|
|
type: 'POST',
|
|
|
data: params
|
|
|
}).then(codeResult => {
|
|
|
this.selector.loginBtn.data('oneClick', false);
|
|
|
|
|
|
if (codeResult.code === 200) {
|
|
|
this.continueBind(
|
|
|
$.extend({isBind: 'N', isRegister: 'N'}, codeResult.data),
|
...
|
...
|
@@ -197,7 +215,6 @@ class EmailBindMobile extends Page { |
|
|
showErrTip(codeResult.message);
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
this.selector.loginBtn.data('oneClick', false);
|
|
|
showErrTip('出错了,请重试');
|
|
|
});
|
|
|
}
|
...
|
...
|
|