achievement.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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/technologyTrading/achievement.css';
  8. import {
  9. provinceList
  10. } from '../../js/NewDicProvinceList';
  11. import {
  12. industryObject,
  13. getIndustryCategory
  14. } from '../DicIndustryList';
  15. $(function(){
  16. //数据处理
  17. var theKeyword, theMode, theFieldA, theFieldB,dataCategory,category,dateSort,lowerPrice,upperPrice;
  18. var thePageNo = 1,
  19. thePageLength = 1,
  20. pageSize = 12;
  21. var categoryObj = {
  22. "0": "专利",
  23. "1": "软著",
  24. "2": "项目",
  25. "3": "版权",
  26. "4": "工业设计",
  27. "5": "配方",
  28. "6": "非标"
  29. };
  30. var transferModeObj = {
  31. "0": "完全转让",
  32. "1": "许可转让",
  33. "2": "技术入股",
  34. "3": "5年独占许可转让"
  35. };
  36. function loadDate(pageNo) {
  37. $.ajax({
  38. method: "get",
  39. dataType: "json",
  40. url: globalConfig.context + "/portal/search/achievementList",
  41. data: {
  42. pageNo: pageNo || 1,
  43. pageSize: pageSize,
  44. keyword: theKeyword,
  45. transferMode: theMode != 999 ? theMode : undefined,
  46. fieldA: theFieldA != 999 ? theFieldA : undefined,
  47. fieldB: theFieldB != 999 ? theFieldB : undefined,
  48. dataCategory:dataCategory != 999 ? dataCategory : undefined,
  49. category:category != 999 ? category : undefined,
  50. dateSort:dateSort,
  51. lowerPrice:lowerPrice,
  52. upperPrice:upperPrice,
  53. },
  54. success: function (data) {
  55. var theArr = [];
  56. if (data.data && data.data.list) {
  57. for (let i = 0; i < data.data.list.length; i++) {
  58. let thisdata = data.data.list[i];
  59. var star='';
  60. for(var n=0;n<thisdata.maturity;n++){
  61. star+='<li></li>';
  62. }
  63. theArr.push([
  64. '<li>', //图片地址
  65. '<img src="' + globalConfig.avatarHost + '/upload' + thisdata.technicalPictureUrl + '" alt="行业" />',
  66. '<div class="list_text">',
  67. '<p>行业<span>' + getIndustryCategory(thisdata.fieldA, thisdata.fieldB) + '</span></p>',
  68. '<p>名称<span title=' + thisdata.name + '>' + thisdata.name + '</span></p>',
  69. '<p>类型<span>' + (thisdata.category ? categoryObj[thisdata.category] : '') + '</span></p>',
  70. '<p>交易方式<span>' + (thisdata.transferMode ? transferModeObj[thisdata.transferMode] : '') + '</span></p>',
  71. '<a href="#">了解详情</a>',
  72. '</div>',
  73. '<div class="star">',
  74. '<p>成熟度</p>',
  75. '<ol>'+star+'</ol>',
  76. '</div>',
  77. '<input type="hidden" class="achievementId" value="' + thisdata.id + '">',
  78. '<input type="hidden" class="achievementType" value="' + thisdata.dataCategory + '">',
  79. '</li>',
  80. ].join(''));
  81. };
  82. };
  83. $('.main_introduce ul').empty();
  84. $('.main_introduce ul').append(theArr.join(''));
  85. $('.totalCount').html("共" + data.data.totalCount + "条数据");
  86. thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
  87. var pageArr = [],
  88. firstNo = 1,
  89. endNo = 5;
  90. if (thePageNo > 3) {
  91. firstNo = thePageNo - 2;
  92. endNo = Math.min((Number(thePageNo) + 2), thePageLength);
  93. } else {
  94. endNo = Math.min(thePageLength, 5);
  95. };
  96. for (let i = firstNo; i <= endNo; i++) {
  97. if (i == thePageNo) {
  98. pageArr.push(
  99. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  100. );
  101. } else {
  102. pageArr.push(
  103. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  104. );
  105. }
  106. };
  107. $('.pageNumber').remove();
  108. $('.pagePre').after(pageArr.join(''));
  109. },
  110. });
  111. }
  112. if (window.location.search) {
  113. let theUrl = window.location.search
  114. theKeyword = theUrl.substring(1, theUrl.length);
  115. theKeyword = decodeURIComponent(theKeyword);
  116. $('#search_on input').val(theKeyword);
  117. };
  118. loadDate();
  119. var industryListArr = [],
  120. industryChildrenArr = [];
  121. industryListArr.push(['<li value="999" class="active">',
  122. '<span>',
  123. '不限',
  124. '</span>',
  125. '</li>',
  126. ].join(''));
  127. industryObject.map(function (item) {
  128. industryListArr.push(['<li value="' + item.value + '">',
  129. '<span>',
  130. item.label,
  131. '</span>',
  132. '</li>',
  133. ].join(''));
  134. });
  135. if (industryListArr && industryListArr.length) {
  136. $('#industryList').append(industryListArr.join(''));
  137. };
  138. $('#industryList li').click(function () {
  139. var theValue = this.value;
  140. $(this).siblings("li").removeClass("active");
  141. $(this).addClass("active");
  142. industryChildrenArr = [];
  143. industryChildrenArr.push(['<li value="999" class="active">',
  144. '<span>',
  145. '不限',
  146. '</span>',
  147. '</li>',
  148. ].join(''));
  149. if (theValue !== 999) {
  150. $('#industryChildrenBox').css("display", "block");
  151. industryObject.map(function (item) {
  152. if (item.value == theValue) {
  153. item.children.map(function (child) {
  154. industryChildrenArr.push(['<li value="' + child.value + '">',
  155. '<span>',
  156. child.label,
  157. '</span>',
  158. '</li>',
  159. ].join(''));
  160. });
  161. };
  162. });
  163. } else {
  164. $('#industryChildrenBox').css("display", "none");
  165. };
  166. if (industryChildrenArr && industryChildrenArr.length) {
  167. $('#industryChildrenList').empty();
  168. $('#industryChildrenList').append(industryChildrenArr.join(''));
  169. };
  170. theFieldA = this.value;
  171. theFieldB = '999';
  172. loadDate();
  173. });
  174. $('#industryChildrenList').on('click', 'li', function () {
  175. $(this).siblings("li").removeClass("active");
  176. $(this).addClass("active");
  177. theFieldB = this.value;
  178. loadDate();
  179. });
  180. $('#transferModeList').on('click', 'li', function () {
  181. $(this).siblings("li").removeClass("active");
  182. $(this).addClass("active");
  183. theMode = this.value;
  184. loadDate();
  185. });
  186. $('#btn_search').click(function () {
  187. theKeyword = $('#search_on input').val();
  188. loadDate();
  189. });
  190. $('.pagination').on('click', 'li', function (e) {
  191. e.preventDefault();
  192. if (this.className === 'pagePre') {
  193. if (thePageNo > 1) {
  194. thePageNo = 1;
  195. loadDate(thePageNo);
  196. }
  197. } else if (this.className === 'pageNext') {
  198. if (thePageNo < thePageLength) {
  199. thePageNo = thePageLength;
  200. loadDate(thePageNo);
  201. }
  202. } else {
  203. var nextPageNo = $(this).children()[0].text;
  204. if (thePageNo != nextPageNo) {
  205. $(this).siblings("li").removeClass("active");
  206. $(this).addClass("active");
  207. thePageNo = nextPageNo;
  208. loadDate(thePageNo);
  209. };
  210. };
  211. });
  212. $('.main_introduce ul').on('click', 'li', function () {
  213. var theId = $(this).find(".achievementId")[0].value;
  214. var theType = $(this).find(".achievementType")[0].value;
  215. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + theId + '&type=' + theType);
  216. })
  217. $('#industryList li').click(function(){
  218. $('.achievement_header ul li').eq(0).show();
  219. var text_ind=$(this).find('span').text();
  220. $('.achievement_header ul li').eq(0).find('p').text(text_ind);
  221. })
  222. //点击搜索下面的字段快捷搜索
  223. $('.head_right ol li').click(function () {
  224. theKeyword = $(this).text();
  225. $('#technologyModeList li').eq(0).addClass('active').siblings().removeClass('active');
  226. $('#transferModeList li').eq(0).addClass('active').siblings().removeClass('active');
  227. $('.achievement_header ul li').eq(0).show().siblings().hide();
  228. $('.achievement_header ul li').eq(0).find('p').text(theKeyword);
  229. $('#search_on input').val(theKeyword);
  230. loadDate();
  231. });
  232. //单选
  233. $('#patent').prop('checked',false);
  234. $('#selectAct li:first-child').click(function(){
  235. $(this).addClass('active');
  236. $('#patent').prop('checked',false);
  237. $('#demand').prop('checked',false);
  238. $('#demand,#patent').parent().addClass('demand').removeClass('patent');
  239. category=null;
  240. dataCategory=null;
  241. loadDate();
  242. })
  243. $('#patent').click(function(){
  244. $('#selectAct li').eq(0).removeClass('active')
  245. $(this).prop('checked',true);
  246. $(this).parent().addClass('patent').removeClass('demand');
  247. $('#demand').attr('checked',false);
  248. $('#demand').parent().addClass('demand').removeClass('patent')
  249. category=null;
  250. dataCategory=1;
  251. loadDate();
  252. })
  253. $('#demand').click(function(){
  254. $('#selectAct li').eq(0).removeClass('active')
  255. $(this).prop('checked',true);
  256. $(this).parent().addClass('patent').removeClass('demand');
  257. $('#patent').attr('checked',false);
  258. $('#patent').parent().addClass('demand').removeClass('patent')
  259. category=0;
  260. dataCategory=null;
  261. loadDate();
  262. })
  263. //排序下拉选择
  264. $('.head-left ul li p').click(function(){
  265. $(this).siblings().slideToggle(300);
  266. })
  267. $('.head-left ul li').mouseleave(function(){
  268. $(this).find('.time_select').slideUp(300);
  269. })
  270. $('.time_select ul li').click(function(){
  271. var txt=$(this).text();
  272. $(this).parents('.time_select').siblings('p').find('span').text(txt);
  273. $('.time_select').hide();
  274. });
  275. $('.timeSelect li').click(function(){
  276. var timeTxt=$(this).attr('value');
  277. dateSort=timeTxt;
  278. loadDate();
  279. })
  280. //价格
  281. $('.inp_select input').keyup(function(){
  282. var val_min=$(this).val();
  283. if(val_min<0){
  284. $(this).val('0')
  285. }
  286. })
  287. $('.inp_select button').click(function(){
  288. var minpri=$('.inp_select #minprice').val();
  289. var maxpri=$('.inp_select #maxprice').val();
  290. lowerPrice =minpri;
  291. upperPrice =maxpri;
  292. loadDate();
  293. })
  294. $('#industryList li:first-child').click(function(){
  295. theFieldA = $(this).attr('value');
  296. theFieldB = '999';
  297. loadDate();
  298. })
  299. //搜索城市下拉
  300. var addlength=provinceList.length;
  301. var soption='';
  302. for(var i=0;i<addlength;i++){
  303. soption+="<option value='"+provinceList[i].id+"'>"+provinceList[i].name+"</option>";
  304. };
  305. $('#selt').html(soption);
  306. //全部结果查询
  307. $('.achievement_header ul li img').click(function(){
  308. $(this).parent().hide();
  309. var lilen=$('.achievement_header ul li').css('display');
  310. if(lilen=='none'){
  311. $('#search_on input').val('');
  312. $('.searchs button').click();
  313. }
  314. });
  315. $('.text_replace').hide()
  316. // 搜索功能关联关键字
  317. $('.searchs button').click(function(e){
  318. e.preventDefault();
  319. var search_txt=$('#search_on input').val();
  320. $('.text_replace span').text(search_txt);
  321. if(search_txt==''){
  322. $('.text_replace').hide()
  323. }else{
  324. $('.text_replace').show()
  325. }
  326. })
  327. //点击行业分类
  328. $('#transferModeList li').click(function(){
  329. $('.achievement_header ul li').eq(1).show()
  330. $(this).addClass('active').siblings().removeClass('active')
  331. var txt_tech=$(this).find('span').text();
  332. $('.achievement_header ul li').eq(1).find('p').text(txt_tech);
  333. })
  334. })