$(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"; } resMgr(id); demandList(true,10, 1); /*查询企业认证状态*/ function companyAuthentState() { $.ajax({ url: '/ajax/org/authStatus', type: "GET", timeout: 10000, dataType: "json", data: { "id": id }, 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(); $("#cmpneedList").on("click",".closeThis",function(){//关闭 var dataId=$(this).parents("li").find(".urlHref").attr("data-id"); $.MsgBox.Confirm("提示", "确认要关闭该需求?",function(){ $.ajax({ "url": "/ajax/demand/close", "type": "POST", "async": true, "data":{ "id":dataId, "uid":id }, "success": function(data) { if(data.success && data.data) { console.log(data); $(".madiaEdit").remove(); demandList(true,10, 1); } } }); }); }) /*需求列表*/ function demandList(isbind, pageSize, pageNo) { $.ajax({ url: "/ajax/demand/pq", type: "GET", timeout: 10000, dataType: "json", data: { "oid": id, "pageNo": pageNo, "pageSize": pageSize }, "beforeSend": function() { $("#cmpneedList").append(''); }, success: function(data, textState) { if(data.success) { console.log(data); $("#cmpneedList").html(""); var $info = data.data.data; if($info.length > 0){ for(var i = 0; i < $info.length; i++) { var liStr=$("
  • ").appendTo("#cmpneedList"); demandHtml($info[i],liStr); userFun($info[i].creator,liStr); } if($info.length != 0) { if(isbind == true) { $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / pageSize), current: data.data.data.pageNo, backFn: function(p) { $("#cmpneedList").html(""); demandList(false,10, p); document.body.scrollTop = document.documentElement.scrollTop = 0; } }); } } }else{ $("#cmpneedList").parent().find(".nodatabox").removeClass("displayNone") } } $(".loading").remove(); }, error: function() { } }) } function demandHtml($data,liStr) { var sowU=""; if($data.pageViews!=0){ sowU='
  • 浏览量 '+$data.pageViews+'
  • ' } var statusU=""; var dateGap = delayDay($data.invalidDay); if($data.state==1 && dateGap=="1"){ statusU='
  • 即将于 '+TimeTr($data.invalidDay)+' 过期
  • ' } if($data.state==0){ statusU='
  • 已于 '+TimeTr($data.invalidDay)+' 过期
  • ' }else if($data.state==2){ statusU='
  • 已于 '+TimeTr($data.modifyTime)+' 完成
  • ' }else if($data.state==3){ statusU='
  • 已于 '+TimeTr($data.modifyTime)+' 关闭
  • ' } var closStr='',pdRight=""; if($data.state==1 || $data.state==0){ pdRight="padding-right:80px"; closStr += '' } var strCon=''; strCon+='' strCon+='

    '+ $data.title +'

    ' strCon+='' strCon+='
    '+closStr $(strCon).appendTo(liStr); } function userFun(id,$listItem) { $.ajax({ "url": "/ajax/professor/editBaseInfo/" + id, "type": "get", "async": true, "data":{ "id":id }, "success": function(data) { if(data.success && data.data) { $listItem.find(".creator").text(data.data.name); } }, "error": function() { $.MsgBox.Alert('提示', '链接服务器超时') } }); } function delayDay(startTime){ var dateToday = new Date(); var dateInvalid = new Date(); dateInvalid.setFullYear(parseInt(startTime.substring(0, 4))); dateInvalid.setMonth(parseInt(startTime.substring(4, 6)) - 1); dateInvalid.setDate(parseInt(startTime.substring(6, 8))); var dateGap = Math.abs(dateToday.getTime() - dateInvalid.getTime()); var ifDelay="0"; if(dateGap < 604800000){ ifDelay="1"; } return ifDelay; } })