import '../css/bootstrap.less'; import 'bootstrap/dist/js/bootstrap.js'; import '../css/public.css'; import '../css/main_banner.css'; import './public.js'; import './main_banner.js'; import '../css/thinkTank.css'; import { provinceList } from './NewDicProvinceList'; import { techFieldList, getTechField } from './DicTechFieldList'; $(function(){ //智库、智者切换 $('.zizone .col-md-6').click(function(){ $(this).addClass('actives').siblings().removeClass('actives') }) $('.zone_left').click(function(){ $('.wiseman_list').hide(); $('.tab_zizone').show(); $('.searchs').hide() }) $('.zone_right').click(function(){ $('.wiseman_list').show(); $('.tab_zizone').hide(); $('.searchs').show() }) //地方政策城市切换 //初始北京第一页新闻 $('.place_city ul li').eq(0).addClass('thon').siblings().removeClass('thon'); var thePageNos= 1; var pageNos = 1; var thePageLengths=1; var pageSizes = 4; var provinces=1; function datt(provinces,pageNos){ $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/portal/news/list", data: { provinceId:provinces || 1, hot: 1, pageNo:pageNos || 1, type:5, pageSize:pageSizes }, success: function (result) { var totlepage=Math.ceil(result.data.totalCount/4); var policy_li =''; for(var i=0;i" +"

" +day+"

" +title+"

"+summary +"

MORE+" +"
" } if(result.data.list.length===0){ $('.policy ol').hide(); $('.policy ul').html('
') ; }else{ $('.policy ol').show() ; $('.policy ul').html(policy_li) } }.bind(this) }) } datt(1,1); //点击省份时刷新页面新闻 $('.place_city ul li').click(function(){ $(this).addClass('thon').siblings().removeClass('thon') $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of'); $('.more_city .inp').removeClass('thon'); $('.more_city .inp').text('更多省份 +') //新闻刷新 var t_val=$(this).prop('value'); provinces=t_val; datt(provinces,1); }); //智政新闻小点切换宽度设置及点击刷新 var cirle = $('.policy ol li').length; var ind_circle=0; $('.policy ol li').click(function(){ $(this).addClass('active_of').siblings().removeClass('active_of'); var place_on = $('.place_city ul li.thon').prop('value') var h_ind=$(this).index()+1; if(place_on==undefined){ place_on=$('.inp').attr('value'); } provinces=place_on; pageNos=h_ind; $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/portal/news/list", data: { provinceId:provinces || 1, hot: 1, pageNo:pageNos || 1, type:5, pageSize:pageSizes }, success: function (result) { var totlepage=Math.ceil(result.data.totalCount/4); var policy_li =''; for(var i=0;i" +"

" +day+"

" +title+"

"+summary +"

MORE+" +"
" } $('.policy ol').show(); $('.policy ul').html(policy_li); }.bind(this) }) }) //中央政策跳转 $('.main_zizone ul').on('click', 'li', function () { var theId = $(this).attr('value'); window.open(globalConfig.context + '/portal/news/newsDetail.html?id=' + theId ); }) //地方政策跳转 //搜索城市下拉 var addlength=provinceList.length; var soption=''; var sol=''; for(var i=5;i"+provinceList[i].name+"

"; }; for(var i=0;i"+provinceList[i].name+""; }; $('.list_city').html(sol); $('#selt').html(soption); //智政城市下拉切换 $('.list_city').hide(); $('.more_city .inp').click(function(){ $('.list_city').slideToggle(500) }) $('.more_city').mouseleave(function(){ $('.list_city').hide(); }) //选择城市及新闻页面刷新 $('.list_city p').click(function(){ var ptxt=$(this).text(); var pval=$(this).attr('value'); $('.more_city .inp').text(ptxt); $('.more_city .inp').attr('value',pval); $('.list_city').hide(); $('.more_city .inp').addClass('thon'); $('.place_city ul li').removeClass('thon'); $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of'); var p_val=$(this).attr('value'); provinces=p_val ; datt(provinces,1); }); //中央政策点击刷新 //初始化内容 function mids(provinces,pageNos){ $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/portal/news/list", data: { provinceId:null, hot: 1, pageNo:pageNos||1, type:4, pageSize:pageSizes }, success: function (result) { thePageLengths = result.data.totalCount ? Math.ceil(result.data.totalCount / pageSizes) : 1; var policy_img =''; var totle=Math.ceil(result.data.totalCount/4); for(var i=0;i" +"" +"

" +title+"

" +summary+"

