thinktank.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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/thinkTank.css';
  8. import {
  9. provinceList
  10. } from './NewDicProvinceList';
  11. import {
  12. techFieldList,
  13. getTechField
  14. } from './DicTechFieldList';
  15. $(function(){
  16. //智库、智者切换
  17. $('.zizone .col-md-6').click(function(){
  18. $(this).addClass('actives').siblings().removeClass('actives')
  19. })
  20. $('.zone_left').click(function(){
  21. $('.wiseman_list').hide();
  22. $('.tab_zizone').show();
  23. })
  24. $('.zone_right').click(function(){
  25. $('.wiseman_list').show();
  26. $('.tab_zizone').hide();
  27. })
  28. //地方政策城市切换
  29. //初始北京第一页新闻
  30. $('.place_city ul li').eq(0).addClass('thon').siblings().removeClass('thon');
  31. var thePageNos= 1;
  32. var pageNos = 1;
  33. var thePageLengths=1;
  34. var pageSizes = 4;
  35. var provinces=1;
  36. function datt(provinces,pageNos){
  37. $.ajax({
  38. method: "get",
  39. dataType: "json",
  40. url: globalConfig.context + "/portal/news/list",
  41. data: {
  42. provinceId:provinces || 1,
  43. hot: 1,
  44. pageNo:pageNos || 1,
  45. type:5,
  46. pageSize:pageSizes,
  47. },
  48. success: function (result) {
  49. var totlepage=Math.ceil(result.data.totalCount/4);
  50. var policy_li ='';
  51. for(var i=0;i<result.data.list.length;i++){
  52. var id=result.data.list[i].id;
  53. var title = result.data.list[i].title; //标题
  54. var time = result.data.list[i].createTimeFormattedDate; //日期
  55. var day=time.substr(8,2);//号
  56. var month=time.substr(0,7) //年、月
  57. var summary = result.data.list[i].summary;//简介
  58. var totle=result.data.totalCount;
  59. var pages=Math.ceil(totle/4);
  60. var sol='';
  61. policy_li+="<li value='"+id+"'>"+"<div class='policy_time'><p>"+day+"</p><time>"+month+"</time></div><div class='policy_details'><h4><a href='#'>"+title+"</a></h4><p>"+summary+"</p><a href='#'>MORE+</a></div></li>"
  62. }
  63. if(result.data.list.length===0){
  64. $('.policy ol').hide();
  65. $('.policy ul').html('<li>敬请期待…</li>') ;
  66. }else{
  67. $('.policy ol').show() ;
  68. $('.policy ul').html(policy_li)
  69. }
  70. }.bind(this)
  71. })
  72. }
  73. datt(1,1);
  74. //点击省份时刷新页面新闻
  75. $('.place_city ul li').click(function(){
  76. $(this).addClass('thon').siblings().removeClass('thon')
  77. $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of');
  78. $('.more_city .inp').removeClass('thon');
  79. $('.more_city .inp').text('更多省份 +')
  80. //新闻刷新
  81. var t_val=$(this).prop('value');
  82. provinces=t_val;
  83. datt(provinces,1);
  84. });
  85. //智政新闻小点切换宽度设置及点击刷新
  86. var cirle = $('.policy ol li').length;
  87. var ind_circle=0;
  88. $('.policy ol li').click(function(){
  89. $(this).addClass('active_of').siblings().removeClass('active_of');
  90. var place_on = $('.place_city ul li.thon').prop('value')
  91. var h_ind=$(this).index()+1;
  92. if(place_on==undefined){
  93. place_on=$('.inp').attr('value');
  94. }
  95. provinces=place_on;
  96. pageNos=h_ind;
  97. $.ajax({
  98. method: "get",
  99. dataType: "json",
  100. url: globalConfig.context + "/portal/news/list",
  101. data: {
  102. provinceId:provinces || 1,
  103. hot: 1,
  104. pageNo:pageNos || 1,
  105. type:5,
  106. pageSize:pageSizes,
  107. },
  108. success: function (result) {
  109. var totlepage=Math.ceil(result.data.totalCount/4);
  110. var policy_li ='';
  111. for(var i=0;i<result.data.list.length;i++){
  112. var id=result.data.list[i].id;
  113. var title = result.data.list[i].title; //标题
  114. var time = result.data.list[i].createTimeFormattedDate; //日期
  115. var day=time.substr(8,2);//号
  116. var month=time.substr(0,7) //年、月
  117. var summary = result.data.list[i].summary;//简介
  118. var totle=result.data.totalCount;
  119. var pages=Math.ceil(totle/4);
  120. var sol='';
  121. policy_li+="<li value='"+id+"'>"+"<div class='policy_time'><p>"+day+"</p><time>"+month+"</time></div><div class='policy_details'><h4><a href='#'>"+title+"</a></h4><p>"+summary+"</p><a href='#'>MORE+</a></div></li>"
  122. }
  123. $('.policy ol').show();
  124. $('.policy ul').html(policy_li);
  125. }.bind(this)
  126. })
  127. })
  128. //中央政策跳转
  129. $('.main_zizone ul').on('click', 'li', function () {
  130. var theId = $(this).attr('value');
  131. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + theId );
  132. })
  133. //地方政策跳转
  134. $('.policy_details a').on('click', 'li', function () {
  135. var theId = $(this).parent('li').attr('value');
  136. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + theId );
  137. })
  138. //搜索城市下拉
  139. var addlength=provinceList.length;
  140. var soption='';
  141. var sol='';
  142. for(var i=5;i<addlength;i++){
  143. sol+="<p value='"+provinceList[i].id+"'>"+provinceList[i].name+"</p>";
  144. };
  145. for(var i=0;i<addlength;i++){
  146. soption+="<option value='"+provinceList[i].id+"'>"+provinceList[i].name+"</option>";
  147. };
  148. $('.list_city').html(sol);
  149. $('#selt').html(soption);
  150. //智政城市下拉切换
  151. $('.list_city').hide();
  152. $('.more_city .inp').click(function(){
  153. $('.list_city').slideToggle(500)
  154. })
  155. $('.more_city').mouseleave(function(){
  156. $('.list_city').hide();
  157. })
  158. //选择城市及新闻页面刷新
  159. $('.list_city p').click(function(){
  160. var ptxt=$(this).text();
  161. var pval=$(this).attr('value');
  162. $('.more_city .inp').text(ptxt);
  163. $('.more_city .inp').attr('value',pval);
  164. $('.list_city').hide();
  165. $('.more_city .inp').addClass('thon');
  166. $('.place_city ul li').removeClass('thon');
  167. $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of');
  168. var p_val=$(this).attr('value');
  169. provinces=p_val ;
  170. datt(provinces,1);
  171. });
  172. //中央政策点击刷新
  173. //初始化内容
  174. function mids(provinces,pageNos){
  175. $.ajax({
  176. method: "get",
  177. dataType: "json",
  178. url: globalConfig.context + "/portal/news/list",
  179. data: {
  180. provinceId:provinces ||1,
  181. hot: 1,
  182. pageNo:pageNos||1,
  183. type:4,
  184. pageSize:pageSizes,
  185. },
  186. success: function (result) {
  187. thePageLengths = result.data.totalCount ? Math.ceil(result.data.totalCount / pageSizes) : 1;
  188. var policy_img ='';
  189. for(var i=0;i<result.data.list.length;i++){
  190. var id=result.data.list[i].id;
  191. var title = result.data.list[i].title; //标题
  192. var titleImg = result.data.list[i].titleImg; //图片
  193. var summary = result.data.list[i].summary;//简介
  194. policy_img+="<li value='"+id+"'>"+"<img src='"+globalConfig.avatarUploadHost+titleImg+"' alt=''/>"+"<div class='zizone_text'><h4><a href='#'>"+title+"</a></h3><p>"+summary+"</p><a href='#'>MORE+</a></div></li>"
  195. }
  196. $('.main_zizone ul').html(policy_img)
  197. }.bind(this)
  198. })
  199. }
  200. mids(1,1)
  201. //点击时left
  202. var t=1;
  203. $('.zizone_left').click(function(){
  204. t--;
  205. if(t<=1){
  206. t=1
  207. }
  208. $.ajax({
  209. method: "get",
  210. dataType: "json",
  211. url: globalConfig.context + "/portal/news/list",
  212. data: {
  213. provinceId:null,
  214. hot: 1,
  215. pageNo:t,
  216. type:4,
  217. pageSize:4,
  218. },
  219. success: function (result) {
  220. var totle=Math.ceil(result.data.totalCount/4);
  221. var policy_img ='';
  222. for(var i=0;i<result.data.list.length;i++){
  223. var id=result.data.list[i].id;
  224. var title = result.data.list[i].title; //标题
  225. var titleImg = result.data.list[i].titleImg; //图片
  226. var summary = result.data.list[i].summary;//简介
  227. policy_img+="<li value='"+id+"'>"+"<img src='"+globalConfig.avatarUploadHost+titleImg+"' alt='''/>"+"<div class='zizone_text'><h4><a href='#'>"+title+"</a></h3><p>"+summary+"</p><a href='#'>MORE+</a></div></li>"
  228. }
  229. if(result.data.list.length===0){
  230. return false
  231. }{
  232. $('.main_zizone ul').html(policy_img)
  233. }
  234. }.bind(this)
  235. })
  236. })
  237. //点击时right
  238. var totle;
  239. $('.zizone_right').click(function(){
  240. t++;
  241. if(t>totle){
  242. t=totle
  243. }
  244. $.ajax({
  245. method: "get",
  246. dataType: "json",
  247. url: globalConfig.context + "/portal/news/list",
  248. data: {
  249. provinceId:null,
  250. hot: 1,
  251. pageNo:t,
  252. type:4,
  253. pageSize:4,
  254. },
  255. success: function (result) {
  256. totle=Math.ceil(result.data.totalCount/4);
  257. var policy_img ='';
  258. for(var i=0;i<result.data.list.length;i++){
  259. var id=result.data.list[i].id;
  260. var title = result.data.list[i].title; //标题
  261. var titleImg = result.data.list[i].titleImg; //图片
  262. var summary = result.data.list[i].summary;//简介
  263. policy_img+="<li value='"+id+"'>"+"<img src='"+globalConfig.avatarUploadHost+titleImg+"' alt='''/>"+"<div class='zizone_text'><h4><a href='#'>"+title+"</a></h3><p>"+summary+"</p><a href='#'>MORE+</a></div></li>"
  264. }
  265. $('.main_zizone ul').html(policy_img)
  266. }.bind(this)
  267. })
  268. })
  269. //智者数据交互
  270. var theKeyword, theFieldA, theFieldB, theFieldC;
  271. var thePageNo = 1,
  272. thePageLength = 1,
  273. pageSize = 12,
  274. theType = 0;
  275. function loadDate(pageNo) {
  276. theFieldA = theFieldA != 999 ? theFieldA : undefined;
  277. theFieldB = theFieldB != 999 ? theFieldB : undefined;
  278. theFieldC = theFieldC != 999 ? theFieldC : undefined;
  279. $.ajax({
  280. method: "get",
  281. dataType: "json",
  282. url: globalConfig.context + "/portal/search/subscriberList",
  283. data: {
  284. pageNo: pageNo || 1,
  285. pageSize: pageSize,
  286. type: theType,
  287. name: theKeyword,
  288. field: theFieldA ? ((theFieldA || '') + (theFieldB ? (',' + theFieldB) : '') + (theFieldC ? (',' + theFieldC) : '')) : undefined,
  289. },
  290. success: function (data) {
  291. var theArr = [];
  292. if (data.data && data.data.list) {
  293. for (let i = 0; i < data.data.list.length; i++) {
  294. let thisdata = data.data.list[i];
  295. let engagedField = thisdata.engagedField ? thisdata.engagedField.split(',') : [];
  296. var imgUrl=thisdata.personPortraitUrl!==null?thisdata.personPortraitUrl:"/img/timg.gif";
  297. theArr.push([
  298. '<li value="'+thisdata.identityId+'">',
  299. '<img src="' + globalConfig.avatarHost + '/upload' + thisdata.personPortraitUrl + '" />',
  300. '<div class="list_text">',
  301. '<p class="bulr">'+ thisdata.username + '</p>',
  302. '<p class="orange">' + (thisdata.position || '未知职位') + '</p>',
  303. '<p class="text_on">' + getTechField(engagedField[0], engagedField[1], engagedField[2]) + '</p>',
  304. '</div>',
  305. '<div class="shadow_text">',
  306. '<p class="bulr">'+ thisdata.username + '</p>',
  307. '<p class="orange">' + (thisdata.position || '未知职位') + '</p>',
  308. '<p class="text_on">' + getTechField(engagedField[0], engagedField[1], engagedField[2]) + '</p>',
  309. '<img src="' + globalConfig.portalHost + '/img/search_txt.png "/>',
  310. '</div>',
  311. '</li>' ,
  312. ].join(''));
  313. };
  314. } else {
  315. return;
  316. };
  317. $('#subscriberList').empty();
  318. $('#subscriberList').append(theArr.join(''));
  319. $('.totalCount').html("共" + data.data.totalCount + "条数据");
  320. thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
  321. var pageArr = [],
  322. firstNo = 1,
  323. endNo = 5;
  324. if (thePageNo > 3) {
  325. firstNo = thePageNo - 2;
  326. endNo = Math.min((Number(thePageNo) + 2), thePageLength);
  327. } else {
  328. endNo = Math.min(thePageLength, 5);
  329. };
  330. for (let i = firstNo; i <= endNo; i++) {
  331. if (i == thePageNo) {
  332. pageArr.push(
  333. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  334. );
  335. } else {
  336. pageArr.push(
  337. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  338. );
  339. }
  340. };
  341. $('.pageNumber').remove();
  342. $('.pagePre').after(pageArr.join(''));
  343. },
  344. });
  345. }
  346. if (window.location.search) {
  347. let theUrl = window.location.search
  348. theKeyword = theUrl.substring(1, theUrl.length);
  349. theKeyword = decodeURIComponent(theKeyword);
  350. $('#searchInput').val(theKeyword);
  351. };
  352. loadDate();
  353. var industryListArr = [],
  354. industrySecondList = [],
  355. industryThirdList = [];
  356. industryListArr.push(['<li value="999" class="active">',
  357. '<span>',
  358. '不限',
  359. '</span>',
  360. '</li>',
  361. ].join(''));
  362. techFieldList.map(function (item) {
  363. industryListArr.push(['<li value="' + item.value + '">',
  364. '<span>',
  365. item.label,
  366. '</span>',
  367. '</li>',
  368. ].join(''));
  369. });
  370. if (industryListArr && industryListArr.length) {
  371. $('#industryList').append(industryListArr.join(''));
  372. };
  373. $('#industryList').on('click', 'li', function () {
  374. var theValue = this.value;
  375. $(this).siblings("li").removeClass("active");
  376. $(this).addClass("active");
  377. industrySecondList = [];
  378. industrySecondList.push(['<li value="999" class="active">',
  379. '<span>',
  380. '不限',
  381. '</span>',
  382. '</li>',
  383. ].join(''));
  384. if (theValue !== 999) {
  385. $('#industrySecondBox').css("display", "block");
  386. techFieldList.map(function (item) {
  387. if (item.value == theValue) {
  388. item.children.map(function (child) {
  389. industrySecondList.push(['<li value="' + child.value + '">',
  390. '<span>',
  391. child.label,
  392. '</span>',
  393. '</li>',
  394. ].join(''));
  395. });
  396. };
  397. });
  398. } else {
  399. $('#industrySecondBox').css("display", "none");
  400. };
  401. if (industrySecondList && industrySecondList.length) {
  402. $('#industrySecondList').empty();
  403. $('#industrySecondList').append(industrySecondList.join(''));
  404. };
  405. $('#industryThirdBox').css("display", "none");
  406. theFieldA = this.value;
  407. theFieldB = 999;
  408. theFieldC = 999;
  409. loadDate();
  410. });
  411. $('#industrySecondList').on('click', 'li', function () {
  412. var theValue = this.value;
  413. $(this).siblings("li").removeClass("active");
  414. $(this).addClass("active");
  415. industryThirdList = [];
  416. industryThirdList.push(['<li value="999" class="active">',
  417. '<span>',
  418. '不限',
  419. '</span>',
  420. '</li>',
  421. ].join(''));
  422. if (theValue !== 999) {
  423. $('#industryThirdBox').css("display", "block");
  424. techFieldList.map(function (itemA) {
  425. if (itemA.value == theFieldA) {
  426. itemA.children.map(function (itemB) {
  427. if (itemB.value == theValue) {
  428. itemB.children.map(function (itemC) {
  429. industryThirdList.push(['<li value="' + itemC.value + '">',
  430. '<span>',
  431. itemC.label,
  432. '</span>',
  433. '</li>',
  434. ].join(''));
  435. })
  436. }
  437. });
  438. };
  439. });
  440. } else {
  441. $('#industryThirdBox').css("display", "none");
  442. };
  443. if (industryThirdList && industryThirdList.length) {
  444. $('#industryThirdList').empty();
  445. $('#industryThirdList').append(industryThirdList.join(''));
  446. };
  447. theFieldB = this.value;
  448. theFieldC = 999;
  449. loadDate();
  450. });
  451. $('#industryThirdList').on('click', 'li', function () {
  452. $(this).siblings("li").removeClass("active");
  453. $(this).addClass("active");
  454. theFieldC = this.value;
  455. loadDate();
  456. });
  457. $('.searchs button').click(function (e) {
  458. e.preventDefault();
  459. theKeyword = $('#search_on input').val();
  460. loadDate();
  461. });
  462. $('.pagination').on('click', 'li', function (e) {
  463. e.preventDefault();
  464. if (this.className === 'pagePre') {
  465. if (thePageNo > 1) {
  466. thePageNo = 1;
  467. loadDate(thePageNo);
  468. }
  469. } else if (this.className === 'pageNext') {
  470. if (thePageNo < thePageLength) {
  471. thePageNo = thePageLength;
  472. loadDate(thePageNo);
  473. }
  474. } else {
  475. var nextPageNo = $(this).children()[0].text;
  476. if (thePageNo != nextPageNo) {
  477. $(this).siblings("li").removeClass("active");
  478. $(this).addClass("active");
  479. thePageNo = nextPageNo;
  480. loadDate(thePageNo);
  481. };
  482. };
  483. });
  484. $('#subscriberList').on('click', 'li', function () {
  485. var theId = $(this).children(".userId")[0].value;
  486. var theType = $(this).children(".userType")[0].value;
  487. window.open(globalConfig.context + '/user/subscriberDetail.html?rid=' + theId + '&type=' + theType);
  488. })
  489. })