$(document).ready(function() { $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent"); $(".workmenu>ul>li.productIcon").addClass("nowLi"); var orgId = $.cookie('orgId'); if(orgId == "" || orgId == null || orgId == "null") { location.href = "cmp-settled-log.html"; } var resourceId; function companyAuthentState() { $.ajax({ url: '/ajax/org/authStatus', type: "GET", timeout: 10000, dataType: "json", data: { "id": orgId }, beforeSend: function() {}, success: function(data, textState) { if(data.success) { console.log(data); if(data.data == 3) { $("#companyDemandList").show(); } else { $("#identityState").show(); } } }, error: function(XMLHttpRequest, textStats, errorThrown) { $.MsgBox.Alert('提示', '服务器请求失败') } }) } companyAuthentState(); $(".issueSpan").click(function(e){ UnauthorizedUser() e.preventDefault(); }) function UnauthorizedUser() { $.ajax({ url: "/ajax/professor/qaOrgAuth", type: "GET", timeout: 10000, dataType: "json", async:"true", data: { "orgId": orgId, "orgAuth": 1 }, success: function(data, textState) { if(data.success) { if(data.data.length==0) { $.MsgBox.Confirm("提示", "请至少认证1位员工选择认证员工作为联系人,代表企业与对方沟通。", function(){ location.href="cmp-staffList.html"; }); $("#mb_btn_no").val("稍后再说"); $("#mb_btn_ok").val("去认证"); }else if(data.data.length>0){ window.open("cmp-procuctIssue.html") } } }, error: function(XMLHttpRequest, textStats, errorThrown) { $.MsgBox.Alert('提示', '服务器请求失败') } }) } /*产品列表查询*/ function getRecourceMe(n, isbind, num) { var resourceNameVa = $("#resouceName").val(); var $info = {}; $info.oid = orgId; $info.pageSize = 10; if(resourceNameVa != "") { $info.key = resourceNameVa; } $info.pageNo = n; $.ajax({ "url": "/ajax/product/pq/org/search", "type": "GET", "success": function(data) { console.log(data) if(data.success) { $("#resourceList").html(""); if(num == 1) { if(data.data.data.length == 0) { $("#noresource").removeClass("displayNone"); $(".noContip").text("您还未发布任何产品"); return; } else { $("#noresource").addClass("displayNone"); } } else { if(data.data.total == 0) { $("#noresource").removeClass("displayNone"); $(".noContip").text("没有符合该搜索条件的内容"); return; } else { $("#noresource").addClass("displayNone"); } } resourceHtml(data.data.data); if(isbind == true) { $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / data.data.pageSize), current: data.data.pageNo, backFn: function(p) { getRecourceMe(p, false); } }); } } }, "data": $info, dataType: "json", 'error': function() { $.MsgBox.Alert('提示', '服务器连接超时!'); } }); } getRecourceMe(1, true); function resourceHtml($data) { for(var i = 0; i < $data.length; i++) { var imgSrc = "../images/default-product.jpg"; var oTime, pageview = "", draftLable = "", oHtml, oLi = ''; if($data[i].images.length) { imgSrc = "/data/product/" + $data[i].images.split(',')[0] } console.log($data[i].status) if($data[i].state == 2) { oTime = "修改于 " + TimeTr($data[i].modifyTime); draftLable = '草稿'; oHtml = "cmp-procuctIssue.html"; oLi = "class='draftList'" } else { oTime = "发布于 " + TimeTr($data[i].createTime); pageview = '
' + $data[i].name + '
' + '' + draftLable + '
' + '