portal html css js resource

cmp-staff-invite-log.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. var step = GetQueryString("step"),
  2. orgId = GetQueryString("aid"),
  3. orgName = GetQueryString("an"),
  4. orgLogo = GetQueryString("al");
  5. var namePass = false;
  6. var passwordPass = false;
  7. $(".cmpOrgName").text(orgName);
  8. $("#orgHeadLogo").attr("src", orgLogo);
  9. var foL = $('.cmp-invite-block').attr('data-step'),
  10. foR = $('.cmp-success-block').attr('data-step');
  11. if(step === foR){
  12. $('.cmp-success-block').show();
  13. }else{
  14. $('.cmp-invite-block').show();
  15. }
  16. $("#soonReg").on("click",function(){
  17. location.href = 'cmp-staff-invite.html?aid='+orgId+'&an='+orgName+'&al='+orgLogo
  18. })
  19. /*校验登录按钮显示状态*/
  20. function checkLoginButtn(_this) {
  21. var username = $(_this).parents(".cmpCoverUl").find(".username").val();
  22. var passwd = $(_this).parents(".cmpCoverUl").find(".passwd").val();
  23. if(username == "" || passwd == "") {
  24. $(_this).parents(".cmpCoverUl").find(".loginSubmit").attr("disabled", true);
  25. } else {
  26. $(_this).parents(".cmpCoverUl").find(".loginSubmit").attr("disabled", false);
  27. }
  28. }
  29. /*获取焦点*/
  30. function getFocus(_this) {
  31. $(_this).next().find("span").text("");
  32. $(_this).removeClass("frmmsg-warning");
  33. }
  34. //校验登录手机和邮箱账户
  35. function nameVal(_this) {
  36. var loginName = $(_this).val();
  37. var gunf = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
  38. var hunPhone = /^1[3|4|5|7|8]\d{9}$/;
  39. if(loginName.length == "") {
  40. $(_this).next().find("span").text("请输入您的手机或邮箱");
  41. $(_this).addClass("frmmsg-warning");
  42. } else if(gunf.test(loginName.trim())) {
  43. userRegisterOk(_this);
  44. $(_this).next().find("span").text("");
  45. $(_this).removeClass("frmmsg-warning");
  46. namePass = true;
  47. } else if(hunPhone.test(loginName.trim())) {
  48. userRegisterOk(_this);
  49. $(_this).next().find("span").text("");
  50. $(_this).removeClass("frmmsg-warning");
  51. namePass = true;
  52. } else {
  53. $(_this).next().find("span").text("请输入正确的手机或邮箱");
  54. $(_this).addClass("frmmsg-warning");
  55. }
  56. }
  57. //判断账号是否注册
  58. function userRegisterOk(_this,org) {
  59. var loginName = $(_this).val();
  60. $.ajax("/ajax/isReg?key=" + loginName, {
  61. type: "GET",
  62. async: true,
  63. success: function($data) {
  64. if($data.data == true) {
  65. $(_this).next().find("span").text("该账号不存在,请检查后重试");
  66. $(_this).addClass("frmmsg-warning");
  67. } else {
  68. $(_this).next().find("span").text("");
  69. $(_this).removeClass("frmmsg-warning");
  70. if(org==1){
  71. doClick("#getcode");
  72. phoneVerificationCode("#getcode");
  73. }
  74. }
  75. }
  76. });
  77. }
  78. //校验登录密码
  79. function passwordVal(_this) {
  80. var passwd = $(_this).val();
  81. if(passwd.length == "") {
  82. $(_this).next().find("span").text("请输入您的登录密码");
  83. $(_this).addClass("frmmsg-warning");
  84. } else if(passwd.length < 6) {
  85. $(_this).next().find("span").text("密码由6-24个字符组成,区分大小写");
  86. $(_this).addClass("frmmsg-warning");
  87. } else {
  88. $(_this).next().find("span").text("");
  89. $(_this).removeClass("frmmsg-warning");
  90. passwordPass = true;
  91. }
  92. }
  93. var professorId;
  94. //密码登录
  95. function passwdLogin(_this) {
  96. var loginName = $(_this).parents(".cmpCoverUl").find(".username").val();
  97. var passwordd = $(_this).parents(".cmpCoverUl").find(".passwd").val();
  98. if(namePass && passwordPass) {
  99. $.ajax("/ajax/login", {
  100. type: "POST",
  101. data: {
  102. "pw": passwordd,
  103. "lk": loginName
  104. },
  105. dataType: 'json',
  106. async: false,
  107. success: function(data) {
  108. if(data.success) {
  109. if(data.data != "null" && data.data != null) {
  110. professorId=data.data.id;
  111. getUserInfo(data.data.id)
  112. } else {
  113. $(_this).parents(".cmpCoverUl").find(".msgLog2 span").text("账号与密码不匹配,请检查后重试");
  114. }
  115. }
  116. }
  117. });
  118. }
  119. }
  120. function getUserInfo(id){
  121. $.ajax("/ajax/professor/baseInfo/"+id, {
  122. type: "GET",
  123. dataType: 'json',
  124. success: function(data) {
  125. if(data.success) {
  126. var auth = data.data.orgAuth;
  127. $(".cmpOrgName2").text(data.data.orgName);
  128. if(auth === '1'){
  129. $('.loginBl').addClass('displayNone')
  130. $('.sureIBl').removeClass('displayNone')
  131. }else if(auth === '0'){
  132. joinOrg(id);
  133. }
  134. }
  135. }
  136. });
  137. }
  138. $('.sureIBl').on('click','.sureUpData',function(){
  139. joinOrg(professorId);
  140. })
  141. $('.sureIBl').on('click','.reject-btn',function(){
  142. $.cookie('userid', null);
  143. $.cookie('userAuth', null);
  144. $.cookie('userEmail', null);
  145. $.cookie('userMobilePhone', null);
  146. $.cookie('userName', null);
  147. $.cookie('userType', null);
  148. location.href = "../index.html"
  149. })
  150. $('.login-kexiu').on('click', function(){
  151. location.href = "../index.html"
  152. })
  153. //加入企业
  154. function joinOrg(id){
  155. $.ajax("/ajax/professor/joinAndPassOrgAuth", {
  156. type: "POST",
  157. async: true,
  158. data: {
  159. "pid": id,
  160. "oid": orgId
  161. },
  162. success: function(res) {
  163. if(res.success){
  164. $('.cmp-success-block').show();
  165. $('.cmp-invite-block').hide();
  166. }
  167. }
  168. })
  169. }
  170. //提交登录
  171. function login(_this) {
  172. passwdLogin(_this);
  173. }