portal html css js resource

cmp-settled-reg.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. //企业注册
  2. $(function() {
  3. var companyNameVal, companyEmailVal, companyPaswVal;
  4. var setname = false;
  5. var setpass = false;
  6. var setemail = false;
  7. var ifxuanze = true;
  8. /*校验注册按钮显示状态*/
  9. $('#cmpSettledul').on('keyup', "#companyName,.companyEmail,#companyPasw", function() {
  10. if($("#companyName").val() == "" || $(".companyEmail").val() == "" || $("#companyPasw").val() == "") {
  11. $("#registerSubmit").attr("disabled", true);
  12. } else {
  13. $("#registerSubmit").attr("disabled", false);
  14. }
  15. });
  16. /*校验企业名称*/
  17. $('#companyName').on('blur', function() {
  18. checkName();
  19. });
  20. /*校验企业邮箱*/
  21. $('.companyEmail').on('blur', function() {
  22. checkEmail();
  23. });
  24. /*校验登录密码*/
  25. $('#companyPasw').on('blur', function() {
  26. checkPasw();
  27. });
  28. /*校验单选框*/
  29. $(".cmpAgree").on("click", function() {
  30. if($(this).hasClass("ifxuanze")) {
  31. $(this).removeClass("ifxuanze");
  32. $(this).attr("src", "images/business_button_xuanze_nor.png")
  33. ifxuanze = false;
  34. } else {
  35. $(this).addClass("ifxuanze");
  36. $(this).attr("src", "images/business_button_xuanze_hig.png");
  37. ifxuanze = true;
  38. }
  39. })
  40. /*注册提交*/
  41. $('#registerSubmit').on('click', function() {
  42. if(ifxuanze) {
  43. mailRegistration();
  44. } else {
  45. $.MsgBox.Alert('提示', '请确认后勾选此选项')
  46. }
  47. });
  48. function checkName() {
  49. companyNameVal = $("#companyName").val();
  50. if(companyNameVal.length==""){
  51. $(".msgReg1 span").text("请输入您的企业名称");
  52. }else{
  53. $.ajax("/ajax/isOrgUser", {
  54. data: {
  55. "orgName": companyNameVal
  56. },
  57. type: "GET",
  58. dataType: 'json',
  59. async: false,
  60. success: function($data) {
  61. console.log($data)
  62. if($data.success && $data.data) {
  63. $(".msgReg1 span").text("");
  64. setname = true;
  65. } else if(!$data.success && !$data.data){
  66. if($data.code == 2 || $data.code == 4) {
  67. $(".msgReg1 span").html('该企业已注册企业账户,若您是企业管理者,<a class="cmpColor" href="cmp-settled-reback.html">您可以点击这里找回账户</a>');
  68. } else if($data.code == 3) {
  69. $(".msgReg1 span").text("该企业已成为【科袖认证企业】,若有问题请联系客服 010-62343359");
  70. }
  71. }
  72. },
  73. error: function() {
  74. $.MsgBox.Alert('提示', '服务器请求失败')
  75. },
  76. });
  77. }
  78. }
  79. function checkEmail() {
  80. companyEmailVal = $(".companyEmail").val();
  81. var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  82. if(gunf.test(companyEmailVal.trim())) {
  83. $.ajax("/ajax/isRegOrg", {
  84. data:{"email":companyEmailVal},
  85. type: "GET",
  86. dataType: 'json',
  87. async: false,
  88. success: function($data) {
  89. console.log($data)
  90. if($data.data == false) {
  91. $(".msgReg2 span").text("该邮箱已注册企业账户,请使用其他邮箱");
  92. } else {
  93. $(".msgReg2 span").text("");
  94. setemail = true;
  95. }
  96. },
  97. error: function() {
  98. $.MsgBox.Alert('提示', '服务器请求失败')
  99. },
  100. });
  101. } else {
  102. $(".msgReg2 span").text("请输入正确是邮箱地址");
  103. }
  104. }
  105. function checkPasw() {
  106. companyPaswVal = $("#companyPasw").val();
  107. if(companyPaswVal.length < 6) {
  108. $(".msgReg3 span").text("密码由6-24个字符组成,区分大小写");
  109. } else {
  110. $(".msgReg3 span").text("");
  111. setpass = true;
  112. }
  113. }
  114. function mailRegistration() {
  115. if(setname && setpass && setemail) {
  116. $.ajax("/ajax/regOrgMail", {
  117. data: {
  118. "orgName": companyNameVal,
  119. "mail": companyEmailVal,
  120. "password": companyPaswVal
  121. },
  122. type: "POST",
  123. dataType: 'json',
  124. async: false,
  125. success: function($data) {
  126. console.log($data)
  127. if($data.success) {
  128. location.href = "cmp-settled-active.html?companyEmailVal=" + companyEmailVal;
  129. } else {
  130. if($data.code == -1) {
  131. $.MsgBox.Alert('提示', '该邮箱已注册企业账户,请使用其他邮箱');
  132. } else if($data.code == -2) {
  133. $.MsgBox.Alert('提示', '邮箱发送失败');
  134. }
  135. }
  136. },
  137. error: function() {
  138. $.MsgBox.Alert('提示', '服务器请求失败');
  139. }
  140. });
  141. } else {
  142. checkName();
  143. checkEmail();
  144. checkPasw();
  145. }
  146. }
  147. })