thinkTank.js 16 KB

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