portal html css js resource

cmp-staffList.js 5.9KB

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