Authored by 毕凯

完善验证码初始化

... ... @@ -23,7 +23,7 @@ const load = (req, res, next) => {
if (res.locals.useGeetest) {
req.yoho.captchaShow = false;
} else {
let isNeedImgCheckApiData = yield req.ctx(imgCheck).isNeedImgCheck();
let isNeedImgCheckApiData = yield req.ctx(imgCheck).isNeedImgCheck(req);
req.yoho.captchaShow = true;
if (_.parseInt(_.get(isNeedImgCheckApiData, 'code')) === 200) {
... ...
... ... @@ -41,10 +41,19 @@ module.exports = class extends global.yoho.BaseModel {
/**
* 是否需要验证码
*/
isNeedImgCheck() {
isNeedImgCheck(req) {
let udid = req.sessionID;
return this.get({
api: global.yoho.ServiceAPI,
url: 'smart/way'
url: 'smart/way',
data: {
udid: udid,
fromPage: PAGE
}
}).then(result => {
logger.info(`smart/way ${udid} result: ${JSON.stringify(result)}`);
return result;
});
}
};
... ...
... ... @@ -35,7 +35,9 @@ class SmsLoginNew extends Page {
* 初始化
*/
init() {
validate.init();
if ($captcha.data('userverify')) {
validate.init();
}
this.bindEvents();
this.selector.getVerifyCodeBtn.data('oneClick', false);
... ...