login.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. define(["easy-admin"], function (ea) {
  2. var Controller = {
  3. index: function () {
  4. if (top.location !== self.location) {
  5. top.location = self.location;
  6. }
  7. $('.bind-password').on('click', function () {
  8. if ($(this).hasClass('icon-5')) {
  9. $(this).removeClass('icon-5');
  10. $("input[name='password']").attr('type', 'password');
  11. } else {
  12. $(this).addClass('icon-5');
  13. $("input[name='password']").attr('type', 'text');
  14. }
  15. });
  16. $('.icon-nocheck').on('click', function () {
  17. if ($(this).hasClass('icon-check')) {
  18. $(this).removeClass('icon-check');
  19. } else {
  20. $(this).addClass('icon-check');
  21. }
  22. });
  23. $('.login-tip').on('click', function () {
  24. $('.icon-nocheck').click();
  25. });
  26. ea.listen(function (data) {
  27. data['keep_login'] = $('.icon-nocheck').hasClass('icon-check') ? 1 : 0;
  28. return data;
  29. }, function (res) {
  30. ea.msg.success(res.msg, function () {
  31. window.location = ea.url('index');
  32. })
  33. }, function (res) {
  34. ea.msg.error(res.msg, function () {
  35. $('#refreshCaptcha').trigger("click");
  36. });
  37. });
  38. },
  39. };
  40. return Controller;
  41. });