thinktank.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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;
  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. pageNo: pageNo || 1,
  264. pageSize: pageSize,
  265. type: theType,
  266. name: theKeyword,
  267. field: theFieldA ? ((theFieldA || '') + (theFieldB ? (',' + theFieldB) : '') + (theFieldC ? (',' + theFieldC) : '')) : undefined
  268. },
  269. success: function (data) {
  270. var theArr = [];
  271. if (data.data && data.data.list) {
  272. for (let i = 0; i < data.data.list.length; i++) {
  273. let thisdata = data.data.list[i];
  274. let engagedField = thisdata.engagedField ? thisdata.engagedField.split(',') : [];
  275. if(thisdata.username==null||thisdata.username==''){
  276. thisdata.username='佚名'
  277. }
  278. var imgUrl=thisdata.personPortraitUrl!=null?globalConfig.avatarHost + '/upload' +thisdata.personPortraitUrl:globalConfig.avatarHost+ '/upload/default/person.jpg';
  279. theArr.push([
  280. '<li value="'+thisdata.uid+'">',
  281. '<img src="'+ imgUrl+'" />',
  282. '<div class="list_text">',
  283. '<p class="bulr">'+ thisdata.username + '</p>',
  284. '<p class="orange">' + (thisdata.position || '未知职位') + '</p>',
  285. '<p class="text_on">' + getTechField(engagedField[0], engagedField[1], engagedField[2]) + '</p>',
  286. '</div>',
  287. '<div class="shadow_text">',
  288. '<p class="bulr">'+ thisdata.username + '</p>',
  289. '<p class="orange">' + (thisdata.position || '未知职位') + '</p>',
  290. '<p class="text_on">' + getTechField(engagedField[0], engagedField[1], engagedField[2]) + '</p>',
  291. '<img src="' + globalConfig.portalHost + '/img/search_txt.png "/>',
  292. '</div>',
  293. '</li>' ,
  294. ].join(''));
  295. };
  296. } else {
  297. return;
  298. };
  299. $('#subscriberList').empty();
  300. $('#subscriberList').append(theArr.join(''));
  301. if(data.data.list.length===0){
  302. $('#subscriberList').html('<div class="imgbg"></div>') ;
  303. }
  304. $('.totalCount').html("共" + data.data.totalCount + "条数据");
  305. thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
  306. var pageArr = [],
  307. firstNo = 1,
  308. endNo = 5;
  309. if (thePageNo > 3) {
  310. firstNo = thePageNo - 2;
  311. endNo = Math.min((Number(thePageNo) + 2), thePageLength);
  312. } else {
  313. endNo = Math.min(thePageLength, 5);
  314. };
  315. for (let i = firstNo; i <= endNo; i++) {
  316. if (i == thePageNo) {
  317. pageArr.push(
  318. '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
  319. );
  320. } else {
  321. pageArr.push(
  322. '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
  323. );
  324. }
  325. };
  326. $('.pageNumber').remove();
  327. $('.pagePre').after(pageArr.join(''));
  328. }
  329. });
  330. }
  331. if (window.location.search) {
  332. let theUrl = window.location.search
  333. theKeyword = theUrl.substring(1, theUrl.length);
  334. theKeyword = decodeURIComponent(theKeyword);
  335. $('#searchInput').val(theKeyword);
  336. };
  337. loadDate();
  338. var industryListArr = [],
  339. industrySecondList = [],
  340. industryThirdList = [];
  341. industryListArr.push(['<li value="999" class="active">',
  342. '<span>',
  343. '不限',
  344. '</span>',
  345. '</li>',
  346. ].join(''));
  347. techFieldList.map(function (item) {
  348. industryListArr.push(['<li value="' + item.value + '">',
  349. '<span>',
  350. item.label,
  351. '</span>',
  352. '</li>',
  353. ].join(''));
  354. });
  355. if (industryListArr && industryListArr.length) {
  356. $('#industryList').append(industryListArr.join(''));
  357. };
  358. $('#industryList').on('click', 'li', function () {
  359. var theValue = this.value;
  360. $(this).siblings("li").removeClass("active");
  361. $(this).addClass("active");
  362. industrySecondList = [];
  363. industrySecondList.push(['<li value="999" class="active">',
  364. '<span>',
  365. '不限',
  366. '</span>',
  367. '</li>',
  368. ].join(''));
  369. if (theValue !== 999) {
  370. $('#industrySecondBox').css("display", "block");
  371. techFieldList.map(function (item) {
  372. if (item.value == theValue) {
  373. item.children.map(function (child) {
  374. industrySecondList.push(['<li value="' + child.value + '">',
  375. '<span>',
  376. child.label,
  377. '</span>',
  378. '</li>',
  379. ].join(''));
  380. });
  381. };
  382. });
  383. } else {
  384. $('#industrySecondBox').css("display", "none");
  385. };
  386. if (industrySecondList && industrySecondList.length) {
  387. $('#industrySecondList').empty();
  388. $('#industrySecondList').append(industrySecondList.join(''));
  389. };
  390. $('#industryThirdBox').css("display", "none");
  391. theFieldA = this.value;
  392. theFieldB = 999;
  393. theFieldC = 999;
  394. loadDate();
  395. });
  396. $('#industrySecondList').on('click', 'li', function () {
  397. var theValue = this.value;
  398. $(this).siblings("li").removeClass("active");
  399. $(this).addClass("active");
  400. industryThirdList = [];
  401. industryThirdList.push(['<li value="999" class="active">',
  402. '<span>',
  403. '不限',
  404. '</span>',
  405. '</li>',
  406. ].join(''));
  407. if (theValue !== 999) {
  408. $('#industryThirdBox').css("display", "block");
  409. techFieldList.map(function (itemA) {
  410. if (itemA.value == theFieldA) {
  411. itemA.children.map(function (itemB) {
  412. if (itemB.value == theValue) {
  413. itemB.children.map(function (itemC) {
  414. industryThirdList.push(['<li value="' + itemC.value + '">',
  415. '<span>',
  416. itemC.label,
  417. '</span>',
  418. '</li>',
  419. ].join(''));
  420. })
  421. }
  422. });
  423. };
  424. });
  425. } else {
  426. $('#industryThirdBox').css("display", "none");
  427. };
  428. if (industryThirdList && industryThirdList.length) {
  429. $('#industryThirdList').empty();
  430. $('#industryThirdList').append(industryThirdList.join(''));
  431. };
  432. theFieldB = this.value;
  433. theFieldC = 999;
  434. loadDate();
  435. });
  436. $('#industryThirdList').on('click', 'li', function () {
  437. $(this).siblings("li").removeClass("active");
  438. $(this).addClass("active");
  439. theFieldC = this.value;
  440. loadDate();
  441. });
  442. $('.searchs button').click(function (e) {
  443. e.preventDefault();
  444. theKeyword = $('#search_on input').val();
  445. loadDate();
  446. });
  447. $('.pagination').on('click', 'li', function (e) {
  448. e.preventDefault();
  449. if (this.className === 'pagePre') {
  450. if (thePageNo > 1) {
  451. thePageNo = 1;
  452. loadDate(thePageNo);
  453. }
  454. } else if (this.className === 'pageNext') {
  455. if (thePageNo < thePageLength) {
  456. thePageNo = thePageLength;
  457. loadDate(thePageNo);
  458. }
  459. } else {
  460. var nextPageNo = $(this).children()[0].text;
  461. if (thePageNo != nextPageNo) {
  462. $(this).siblings("li").removeClass("active");
  463. $(this).addClass("active");
  464. thePageNo = nextPageNo;
  465. loadDate(thePageNo);
  466. };
  467. };
  468. });
  469. $('#subscriberList').on('click', 'li', function () {
  470. var theId = $(this).attr('value');
  471. window.open(globalConfig.context + '/user/subscriberDetail.html?uid=' + theId + '&type=0');
  472. })
  473. })