portal html css js resource

cmp-settled-log.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. if(gunf.test(companyEmailVal.trim())) {
  36. $.ajax("/ajax/isRegOrg", {
  37. data:{"email":companyEmailVal},
  38. type: "GET",
  39. dataType: 'json',
  40. async: false,
  41. success: function($data) {
  42. console.log($data);
  43. if($data.success && $data.data) {
  44. $(".msgLog1").prev().addClass("frmmsg-warning");
  45. $(".msgLog1 span").text("该企业账号不存在,请检查后重试");
  46. } else {
  47. $(".msgLog1").prev().removeClass("frmmsg-warning");
  48. $(".msgLog1 span").text("");
  49. setemail = true;
  50. }
  51. },
  52. error: function() {
  53. $.MsgBox.Alert('提示', '服务器请求失败')
  54. },
  55. });
  56. } else {
  57. $(".msgLog1").prev().addClass("frmmsg-warning");
  58. $(".msgLog1 span").text("请输入正确的邮箱地址");
  59. }
  60. }
  61. function checkPasw() {
  62. companyPaswVal = $("#companyPasw").val();
  63. if(companyPaswVal.length < 6) {
  64. $(".msgLog2").prev().addClass("frmmsg-warning");
  65. $(".msgLog2 span").text("密码由6-24个字符组成,区分大小写");
  66. } else {
  67. $(".msgLog2").prev().removeClass("frmmsg-warning");
  68. $(".msgLog2 span").text("");
  69. setpass = true;
  70. }
  71. }
  72. function mailRegistration() {
  73. if(setpass && setemail) {
  74. $.ajax("/ajax/orgLogin", {
  75. data: {
  76. "lk": companyEmailVal,
  77. "pw": companyPaswVal
  78. },
  79. type: "POST",
  80. dataType: 'json',
  81. async: false,
  82. success: function($data) {
  83. console.log($data)
  84. if($data.success && $data.data!==null) {
  85. $(".msgLog2").prev().removeClass("frmmsg-warning");
  86. location.href = "cmp-workspaces.html";
  87. } else if($data.success && $data.data == null){
  88. $(".msgLog2").prev().addClass("frmmsg-warning");
  89. $(".msgLog2 span").text("登录账号与密码不匹配");
  90. }
  91. },
  92. error: function() {
  93. $.MsgBox.Alert('提示', '服务器请求失败');
  94. }
  95. });
  96. } else {
  97. checkEmail();
  98. checkPasw();
  99. }
  100. }
  101. })