Skip to content

Commit

Permalink
Fix : Disabled invite add button.
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Jun 6, 2016
1 parent c9272c1 commit 9a98893
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Library/Controller/Invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public function create()
$result = array(
'error' => 0,
'message' => '创建邀请码成功,刷新后可见',
'invite_num' => $user->invite_num -1,
'invite_num' => $user->invite_num - 1,
'invite' => $invite
);
$user->invite_num = $user->invite_num - 1;
$user->save();
}
$user->invite_num = $user->invite_num -1;
$user->save();

return $result;
}
Expand Down
7 changes: 4 additions & 3 deletions Template/Default/panel/invite.htm
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ <h4>注意!</h4>
$(document).ready(function(){
$(".invitec").click(function(){
showToastr("生成邀请码中..", 0, 2000);
var btn = $(this);
btn.attr('disabled', 'disabled');
$.ajax({
type:"GET",
url:"/invite/create.json",
Expand All @@ -94,17 +96,16 @@ <h4>注意!</h4>
$("#invitec_num2").html(data.invite_num);

if(data.invite != null) {

$("#data-tbody").append('<tr><td>'+ $("#data-tbody").children("tr").length +'</td><td>'+data.invite.invite+'</td><td><a href="javascript:;" class="btn btn-sm btn-secondary" data-set-skin="">可用</a></td></tr>');
}

} else {
showToastr(data.message, 0, 5000, '错误');
}

btn.removeAttr('disabled');
},
error:function(jqXHR){
showToastr("发生错误:"+jqXHR.status, 0);
btn.removeAttr('disabled');
}
})
});
Expand Down

0 comments on commit 9a98893

Please sign in to comment.