portal html css js resource

cmp-staffList.js 5.9KB

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