/** * Created by Tong on 2018/8/7. */ var myDate = new Date(); //获取当前年 var year_number=myDate.getFullYear(); for (var j=0,n=year_number-2004;j div.dropdown .dropdown-menu.year_menu').append('
  • '+(year_number-j)+'
  • '); } $('#dropdownMenu_year .year').text('Year'); var page=1,timeSlot=1; var begin,end,beginTime,endTime,max_page,bool=true,time_year,time_month; time_year='Year'; time_month='all'; // begin= new Date(myDate.getFullYear(), myDate.getMonth() - 9*page, myDate.getDate()+1); // beginTime=timeFormat(begin,0); // end= new Date(myDate.getFullYear(), myDate.getMonth() - 9*(page-1), myDate.getDate()+1); // endTime=timeFormat(end,1); var loadImg=false; var pageUrl=window.location.href; var path; if(pageUrl.indexOf('59.36.166.192')>0){ path='/gzligen'+pageUrl.split('gzlig')[1]; }else if(pageUrl.indexOf('com/gzligen/')>0){ path=pageUrl.split('.com')[1]; }else{ path='/gzligen'+pageUrl.split('.com')[1]; } if (path.indexOf('index.html')>-1){ path=path.replace('index.html','') } function getData(param) { var start=(page-1)*10; // if (timeSlot>1) { // end= new Date(begin.getFullYear(), begin.getMonth() -1, begin.getDate()+1); // begin= new Date(end.getFullYear(), end.getMonth() - 9, end.getDate()+1); // beginTime=timeFormat(begin,0); // // endTime=timeFormat(end,0); // } $.ajax({ url:'/-manager-/search?beginDate='+beginTime+'&endDate='+endTime+'&start='+start+'&path='+path, dataType: "json", success:function(data){ console.log('data0',data); var dataList=data.data; $('.innerMain .newsList ul').html(' '); for (var j=0,k=dataList.length;j'+ ' '+ '
    '; if(dataList[j].img=='' || dataList[j].img=='undefined' || !dataList[j].hasOwnProperty('img')){ newsHtml=newsHtml+'
    '; }else { newsHtml=newsHtml+'' } newsHtml=newsHtml+'
    '+ '
    '+ '
    '+dataList[j].title+'
    '+ '
    '+dataList[j].abstract+'
    '+ '
    '+(dataList[j].pubDate).substring(0,10)+'
    '+ '
    '+ '
    '+ '
    '+ ''; $('.innerMain .newsList ul').append(newsHtml); } loadImg=false; // setTimeout('useImgJs()',500); useImgJs(); if(param==1){ setTimeout('goTop()',500); } max_page=Math.ceil(data.numFound/10); var pageHtml=' '+data.numFound+' itemsPrevious'; for (var i=0;i'+(i+1)+''; } pageHtml=pageHtml+'Next'; $('.page #info').html(pageHtml); if(bool){ bool=false; Common.innerS(); } $('#info a').removeClass('currentlinkspan'); $('#info').children('a').eq(page).addClass('currentlinkspan'); pageHandle(); isCanClick(); }, error: function(){ console.log('fail'); } }); } // getData(); var clickObj=$('body'); clickObj.on('click','.pageNumber',function () { page=parseInt($(this).text()); getData(1); }); clickObj.on('click','.prevPage',function () { if (page>1){ page=page-1; getData(1); } }); clickObj.on('click','.nextPage',function () { if (page9?month:'0'+month)+'-'+(date>9?date:'0'+date); } function pageHandle() { var index=parseInt($('.currentlinkspan').text()); var length= $('#info').children('.pageNumber').length; if (length>5){ if(index>3){ $('.pageNumber').hide(); $('.currentlinkspan').show(); $('#info').children('.pageNumber').eq(index-2).show(); $('#info').children('.pageNumber').eq(index-3).show(); if (max_page-index>2){ $('#info').children('.pageNumber').eq(index+1).show(); $('#info').children('.pageNumber').eq(index).show(); }else if (max_page-index==2){ $('#info').children('.pageNumber').eq(index-1).show(); $('#info').children('.pageNumber').eq(index+1).show(); $('#info').children('.pageNumber').eq(index).show(); } else if (max_page-index==1){ $('#info').children('.pageNumber').eq(index-1).show(); $('#info').children('.pageNumber').eq(index-4).show(); $('#info').children('.pageNumber').eq(index).show(); }else { $('#info').children('.pageNumber').eq(index-5).show(); $('#info').children('.pageNumber').eq(index-4).show(); } }else { $('.pageNumber').hide(); for (var g=0;g<5;g++){ $('#info').children('.pageNumber').eq(g).show(); } } } } function useImgJs() { loadImg=true; $('.newsList .newsImg img').each(function () { var w=$(this).width(); if (w<1){ loadImg=false; setTimeout('useImgJs()',500); return false; } }); if (loadImg){ PictureProcessing.cutting('.innerMain .newsList ul li .newsImg img','.innerMain .newsList ul li .newsImg',280,160); } } function isCanClick(){ var activeIndex=$(' #info .currentlinkspan').text(); var nextLable=$(' #info .currentlinkspan').next('a').text(); console.log('currentlinkspan',activeIndex); if(activeIndex=='1'){ $('.prevPage').addClass('cannotClick'); }else{ $('.prevPage').removeClass('cannotClick'); } // console.log('nextLable',nextLable); if(nextLable=='Next'){ $('.nextPage').addClass('cannotClick'); }else{ $('.nextPage').removeClass('cannotClick'); } } //回到底部 function goTop(){ //setInterval('cut_img()',1000); var speed=200; $('body,html').animate({ scrollTop: 0 }, speed,function(){ }); }