123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- $(document).ready(function() {
- 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"
- }
- if($obje.authType) {
- var typeTname = " authicon authicon-cu"
- } else {
- if($obje.authStatus == 3) {
- if($obje.authentication == 1) {
- var typeTname = " authicon2 authicon-mana";
- } else if($obje.authentication == 2) {
- var typeTname = " authicon2 authicon-staff";
- } else {
- var typeTname = " authicon2 authicon-stu"
- }
- }
- }
- 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 headRadius'>"
- 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);
- $("#demandList").on("click", ".replybtn", function() {
- var demand = $(this).attr("demanid");
- location.href = "cmp-needShow.html?demandId=" + demand;
- })
- })
|