Technologytrading.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  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 './public.js';
  6. import './main_banner.js';
  7. import '../css/technologyTrading.css';
  8. import {
  9. industryObject,
  10. getIndustryCategory
  11. } from './DicIndustryList';
  12. (function(){
  13. var theKeyword,Province;
  14. var thePageNo = 1,
  15. thePageLength = 1,
  16. pageSize = 6;
  17. //技术交易问题的点击出答案
  18. $(".technolo_right .technolo_text>div>a").click(function(e){
  19. e.preventDefault();
  20. var alength=$(this).parent().index();
  21. $(".answer").css({"display":"block"});
  22. $(".answer>p").eq(alength).fadeIn();
  23. });
  24. //技术交易政策的点击跳转政策详情页面
  25. $(".technolo_center .technolo_text").on('click', 'div', function () {
  26. var theId = $(this).attr('val');
  27. window.open(globalConfig.context + '/portal/news/newsDetail?id=' + theId );
  28. });
  29. //技术交易成功案例的点击跳转成果详情页面
  30. $(".technolo_left .technolo_text").on('click', 'div', function () {
  31. var theId = $(this).attr('val');
  32. var thetype=$(this).attr('typ');
  33. window.open(globalConfig.context + '/portal/technologyTrading/achievementDetail?id=' + theId+'&type='+thetype );
  34. });
  35. //技术交易问题的答案删除
  36. $(".answer").click(function(e){
  37. if(e.target.className=="answer"){
  38. $(".answer").css({"display":"none"});
  39. $(".answer>p").fadeOut();
  40. }
  41. });
  42. //技术交易问题的点击出答案
  43. $(".answer>p>span").click(function(e){
  44. $(".answer").css({"display":"none"});
  45. $(".answer>p").fadeOut();
  46. });
  47. //点击搜索开始调用接口并跳转
  48. $(".searchs>button").click(function(e){
  49. //localStorage.clear();
  50. var key=$("#search_on>input").val()?$("#search_on>input").val():"null";
  51. var typ=$("#selt>option:selected").attr("val");
  52. if(typ==2){
  53. window.open(globalConfig.context + '/portal/technologyTrading/demand.html');
  54. localStorage.setItem("keyWord",key);
  55. localStorage.setItem("pageType",typ);
  56. }else{
  57. window.open(globalConfig.context + '/portal/technologyTrading/achievement.html');
  58. localStorage.setItem("keyWord",key);
  59. localStorage.setItem("pageType",typ);
  60. }
  61. });
  62. $("#demandList_patent").on('click', 'li', function () {
  63. var ol_index= $(".title_details ol>li.act").index();
  64. var theId = $(this).attr('val');
  65. var thetype=$(this).attr('typ');
  66. if(ol_index==2){
  67. window.open(globalConfig.context + '/portal/technologyTrading/demandDetail?id=' + theId+'&type='+thetype );
  68. }
  69. else{
  70. window.open(globalConfig.context + '/portal/technologyTrading/achievementDetail?id=' + theId+'&type='+thetype );
  71. }
  72. });
  73. //处理data数据函数提取
  74. function manage(data){
  75. var demand_html="";
  76. for(var i=0;i<data.list.length;i++){
  77. var catalog,price,sketch;
  78. catalog=data.list[i].industryCatalog?data.list[i].industryCatalog:"所有行业";
  79. price=data.list[i].price?data.list[i].price:"价格面议";
  80. sketch=data.list[i].sketch?data.list[i].sketch.substring(0,18):"暂未简介";
  81. if(!data.list[i].pictureUrl){
  82. demand_html+="<li val='"+data.list[i].id+"' typ='"+data.list[i].ownerType+"'>" +
  83. "<div class='imgnull'></div>" +
  84. "<div class='details_text'>" +
  85. "<p>行业:<span>"+catalog+"</span></p>" +
  86. "<p>价格:<span>"+price+"</span></p>" +
  87. "<p>简介:<span>"+sketch+"..."+"</span></p>" +
  88. "<a href='#'>了解详情</a>" +
  89. "</div>" +
  90. "<div class='details_fix'>" +
  91. "<p>专利名:<span>"+data.list[i].name+"</span></p>" +
  92. "<p>所有人:<span>"+(data.list[i].personName?data.list[i].personName:"佚名")+"</span></p>" +
  93. "</div></li>"
  94. }else{
  95. demand_html+="<li val='"+data.list[i].id+"' typ='"+data.list[i].ownerType+"'>" +
  96. "<img src='"+globalConfig.avatarUploadHost+data.list[i].pictureUrl+"' alt=''/>" +
  97. "<div class='details_text'>" +
  98. "<p>行业:<span>"+catalog+"</span></p>" +
  99. "<p>价格:<span>"+price+"</span></p>" +
  100. "<p>简介:<span>"+sketch+"..."+"</span></p>" +
  101. "<a href='#'>了解详情</a>" +
  102. "</div>" +
  103. "<div class='details_fix'>" +
  104. "<p>专利名:<span>"+data.list[i].name+"</span></p>" +
  105. "<p>所有人:<span>"+(data.list[i].personName?data.list[i].personName:"佚名")+"</span></p>" +
  106. "</div></li>"
  107. }
  108. }
  109. $("#demandList_patent").html(demand_html);
  110. }
  111. //当数据传回来之后,
  112. function page(data){
  113. var date=Math.ceil(data/6);
  114. $('.totalCount').html("共 "+ date +" 页 ");
  115. var pageArr = [],
  116. firstNo = 1,
  117. endNo = 5;
  118. if (thePageNo > 3) {
  119. firstNo = thePageNo - 2;
  120. endNo = Math.min((Number(thePageNo) + 2), date);
  121. } else {
  122. endNo = Math.min(date, 5);
  123. };
  124. for (let i = firstNo; i <= endNo; i++) {
  125. if (i == thePageNo) {
  126. pageArr.push(
  127. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  128. );
  129. } else {
  130. pageArr.push(
  131. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  132. );
  133. }
  134. };
  135. $('.pageNumber').remove();
  136. $('.pagePre').after(pageArr.join(''));
  137. }
  138. var ul_html="";
  139. for(var i=0;i<industryObject.length;i++){
  140. ul_html+="<li value='"+industryObject[i].value+"'><a href='javascript:;'>"+industryObject[i].label+"</a></li>";
  141. }
  142. $(".industry_ul").html(ul_html);
  143. $(".industry_ul li:first").addClass("action_li");
  144. var left_val=$(".industry_ul li.action_li").val();
  145. $.ajax({
  146. method: "post",
  147. dataType: "json",
  148. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  149. data: {
  150. boutiqueType:0,
  151. industryCatalog:left_val,
  152. pageNo:1,
  153. pageSize:6
  154. },
  155. success: function (data) {
  156. if(data.data.totalCount==0){
  157. $(".pagination_box").css("display","none");
  158. $("#demandList_patent").html("<div class='list_none'></div>");
  159. }else{
  160. $(".pagination_box").css("display","block");
  161. manage(data.data);
  162. page(data.data.totalCount);
  163. $(".pageNext").attr("all_length",Math.ceil(data.data.totalCount/6));
  164. }
  165. }
  166. })
  167. })();
  168. (function(){
  169. var theKeyword,Province;
  170. var thePageNo = 1,
  171. thePageLength = 1,
  172. pageSize = 6;
  173. //处理data数据函数提取
  174. function manage(data){
  175. var chagename="";
  176. var caseindex=$(".title_details ol li.act").index();
  177. switch (caseindex){
  178. case 0:chagename="专利名";break;
  179. case 1:chagename="技术名";break;
  180. case 2:chagename="需求名";break;
  181. }
  182. var demand_html="";
  183. for(var i=0;i<data.list.length;i++){
  184. var catalog,price,sketch;
  185. catalog=data.list[i].industryCatalog?data.list[i].industryCatalog:"所有行业";
  186. price=data.list[i].price?data.list[i].price:"价格面议";
  187. sketch=data.list[i].sketch?data.list[i].sketch.substring(0,18):"暂无简介";
  188. if(!data.list[i].pictureUrl){
  189. demand_html+="<li val='"+data.list[i].id+"' typ='"+data.list[i].ownerType+"'>" +
  190. "<div class='imgnull'></div>" +
  191. "<div class='details_text'>" +
  192. "<p>行业:<span>"+catalog+"</span></p>" +
  193. "<p>价格:<span>"+price+"</span></p>" +
  194. "<p>简介:<span>"+sketch+"..."+"</span></p>" +
  195. "<a href='#'>了解详情</a>" +
  196. "</div>" +
  197. "<div class='details_fix'>" +
  198. "<p>"+chagename+":<span>"+data.list[i].name+"</span></p>" +
  199. "<p>所有人:<span>"+(data.list[i].personName?data.list[i].personName:"佚名")+"</span></p>" +
  200. "</div></li>"
  201. }else{
  202. demand_html+="<li val='"+data.list[i].id+"' typ='"+data.list[i].ownerType+"'>" +
  203. "<img src='"+globalConfig.avatarUploadHost+data.list[i].pictureUrl+"' alt=''/>" +
  204. "<div class='details_text'>" +
  205. "<p>行业:<span>"+catalog+"</span></p>" +
  206. "<p>价格:<span>"+price+"</span></p>" +
  207. "<p>简介:<span>"+sketch+"..."+"</span></p>" +
  208. "<a href='#'>了解详情</a>" +
  209. "</div>" +
  210. "<div class='details_fix'>" +
  211. "<p>专利名:<span>"+data.list[i].name+"</span></p>" +
  212. "<p>所有人:<span>"+(data.list[i].personName?data.list[i].personName:"佚名")+"</span></p>" +
  213. "</div></li>"
  214. }
  215. }
  216. $("#demandList_patent").html(demand_html);
  217. }
  218. $(".title_details ol li").click(function(){
  219. $(".paging_box span:first").addClass("action_span").siblings().removeClass("action_span");
  220. $(this).addClass("act").siblings().removeClass("act");
  221. var left_val=$(".industry_ul li.action_li").val();
  222. var right_val = $(this).val();
  223. $.ajax({
  224. method: "post",
  225. dataType: "json",
  226. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  227. data: {
  228. boutiqueType:right_val,
  229. industryCatalog:left_val,
  230. pageNo:1,
  231. pageSize:6
  232. },
  233. success: function (data) {
  234. if(data.data.totalCount==0){
  235. $("#demandList_patent").html("<div class='list_none'></div>");
  236. }else{
  237. thePageNo=1;
  238. manage(data.data);
  239. page_ol(data.data.totalCount);
  240. $(".pageNext").attr("all_length",Math.ceil(data.data.totalCount/6));
  241. }
  242. }
  243. })
  244. });
  245. $(".industry_ul li").click(function() {
  246. $(".paging_box span:first").addClass("action_span").siblings().removeClass("action_span");
  247. $(".title_details ol li").eq(0).addClass("act").siblings().removeClass("act");
  248. $(this).addClass("action_li").siblings().removeClass("action_li");
  249. var left_val = $(this).val();
  250. var right_val = $(".title_details ol li").eq(0).val();
  251. $.ajax({
  252. method: "post",
  253. dataType: "json",
  254. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  255. data: {
  256. boutiqueType:right_val,
  257. industryCatalog:left_val,
  258. pageNo:1,
  259. pageSize:6
  260. },
  261. success: function (data) {
  262. if(data.data.totalCount==0){
  263. $(".pagination_box").css("display","none");
  264. $("#demandList_patent").html("<div class='list_none'>.</div>");
  265. }else{
  266. $(".pagination_box").css("display","block");
  267. manage(data.data);
  268. page(data.data.totalCount);
  269. $(".pageNext").attr("all_length",Math.ceil(data.data.totalCount/6));
  270. }
  271. }
  272. })
  273. });
  274. //右侧内容的分页功能,点击一次发送一个ajax的请求,只请求6组数据
  275. function loadDate(pageNo) {
  276. //var page_length = $(this).attr("value");
  277. var left_val = $(".industry_ul li.action_li").val();
  278. var right_val = $(".title_details ol li.act").val();
  279. //var right_check = $(".title_details ol li.act").index();
  280. $.ajax({
  281. method: "post",
  282. dataType: "json",
  283. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  284. data: {
  285. boutiqueType: right_val,
  286. industryCatalog: left_val,
  287. pageNo: pageNo,
  288. pageSize: 6
  289. },
  290. success: function (data) {
  291. if (data.data.totalCount == 0) {
  292. // $(".pagination_box").css("display", "none");
  293. $("#demandList_patent").html("<div class='list_none'></div>");
  294. } else {
  295. //$(".pagination_box").css("display", "block");
  296. manage(data.data);
  297. var data=data.data.totalCount;
  298. var date=Math.ceil(data/6);
  299. $(".pageNext").attr("all_length",date);
  300. $('.totalCount').html("共 "+ date +" 页 ");
  301. var pageArr = [],
  302. firstNo = 1,
  303. endNo = 5;
  304. if (thePageNo > 3) {
  305. firstNo = thePageNo - 2;
  306. endNo = Math.min((Number(thePageNo) + 2), date);
  307. } else {
  308. endNo = Math.min(date, 5);
  309. };
  310. $('.pageNumber').remove();
  311. for (let i = firstNo; i <= endNo; i++) {
  312. if (i == thePageNo) {
  313. pageArr.push(
  314. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  315. );
  316. } else {
  317. pageArr.push(
  318. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  319. );
  320. }
  321. };
  322. $('.pagePre').after(pageArr.join(''));
  323. }
  324. }
  325. });
  326. }
  327. //当数据传回来之后,
  328. function page(data){
  329. thePageNo=$(".pagination li.active").children()[0].text;
  330. var date=Math.ceil(data/6);
  331. $('.totalCount').html("共 "+ date +" 页 ");
  332. var pageArr = [],
  333. firstNo = 1,
  334. endNo = 5;
  335. if (thePageNo > 3) {
  336. firstNo = thePageNo - 2;
  337. endNo = Math.min((Number(thePageNo) + 2), date);
  338. } else {
  339. endNo = Math.min(date, 5);
  340. }
  341. $('.pageNumber').remove();
  342. for (let i = firstNo; i <= endNo; i++) {
  343. if (i == thePageNo) {
  344. pageArr.push(
  345. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  346. );
  347. } else {
  348. pageArr.push(
  349. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  350. );
  351. }
  352. }
  353. $('.pagePre').after(pageArr.join(''));
  354. }
  355. function page_ol(data){
  356. var date=Math.ceil(data/6);
  357. $('.totalCount').html("共 "+ date +" 页 ");
  358. var pageArr = [],
  359. firstNo = 1,
  360. endNo = 5;
  361. if (thePageNo > 3) {
  362. firstNo = thePageNo - 2;
  363. endNo = Math.min((Number(thePageNo) + 2), date);
  364. } else {
  365. endNo = Math.min(date, 5);
  366. }
  367. $('.pageNumber').remove();
  368. for (let i = firstNo; i <= endNo; i++) {
  369. if (i == thePageNo) {
  370. pageArr.push(
  371. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  372. );
  373. } else {
  374. pageArr.push(
  375. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  376. );
  377. }
  378. }
  379. $('.pagePre').after(pageArr.join(''));
  380. }
  381. $('.pagination').on('click', 'li', function (e) {
  382. e.preventDefault();
  383. thePageNo=$(".pagination li.active").children()[0].text;
  384. if (this.className === 'pagePre') {
  385. if (thePageNo > 1) {
  386. thePageNo = 1;
  387. loadDate(thePageNo);
  388. }
  389. } else if (this.className === 'pageNext') {
  390. thePageLength=$(".pageNext").attr("all_length");
  391. if (thePageNo < thePageLength) {
  392. thePageNo = thePageLength;
  393. loadDate(thePageNo);
  394. }
  395. } else {
  396. var nextPageNo = $(this).children()[0].text;
  397. if (thePageNo != nextPageNo) {
  398. $(this).siblings("li").removeClass("active");
  399. $(this).addClass("active");
  400. thePageNo = nextPageNo;
  401. loadDate(thePageNo);
  402. }
  403. }
  404. });
  405. })();