MORE+" +"
" } $('.main_zizone ul').html(policy_img) }.bind(this) }) } mids(1,1) //点击时left var t=1; $('.zizone_left').click(function(){ t--; if(t<=1){ t=1 } pageNos=t; mids(1,pageNos); }) //点击时right $('.zizone_right').click(function(){ var tot=$('.main_zizone ul').find('input').val() t++; if(t>tot){ t=tot } pageNos=t; mids(1,pageNos); }) //智者数据交互 var theKeyword, theFieldA, theFieldB, theFieldC; var thePageNo = 1, thePageLength = 1, pageSize = 12, theType = 0; function loadDate(pageNo) { theFieldA = theFieldA != 999 ? theFieldA : undefined; theFieldB = theFieldB != 999 ? theFieldB : undefined; theFieldC = theFieldC != 999 ? theFieldC : undefined; $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/portal/search/subscriberList", data: { pageNo: pageNo || 1, pageSize: pageSize, type: theType, name: theKeyword, field: theFieldA ? ((theFieldA || '') + (theFieldB ? (',' + theFieldB) : '') + (theFieldC ? (',' + theFieldC) : '')) : undefined }, success: function (data) { var theArr = []; if (data.data && data.data.list) { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; let engagedField = thisdata.engagedField ? thisdata.engagedField.split(',') : []; if(thisdata.username==null||thisdata.username==''){ thisdata.username='佚名' } var imgUrl=thisdata.personPortraitUrl!=null?globalConfig.avatarHost + '/upload' +thisdata.personPortraitUrl:globalConfig.avatarHost+ '/upload/default/person.jpg'; theArr.push([ '
  • ', '', '
    ', '

    '+ thisdata.username + '

    ', '

    ' + (thisdata.position || '未知职位') + '

    ', '

    ' + getTechField(engagedField[0], engagedField[1], engagedField[2]) + '

    ', '
    ', '
    ', '

    '+ thisdata.username + '

    ', '

    ' + (thisdata.position || '未知职位') + '

    ', '

    ' + getTechField(engagedField[0], engagedField[1], engagedField[2]) + '

    ', '', '
    ', '
  • ' , ].join('')); }; } else { return; }; $('#subscriberList').empty(); $('#subscriberList').append(theArr.join('')); if(data.data.list.length===0){ $('#subscriberList').html('
    ') ; } $('.totalCount').html("共" + data.data.totalCount + "条数据"); thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1; var pageArr = [], firstNo = 1, endNo = 5; if (thePageNo > 3) { firstNo = thePageNo - 2; endNo = Math.min((Number(thePageNo) + 2), thePageLength); } else { endNo = Math.min(thePageLength, 5); }; for (let i = firstNo; i <= endNo; i++) { if (i == thePageNo) { pageArr.push( '
  • ' + i + '
  • ' ); } else { pageArr.push( '
  • ' + i + '
  • ' ); } }; $('.pageNumber').remove(); $('.pagePre').after(pageArr.join('')); } }); } if (window.location.search) { let theUrl = window.location.search theKeyword = theUrl.substring(1, theUrl.length); theKeyword = decodeURIComponent(theKeyword); $('#searchInput').val(theKeyword); }; loadDate(); var industryListArr = [], industrySecondList = [], industryThirdList = []; industryListArr.push(['
  • ', '', '不限', '', '
  • ', ].join('')); techFieldList.map(function (item) { industryListArr.push(['
  • ', '', item.label, '', '
  • ', ].join('')); }); if (industryListArr && industryListArr.length) { $('#industryList').append(industryListArr.join('')); }; $('#industryList').on('click', 'li', function () { var theValue = this.value; $(this).siblings("li").removeClass("active"); $(this).addClass("active"); industrySecondList = []; industrySecondList.push(['
  • ', '', '不限', '', '
  • ', ].join('')); if (theValue !== 999) { $('#industrySecondBox').css("display", "block"); techFieldList.map(function (item) { if (item.value == theValue) { item.children.map(function (child) { industrySecondList.push(['
  • ', '', child.label, '', '
  • ', ].join('')); }); }; }); } else { $('#industrySecondBox').css("display", "none"); }; if (industrySecondList && industrySecondList.length) { $('#industrySecondList').empty(); $('#industrySecondList').append(industrySecondList.join('')); }; $('#industryThirdBox').css("display", "none"); theFieldA = this.value; theFieldB = 999; theFieldC = 999; loadDate(); }); $('#industrySecondList').on('click', 'li', function () { var theValue = this.value; $(this).siblings("li").removeClass("active"); $(this).addClass("active"); industryThirdList = []; industryThirdList.push(['
  • ', '', '不限', '', '
  • ', ].join('')); if (theValue !== 999) { $('#industryThirdBox').css("display", "block"); techFieldList.map(function (itemA) { if (itemA.value == theFieldA) { itemA.children.map(function (itemB) { if (itemB.value == theValue) { itemB.children.map(function (itemC) { industryThirdList.push(['
  • ', '', itemC.label, '', '
  • ', ].join('')); }) } }); }; }); } else { $('#industryThirdBox').css("display", "none"); }; if (industryThirdList && industryThirdList.length) { $('#industryThirdList').empty(); $('#industryThirdList').append(industryThirdList.join('')); }; theFieldB = this.value; theFieldC = 999; loadDate(); }); $('#industryThirdList').on('click', 'li', function () { $(this).siblings("li").removeClass("active"); $(this).addClass("active"); theFieldC = this.value; loadDate(); }); $('.searchs button').click(function (e) { e.preventDefault(); theKeyword = $('#search_on input').val(); loadDate(); }); $('.pagination').on('click', 'li', function (e) { e.preventDefault(); if (this.className === 'pagePre') { if (thePageNo > 1) { thePageNo = 1; loadDate(thePageNo); } } else if (this.className === 'pageNext') { if (thePageNo < thePageLength) { thePageNo = thePageLength; loadDate(thePageNo); } } else { var nextPageNo = $(this).children()[0].text; if (thePageNo != nextPageNo) { $(this).siblings("li").removeClass("active"); $(this).addClass("active"); thePageNo = nextPageNo; loadDate(thePageNo); }; }; }); $('#subscriberList').on('click', 'li', function () { var theId = $(this).attr('value'); window.open(globalConfig.context + '/user/subscriberDetail.html?uid=' + theId + '&type=0'); }) })