thinkTank.js 16 KB

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