portal html css js resource

cmp-needList.js 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. $(document).ready(function() {
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. var id = $.cookie('orgId');
  4. var oDemandAim = "",
  5. oSortType = "";
  6. /*查询企业认证状态*/
  7. function companyAuthentState() {
  8. $.ajax({
  9. url: '/ajax/org/authStatus',
  10. type: "GET",
  11. timeout: 10000,
  12. dataType: "json",
  13. data: {
  14. "id": id
  15. },
  16. beforeSend: function() {},
  17. success: function(data, textState) {
  18. if(data.success) {
  19. console.log(data);
  20. if(data.data == 3) {
  21. $("#companyDemandList").show();
  22. } else {
  23. $("#identityState").show();
  24. }
  25. }
  26. },
  27. error: function(XMLHttpRequest, textStats, errorThrown) {
  28. $.MsgBox.Alert('提示', '服务器请求失败')
  29. }
  30. })
  31. }
  32. companyAuthentState();
  33. /*企业需求列表*/
  34. /*需求列表*/
  35. function demandList(isbind, pageSize, pageNo, oDemand, oSort) {
  36. $.ajax({
  37. url: "/ajax/demand/pqOrg",
  38. type: "GET",
  39. timeout: 10000,
  40. dataType: "json",
  41. data: {
  42. "orgId": id,
  43. "pageNo": pageNo,
  44. "demandStatus": oDemand,
  45. "sortType": oSort
  46. },
  47. beforeSend: function() {},
  48. success: function(data, textState) {
  49. if(data.success) {
  50. console.log(data);
  51. $("#demandList").html(" ");
  52. var $info = data.data.data;
  53. demandHtml($info);
  54. if($info.length != 0) {
  55. if(isbind == true) {
  56. $(".tcdPageCode").createPage({
  57. pageCount: Math.ceil(data.data.total / pageSize),
  58. current: data.data.data.pageNo,
  59. backFn: function(p) {
  60. demandList(false, 5, p, oDemandAim, oSortType);
  61. }
  62. });
  63. }
  64. }
  65. }
  66. },
  67. error: function(XMLHttpRequest, textStats, errorThrown) {
  68. }
  69. })
  70. }
  71. demandList(true, 5, 1, oDemandAim, oSortType);
  72. function demandHtml($data) {
  73. for(var i = 0; i < $data.length; i++) {
  74. var $obje = $data[i].professor;
  75. var personStr = personalInformation($obje);
  76. var demandAim = "技术咨询",
  77. demandType = "已关闭",
  78. demandStyle = "status-5";
  79. var oImg = "",
  80. oTime = "";
  81. if($data[i].demandAim == 2) {
  82. demandAim = "寻找资源"
  83. } else if($data[i].demandAim == 3) {
  84. demandAim = "其他需求"
  85. }
  86. if($data[i].demandStatus == 1) {
  87. demandType = "发布中";
  88. demandStyle = "status-4";
  89. }
  90. if($obje.hasHeadImage) {
  91. oImg = "/images/head/" + $obje.id + "_l.jpg";
  92. } else {
  93. oImg = "../images/default-photo.jpg"
  94. }
  95. oTime = $data[i]["createTime"].substr(0, 4) + "年" + $data[i].createTime.substr(4, 2) + "月" + $data[i].createTime.substr(6, 2) + "日" +
  96. $data[i].createTime.substr(8, 2) + ":" + $data[i].createTime.substr(10, 2);
  97. var oClass = autho($obje.authType, $obje.orgAuth, $obje.authStatus);
  98. var dataString = "<li class='workselectitem'>"
  99. dataString += "<div class='col-w-2'>"
  100. dataString += "<div class='workitimg userRadius'>"
  101. dataString += "<img class='headPhoto' src='" + oImg + "' width='100%'>"
  102. dataString += "</div></div>"
  103. dataString += "<div class='col-w-10 needinfo'>"
  104. dataString += "<div class='workinfor worksitcon'>"
  105. dataString += "<h4><span class='h1Font'>" + $obje.name + "</span>"
  106. dataString += "<em class='authicon "+oClass.sty+"' title='"+oClass.title+"'></em></h4>"
  107. dataString += "<h6 class='h3Font'>" + personStr + "</h6>"
  108. dataString += "<h6 style='position:relative;'>"
  109. dataString += "<div class='titList'>需求主题:<em class='h4Font'>" + $data[i].demandTitle + "</em></div>"
  110. dataString += "<span class='lasttime rightTime'>" + oTime + "</span>"
  111. dataString += "<p class='rebackcon ellipsisSty-2'>" + $data[i].demandContent + "</p>"
  112. dataString += "</h6></div>"
  113. dataString += "<div class='workhandle'>"
  114. dataString += "<div class='rightopert floatR'>"
  115. dataString += "<span class='replybtn' demanid='" + $data[i].demandId + "'>查看</span></div>"
  116. dataString += "<div class='leftstate floatR'>"
  117. dataString += "<span class='coultstate " + demandStyle + "'><i>" + demandType + "</i></span></div>"
  118. dataString += "<div class='leftstate floatR'>"
  119. dataString += "<span class='coultstate coulstAim status-4'><i>" + demandAim + "</i></span></div></div></div></li>"
  120. $("#demandList").append(dataString);
  121. }
  122. }
  123. /*职位职称所在机构,部门,地址等等*/
  124. function personalInformation($person) {
  125. var arr1 = [$person.title, $person.office, $person.department, $person.orgName, $person.address];
  126. var arr = new Array();
  127. var arr2 = new Array();
  128. var n = 0;
  129. for(var i = 0; i < arr1.length; i++) {
  130. if(arr1[i]) {
  131. arr.push(arr1[i]);
  132. if(arr1[i] == arr1[arr1.length - 1]) {
  133. n = 1;
  134. }
  135. }
  136. }
  137. if(n == 1) {
  138. for(var i = 0; i < arr.length - 1; i++) {
  139. arr2.push(arr[i]);
  140. }
  141. return arr2.join() + " | " + arr[arr.length - 1];
  142. } else {
  143. return arr.join();
  144. }
  145. }
  146. /*检索排序*/
  147. function selcet(i) {
  148. $(".selcet" + i).on('click', function(e) {
  149. var option = $(this).find(".option" + i);
  150. option.css("display", "block")
  151. var o_this = $(this);
  152. o_this.find("li").click(function() {
  153. o_this.find("li").removeClass("workcurrent");
  154. $(this).addClass("workcurrent");
  155. o_this.find("span").text($(this).text());
  156. option.css("display", "none");
  157. if($(this).text() == "发布中") {
  158. oDemandAim = 1;
  159. $(".tcdPageCode").remove();
  160. $("#shoudao").append('<div class="tcdPageCode"></div>');
  161. demandList(true, 5, 1, oDemandAim, oSortType);
  162. } else if($(this).text() == "已关闭") {
  163. oDemandAim = 0;
  164. $(".tcdPageCode").remove();
  165. $("#shoudao").append('<div class="tcdPageCode"></div>');
  166. demandList(true, 5, 1, oDemandAim, oSortType);
  167. } else if($(this).text() == "全部") {
  168. oDemandAim = "";
  169. $(".tcdPageCode").remove();
  170. $("#shoudao").append('<div class="tcdPageCode"></div>');
  171. demandList(true, 5, 1, oDemandAim, oSortType);
  172. } else if($(this).text() == "按最早发布时间排序") {
  173. oSortType = 1;
  174. $(".tcdPageCode").remove();
  175. $("#shoudao").append('<div class="tcdPageCode"></div>');
  176. demandList(true, 5, 1, oDemandAim, oSortType);
  177. } else if($(this).text() == "按最新发布时间排序") {
  178. oSortType = 0;
  179. $(".tcdPageCode").remove();
  180. $("#shoudao").append('<div class="tcdPageCode"></div>');
  181. demandList(true, 5, 1, oDemandAim, oSortType);
  182. }
  183. return false;
  184. });
  185. $("body").click(function(e) {
  186. if($(".option4")[0].style.display == "block" || $(".option3")[0].style.display == "block") {
  187. $(".option4")[0].style.display = "none";
  188. $(".option3")[0].style.display = "none";
  189. }
  190. });
  191. return false;
  192. })
  193. }
  194. selcet(3); selcet(4);
  195. /*进入needSure.html*/
  196. $("#demandList").on("click", ".replybtn", function() {
  197. var demand = $(this).attr("demanid");
  198. location.href = "cmp-needShow.html?demandId=" + demand;
  199. })
  200. })