123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- $(document).ready(function() {
- $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
- var id = $.cookie('orgId');
- if(id == "" || id == null || id == "null"){
- location.href = "cmp-settled-log.html";
- }
-
- function companyAuthStatus() {
- $.ajax({
- url: "/ajax/org/authStatus",
- type: "GET",
- timeout: 10000,
- dataType: "json",
- data: {
- "id": id
- },
- success: function(data, textState) {
- if(data.success) {
- if(data.data == 3) {
- $("#staff").show();
- } else {
- $("#identityState").show();
- $("#costf").html("员工管理");
- }
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- }
- companyAuthStatus();
-
- function UnauthorizedUser() {
- $.ajax({
- url: "/ajax/professor/qaOrgAuth",
- type: "GET",
- timeout: 10000,
- dataType: "json",
- data: {
- "orgId": id,
- "orgAuth": 1
- },
- success: function(data, textState) {
- if(data.success) {
- console.log(data);
- var $data = data.data;
- UnauthorizedUserHtml($data, "#authorizedUserList", 0);
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- }
- UnauthorizedUser()
-
- function UnauthorizedUserHtml() {
- var arr = new Array();
- for(var i = 0; i < arguments[0].length; i++) {
- var img, tiof, deor, otex;
- if(arguments[0][i].hasHeadImage) {
- img = "/images/head/" + arguments[0][i].id + "_l.jpg";
- } else {
- img = "../images/default-photo.jpg"
- }
- if(arguments[0][i].title) {
- if(arguments[0][i].office) {
- tiof = arguments[0][i].title + " ," + arguments[0][i].office;
- } else {
- tiof = arguments[0][i].title;
- }
- } else {
- if(arguments[0][i].office) {
- tiof = arguments[0][i].office;
- } else {
- tiof = "";
- }
- }
- if(arguments[0][i].department) {
- if(arguments[0][i].orgName) {
- deor = arguments[0][i].department + " ," + arguments[0][i].orgName;
- } else {
- deor = arguments[0][i].department;
- }
- } else {
- if(arguments[0][i].orgName) {
- deor = arguments[0][i].orgName;
- } else {
- deor = "";
- }
- }
- if(arguments[2] == 1) {
- otex = "待认证";
- } else {
- otex = "移除";
- }
- var oString = "<li>"
- oString += "<div class='leftlogo floatL userRadius'>"
- oString += "<img class='headPhoto' src='" + img + "' width='100%'>"
- oString += "</div>"
- oString += "<div class='rightinfo staffinfo floatL'>"
- oString += "<p class='h3Font'>" + arguments[0][i].name + "</p>"
- oString += "<p class='h5Font ellipsisSty'>" + tiof + "</p>"
- oString += "<p class='h5Font ellipsisSty'>" + deor + "</p>"
- oString += "</div>"
- oString += "<button type='button' class='frmtype fontLink btnPosition cmpColor headRadius' data-id='" + arguments[0][i].id + "'>" + otex + "</button>"
- oString += "</li>"
- $(arguments[1]).append(oString);
- }
- }
-
- $("#authorizedUserList").on("click", "button", function() {
- var oDataId = $(this).attr("data-id");
- var oDa = $(this);
- $.ajax({
- url: "/ajax/professor/removeOrgAuth",
- type: "POST",
- timeout: 10000,
- dataType: "json",
- data: {
- "id": oDataId,
- },
- success: function(data, textState) {
- if(data.success) {
- oDa.parents("li").remove();
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- })
-
- $("#mail").on("blur", function() {
- var oMail = $(this).val();
- var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
- if(oMail.trim().length == 0) {
- $.MsgBox.Alert('提示', '请输入您企业员工的邮箱地址');
- return;
- }
- if(!gunf.test(oMail.trim())) {
- $.MsgBox.Alert('提示', '请输入正确的邮箱地址');
- }
- })
- $("button:contains('邀请')").on("click", function() {
- var oMail = $("#mail").val();
- var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
- if(oMail.trim().length == 0) {
- $.MsgBox.Alert('提示', '请输入您企业员工的邮箱地址');
- return;
- }
- if(!gunf.test(oMail.trim())) {
- $.MsgBox.Alert('提示', '请输入正确的邮箱地址');
- return;
- } else {
-
- $.ajax({
- url: "/ajax/isReg",
- type: "GET",
- timeout: 10000,
- dataType: "json",
- data: {
- "key": oMail
- },
- success: function(data, textState) {
- if(data.success) {
- if(data.data) {
- $.ajax({
- url: "/ajax/inviteStaffMail",
- type: "GET",
- timeout: 10000,
- dataType: "json",
- data: {
- "orgId": id,
- "mail": oMail
- },
- success: function(data, textState) {
- if(data.success) {
- if(data.data) {
- $.MsgBox.Alert('提示', '已发送邀请邮件');
- $("#mb_msgicon").css({
- "background-image": "url(images/sign_icon_chenggong_nor.png)",
- "background-size": "cover"
- });
- $("#mail").val("");
- }
- } else {
- $.MsgBox.Alert('提示', data.msg);
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- } else {
- $.MsgBox.Alert('提示', "该邮箱已注册账户");
- }
- } else {
- $.MsgBox.Alert('提示', data.msg);
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- }
- })
- })
|