portal html css js resource

cmp-settled-log.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //企业登录
  2. $(function() {
  3. var companyNameVal, companyEmailVal;
  4. var setpass = false;
  5. var setemail = false;
  6. /*校验登录按钮显示状态*/
  7. $('#cmpCoverUl').on('keyup', ".companyEmail,#companyPasw", function() {
  8. if($(".companyEmail").val() == "" || $("#companyPasw").val() == "") {
  9. $("#loginSubmit").attr("disabled", true);
  10. } else {
  11. $("#loginSubmit").attr("disabled", false);
  12. }
  13. });
  14. /*校验企业邮箱*/
  15. $('.companyEmail').on('focus', function() {
  16. $(".msgLog1 span").text("");
  17. });
  18. $('.companyEmail').on('blur', function() {
  19. checkEmail();
  20. });
  21. /*校验登录密码*/
  22. $('#companyPasw').on('focus', function() {
  23. $(".msgLog2 span").text("");
  24. });
  25. $('#companyPasw').on('blur', function() {
  26. checkPasw();
  27. });
  28. /*注册提交*/
  29. $('#loginSubmit').on('click', function() {
  30. mailRegistration();
  31. });
  32. function checkEmail() {
  33. companyEmailVal = $(".companyEmail").val();
  34. //var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  35. var gunf = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  36. if(gunf.test(companyEmailVal.trim())) {
  37. $.ajax("/ajax/isRegOrg", {
  38. data:{"email":companyEmailVal},
  39. type: "GET",
  40. dataType: 'json',
  41. async: false,
  42. success: function($data) {
  43. console.log($data);
  44. if($data.success && $data.data) {
  45. $(".msgLog1").prev().addClass("frmmsg-warning");
  46. $(".msgLog1 span").text("该企业账号不存在,请检查后重试");
  47. } else {
  48. $(".msgLog1").prev().removeClass("frmmsg-warning");
  49. $(".msgLog1 span").text("");
  50. setemail = true;
  51. }
  52. },
  53. error: function() {
  54. $.MsgBox.Alert('提示', '服务器请求失败')
  55. },
  56. });
  57. } else {
  58. $(".msgLog1").prev().addClass("frmmsg-warning");
  59. $(".msgLog1 span").text("请输入正确的邮箱地址");
  60. }
  61. }
  62. function checkPasw() {
  63. companyPaswVal = $("#companyPasw").val();
  64. if(companyPaswVal.length < 6) {
  65. $(".msgLog2").prev().addClass("frmmsg-warning");
  66. $(".msgLog2 span").text("密码由6-24个字符组成,区分大小写");
  67. } else {
  68. $(".msgLog2").prev().removeClass("frmmsg-warning");
  69. $(".msgLog2 span").text("");
  70. setpass = true;
  71. }
  72. }
  73. function mailRegistration() {
  74. if(setpass && setemail) {
  75. $.ajax("/ajax/orgLogin", {
  76. data: {
  77. "lk": companyEmailVal,
  78. "pw": companyPaswVal
  79. },
  80. type: "POST",
  81. dataType: 'json',
  82. async: false,
  83. success: function($data) {
  84. console.log($data)
  85. if($data.success && $data.data!==null) {
  86. $(".msgLog2").prev().removeClass("frmmsg-warning");
  87. location.href = "cmp-workspaces.html";
  88. } else if($data.success && $data.data == null){
  89. $(".msgLog2").prev().addClass("frmmsg-warning");
  90. $(".msgLog2 span").text("登录账号与密码不匹配");
  91. }
  92. },
  93. error: function() {
  94. $.MsgBox.Alert('提示', '服务器请求失败');
  95. }
  96. });
  97. } else {
  98. checkEmail();
  99. checkPasw();
  100. }
  101. }
  102. })