achievement.js 14 KB

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