Authored by htoooth

fix lib

... ... @@ -120,7 +120,10 @@ var mailPhoneRegx = require('../common/mail-phone-regx'), // 邮箱格式验证
mailAc = require('../common/ac-email'); // 邮箱自动完成
// 刷新手机短信图形验证码
var refreshSmsImgCallBack = $.Callbacks(); // eslint-disable-line
var refreshSmsCaptchaEvent = $.Callbacks(); // eslint-disable-line
// 刷新手机密码图形验证码
var refreshPasswordCaptchaEvent = $.Callbacks(); // eslint-disable-line
// 记住我符号
var checkboxSymbol = {
... ... @@ -321,10 +324,14 @@ mobileTipShowOnce.add(function() {
$deviceTips.removeClass('hide');
});
refreshSmsImgCallBack.add(function() {
refreshSmsCaptchaEvent.add(function() {
refreshSmsCaptchaImg(); // eslint-disable-line
});
refreshPasswordCaptchaEvent.add(function() {
refreshPasswordCaptchaImg(); // eslint-disable-line
});
/** ************************************************************************/
/* 加载自定义库 */
/** ************************************************************************/
... ... @@ -350,6 +357,7 @@ function errTipHide($tip, $input) {
/** ************************************************************************/
function showAccountTip1(msg) {
refreshPasswordCaptchaEvent.fire();
return errTipShow($accountTip1, $accountInput1, msg);
}
... ... @@ -358,7 +366,7 @@ function hideAccountTip1() {
}
function showAccountTip2(msg) {
refreshSmsImgCallBack.fire();
refreshSmsCaptchaEvent.fire();
return errTipShow($accountTip2, $accountInput2, msg);
}
... ... @@ -369,6 +377,7 @@ function hideAccountTip2() {
/** ************************************************************************/
function showPasswordTip(msg) {
refreshPasswordCaptchaEvent.fire();
return errTipShow($passwordTip, $passwordInput, msg);
}
... ... @@ -385,7 +394,7 @@ function hideCaptchaImgTip() {
/** ************************************************************************/
function showCaptchaSmsTip(msg) {
refreshSmsImgCallBack.fire();
refreshSmsCaptchaEvent.fire();
return errTipShow($captchaSmsTip, $captchaSmsInput, msg);
}
... ... @@ -396,7 +405,7 @@ function hideCaptchaSmsTip() {
/** ************************************************************************/
function showSmsCaptchaImgTip() {
refreshSmsImgCallBack.fire();
refreshSmsCaptchaEvent.fire();
smsCaptchaImg.showTip();
}
... ... @@ -544,6 +553,10 @@ function validateCaptchaImg() {
.then(hideCaptchaSmsTip);
}
function refreshPasswordCaptchaImg() {
return captchaImg.refresh();
}
/** ************************************************************************/
/* 短信验证码 */
/** ************************************************************************/
... ...
... ... @@ -2,6 +2,10 @@
* Created by TaoHuang on 2016/12/12.
*/
var $ = require('yoho-jquery');
require('../common/promise');
var GeeCaptcha = function(container, options) {
var optionDefault = {
template: require('hbs/common/gee-captcha.hbs')
... ... @@ -13,6 +17,7 @@ var GeeCaptcha = function(container, options) {
this.$container.html(this.template());
this.$tip = this.$container.find('.img-check-tip-gee');
this._result = [];
this._captchObj = null;
return this;
};
... ... @@ -35,6 +40,8 @@ GeeCaptcha.prototype = {
initCallback: function(captchaObj) {
var _this = this;
_this._captchObj = captchaObj;
captchaObj.onSuccess(function() {
var validate = captchaObj.getValidate();
... ... @@ -61,7 +68,11 @@ GeeCaptcha.prototype = {
},
refresh: function() {
return $.Deferred().resolve().promise(); // eslint-disable-line
var _this = this;
return $.sleep(500).then(function() {
_this._captchObj.refresh();
});
},
onRefresh: function(cb) {
... ...