achievement.js 12 KB

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