portal html css js resource

cmp-staffList.js 5.9KB

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