filesbox/web/dist/design/designstatic/front/js/caseshow.js

2 lines
5.6 KiB
JavaScript
Raw Permalink Normal View History

2024-07-26 06:10:54 +00:00
var wapurl=window.location.origin+"/pages/wap/newslist.html";if(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)&&(window.location.href=wapurl+"?busType=7"),!cdnPath)var cdnPath="";var peIde=getPar("typeId")?getPar("typeId"):"",infoValue=getPar("infoValue")?getPar("infoValue"):"1",infoValuePeIde=getPar("typeId")?getPar("typeId"):"",peId,peId2,peId3,peId4,peId5,item,item2,item3,item4,item5;function resetImgSrc(a){var t=a.replace(/([^.]*).([^.]*)$/g,"$1!medium.$2");return t}function coverError(a){var t=event.target;parseInt(t.dataset.errorcount)==0?(t.setAttribute("data-errorcount",1),t.src=a):parseInt(t.dataset.errorcount)==1&&(t.setAttribute("data-errorcount",2),t.src="/static/common/image/information/defult.jpg")}function list(a,t,r){$.ajax({type:"GET",headers:{token:getCookie("token")},url:"/api/common/getHomepageList?projectid=41",contentType:"application/json",dataType:"json",data:{infoTypeId:a,currentPage:t,pageSize:20,keywords:r,infoType:"7"},async:!0,success:function(e){for(var i=e.data.list,n="",o=0,s=i.length;o<s;o++){var c=i[o].commonHomepageInfoId,u=getTimeZhCN(i[o].gmtModified),p=i[o].computerPicPath,d=i[o].infoType=="1",l=p?JSON.parse(p):[],h=l&&l.length?l[0].sourcePath:"/static/common/image/information/defult.jpg",v=location.port=="81"?"/pages/information.html?aid="+c:"/information/"+c+".shtml",I=i[o].introduce.replace(/<[^>]+>/g,"");n+="<li>",n+=' <a href="'+v+'" target="_blank">',n+=" <img src="+(cdnPath+resetImgSrc(h))+' data-errorcount="0" onerror="coverError(&quot'+cdnPath+h+'&quot)" >',n+=' <div class="detail" >',n+=" <h2>",n+=i[o].title,n+=" </h2>",n+=" <p>",n+=u,n+=" </p>",n+=" </div>",n+=" </a>",n+="</li>"}$("#pagination2").pagination({currentPage:t,totalPage:Math.ceil(e.data.total/20),isShow:!1,count:20,prevPageText:"<",nextPageText:">",callback:function(f){list(a,f)}}),i.length==0?$(".plate-navcm").html("<div class='nodata'></div>"):$(".plate-navcm").html(n)}})}list(peIde,1),function(a,t){var r={init:function(){this.getListHomepageSetting()},getListHomepageSetting:function(){var e=this;a.ajax({type:"GET",url:"/api/common/listHomepageSetting",contentType:"application/json",dataType:"json",data:{busType:"7"},async:!0,success:function(i){window.classifyData=i.data;var n=i.data,o=n;parseInt(infoValue)==0&&(o=e.getParentObj(n,peIde,!0)),e.renderNav(o,peIde),e.filterrigEvent(o)}})},renderNav:function(e,i){for(var n=this,o="",s=e,c=e,u=1,p=n.getParentObj(e,i),d=parseInt(u)==1,l=0,h=p.length;l<h;l++){var v=p[l-1]||0,I=p[l];if(s=c,parseInt(u)==0&&p[l]==infoValuePeIde&&(d=!0),s&&d){I?o+='<div class="plate-nav"> <a class="pid" tabs="'+v+'" href="javascript:void(0);">\u5168\u90E8</a>':o+='<div class="plate-nav"> <a class="pid curs" tabs="0" href="javascript:void(0);">\u5168\u90E8</a>';for(var f=0,m=s.length;f<m;f++){var g=s[f];parseInt(I)==parseInt(g.commonHomepageInfoTypeId)?(c=g.children,o+='<a class="pid curs" tabs="'+g.commonHomepageInfoTypeId+'" href="javascript:void(0);">'+g.typeName+"</a>"):o+='<a class="pid" tabs="'+g.commonHomepageInfoTypeId+'" href="javascript:void(0);">'+g.typeName+"</a>"}o+="</div>"}else if(s)for(var f=0,m=s.length;f<m;f++){var g=s[f];parseInt(I)==parseInt(g.commonHomepageInfoTypeId)&&(c=g.children)}}a(".filterrig .plate-nav").html(o)},getParentObj:function(e,i,n){var o="",s=e;function c(u,p,d){for(var l=0,h=u.length;l<h;l++){var v=u[l];if(parseInt(v.commonHomepageInfoTypeId)==parseInt(p))s=u,o=d+v.commonHomepageInfoTypeId+",";else if(v.children){var I=d+v.commonHomepageInfoTypeId+",";c(v.children,p,I)}}}return c(e,i,[]),n?s:o.split(",")},filterrigEvent:function(e){var i=this;a(".searchtxt").on("keypress",function(n){n.keyCode==13&&(t.keyWord=a(this).val(),list(t.peIde,1,t.keyWord))}),a(".filterrig").on("click","a",function(){var n=a(this);if(n.hasClass("searchbtn"))t.keyWord=a(".searchtxt").val(),list(t.peIde,1,t.keyWord);else{var o=n.attr("tabs");t.peIde=o,i.peId=o,i.renderNav(e,o),list(t.peIde)}})}};r.init()}(jQuery,window),Date.prototype.format=function(a){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s