Authored by targaryen

geetest-downgrade

... ... @@ -202,3 +202,17 @@ $('.tp-link a').on('touchstart', function() {
}, true);
}
});
/**
* 极验证不行,重新初始化为自有图片验证
*/
$('#js-img-check').on('change', function() {
validate = new Validate($captcha, {
useREM: {
rootFontSize: 40,
picWidth: 150
}
}, 1);
validate.init();
});
... ...
... ... @@ -19,10 +19,14 @@ const validType = {
})();
class Validate {
constructor(container, options) {
constructor(container, options, type) {
this.$container = container instanceof $ ? container : $(container);
this.options = options;
this.type = this.$container.data('geetest') ? validType.GEETEST : validType.IMG_CHECK;
if (type) {
this.type = type;
} else {
this.type = this.$container.data('geetest') ? validType.GEETEST : validType.IMG_CHECK;
}
this.$container.after('<input id="yohobuy" type="text" style="display:none;">');
if (this.type === validType.IMG_CHECK) {
this.imgCheck = new ImgCheck(this.$container, this.options);
... ... @@ -32,16 +36,20 @@ class Validate {
type: 'get',
dataType: 'json',
success: data => {
window.initGeetest && window.initGeetest({
gt: data.gt,
challenge: data.challenge,
offline: !data.success
}, (captchaObj) => {
this.captchaObj = captchaObj;
captchaObj.appendTo(this.$container);
this._atWorking = true;
this.$container.addClass('hide').addClass('popup');
});
if (data.success) {
window.initGeetest && window.initGeetest({
gt: data.gt,
challenge: data.challenge,
offline: !data.success
}, (captchaObj) => {
this.captchaObj = captchaObj;
captchaObj.appendTo(this.$container);
this._atWorking = true;
this.$container.addClass('hide').addClass('popup');
});
} else {
this.$container.trigger('change');
}
}
});
$('.yoho-page').on('touchstart', '#js-img-check', (e) => {
... ...