2 lines
6.0 KiB
JavaScript
2 lines
6.0 KiB
JavaScript
|
if(!cdnPath)var cdnPath="";var peIde=getPar("typeId")?getPar("typeId"):"",infoValue=getPar("infoValue")?getPar("infoValue"):"1",infoValuePeIde=getPar("typeId")?getPar("typeId"):"",issendhou=!1,isGoOut=!1,peId,peId2,peId3,peId4,peId5,item,item2,item3,item4,item5,currentPage=1,total=0,$grid=$("#plate-navcm").masonry({itemSelector:".box",gutter:20,isAnimated:!0,isResizeBound:!0});function resetImgSrc(r){var t=r.replace(/([^.]*).([^.]*)$/g,"$1!medium.$2");return t}function coverError(r){var t=event.target;parseInt(t.dataset.errorcount)==0?(t.setAttribute("data-errorcount",1),t.src=r):parseInt(t.dataset.errorcount)==1&&(t.setAttribute("data-errorcount",2),t.src="/static/common/image/information/defult.jpg")}function list(r,t,n,e){$.ajax({type:"GET",headers:{token:getCookie("token")},url:"/api/common/getHomepageList?projectid=41",contentType:"application/json",dataType:"json",data:{infoTypeId:r,currentPage:t,pageSize:10,keywords:n,infoType:"9"},async:!0,success:function(s){var o=s.data.list;total=s.data.total||0;for(var a="",i=0,d=o.length;i<d;i++){var c=o[i].commonHomepageInfoId,g=getTimeZhCN(o[i].gmtModified),m=o[i].computerPicPath,v=o[i].infoType=="1",p=m?JSON.parse(m):[],f=p&&p.length?p[0].sourcePath:"/static/common/image/information/defult.jpg",h=p&&p.length?p[0].title:"",u=location.port=="81"?"/pages/information.html?aid="+c:"/information/"+c+".shtml",I=o[i].introduce.replace(/<[^>]+>/g,"");a+=' <a class="box" href="'+u+'" target="_blank">',a+=" <img src="+(cdnPath+resetImgSrc(f))+' data-errorcount="0" onerror="coverError("'+cdnPath+f+'")" >',a+=' <div class="detail" >',a+=" <h2>",a+=h,a+=" </h2>",a+=" </div>",a+=" </a>"}if($(".plate-navcm .nodata").remove(),o.length==0){if($grid){var l=$(".plate-navcm .box");$grid.masonry("remove",l).masonry("layout")}$(".plate-navcm").html("<div class='nodata'></div>")}else{if(e){var l=$(".plate-navcm .box");$grid.masonry("remove",l).masonry("layout")}var y=$(a);$grid.append(y).masonry("appended",y),$grid.imagesLoaded().progress(function(){$grid.masonry("layout"),issendhou=!1})}}})}list(peIde,1),$(document).on("scroll",function(){var r=$(".foot").height()||0;if($(window).scrollTop()+$(window).height()>$(document).height()-100-r){if(isGoOut||issendhou)return!1;if(issendhou=!0,currentPage*10>=total)return currentPage<2,void 0;currentPage=currentPage+1,list(window.peIde,currentPage,window.keyWord)}}),function(r,t){var n={init:function(){this.getListHomepageSetting()},getListHomepageSetting:function(){var e=this;r.ajax({type:"GET",url:"/api/common/listHomepageSetting",contentType:"application/json",dataType:"json",data:{busType:"9"},async:!0,success:function(s){window.classifyData=s.data;var o=s.data,a=o;parseInt(infoValue)==0&&(a=e.getParentObj(o,peIde,!0)),e.renderNav(a,peIde),e.filterrigEvent(a)}})},renderNav:function(e,s){for(var o=this,a="",i=e,d=e,c=1,g=o.getParentObj(e,s),m=parseInt(c)==1,v=0,p=g.length;v<p;v++){var f=g[v-1]||0,h=g[v];if(i=d,parseInt(c)==0&&g[v]==infoValuePeIde&&(m=!0),i&&m){h?a+='<div class="plate-nav"> <a class="pid" tabs="'+f+'" href="javascript:void(0);">\u5168\u90E8</a>':a+='<div class="plate-nav"> <a class="pid curs" tabs="0" href="javascript:void(0);">\u5168\u90E8</a>';for(var u=0,I=i.length;u<I;u++){var l=i[u];parseInt(h)==parseInt(l.commonHomepageInfoTypeId)?(d=l.children,a+='<a class="pid curs" tabs="'+l.commonHomepageInfoTypeId+'" href="javascript:void(0);">'+l.typeName+"</a>"):a+='<a class="pid" tabs="'+l.commonHomepageInfoTypeId+'" href="javascript:void(0);">'+l.typeName+"</a>"}a+="</div>"}else if(i)for(var u=0,I=i.length;u<I;u++){var l=i[u];parseInt(h)==parseInt(l.commonHomepageInfoTypeId)&&(d=l.children)}}r(".filterrig .plate-nav").html(a)},getParentObj:function(e,s,o){var a="",i=e;function d(c,g,m){for(var v=0,p=c.length;v<p;v++){var f=c[v];if(parseInt(f.commonHomepageInfoTypeId)==parseInt(g))i=c,a=m+f.commonHomepageInfoTypeId+",";else if(f.children){var h=m+f.commonHomepageInfoTypeId+",";d(f.children,g,h)}}}return d(e,s,[]),o?i:a.split(",")},filterrigEvent:function(e){var s=this;r(".searchtxt").on("keypress",function(o){o.keyCode==13&&(t.
|