Technologytrading.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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").attr("value");
  145. $.ajax({
  146. method: "post",
  147. dataType: "json",
  148. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  149. data: {
  150. boutiqueType:0,
  151. industryCatalog:"",
  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").attr("value");
  222. var right_val = $(this).attr("value");
  223. if(left_val=="null"){
  224. left_val="";
  225. }
  226. $.ajax({
  227. method: "post",
  228. dataType: "json",
  229. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  230. data: {
  231. boutiqueType:right_val,
  232. industryCatalog:left_val,
  233. pageNo:1,
  234. pageSize:6
  235. },
  236. success: function (data) {
  237. if(data.data.totalCount==0){
  238. $("#demandList_patent").html("<div class='list_none'></div>");
  239. }else{
  240. thePageNo=1;
  241. manage(data.data);
  242. page_ol(data.data.totalCount);
  243. $(".pageNext").attr("all_length",Math.ceil(data.data.totalCount/6));
  244. }
  245. }
  246. })
  247. });
  248. $(".industry_ul li").click(function() {
  249. $(".paging_box span:first").addClass("action_span").siblings().removeClass("action_span");
  250. $(".title_details ol li").eq(0).addClass("act").siblings().removeClass("act");
  251. $(this).addClass("action_li").siblings().removeClass("action_li");
  252. var left_val = $(this).attr("value");
  253. var right_val = $(".title_details ol li").eq(0).attr("value");
  254. if(left_val=="null"){
  255. left_val="";
  256. }
  257. console.log(left_val)
  258. $.ajax({
  259. method: "post",
  260. dataType: "json",
  261. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  262. data: {
  263. boutiqueType:right_val,
  264. industryCatalog:left_val,
  265. pageNo:1,
  266. pageSize:6
  267. },
  268. success: function (data) {
  269. if(data.data.totalCount==0){
  270. $(".pagination_box").css("display","none");
  271. $("#demandList_patent").html("<div class='list_none'>.</div>");
  272. }else{
  273. $(".pagination_box").css("display","block");
  274. manage(data.data);
  275. page(data.data.totalCount);
  276. $(".pageNext").attr("all_length",Math.ceil(data.data.totalCount/6));
  277. }
  278. }
  279. })
  280. });
  281. //右侧内容的分页功能,点击一次发送一个ajax的请求,只请求6组数据
  282. function loadDate(pageNo) {
  283. var left_val = $(".industry_ul li.action_li").attr("value");
  284. var right_val = $(".title_details ol li.act").attr("value");
  285. if(left_val=="null"){
  286. left_val="";
  287. }
  288. $.ajax({
  289. method: "post",
  290. dataType: "json",
  291. url: globalConfig.context + "/portal/search/boutiqueSearchList",
  292. data: {
  293. boutiqueType: right_val,
  294. industryCatalog: left_val,
  295. pageNo: pageNo,
  296. pageSize: 6
  297. },
  298. success: function (data) {
  299. if (data.data.totalCount == 0) {
  300. // $(".pagination_box").css("display", "none");
  301. $("#demandList_patent").html("<div class='list_none'></div>");
  302. } else {
  303. //$(".pagination_box").css("display", "block");
  304. manage(data.data);
  305. var data=data.data.totalCount;
  306. var date=Math.ceil(data/6);
  307. $(".pageNext").attr("all_length",date);
  308. $('.totalCount').html("共 "+ date +" 页 ");
  309. var pageArr = [],
  310. firstNo = 1,
  311. endNo = 5;
  312. if (thePageNo > 3) {
  313. firstNo = thePageNo - 2;
  314. endNo = Math.min((Number(thePageNo) + 2), date);
  315. } else {
  316. endNo = Math.min(date, 5);
  317. };
  318. $('.pageNumber').remove();
  319. for (let i = firstNo; i <= endNo; i++) {
  320. if (i == thePageNo) {
  321. pageArr.push(
  322. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  323. );
  324. } else {
  325. pageArr.push(
  326. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  327. );
  328. }
  329. };
  330. $('.pagePre').after(pageArr.join(''));
  331. }
  332. }
  333. });
  334. }
  335. //当数据传回来之后,
  336. function page(data){
  337. thePageNo=$(".pagination li.active").children()[0].text;
  338. var date=Math.ceil(data/6);
  339. $('.totalCount').html("共 "+ date +" 页 ");
  340. var pageArr = [],
  341. firstNo = 1,
  342. endNo = 5;
  343. if (thePageNo > 3) {
  344. firstNo = thePageNo - 2;
  345. endNo = Math.min((Number(thePageNo) + 2), date);
  346. } else {
  347. endNo = Math.min(date, 5);
  348. }
  349. $('.pageNumber').remove();
  350. for (let i = firstNo; i <= endNo; i++) {
  351. if (i == thePageNo) {
  352. pageArr.push(
  353. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  354. );
  355. } else {
  356. pageArr.push(
  357. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  358. );
  359. }
  360. }
  361. $('.pagePre').after(pageArr.join(''));
  362. }
  363. function page_ol(data){
  364. var date=Math.ceil(data/6);
  365. $('.totalCount').html("共 "+ date +" 页 ");
  366. var pageArr = [],
  367. firstNo = 1,
  368. endNo = 5;
  369. if (thePageNo > 3) {
  370. firstNo = thePageNo - 2;
  371. endNo = Math.min((Number(thePageNo) + 2), date);
  372. } else {
  373. endNo = Math.min(date, 5);
  374. }
  375. $('.pageNumber').remove();
  376. for (let i = firstNo; i <= endNo; i++) {
  377. if (i == thePageNo) {
  378. pageArr.push(
  379. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  380. );
  381. } else {
  382. pageArr.push(
  383. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  384. );
  385. }
  386. }
  387. $('.pagePre').after(pageArr.join(''));
  388. }
  389. $('.pagination').on('click', 'li', function (e) {
  390. e.preventDefault();
  391. thePageNo=$(".pagination li.active").children()[0].text;
  392. if (this.className === 'pagePre') {
  393. if (thePageNo > 1) {
  394. thePageNo = 1;
  395. loadDate(thePageNo);
  396. }
  397. } else if (this.className === 'pageNext') {
  398. thePageLength=$(".pageNext").attr("all_length");
  399. if (thePageNo < thePageLength) {
  400. thePageNo = thePageLength;
  401. loadDate(thePageNo);
  402. }
  403. } else {
  404. var nextPageNo = $(this).children()[0].text;
  405. if (thePageNo != nextPageNo) {
  406. $(this).siblings("li").removeClass("active");
  407. $(this).addClass("active");
  408. thePageNo = nextPageNo;
  409. loadDate(thePageNo);
  410. }
  411. }
  412. });
  413. })();