portal html css js resource

cmp-staffList.js 5.7KB

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