portal html css js resource

needList.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. cmpFun($info[i].orgId,liStr);
  40. }
  41. if(isbind == true) {
  42. $(".tcdPageCode").createPage({
  43. pageCount: Math.ceil(data.data.total / pageSize),
  44. current: data.data.data.pageNo,
  45. backFn: function(p) {
  46. demandList(false,5, p);
  47. }
  48. });
  49. }
  50. }else{
  51. $("#demandList").parent().find(".nodatabox").removeClass("displayNone")
  52. }
  53. }
  54. $(".loading").remove();
  55. },
  56. error: function() {
  57. $.MsgBox.Alert('提示', '链接服务器超时')
  58. }
  59. })
  60. }
  61. function demandHtml($data,liStr) {
  62. var sowU="";
  63. if($data.pageViews!=0){
  64. sowU='<li><span>浏览量 '+$data.pageViews +'</span></li>'
  65. }
  66. var strCon='';
  67. strCon+='<a class="" target="_blank" href="demandShow.html?demandId='+$data.id+'" class="madiaInfo">'
  68. strCon+='<p class="h1Font ellipsisSty">'+ $data.title +'</p>'
  69. strCon+='<ul class="showliTop h3Font clearfix">'
  70. strCon+='<li><span class="cmpName"></span></li><li><span>发布于 '+TimeTr($data.createTime)+'</span></li>'
  71. strCon+= sowU
  72. strCon+='</ul>'
  73. strCon+='<p class="h2Font ellipsisSty-2">'+$data.descp+'</p>'
  74. strCon+='<ul class="showli clearfix h3Font">'
  75. if($data.city){ strCon+='<li>所在城市:'+$data.city+'</li>' }
  76. if($data.duration!=0){ strCon+='<li>预期时长:'+demandDuration[$data.duration]+'</li>' }
  77. if($data.cost!=0){ strCon+='<li>费用预算:'+demandCost[$data.cost]+'</li>' }
  78. if($data.invalidDay){ strCon+='<li>有效期至:'+TimeTr($data.invalidDay)+'</li>' }
  79. strCon+='</ul>'
  80. strCon+='</a>'
  81. $(strCon).appendTo(liStr);
  82. }
  83. /*企业用户信息*/
  84. function cmpFun(id,$listItem) {
  85. $.ajax({
  86. "url": "/ajax/org/" + id,
  87. "type": "get",
  88. "async": true,
  89. "success": function(data) {
  90. if(data.success && data.data) {
  91. if(data.data.forShort) {
  92. $listItem.find(".cmpName").text(data.data.forShort);
  93. }else{
  94. $listItem.find(".cmpName").text(data.data.name);
  95. }
  96. }
  97. },
  98. "error": function() {
  99. $.MsgBox.Alert('提示', '链接服务器超时')
  100. }
  101. });
  102. }
  103. })