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. $('.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. auditStatus:2
  210. },
  211. success: function (data) {
  212. var theArr = [];
  213. if(data&&data.error.length){
  214. msg(data.error[0].message)
  215. $('.pagination_box').hide();
  216. }
  217. if (data&&data.data && data.data.list) {
  218. for (let i = 0; i < data.data.list.length; i++) {
  219. let thisdata = data.data.list[i];
  220. let achievementNumText=(thisdata.achievementNum==null)?"":thisdata.achievementNum;
  221. if(thisdata.username==null||thisdata.username==''){
  222. thisdata.username='佚名'
  223. }
  224. theArr.push(`
  225. <li value="${thisdata.uid}">
  226. <div class="noImg">
  227. ${thisdata.personPortraitUrl&&thisdata.personPortraitUrl!=null?'<img src="'+globalConfig.avatarHost+'/upload'+thisdata.personPortraitUrl+'"/>':''}
  228. </div>
  229. <div class="list_text">
  230. <p class="bulr">${thisdata.username}</p>
  231. <p class="orange">${thisdata.position?thisdata.position:'未知职位'}</p>
  232. <p class="text_on">${achievementNumText}</p>
  233. </div>
  234. <div class="shadow_text">
  235. <p class="bulr">${thisdata.username }</p>
  236. <p class="orange">${thisdata.position?thisdata.position:'未知职位'}</p>
  237. <p class="text_on">${achievementNumText}</p>
  238. <span> <img src="${globalConfig.portalHost}/img/search_txt.png "/></span>
  239. </div>
  240. </li>
  241. `);
  242. };
  243. }
  244. $('.loading').hide();
  245. $('#subscriberList').empty();
  246. $('#subscriberList').append(theArr.join(''));
  247. if(data.data.list.length===0){
  248. $('#subscriberList').html('<div class="imgbg"></div>') ;
  249. }
  250. $('.totalCount').html("共" + data.data.totalCount + "条数据");
  251. thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
  252. var pageArr = [],
  253. firstNo = 1,
  254. endNo = 5;
  255. if (thePageNo > 3) {
  256. firstNo = thePageNo - 2;
  257. endNo = Math.min((Number(thePageNo) + 2), thePageLength);
  258. } else {
  259. endNo = Math.min(thePageLength, 5);
  260. };
  261. for (let i = firstNo; i <= endNo; i++) {
  262. if (i == thePageNo) {
  263. pageArr.push(
  264. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  265. );
  266. } else {
  267. pageArr.push(
  268. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  269. );
  270. }
  271. };
  272. if(!data.data.totalCount){
  273. $('.pagination_box').hide()
  274. }else{
  275. $('.pageNumber').remove();
  276. $('.pagePre').after(pageArr.join(''));
  277. }
  278. }
  279. });
  280. }
  281. //搜索城市下拉
  282. var addlength = provinceList.length;
  283. var soption = '';
  284. var sol = '';
  285. for(var i = 0; i < addlength; i++) {
  286. sol += "<p value='" + provinceList[i].id + "'>" + provinceList[i].name + "</p>";
  287. };
  288. for(var i = 0; i < addlength; i++) {
  289. soption += "<option value='" + provinceList[i].id + "'>" + provinceList[i].name + "</option>";
  290. };
  291. $('.list_city').html(sol);
  292. $('#selt').html(soption);
  293. //智政城市下拉切换
  294. $('.list_city').hide();
  295. $('.more_city .inp').click(function() {
  296. $('.list_city').slideToggle(500)
  297. })
  298. $('.more_city').mouseleave(function() {
  299. $('.list_city').hide();
  300. })
  301. //选择城市及新闻页面刷新
  302. $('.list_city p').click(function() {
  303. var ptxt = $(this).text();
  304. var pval = $(this).attr('value');
  305. $('.more_city .inp').text(ptxt);
  306. $('.more_city .inp').attr('value', pval);
  307. $('.list_city').hide();
  308. $('.more_city .inp').addClass('thon');
  309. $('.place_city ul li').removeClass('thon');
  310. $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of');
  311. var p_val = $(this).attr('value');
  312. provinces = p_val;
  313. datt(provinces, 1);
  314. });
  315. //初始化内容
  316. function mids(provinces, pageNos) {
  317. $.ajax({
  318. method: "get",
  319. dataType: "json",
  320. url: globalConfig.context + "/portal/news/list",
  321. data: {
  322. provinceId: null,
  323. hot: 1,
  324. pageNo: pageNos || 1,
  325. type: 4,
  326. pageSize: pageSizes
  327. },
  328. success: function(result) {
  329. thePageLengths = result.data.totalCount ? Math.ceil(result.data.totalCount / pageSizes) : 1;
  330. var policy_img = '';
  331. var totle = Math.ceil(result.data.totalCount / 4);
  332. for(var i = 0; i < result.data.list.length; i++) {
  333. var id = result.data.list[i].id;
  334. var title = result.data.list[i].title; //标题
  335. var titleImg = result.data.list[i].titleImg; //图片
  336. if(titleImg == null) {
  337. titleImg = ''
  338. }
  339. var summary = result.data.list[i].summary; //简介
  340. if(summary == null) {
  341. summary = ''
  342. };
  343. var imgUrls = titleImg != '' ? globalConfig.avatarHost + '/upload' + titleImg : globalConfig.avatarHost + '/upload/default/news.jpg';
  344. policy_img +=
  345. "<li value='" + id + "'>" +
  346. "<img src='" + imgUrls + "' alt=''/>" +
  347. "<div class='zizone_text'><h4><a href='#'>" +
  348. title + "</a></h3><p>" +
  349. summary + "</p><a href='#'>MORE+</a>" +
  350. "<input type='hidden' value='" + totle + "'/></div></li>"
  351. }
  352. $('.main_zizone ul').html(policy_img)
  353. }.bind(this)
  354. })
  355. }
  356. mids(1, 1)
  357. //点击时left
  358. var t = 1;
  359. //点击时right
  360. $('.zizone_right').click(function() {
  361. var tot = $('.main_zizone ul').find('input').val()
  362. t++;
  363. if(t > tot) {
  364. t = tot
  365. }
  366. pageNos = t;
  367. mids(1, pageNos);
  368. })
  369. //智者数据交互
  370. if(window.location.search) {
  371. let theUrl = window.location.search
  372. theKeyword = theUrl.substring(1, theUrl.length);
  373. theKeyword = decodeURIComponent(theKeyword);
  374. $('#searchInput').val(theKeyword);
  375. };
  376. loadDate();
  377. var industryListArr = [];
  378. industryListArr.push(['<li value="" class="active">',
  379. '<span>',
  380. '不限',
  381. '</span>',
  382. '</li>',
  383. ].join(''));
  384. industry.map(function(item) {
  385. industryListArr.push(['<li value="' + item.value + '">',
  386. '<span>',
  387. item.key,
  388. '</span>',
  389. '</li>',
  390. ].join(''));
  391. });
  392. if(industryListArr && industryListArr.length) {
  393. $('#industryList').append(industryListArr.join(''));
  394. };
  395. $('#industryList').on('click', 'li', function() {
  396. var theValue = this.value;
  397. $(this).siblings("li").removeClass("active");
  398. $(this).addClass("active");
  399. dataObj.province ='';
  400. dataObj.theKeyword='';
  401. dataObj.theFieldA=theValue;
  402. loadDate();
  403. });
  404. $('.searchs button').click(function(e) {
  405. e.preventDefault();
  406. theKeyword = $('#search_on input').val();
  407. province = $('#selt option:checked').attr('value');
  408. dataObj.theFieldA ='';
  409. dataObj.province = province;
  410. dataObj.theKeyword=theKeyword;
  411. loadDate();
  412. $('#industryList li').removeClass('active');
  413. $('#selectInt li').eq(0).addClass('active');
  414. $('#isInt').prop('checked', false);
  415. $('#noInt').prop('checked', false);
  416. $('#noInt,#isInt').parent().addClass('demand').removeClass('patent');
  417. });
  418. $('.pagination').on('click', 'li', function(e) {
  419. e.preventDefault();
  420. if(this.className === 'pagePre') {
  421. if(thePageNo > 1) {
  422. thePageNo = 1;
  423. loadDate(thePageNo);
  424. }
  425. } else if(this.className === 'pageNext') {
  426. if(thePageNo < thePageLength) {
  427. thePageNo = thePageLength;
  428. loadDate(thePageNo);
  429. }
  430. } else {
  431. var nextPageNo = $(this).children()[0].text;
  432. if(thePageNo != nextPageNo) {
  433. $(this).siblings("li").removeClass("active");
  434. $(this).addClass("active");
  435. thePageNo = nextPageNo;
  436. loadDate(thePageNo);
  437. };
  438. };
  439. });
  440. $('#subscriberList').on('click', 'li', function() {
  441. var theId = $(this).attr('value');
  442. window.open(globalConfig.context + '/portal/subscriberDetail.html?uid=' + theId + '&type=0');
  443. });
  444. //是否国际单选
  445. $('#isInt').prop('checked', false);
  446. $('#selectInt li:first-child').click(function() {
  447. $(this).addClass('active');
  448. $('#isInt').prop('checked', false);
  449. $('#noInt').prop('checked', false);
  450. $('#noInt,#isInt').parent().addClass('demand').removeClass('patent');
  451. dataObj.international = null;
  452. dataObj.province = '';
  453. dataObj.theKeyword='';
  454. loadDate();
  455. })
  456. $('#isInt').click(function() {
  457. $('#selectInt li').eq(0).removeClass('active')
  458. $(this).prop('checked', true);
  459. $(this).parent().addClass('patent').removeClass('demand');
  460. $('#noInt').attr('checked', false);
  461. $('#noInt').parent().addClass('demand').removeClass('patent');
  462. dataObj.international = 1;
  463. dataObj.province = '';
  464. dataObj.theKeyword='';
  465. loadDate();
  466. })
  467. $('#noInt').click(function() {
  468. $('#selectInt li').eq(0).removeClass('active')
  469. $(this).prop('checked', true);
  470. $(this).parent().addClass('patent').removeClass('demand');
  471. $('#isInt').attr('checked', false);
  472. $('#isInt').parent().addClass('demand').removeClass('patent');
  473. dataObj.international = 0;
  474. dataObj.province = '';
  475. dataObj.theKeyword='';
  476. loadDate();
  477. })
  478. //提示框渐隐函数
  479. function msg(txt) {
  480. if($('.smg').hasClass('active')){
  481. return ;
  482. }
  483. $('.smg').addClass('active');
  484. var lit = $('#msg').val(txt);
  485. setTimeout(function () {
  486. $('.smg').removeClass('active');
  487. $('#msg').val('');
  488. }, 2000)
  489. }
  490. })