Authored by 周少峰

Merge branch 'release/5.3' into 'gray'

Release/5.3

增加标志调整请求速度

See merge request !28
... ... @@ -16,6 +16,7 @@ var Captcha = function(container, options) {
this.picWidth = null;
this.$tip = null;
this.refreshCb = null;
this.running = false;
return this;
};
... ... @@ -89,13 +90,19 @@ Captcha.prototype = {
var self = this;
var uri = this.refreshURI;
if (self.running) {
return $.Deferred().reject().promise(); // eslint-disable-line
}
self.running = true;
return $.get(uri)
.done(function(result) {
if (result.code !== 200) {
return self.showTip();
}
var src = result.data.images;
var src = result.data.images; // eslint-disable-line
self.render({
images: src
... ... @@ -105,7 +112,9 @@ Captcha.prototype = {
self.refreshCb && self.refreshCb();
})
.fail($.noop);
.always(function() {
self.running = false;
});
},
onRefresh: function(cb) {
... ...