register.ui.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. window.changeAgreeUX = function(e)
  2. {
  3. e = $(e);
  4. $.post($.createLink('admin', 'changeAgreeUX'),{agreeUX:e.prop('checked')},function(response)
  5. {
  6. response = JSON.parse(response);
  7. zui.Messager.show(response.message);
  8. });
  9. }
  10. window.unBind = function()
  11. {
  12. $.post($.createLink('admin', 'unBindCommunity'),{},function(response)
  13. {
  14. response = JSON.parse(response);
  15. zui.Messager.show(response.message);
  16. if(response.result == 'success')
  17. {
  18. setTimeout(function() {
  19. location.href = response.load;
  20. }, 1000);
  21. }
  22. });
  23. }
  24. window.getCaptchaContent = function(ele)
  25. {
  26. $ele = $(ele);
  27. $.get($.createLink('admin', 'getCaptcha'), function(response)
  28. {
  29. response = JSON.parse(response);
  30. if(response.result == 'success') $ele.html(response.captchaContent);
  31. });
  32. }
  33. window.showCaptcha = function()
  34. {
  35. $('.captcha-mobile-sender').show();
  36. }
  37. window.checkMobileSender = function()
  38. {
  39. $.post($.createLink('admin', 'sendCode'),{mobile:$('#mobile-captcha').val(), captchaContent: $('#captchaImage').val()},function(response)
  40. {
  41. response = JSON.parse(response);
  42. zui.Messager.show(response.message);
  43. if(response.result == 'success')
  44. {
  45. countdown = 60;
  46. setSmsSenderTime();
  47. $('.captcha-mobile-sender').hide();
  48. }
  49. else
  50. {
  51. if(response.captchaContent) $('.captcha-box .image-box').html(response.captchaContent);
  52. }
  53. });
  54. }
  55. window.setSmsSenderTime = function()
  56. {
  57. $('#captcha-btn').html(countdown + 's').off('click').removeClass('captcha-btn-class');
  58. smsSenderTimer = setInterval(function(){
  59. countdown -= 1;
  60. if(countdown > 0){
  61. $('#captcha-btn').html(countdown + 's').off('click').removeClass('captcha-btn-class');
  62. }else{
  63. window.clearInterval(smsSenderTimer);
  64. $('#captcha-btn').html(reSendText).on('click', function(e)
  65. {
  66. $('.captcha-mobile-sender').show();
  67. }).addClass('captcha-btn-class');
  68. }
  69. },1000);
  70. }
  71. window.goCommunity = function(link)
  72. {
  73. window.open(link)
  74. }
  75. window.loadToRegister = function()
  76. {
  77. setTimeout(function() {
  78. location.href = $.createLink('admin', 'register');
  79. }, 2000);
  80. }
  81. window.loadToIndex = function()
  82. {
  83. setTimeout(function() {
  84. location.href = $.createLink('index', 'index');
  85. }, 2000);
  86. }
  87. window.getFingerprint = function()
  88. {
  89. $.getLib(config.webRoot + 'js/fingerprint/fingerprint.js', {root: false}, async function(fingerprint)
  90. {
  91. const agent = typeof(FingerprintJS) !== 'undefined' ? await FingerprintJS.load() : '';
  92. fingerprint = agent ? await agent.get() : '';
  93. fingerprint = fingerprint ? fingerprint.visitorId : '';
  94. $('.form-fingerprint').val(fingerprint);
  95. });
  96. }
  97. window.skip = function()
  98. {
  99. ajaxInstallEvent('click-skip');
  100. setTimeout(function() {
  101. location.href = $.createLink('index', 'index');
  102. }, 1000);
  103. }
  104. window.ajaxInstallEvent = function(location = '')
  105. {
  106. $.getLib(config.webRoot + 'js/fingerprint/fingerprint.js', {root: false}, async function()
  107. {
  108. const agent = typeof(FingerprintJS) !== 'undefined' ? await FingerprintJS.load() : '';
  109. let fingerprint = agent ? await agent.get() : '';
  110. fingerprint = fingerprint ? fingerprint.visitorId : '';
  111. $.ajax({url: $.createLink('misc', 'installEvent'), type: "post", data: {fingerprint, location}, timeout: 2000});
  112. });
  113. }