Skip to content

Commit

Permalink
fix 发送验证码
Browse files Browse the repository at this point in the history
  • Loading branch information
gbzhurui authored and twinh committed Dec 7, 2016
1 parent cede06e commit 1761360
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions public/js/verify-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ define(function() {
var VerifyCode = function(element, options) {
this.options = options;
this.$element = $(element);
this.enabled = true;

this.init();
};
Expand All @@ -23,8 +24,10 @@ define(function() {
this.options.btnContent = $el.html();

$el.click(function () {
that.disable('发送中...');
that.send();
if(that.enabled) {
that.disable('发送中...');
that.send();
}
});
};

Expand All @@ -50,10 +53,12 @@ define(function() {
};

VerifyCode.prototype.enable = function (content) {
this.enabled = true;
this.$element.removeClass('disabled').html(content || this.options.btnContent);
};

VerifyCode.prototype.disable = function (content) {
this.enabled = false;
this.$element.addClass('disabled').html(content);
};

Expand Down

0 comments on commit 1761360

Please sign in to comment.