achievement.js 17 KB

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