portal html css js resource

needList.js 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. $(document).ready(function() {
  2. loginStatus();//判断个人是否登录
  3. var oDemandAim = "",
  4. oSortType = "";
  5. /*需求列表*/
  6. function demandList(isbind, pageSize, pageNo, oDemand, oSort) {
  7. $.ajax({
  8. url: "/ajax/demand/pq",
  9. type: "GET",
  10. timeout: 10000,
  11. dataType: "json",
  12. data: {
  13. "pageNo": pageNo,
  14. "demandAim": oDemand,
  15. "sortType": oSort
  16. },
  17. beforeSend: function() {},
  18. success: function(data, textState) {
  19. if(data.success) {
  20. //console.log(data);
  21. $("#demandList").html(" ");
  22. var $info = data.data.data;
  23. demandHtml($info);
  24. if(isbind == true) {
  25. $(".tcdPageCode").createPage({
  26. pageCount: Math.ceil(data.data.total / pageSize),
  27. current: data.data.data.pageNo,
  28. backFn: function(p) {
  29. demandList(false, 5, p, oDemandAim, oSortType);
  30. }
  31. });
  32. }
  33. }
  34. },
  35. error: function(XMLHttpRequest, textStats, errorThrown) {
  36. }
  37. })
  38. }
  39. function demandHtml($data) {
  40. for(var i = 0; i < $data.length; i++) {
  41. var $obje = $data[i].professor;
  42. var personStr = personalInformation($obje);
  43. var demandAim = "技术咨询",
  44. demandType = "企业需求";
  45. var oImg = "",
  46. oTime = "";
  47. if($data[i].demandAim == 2) {
  48. demandAim = "寻找资源"
  49. } else if($data[i].demandAim == 3) {
  50. demandAim = "其他需求"
  51. }
  52. if($data[i].demandType == 1) {
  53. demandType = "个人需求"
  54. }
  55. if($obje.hasHeadImage) {
  56. oImg = "/images/head/" + $obje.id + "_l.jpg";
  57. } else {
  58. oImg = "images/default-photo.jpg"
  59. }
  60. if($obje.authType) {
  61. var typeTname = " authicon authicon-cu"
  62. } else {
  63. if($obje.authStatus == 3) {
  64. if($obje.authentication == 1) {
  65. var typeTname = " authicon2 authicon-mana";
  66. } else if($obje.authentication == 2) {
  67. var typeTname = " authicon2 authicon-staff";
  68. } else {
  69. var typeTname = " authicon2 authicon-stu"
  70. }
  71. }
  72. }
  73. oTime = $data[i]["createTime"].substr(0, 4) + "年" + $data[i].createTime.substr(4, 2) + "月" + $data[i].createTime.substr(6, 2) + "日" +
  74. $data[i].createTime.substr(8, 2) + ":" + $data[i].createTime.substr(10, 2);
  75. var dataString = "<div class='workselectitem'><table width='100%'>"
  76. dataString += "<tbody><tr><td width='14%' class='messagebox'>"
  77. dataString += "<a class='workhead workitimg headRadius'>"
  78. dataString += "<img class='headPhoto' src='" + oImg + "' width='100%' height='100%'></a></td>"
  79. dataString += "<td style='position:relative;top:20px;' width='86%'>"
  80. dataString += "<div class='workinfor worksitcon'><h4><a class='named'>" + $obje.name + "</a>"
  81. dataString += "<a class='modifyicon" + typeTname + "'></a><input type='text' class='assessStar' style='display: none;'></h4><h6 class='h3Font'>"
  82. dataString += "<span>" + personStr + "</span>"
  83. dataString += "<h6 style='position:relative;'>"
  84. dataString += "<div class='titList'>需求主题:<em class='h4Font'>" + $data[i].demandTitle + "</em></div>"
  85. dataString += "<span class='lasttime rightTime'>" + oTime + "</span>"
  86. dataString += "<div style='height:70px;'><p class='ellipsisSty-2 rebackcon' >" + $data[i].demandContent + "</p></div></div>"
  87. dataString += "<div class='workhandle'><div class='rightopert floatR'>"
  88. dataString += "<span class='replybtn' demanid='" + $data[i].demandId + "'>查看</span></div>"
  89. dataString += "<div class='leftstate floatR'>"
  90. dataString += "<span class='coultstate status-4'><i>" + demandAim + "</i></span></div>"
  91. dataString += "<div class='leftstate floatR'>"
  92. dataString += "<span class='coultstate coulstAim status-4'><i>" + demandType + "</i></span>"
  93. dataString += "</div></div></td></tr></tbody></table></div>"
  94. $("#demandList").append(dataString);
  95. }
  96. }
  97. /*职位职称所在机构,部门,地址等等*/
  98. function personalInformation($person) {
  99. var arr1 = [$person.title, $person.office, $person.department, $person.orgName, $person.address];
  100. var arr = new Array();
  101. var arr2 = new Array();
  102. var n = 0;
  103. for(var i = 0; i < arr1.length; i++) {
  104. if(arr1[i]) {
  105. arr.push(arr1[i]);
  106. if(arr1[i] == arr1[arr1.length - 1]) {
  107. n = 1;
  108. }
  109. }
  110. }
  111. if(n == 1) {
  112. for(var i = 0; i < arr.length-1; i++) {
  113. arr2.push(arr[i]);
  114. }
  115. return arr2.join()+ " | " + arr[arr.length - 1];
  116. } else {
  117. return arr.join();
  118. }
  119. }
  120. demandList(true, 5, 1, oDemandAim, oSortType);
  121. /*检索排序*/
  122. function selcet(i) {
  123. $(".selcet" + i).on('click', function(e) {
  124. var option = $(this).find(".option" + i);
  125. option.css("display", "block")
  126. var o_this = $(this);
  127. o_this.find("li").click(function() {
  128. o_this.find("li").removeClass("workcurrent");
  129. $(this).addClass("workcurrent");
  130. o_this.find("span").text($(this).text());
  131. option.css("display", "none");
  132. if($(this).text() == "技术咨询") {
  133. oDemandAim = 1;
  134. $(".tcdPageCode").remove();
  135. $("#shoudao").append('<div class="tcdPageCode"></div>');
  136. demandList(true, 5, 1, oDemandAim, oSortType);
  137. } else if($(this).text() == "资源合作") {
  138. oDemandAim = 2;
  139. $(".tcdPageCode").remove();
  140. $("#shoudao").append('<div class="tcdPageCode"></div>');
  141. demandList(true, 5, 1, oDemandAim, oSortType);
  142. } else if($(this).text() == "其他需求") {
  143. oDemandAim = 3;
  144. $(".tcdPageCode").remove();
  145. $("#shoudao").append('<div class="tcdPageCode"></div>');
  146. demandList(true, 5, 1, oDemandAim, oSortType);
  147. } else if($(this).text() == "不限") {
  148. oDemandAim = "";
  149. $(".tcdPageCode").remove();
  150. $("#shoudao").append('<div class="tcdPageCode"></div>');
  151. demandList(true, 5, 1, oDemandAim, oSortType);
  152. } else if($(this).text() == "按最早发布时间排序") {
  153. oSortType = 1;
  154. $(".tcdPageCode").remove();
  155. $("#shoudao").append('<div class="tcdPageCode"></div>');
  156. demandList(true, 5, 1, oDemandAim, oSortType);
  157. } else if($(this).text() == "按最新发布时间排序") {
  158. oSortType = 0;
  159. $(".tcdPageCode").remove();
  160. $("#shoudao").append('<div class="tcdPageCode"></div>');
  161. demandList(true, 5, 1, oDemandAim, oSortType);
  162. }
  163. return false;
  164. });
  165. $("body").click(function(e) {
  166. if($(".option4")[0].style.display == "block" || $(".option3")[0].style.display == "block") {
  167. $(".option4")[0].style.display = "none";
  168. $(".option3")[0].style.display = "none";
  169. }
  170. });
  171. return false;
  172. })
  173. }
  174. selcet(3);
  175. selcet(4);
  176. /*进入needSure.html*/
  177. $("#demandList").on("click", ".replybtn", function() {
  178. var demand = $(this).attr("demanid");
  179. location.href = "needSure.html?demandId=" + demand;
  180. })
  181. })