portal html css js resource

cmp-settled-reg.js 5.0KB

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