thinkTank.js 15 KB

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