investmentInstitution.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import '../../css/bootstrap.less';
  2. import 'bootstrap/dist/js/bootstrap.js';
  3. import '../../css/public.css';
  4. import '../../css/main_banner.css';
  5. import '../../js/public.js';
  6. import '../../js/main_banner.js';
  7. import '../../css/financial/investmentInstitution.css';
  8. import {
  9. provinceList
  10. } from '../../js/NewDicProvinceList';
  11. $(function(){
  12. //数据处理
  13. var theKeyword,pageSize,Province;
  14. var thePageNo = 1,
  15. thePageLength = 1,
  16. pageSize = 6;
  17. function loadDate(pageNo) {
  18. $.ajax({
  19. method: "get",
  20. dataType: "json",
  21. url: globalConfig.context + "/portal/financial/search",
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: pageSize,
  25. keyword: theKeyword,
  26. provinceId: Province != 999 ? Province : undefined
  27. },
  28. success: function (data) {
  29. var theArr = [];
  30. thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
  31. if (data.data && data.data.list) {
  32. for (let i = 0; i < data.data.list.length; i++) {
  33. let thisdata = data.data.list[i];
  34. var imgUrl=thisdata.publicityPictureUrl!==null?thisdata.publicityPictureUrl:"/img/timg.gif";
  35. theArr.push([
  36. '<li value="'+thisdata.id+'">',
  37. '<img src="' + globalConfig.avatarHost + '/upload' + imgUrl+'"/>',
  38. '<p>' + thisdata.companyName + '</p>',
  39. '<a href="">MORE+</a>',
  40. '</li>',
  41. ].join(''));
  42. };
  43. };
  44. $('.invest_imglist ul').empty();
  45. $('.invest_imglist ul').append(theArr.join(''));
  46. if(data.data.list.length===0){
  47. $('.invest_imglist ul').html('<li>敬请期待…<li>')
  48. }
  49. $('.totalCount').html("共 "+ thePageLength +" 页 " + data.data.totalCount + " 条数据");
  50. var pageArr = [],
  51. firstNo = 1,
  52. endNo = 5;
  53. if (thePageNo > 3) {
  54. firstNo = thePageNo - 2;
  55. endNo = Math.min((Number(thePageNo) + 2), thePageLength);
  56. } else {
  57. endNo = Math.min(thePageLength, 5);
  58. };
  59. for (let i = firstNo; i <= endNo; i++) {
  60. if (i == thePageNo) {
  61. pageArr.push(
  62. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  63. );
  64. } else {
  65. pageArr.push(
  66. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  67. );
  68. }
  69. };
  70. $('.pageNumber').remove();
  71. $('.pagePre').after(pageArr.join(''));
  72. },
  73. });
  74. }
  75. if (window.location.search) {
  76. let theUrl = window.location.search
  77. theKeyword = theUrl.substring(1, theUrl.length);
  78. theKeyword = decodeURIComponent(theKeyword);
  79. $('#search_on input').val(theKeyword);
  80. var search_city=$('#selt').value;
  81. Province=search_city
  82. };
  83. loadDate();
  84. //点击分页
  85. $('.pagination').on('click', 'li', function (e) {
  86. e.preventDefault();
  87. if (this.className === 'pagePre') {
  88. if (thePageNo > 1) {
  89. thePageNo = 1;
  90. loadDate(thePageNo);
  91. }
  92. } else if (this.className === 'pageNext') {
  93. if (thePageNo < thePageLength) {
  94. thePageNo = thePageLength;
  95. loadDate(thePageNo);
  96. }
  97. } else {
  98. var nextPageNo = $(this).children()[0].text;
  99. if (thePageNo != nextPageNo) {
  100. $(this).siblings("li").removeClass("active");
  101. $(this).addClass("active");
  102. thePageNo = nextPageNo;
  103. loadDate(thePageNo);
  104. };
  105. };
  106. });
  107. //链接详情
  108. $('.invest_imglist ul').on('click', 'li', function () {
  109. var theId = $(this).attr('value');
  110. window.open(globalConfig.context + '/portal/financial/investmentDetail.html?organizationId=' + theId );
  111. })
  112. //搜索城市下拉
  113. var addlength=provinceList.length;
  114. var soption='';
  115. for(var i=0;i<addlength;i++){
  116. soption+="<option value='"+provinceList[i].id+"'>"+provinceList[i].name+"</option>";
  117. };
  118. $('#selt').html(soption);
  119. //导航城市添加
  120. var industryListArr = [],
  121. industryChildrenArr = [];
  122. industryListArr.push(['<li value="999" class="active">',
  123. '<span>',
  124. '不限',
  125. '</span>',
  126. '</li>',
  127. ].join(''));
  128. provinceList.map(function (item) {
  129. industryListArr.push(['<li value="' +item.id + '">',
  130. '<span>',
  131. item.name,
  132. '</span>',
  133. '</li>',
  134. ].join(''));
  135. });
  136. if (industryListArr && industryListArr.length) {
  137. $('#industryList').append(industryListArr.join(''));
  138. };
  139. //点击城市时
  140. $('#industryList li').click(function () {
  141. var theValue = this.value;
  142. $(this).siblings("li").removeClass("active");
  143. $(this).addClass("active");
  144. Province=theValue;
  145. loadDate();
  146. })
  147. //搜索时
  148. $('#btn_search').click(function(e){
  149. e.preventDefault();
  150. var sel= $('.select select').val();
  151. var val_inp=$('#search_on input').val();
  152. Province=sel;
  153. theKeyword=val_inp;
  154. loadDate();
  155. })
  156. })