portal html css js resource

needList.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. $(document).ready(function() {
  2. $(".onlogin .headnavbtn li.mywork").addClass("navcurrent");
  3. $(".workmenu>ul>li:contains('需求')").addClass("nowLi");
  4. loginStatus();//判断个人是否登录
  5. valUser();
  6. demandList(true,5, 1);
  7. /*点击搜索*/
  8. $(".searchSpan").click(function(){
  9. $(".tcdPageCode").remove();
  10. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  11. demandList(true,5,1);
  12. })
  13. /*需求列表*/
  14. function demandList(isbind, pageSize, pageNo) {
  15. $.ajax({
  16. url: "/ajax/demand/search",
  17. type: "GET",
  18. timeout: 10000,
  19. dataType: "json",
  20. traditional:true,
  21. data: {
  22. "state":[1],
  23. "key":$("#needKey").val(),
  24. "pageNo": pageNo,
  25. "pageSize":pageSize
  26. },
  27. beforeSend: function() {
  28. $("#demandList").append('<img src="../images/loading.gif" class="loading" />');
  29. },
  30. success: function(data) {
  31. if(data.success) {
  32. $("#demandList").html(" ");
  33. var $info = data.data.data;
  34. console.log(data)
  35. if($info.length > 0){
  36. for(var i = 0; i < $info.length; i++) {
  37. var liStr=$("<li></li>").appendTo("#demandList");
  38. demandHtml($info[i],liStr);
  39. }
  40. if(isbind == true) {
  41. $(".tcdPageCode").createPage({
  42. pageCount: Math.ceil(data.data.total / pageSize),
  43. current: data.data.data.pageNo,
  44. backFn: function(p) {
  45. demandList(false,5, p);
  46. }
  47. });
  48. }
  49. }else{
  50. $("#demandList").parent().find(".nodatabox").removeClass("displayNone")
  51. }
  52. }
  53. $(".loading").remove();
  54. },
  55. error: function() {
  56. $.MsgBox.Alert('提示', '链接服务器超时')
  57. }
  58. })
  59. }
  60. function demandHtml($data,liStr) {
  61. var sowU="";
  62. if($data.pageViews!=0){
  63. sowU='<li><span>浏览量 '+$data.pageViews +'</span></li>'
  64. }
  65. var strCon='';
  66. strCon+='<a class="" target="_blank" href="demandShow.html?demandId='+$data.id+'" class="madiaInfo">'
  67. strCon+='<p class="h1Font ellipsisSty">'+ $data.title +'</p>'
  68. strCon+='<ul class="showliTop h3Font clearfix">'
  69. strCon+='<li><span class="cmpName">'+ $data.orgName +'</span></li><li><span>发布于 '+TimeTr($data.createTime)+'</span></li>'
  70. strCon+= sowU
  71. strCon+='</ul>'
  72. strCon+='<p class="h2Font ellipsisSty-2">'+$data.descp+'</p>'
  73. strCon+='<ul class="showli clearfix h3Font">'
  74. if($data.city){ strCon+='<li>所在城市:'+$data.city+'</li>' }
  75. if($data.duration!=0){ strCon+='<li>预计周期:'+demandDuration[$data.duration]+'</li>' }
  76. if($data.cost!=0){ strCon+='<li>费用预算:'+demandCost[$data.cost]+'</li>' }
  77. if($data.invalidDay){ strCon+='<li>有效期至:'+TimeTr($data.invalidDay)+'</li>' }
  78. strCon+='</ul>'
  79. strCon+='</a>'
  80. $(strCon).appendTo(liStr);
  81. }
  82. });