Authored by 郝肖肖

'绑定手机号成功界面'

... ... @@ -372,16 +372,13 @@ const bind = {
// 调用绑定接口
forceBindMobileApi: (req, res, next) => {
if (req.session.bindEmail && req.session.bindPass) {
return res.json({code: 301, data: {}, message: 'success'});
if (!req.session.bindEmail || !req.session.bindPassword) {
return res.json({code: 401, data: {}, message: '请重新登录授权'});
}
req.body.email = '1181060696@qq.com';
req.body.password = 'hao123456';
req.ctx(BindServiceModel).bindEmailLoginMobile(Object.assign(req.body, {
email: req.session.bindEmail,
password: req.session.bindPass,
password: req.session.bindPassword,
})).then(result => {
if (_.get(result, 'code', 400) !== 200) {
return res.json(result);
... ... @@ -394,7 +391,7 @@ const bind = {
result.data.session_key
).then(() => {
delete req.session.bindEmail;
delete req.session.bindPass;
delete req.session.bindPassword;
return res.json({code: 200, data: {}, message: 'success'});
});
}).catch(next);
... ...
... ... @@ -83,9 +83,8 @@ router.get('/passport/password/resetsuccess', reset.passwordResetOkPage); // 重
// 通过邮箱登录绑定手机号
router.get('/passport/bind/forceBindMobile', validateCode.load, bind.forceBindMobilePage);
router.post('/passport/bind/forceSendMsg', bind.sendMsgApi, bind.forceSendMsg);
router.post('/passport/bind/forceSendMsg', validateCode.check, bind.sendMsgApi, bind.forceSendMsg);
router.post('/passport/bind/forceMobileCheck',
validateCode.check,
bind.forceMobileCheckApi,
bind.forceBindMobileApi
);
... ...
... ... @@ -147,26 +147,34 @@ class EmailMobile 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);
if (codeResult.code === 200) {
this.countDown();
return;
} else {
showErrTip(codeResult.message);
}
}).catch(() => {
this.selector.verifyCodeBtn.data('oneClick', false);
showErrTip('出错了,请重试');
$.extend(params, result);
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();
});
});
}
... ... @@ -187,39 +195,30 @@ class EmailMobile extends Page {
this.selector.loginBtn.data('oneClick', true);
validate.getResults().then(result => {
let params = {
area: area.replace('+', ''),
mobile: pn,
code: verifyCode,
};
$.extend(params, result);
this.ajax({
url: '/passport/bind/forceMobileCheck',
type: 'POST',
data: params
}).then(codeResult => {
this.selector.loginBtn.data('oneClick', false);
validate.type === 2 && validate.refresh();
let params = {
area: area.replace('+', ''),
mobile: pn,
code: verifyCode,
};
if (codeResult.code === 200) {
this.continueBind(
$.extend({isBind: 'N', isRegister: 'N'}, codeResult.data),
params
);
} else {
showErrTip(codeResult.message);
}
this.ajax({
url: '/passport/bind/forceMobileCheck',
type: 'POST',
data: params
}).then(codeResult => {
this.selector.loginBtn.data('oneClick', false);
(codeResult.changeCaptcha && validate.type !== 2) && validate.refresh();
}).catch(() => {
this.selector.loginBtn.data('oneClick', false);
showErrTip('出错了,请重试');
validate.refresh();
});
if (codeResult.code === 200) {
this.continueBind(
$.extend({isBind: 'N', isRegister: 'N'}, codeResult.data),
params
);
} else {
showErrTip(codeResult.message);
}
}).catch(() => {
this.selector.loginBtn.data('oneClick', false);
showErrTip('出错了,请重试');
});
}
... ... @@ -238,7 +237,7 @@ class EmailMobile extends Page {
}
dialog.showDialog({
dialogText: bindDialogHbs({isBind: true}),
dialogText: bindDialogHbs(bindParams),
fast: true,
hasFooter: {
leftBtnText: '去登录',
... ...