thinktank.js 19 KB

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