2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
var busType=getPar("busType")?decodeURIComponent(getPar("busType")):"";if(!cdnPath)var cdnPath="";var peIde=getPar("typeId")?getPar("typeId"):"",infoValue=getPar("infoValue")?getPar("infoValue"):"1",infoValuePeIde=getPar("typeId")?getPar("typeId"):"",rightFlag=getPar("rightFlag")?getPar("rightFlag"):"",peId,peId2,peId3,peId4,peId5,item,item2,item3,item4,item5;function resetImgSrc(t){var e=t.indexOf("appstatic")>-1?t:t.replace(/([^.]*).([^.]*)$/g,"$1!medium.$2");return e}function coverError(t){var e=event.target;parseInt(e.dataset.errorcount)==0?(e.setAttribute("data-errorcount",1),e.src=t):parseInt(e.dataset.errorcount)==1&&(e.setAttribute("data-errorcount",2),e.src="/static/common/image/information/defult.jpg")}function list(t,e,n){$.ajax({type:"GET",headers:{token:getCookie("token")},url:"/api/disk/getInfoList?projectid=41",contentType:"application/json",dataType:"json",data:{infoTypeID:t||void 0,parentLevel:window.parentLevel||void 0,currentPage:e,pageSize:30,keyword:n},async:!0,success:function(i){for(var s=i.data.list,a="",l=0,o=s.length;l<o;l++){var r=s[l]||{},d=r.infoID,g=r.showTime?getTimeZhCN(r.gmtModified):"",c=r.computerPicPath,I=r.infoType=="1",f=c?JSON.parse(c):[],T=r.fileId,h=r.fileInfo||{},u=r.thumb||"",v=u?[u]:[],y=u,p=r.domain?"//"+r.domain:"",x=r.isUrlInfo?(r.infoUrl||"").indexOf("http")<0?"//"+r.infoUrl:r.infoUrl||"":"",M=x||"/pubinfo/"+d+".shtml",E=s[l].introduce.replace(/<[^>]+>/g,"");if(f.length>1?a+="<li style='height:165px;'>":a+="<li>",a+=' <a href="'+(x?"":p)+M+'" target="_blank">',v.length==1?(a+=" <img src="+(cdnPath+resetImgSrc(y))+' data-errorcount="0" onerror="coverError("'+cdnPath+y+'")" width="156" height="102">',I&&(a+=' <div class="play"></div>'),a+=' <div class="detail" style="left:190px;">'):a+=' <div class="detail" style="left:20px;">',a+=" <h2>",a+=s[l].title.replace(/<script>/gi,stringEncode("<script>")),a+=" </h2>",a+=" <p>"+E+"</p>",v.length>1)for(var D=0,b=v.length;D<b;D++){D==0&&(a+="<div class='moreimgbox'>");var k=r.infoType=="19"||r.infoType=="20"?v[D]:v[D].sourcePath;a+=" <img src="+(cdnPath+resetImgSrc(k))+' data-errorcount="0" onerror="coverError("'+cdnPath+k+'")" width="156" height="102">',D==b-1&&(a+="</div>")}a+=' <div class="viewinfo">',a+=" "+g+"<span></span>",a+=" </div>",a+=" </div>",a+=" </a>",a+="</li>"}$("#pagination2").pagination({currentPage:e,totalPage:Math.ceil(i.data.total/30),isShow:!1,count:30,prevPageText:"<",nextPageText:">",callback:function(L){list(t,L)}}),s.length==0?$(".plate-navcm").html("<div class='nodata'></div>"):$(".plate-navcm").html(a)}})}(function(t,e){var n={init:function(){this.getListHomepageSetting()},getListHomepageSetting:function(){var s=this;t.ajax({type:"GET",url:"/api/disk/getInfoTypeList",contentType:"application/json",dataType:"json",data:{showCount:1},async:!0,success:function(a){window.classifyData=a.data;var l=a.data||[],o=l;parseInt(infoValue)==0&&(o=s.getParentObj(l,peIde,!0)),s.renderNav(o,peIde),s.filterrigEvent(o)}})},renderNav:function(s,a){for(var l=this,o="",r=s,d=s,g=1,c=l.getParentObj(s,a),I=parseInt(g)==1,f=0,T=c.length;f<T;f++){var h=c[f-1]||0,u=c[f];if(r=d,parseInt(g)==0&&c[f]==infoValuePeIde&&(I=!0),r&&I){u?o+='<div class="plate-nav"> <a class="pid" tabs="'+h+'" 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 v=0,y=r.length;v<y;v++){var p=r[v];parseInt(u)==parseInt(p.infoTypeID)?(d=p.children,o+='<a class="pid curs" tabs="'+p.infoTypeID+'" parentLevel="'+p.parentLevel+'" href="javascript:void(0);">'+p.typeName+"</a>"):o+='<a class="pid" tabs="'+p.infoTypeID+'" parentLevel="'+p.parentLevel+'" href="javascript:void(0);">'+p.typeName+"</a>"}o+="</div>"}else if(r)for(var v=0,y=r.length;v<y;v++){var p=r[v];parseInt(u)==parseInt(p.infoTypeID)&&(d=p.children)}}t(".filterrig .plate-nav").html(o)},getParentObj:function(s,a,l){var o="",r=s;function d(g,c,I){for(var f=0,T=g.length;f<T;f++){var h=g[f];if(parseInt(h.infoTypeID)==parseInt(c))r=g,o=I+h.infoTypeID+",";else if(h.children){var u=I+h.infoTypeID+",";d(h.children,c,u)}}}return d(s,a,[]),l?r:o.split(",")},filterrigEvent:function(s){var a=this;t(".searchtxt").on("keypress",function(l){l.keyCode==13&&(e.keyWord=t(this).val(),list(e.peIde,1,e.keyWord))}),t(".filterrig").on("click","a",function(){var l=t(this);if(l.hasClass("searchbtn"))e.keyWord=t(".searchtxt").val(),list(e.peIde,1,e.keyWord);else{var o=l.attr("tabs"),r=l.attr("parentLevel")||void 0;e.peIde=o,window.parentLevel=r,a.peId=o,a.renderNav(s,o),list(e.peIde,1)}})}},i=0;setTimeout(function(){list(peIde,1),n.init()},300)})(jQuery,window),Date.prototype.format=function(t){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length==1?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t};function getTimeZhCN(t,e){if(new Date(parseInt(t))=="Invalid Date"&&new Date(parseInt(t)*1e3)=="Invalid Date")return"--";new Date(parseInt(e))=="Invalid Date"&&new Date(parseInt(e)*1e3)=="Invalid Date"&&(e=Date.parse(new Date));var n=e-t;if(n<0)return"\u521A\u521A";if(n<6e4)return parseInt(n/1e3,10)+"\u79D2\u524D";if(n<3600*1e3)return parseInt(n/1e3/60,10)+"\u5206\u949F\u524D";if(n<24*3600*1e3)return parseInt(n/1e3/3600,10)+"\u5C0F\u65F6\u524D";if(n<7*24*3600*1e3)return parseInt(n/1e3/3600/24,10)+"\u5929\u524D";if(n<30*24*3600*1e3)return parseInt(n/1e3/3600/24/7,10)+"\u5468\u524D";if(n<365*24*3600*1e3)return parseInt(n/1e3/3600/24/30,10)+"\u4E2A\u6708\u524D";var i=new Date(parseInt(t)),s=parseInt(i.getMonth()+1)<10?"0"+(i.getMonth()+1):i.getMonth()+1,a=parseInt(i.getDate())<10?"0"+i.getDate():i.getDate(),l=parseInt(i.getHours())<10?"0"+i.getHours():i.getHours(),o=parseInt(i.getMinutes())<10?"0"+i.getMinutes():i.getMinutes();return i.getFullYear()+"-"+s+"-"+a+" "+l+":"+o}function getPar(t){var e=document.location.href,n=e.indexOf(t+"=");if(n==-1)return!1;var i=e.slice(t.length+n+1),s=i.indexOf("&");return s!=-1&&(i=i.slice(0,s)),i}function stringEncode(t){var e=document.createElement("div");return e.innerText?e.innerText=t:e.textContent=t,e.innerHTML}function getCookie(t){for(var e=document.cookie,n=e.split("; "),i=0;i<n.length;i++){var s=n[i].split("=");if(s[0]==t)return s[1]}return""}
|