$(document).ready(function() { $(".onlogin .headnavbtn li.mywork").addClass("navcurrent"); $(".workmenu>ul>li:contains('需求')").addClass("nowLi"); loginStatus();//判断个人是否登录 valUser(); function getYYYYMMDD() { var time = new Date(); var year = time.getFullYear(); var month = time.getMonth() + 1; if (month < 10) { month = '0' + month; } var day = time.getDate(); if(day < 10) { day = '0' + day; } return year + '' + month +'' + day; } var plat = { info: {}, catch: {}, request: function(id,$this) { const funArray = this.catch.id; var that = this; $.ajax({ url: "/ajax/platform/info", type: "GET", timeout: 10000, dataType: "json", traditional:true, data:{ id: id }, success: function(data) { delete that.catch.id; if(data.success) { var $data = data.data; that.info.id = $data; for(var i = 0; i < funArray.length; i++ ) { funArray[i]($data); } } }, error: function() { $.MsgBox.Alert('提示', '链接服务器超时') } }) }, judge: function(id, callback) { if(this.info.id) { callback(this.info.id) } else { if(this.catch.id) { this.catch.id.push(callback) } else { this.catch.id = [callback] this.request(id) } } } } demandList(true,10, 1); /*点击搜索*/ $(".searchSpan").click(function(){ $(".tcdPageCode").remove(); $(".aboutRes").append('
'); demandList(true,10,1); }) /*需求列表*/ function demandList(isbind, pageSize, pageNo) { $.ajax({ url: "/ajax/platform/demand/pq", type: "GET", timeout: 10000, dataType: "json", traditional:true, data: { 'invalidDay': getYYYYMMDD(), "key":$("#needKey").val(), "pageNo": pageNo, "pageSize":pageSize }, beforeSend: function() { $("#demandList").append(''); }, success: function(data) { if(data.success) { $("#demandList").html(" "); var $info = data.data.data; if($info.length > 0){ for(var i = 0; i < $info.length; i++) { var liStr=$("
  • ").appendTo("#demandList"); demandHtml($info[i],liStr); } if(isbind == true) { $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / pageSize), current: data.data.data.pageNo, backFn: function(p) { demandList(false,5, p); } }); } }else{ $("#demandList").parent().find(".nodatabox").removeClass("displayNone") } } $(".loading").remove(); }, error: function() { $.MsgBox.Alert('提示', '链接服务器超时') } }) } function demandHtml($data,liStr) { var strCon=''; strCon+='' strCon+='

    '+ $data.title +'

    ' strCon+='' strCon+='

    '+$data.descp+'

    ' strCon+='' strCon+='
    ' var $strCon = $(strCon); $strCon.appendTo(liStr); var localTime = Number( getYYYYMMDD()); var invaTime = Number($data.invalidDay); if(invaTime - localTime <= 7) { $strCon.find('.invaliTime').addClass('colorRed'); } plat.judge($data.pid,function(data) { $strCon.find('.platName').text(data.name) }) } });