You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

108 lines
4.1 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2024.07.12
  6. * 描 述:解绑微信
  7. */
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var codeType = 'unbindwx', hasSendCode = false, time = 0, timeT = '', isSending = false;
  11. var lrPage = {
  12. init: function () {
  13. lrPage.bind();
  14. },
  15. bind: function () {
  16. // 确认按钮
  17. $("#confirmUpdate").on('click', function () {
  18. lrPage.confirmUpdate();
  19. });
  20. // 发送验证码事件
  21. $("#sendCode").on('click', function () {
  22. lrPage.sendCode();
  23. });
  24. },
  25. updating: function (isShow) {
  26. if (isShow) {
  27. $('#updatepwBox input').attr('disabled', 'disabled');
  28. $("#confirmUpdate").addClass('active').attr('disabled', 'disabled').find('span').hide();
  29. $("#confirmUpdate").css('background', '#eeecec url(/Content/images/Login/loading.gif) no-repeat center 10px');
  30. }
  31. else {
  32. $('#updatepwBox input').removeAttr('disabled');
  33. $("#confirmUpdate").removeClass('active').removeAttr('disabled').find('span').show();
  34. $("#confirmUpdate").css('background', '#268fe2');
  35. }
  36. },
  37. sendCode: function () {
  38. if (isSending || hasSendCode) return;
  39. $('#updatepwBox .error_info').hide()
  40. isSending = true
  41. $.ajax({
  42. url: top.$.rootUrl + "/Home/Sendcode",
  43. data: { codeType },
  44. dataType: 'json',
  45. type: "post",
  46. success: (res) => {
  47. isSending = false;
  48. if (res.code == 200) {
  49. $('#updatepwBox .error_info span').text('短信已发送')
  50. $('#updatepwBox .error_info').show()
  51. hasSendCode = true
  52. time = 60
  53. $('#sendCode').text(`重新发送(${time}s)`)
  54. timeT = setInterval(() => {
  55. time--
  56. if (time == 0) {
  57. hasSendCode = false
  58. clearInterval(timeT)
  59. timeT = ''
  60. }
  61. $('#sendCode').text(`重新发送${time ? '(' + time + 's' + ')' : ''}`)
  62. }, 1000);
  63. } else {
  64. $('#updatepwBox .error_info span').text(res.info)
  65. $('#updatepwBox .error_info').show()
  66. }
  67. }
  68. });
  69. },
  70. confirmUpdate: async function () {
  71. let verifycode = $('#verifycode').val()
  72. if (!verifycode) {
  73. $('#updatepwBox .error_info span').text('请输入验证码')
  74. $('#updatepwBox .error_info').show()
  75. return
  76. }
  77. $('#updatepwBox .error_info').hide()
  78. lrPage.updating(true);
  79. $.ajax({
  80. url: top.$.rootUrl + '/Home/CancelWeiXinBind',
  81. data: { verifycode, codeType },
  82. dataType: 'json',
  83. type: "post",
  84. success: (res) => {
  85. if (res.code == 200) {
  86. $('#updatepwBox .error_info span').text('解绑成功')
  87. $('#updatepwBox .error_info').show()
  88. setTimeout(() => {
  89. learun.layerClose('CancelWeiXinBindForm', '');
  90. }, 1500)
  91. } else {
  92. lrPage.updating(false);
  93. $('#updatepwBox .error_info span').text(res.info)
  94. $('#updatepwBox .error_info').show()
  95. }
  96. }
  97. });
  98. }
  99. };
  100. $(function () {
  101. lrPage.init();
  102. });
  103. }