portal html css js resource

cmp-staffList.js 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. $(document).ready(function() {
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. var id = $.cookie('orgId');
  4. /*判断企业是否认证*/
  5. function companyAuthStatus() {
  6. $.ajax({
  7. url: "/ajax/org/authStatus",
  8. type: "GET",
  9. timeout: 10000,
  10. dataType: "json",
  11. data: {
  12. "id": id
  13. },
  14. success: function(data, textState) {
  15. if(data.success) {
  16. if(data.data == 3) {
  17. $("#staff").show();
  18. } else {
  19. $("#identityState").show();
  20. $("#costf").html("员工管理");
  21. }
  22. }
  23. },
  24. error: function(XMLHttpRequest, textStats, errorThrown) {
  25. $.MsgBox.Alert('提示', '服务器请求失败')
  26. }
  27. })
  28. }
  29. companyAuthStatus();
  30. /*获取企业认证的用户*/
  31. function UnauthorizedUser() {
  32. $.ajax({
  33. url: "/ajax/professor/qaOrgAuth",
  34. type: "GET",
  35. timeout: 10000,
  36. dataType: "json",
  37. data: {
  38. "orgId": id,
  39. "orgAuth": 1
  40. },
  41. success: function(data, textState) {
  42. if(data.success) {
  43. console.log(data);
  44. var $data = data.data;
  45. UnauthorizedUserHtml($data, "#authorizedUserList", 0);
  46. }
  47. },
  48. error: function(XMLHttpRequest, textStats, errorThrown) {
  49. $.MsgBox.Alert('提示', '服务器请求失败')
  50. }
  51. })
  52. }
  53. UnauthorizedUser()
  54. /*企业认证用户html*/
  55. function UnauthorizedUserHtml() {
  56. var arr = new Array();
  57. for(var i = 0; i < arguments[0].length; i++) {
  58. var img, tiof, deor, otex;
  59. if(arguments[0][i].hasHeadImage) {
  60. img = "/images/head/" + arguments[0][i].id + "_l.jpg";
  61. } else {
  62. img = "../images/default-photo.jpg"
  63. }
  64. if(arguments[0][i].title) {
  65. if(arguments[0][i].office) {
  66. tiof = arguments[0][i].title + " ," + arguments[0][i].office;
  67. } else {
  68. tiof = arguments[0][i].title;
  69. }
  70. } else {
  71. if(arguments[0][i].office) {
  72. tiof = arguments[0][i].office;
  73. } else {
  74. tiof = "";
  75. }
  76. }
  77. if(arguments[0][i].department) {
  78. if(arguments[0][i].orgName) {
  79. deor = arguments[0][i].department + " ," + arguments[0][i].orgName;
  80. } else {
  81. deor = arguments[0][i].department;
  82. }
  83. } else {
  84. if(arguments[0][i].orgName) {
  85. deor = arguments[0][i].orgName;
  86. } else {
  87. deor = "";
  88. }
  89. }
  90. if(arguments[2] == 1) {
  91. otex = "待认证";
  92. } else {
  93. otex = "移除";
  94. }
  95. var oString = "<li>"
  96. oString += "<div class='leftlogo floatL userRadius'>"
  97. oString += "<img class='headPhoto' src='" + img + "' width='100%'>"
  98. oString += "</div>"
  99. oString += "<div class='rightinfo staffinfo floatL'>"
  100. oString += "<p class='h3Font'>" + arguments[0][i].name + "</p>"
  101. oString += "<p class='h5Font ellipsisSty'>" + tiof + "</p>"
  102. oString += "<p class='h5Font ellipsisSty'>" + deor + "</p>"
  103. oString += "</div>"
  104. oString += "<button type='button' class='frmtype fontLink btnPosition cmpColor headRadius' data-id='" + arguments[0][i].id + "'>" + otex + "</button>"
  105. oString += "</li>"
  106. $(arguments[1]).append(oString);
  107. }
  108. }
  109. /*移除企业员工*/
  110. $("#authorizedUserList").on("click", "button", function() {
  111. var oDataId = $(this).attr("data-id");
  112. var oDa = $(this);
  113. $.ajax({
  114. url: "/ajax/professor/removeOrgAuth",
  115. type: "POST",
  116. timeout: 10000,
  117. dataType: "json",
  118. data: {
  119. "id": oDataId,
  120. },
  121. success: function(data, textState) {
  122. if(data.success) {
  123. oDa.parents("li").remove();
  124. }
  125. },
  126. error: function(XMLHttpRequest, textStats, errorThrown) {
  127. $.MsgBox.Alert('提示', '服务器请求失败')
  128. }
  129. })
  130. })
  131. /*检验邮箱*/
  132. $("#mail").on("blur", function() {
  133. var oMail = $(this).val();
  134. var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  135. if(oMail.trim().length == 0) {
  136. $.MsgBox.Alert('提示', '请输入您企业员工的邮箱地址');
  137. return;
  138. }
  139. if(!gunf.test(oMail.trim())) {
  140. $.MsgBox.Alert('提示', '请输入正确的邮箱地址');
  141. }
  142. })
  143. $("button:contains('邀请')").on("click", function() {
  144. var oMail = $("#mail").val();
  145. var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  146. if(oMail.trim().length == 0) {
  147. $.MsgBox.Alert('提示', '请输入您企业员工的邮箱地址');
  148. return;
  149. }
  150. if(!gunf.test(oMail.trim())) {
  151. $.MsgBox.Alert('提示', '请输入正确的邮箱地址');
  152. return;
  153. } else {
  154. /*验证邮箱是否注册*/
  155. $.ajax({
  156. url: "/ajax/isReg",
  157. type: "GET",
  158. timeout: 10000,
  159. dataType: "json",
  160. data: {
  161. "key": oMail
  162. },
  163. success: function(data, textState) {
  164. if(data.success) {
  165. if(data.data) {
  166. $.ajax({
  167. url: "/ajax/inviteStaffMail",
  168. type: "GET",
  169. timeout: 10000,
  170. dataType: "json",
  171. data: {
  172. "orgId": id,
  173. "mail": oMail
  174. },
  175. success: function(data, textState) {
  176. if(data.success) {
  177. if(data.data) {
  178. $.MsgBox.Alert('提示', '已发送邀请邮件');
  179. $("#mb_msgicon").css({
  180. "background-image": "url(images/sign_icon_chenggong_nor.png)",
  181. "background-size": "cover"
  182. });
  183. $("#mail").val("");
  184. }
  185. } else {
  186. $.MsgBox.Alert('提示', data.msg);
  187. }
  188. },
  189. error: function(XMLHttpRequest, textStats, errorThrown) {
  190. $.MsgBox.Alert('提示', '服务器请求失败')
  191. }
  192. })
  193. } else {
  194. $.MsgBox.Alert('提示', "该邮箱已注册账户");
  195. }
  196. } else {
  197. $.MsgBox.Alert('提示', data.msg);
  198. }
  199. },
  200. error: function(XMLHttpRequest, textStats, errorThrown) {
  201. $.MsgBox.Alert('提示', '服务器请求失败')
  202. }
  203. })
  204. }
  205. })
  206. })