achievement.js 17 KB

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