portal html css js resource

cmp-needList.js 6.7KB

    $(document).ready(function() { $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent"); var id = $.cookie('orgId'); var oDemandAim = "", oSortType = ""; /*查询企业认证状态*/ 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(); /*企业需求列表*/ /*需求列表*/ function demandList(isbind, pageSize, pageNo, oDemand, oSort) { $.ajax({ url: "/ajax/demand/pqOrg", type: "GET", timeout: 10000, dataType: "json", data: { "orgId": id, "pageNo": pageNo, "demandStatus": oDemand, "sortType": oSort }, beforeSend: function() {}, success: function(data, textState) { if(data.success) { console.log(data); $("#demandList").html(" "); var $info = data.data.data; demandHtml($info); if($info.length != 0) { if(isbind == true) { $(".tcdPageCode").createPage({ pageCount: Math.ceil(data.data.total / pageSize), current: data.data.data.pageNo, backFn: function(p) { demandList(false, 5, p, oDemandAim, oSortType); } }); } } } }, error: function(XMLHttpRequest, textStats, errorThrown) { } }) } demandList(true, 5, 1, oDemandAim, oSortType); function demandHtml($data) { for(var i = 0; i < $data.length; i++) { var $obje = $data[i].professor; var personStr = personalInformation($obje); var demandAim = "技术咨询", demandType = "已关闭", demandStyle = "status-5"; var oImg = "", oTime = ""; if($data[i].demandAim == 2) { demandAim = "寻找资源" } else if($data[i].demandAim == 3) { demandAim = "其他需求" } if($data[i].demandStatus == 1) { demandType = "发布中"; demandStyle = "status-4"; } if($obje.hasHeadImage) { oImg = "/images/head/" + $obje.id + "_l.jpg"; } else { oImg = "../images/default-photo.jpg" } oTime = $data[i]["createTime"].substr(0, 4) + "年" + $data[i].createTime.substr(4, 2) + "月" + $data[i].createTime.substr(6, 2) + "日" + $data[i].createTime.substr(8, 2) + ":" + $data[i].createTime.substr(10, 2); var oClass = autho($obje.authType, $obje.orgAuth, $obje.authStatus); var dataString = "<li class='workselectitem'>" dataString += "<div class='col-w-2'>" dataString += "<div class='workitimg userRadius'>" dataString += "<img class='headPhoto' src='" + oImg + "' width='100%'>" dataString += "</div></div>" dataString += "<div class='col-w-10 needinfo'>" dataString += "<div class='workinfor worksitcon'>" dataString += "<h4><span class='h1Font'>" + $obje.name + "</span>" dataString += "<em class='authicon "+oClass.sty+"' title='"+oClass.title+"'></em></h4>" dataString += "<h6 class='h3Font'>" + personStr + "</h6>" dataString += "<h6 style='position:relative;'>" dataString += "<div class='titList'>需求主题:<em class='h4Font'>" + $data[i].demandTitle + "</em></div>" dataString += "<span class='lasttime rightTime'>" + oTime + "</span>" dataString += "<p class='rebackcon ellipsisSty-2'>" + $data[i].demandContent + "</p>" dataString += "</h6></div>" dataString += "<div class='workhandle'>" dataString += "<div class='rightopert floatR'>" dataString += "<span class='replybtn' demanid='" + $data[i].demandId + "'>查看</span></div>" dataString += "<div class='leftstate floatR'>" dataString += "<span class='coultstate " + demandStyle + "'><i>" + demandType + "</i></span></div>" dataString += "<div class='leftstate floatR'>" dataString += "<span class='coultstate coulstAim status-4'><i>" + demandAim + "</i></span></div></div></div></li>" $("#demandList").append(dataString); } } /*职位职称所在机构,部门,地址等等*/ function personalInformation($person) { var arr1 = [$person.title, $person.office, $person.department, $person.orgName, $person.address]; var arr = new Array(); var arr2 = new Array(); var n = 0; for(var i = 0; i < arr1.length; i++) { if(arr1[i]) { arr.push(arr1[i]); if(arr1[i] == arr1[arr1.length - 1]) { n = 1; } } } if(n == 1) { for(var i = 0; i < arr.length - 1; i++) { arr2.push(arr[i]); } return arr2.join() + " | " + arr[arr.length - 1]; } else { return arr.join(); } } /*检索排序*/ function selcet(i) { $(".selcet" + i).on('click', function(e) { var option = $(this).find(".option" + i); option.css("display", "block") var o_this = $(this); o_this.find("li").click(function() { o_this.find("li").removeClass("workcurrent"); $(this).addClass("workcurrent"); o_this.find("span").text($(this).text()); option.css("display", "none"); if($(this).text() == "发布中") { oDemandAim = 1; $(".tcdPageCode").remove(); $("#shoudao").append('<div class="tcdPageCode"></div>'); demandList(true, 5, 1, oDemandAim, oSortType); } else if($(this).text() == "已关闭") { oDemandAim = 0; $(".tcdPageCode").remove(); $("#shoudao").append('<div class="tcdPageCode"></div>'); demandList(true, 5, 1, oDemandAim, oSortType); } else if($(this).text() == "全部") { oDemandAim = ""; $(".tcdPageCode").remove(); $("#shoudao").append('<div class="tcdPageCode"></div>'); demandList(true, 5, 1, oDemandAim, oSortType); } else if($(this).text() == "按最早发布时间排序") { oSortType = 1; $(".tcdPageCode").remove(); $("#shoudao").append('<div class="tcdPageCode"></div>'); demandList(true, 5, 1, oDemandAim, oSortType); } else if($(this).text() == "按最新发布时间排序") { oSortType = 0; $(".tcdPageCode").remove(); $("#shoudao").append('<div class="tcdPageCode"></div>'); demandList(true, 5, 1, oDemandAim, oSortType); } return false; }); $("body").click(function(e) { if($(".option4")[0].style.display == "block" || $(".option3")[0].style.display == "block") { $(".option4")[0].style.display = "none"; $(".option3")[0].style.display = "none"; } }); return false; }) } selcet(3); selcet(4); /*进入needSure.html*/ $("#demandList").on("click", ".replybtn", function() { var demand = $(this).attr("demanid"); location.href = "cmp-needShow.html?demandId=" + demand; }) })