filesbox/web/dist/design/designstatic/home/js/main.js
2024-07-26 14:10:54 +08:00

2 lines
28 KiB
JavaScript

(function(o,S){var A={init:function(){var e=this;e.aHrefClick(),e.fixed(),e.advert(),e.serach(),e.calendar(),e.baiduMap(),e.weather(),e.course(),e.courseWare(),e.getAjaxRoomInfo(),e.setAnimation()},aHrefClick:function(){for(var e=o("a[href]"),n=[],s=0,i=e.length;s<i;s++){var t=e.eq(s);(t.attr("href").indexOf("/aroom/#")>-1||t.attr("href").indexOf("/myroom/#")>-1&&t.attr("href").indexOf("/nolimit")<0||t.attr("href").indexOf("/pay/#")>-1)&&(t.attr("clickUrl",t.attr("href")),t.removeAttr("href"))}o(".module a[clickUrl]").on("click",function(p){p.stopPropagation();var r=window.user,a=o(this).attr("clickUrl"),u=function(l){l=="STUDENT"?a.indexOf("/pay/#")>-1?window.location.href=a.indexOf("/pay/#/")>-1?a:window.basePath?"/"+window.basePath+"#/":"/#/":window.location.href=a.indexOf("/myroom/#/")>-1?a:window.basePath?"/"+window.basePath+"#/":"/#/":window.location.href=a.indexOf("/aroom/#/")>-1?a:window.basePath?"/"+window.basePath+"#/":"/#/"},d=function(){r.loginLayer(function(l){l.success&&r.isLogin(function(c){c.success&&u(c.data.userTypeExact)})})};getCookie("token")||getCookie("stoken")?r.isLogin(function(l){l.success?u(l.data.userTypeExact):d()}):d()})},fixed:function(){for(var e=this,n=o(".module[data-fixed]"),s=0,i=n.length;s<i;s++){var t=n.eq(s),p=parseInt(t.css("left")),r=t.parent().width(),a=p-r/2;t.attr("data-fixed")=="fixedTop"?t.css({position:"fixed",top:t.attr("data-fixedvalue")+"px",left:"50%",marginLeft:a+"px",zIndex:999}):t.attr("data-fixed")=="fixedBottom"&&t.css({position:"fixed",top:"auto",bottom:t.attr("data-fixedvalue")+"px",left:"50%",marginLeft:a+"px",zIndex:999})}},advert:function(){var e=this,n=o(".module[data-type=suspend]");if(n.length<1)return!1;var s=3,i=100,t=o(window).width(),p=o(window).height(),r=o(document).height();o(window).resize(function(){t=o(window).width();for(var k=0,I=n.length;k<I;k++){var g=n.eq(k);if(g.attr("data-suspend")){var T=o.parseJSON(g.attr("data-suspend"));if(T.type=="dynamic"){var b=g[0].parentElement.offsetLeft,x=g[0].parentElement.offsetTop;g.css({left:-b,top:-x,zIndex:999})}}}});for(var a={},u=0,d=n.length;u<d;u++){var l=n.eq(u);if(l.find("a").attr("href")==""&&l.find("a").removeAttr("href"),l.attr("data-suspend")){var c=o.parseJSON(l.attr("data-suspend")),f=l[0].parentElement.offsetLeft,m=l[0].parentElement.offsetTop,h=f+l[0].offsetLeft,w=m+l[0].offsetTop;if(c.type=="dynamic")l.css({left:-f,top:-m,zIndex:999}),function(k,I,g){var T=0,b=0,x=0,D,O,C=!0,N=!0,j=parseInt(I.css("width")),W=parseInt(I.css("height")),P=t-j,_=r-W;I.css({transition:"transform "+i/1e3+"s linear",cursor:"pointer"}),a["fn"+g]=function(B,q){C?b+=s:b-=s,N?x+=s:x-=s,b>P&&(C=!1,b=P),b<0&&(C=!0,b=0),x>_&&(N=!1,x=_),x<0&&(N=!0,x=0),B.css({transform:"translate("+b+"px, "+x+"px)"})},a["int"+g]=setInterval(function(){a["fn"+g](I,g)},i),I.hover(function(){clearInterval(a["int"+g])},function(){a["int"+g]=setInterval(function(){a["fn"+g](I,g)},i)})}(c,l,u);else{var v=parseInt(t)-parseInt(l.css("width")),y=parseInt(p)-parseInt(l.css("height"));l.css({position:"fixed",left:h<0?0:h>v?"auto":h,right:h>v?0:"auto",top:w>p?y:w,zIndex:999})}}}},serach:function(){var e=this;if(e.$search=o(".module[data-type=search]"),e.$search.length<1)return!1;for(var n=0,s=e.$search.length;n<s;n++){var i=e.$search.eq(n);(function(t){var p=t.find(".searchBtn"),r=t.find("input");p.on("click",function(){r.val()?S.location.href="/pages/elective.html?keyword="+r.val():S.location.href="/pages/elective.html"})})(i)}},calendar:function(){var e=this;if(e.$calendar=o(".module[data-type=calendar]"),e.$calendar.length<1)return!1;loadScriptmin.apply(e,["/design/designstatic/home/js/simple-calendar.js",function(n){for(var s=0,i=n.length;s<i;s++){var t=n.eq(s);t.find("div[id=calendarbox]").attr("id","calendarbox"+s),e.myCalendar=new SimpleCalendar("#calendarbox"+s)}},e.$calendar])},baiduMap:function(){var e=this;if(e.$Map=o(".module[data-type=Map]"),!window.BMap||e.$Map.length<1)return!1;for(var n=0,s=e.$Map.length;n<s;n++){var i=e.$Map.eq(n),t=JSON.parse(i.attr("data-map")),p=i.attr("data-mid");self["map"+p]=new BMap.Map(p),self["myGeo"+p]=new BMap.Geocoder,self["map"+p].enableScrollWheelZoom(!0);var r=new BMap.ScaleControl({anchor:BMAP_ANCHOR_TOP_LEFT}),a=new BMap.NavigationControl,u=new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_RIGHT,type:BMAP_NAVIGATION_CONTROL_SMALL});self["map"+p].addControl(r),self["map"+p].addControl(a),self["map"+p].addControl(u),self["myGeo"+p].getPoint(t.address,function(d){if(d){e.point=d,e.city=t.city,self["map"+p].centerAndZoom(d,16);var l=new BMap.Marker(d);self["map"+p].addOverlay(l);var c="<div style='width:300px;'><p style='margin:0;line-height:1.5;font-size:13px;'>"+t.textAddress+"</p></div>",f=new BMap.InfoWindow(c);l.openInfoWindow(f)}else message.info("\u60A8\u9009\u62E9\u5730\u5740\u6CA1\u6709\u89E3\u6790\u5230\u7ED3\u679C!")},t.city)}},weather:function(){var e=this;e.getCity()},getCity:function(){var e=this;e.$Map.length>0?e.hasScene(JSON.parse(e.$Map.eq(0).attr("data-map")).city):e.hasScene("\u676D\u5DDE")},hasScene:function(e){var n=this;o(document).ready(function(){if(n.$weather=o(".module[data-type=weather]"),n.$weather.addClass("scene"),n.$weather.length<1)return!1;loadScriptmin.apply(n,["/design/designstatic/home/js/city.js",n.scene,e])})},scene:function(e){var n=this;n.getAjaxScence(e);var s=new Vcity.CitySelector({input:"sceneCitySelect"});s.createWarp(),o(".cityBox").addClass("hide"),n.$weather.find(".scene-change").click(function(r){var a=e;o(".scene-city").hide(),o(".scene-change").hide(),o(".scene-demo").show(),o(".blackone").show(),o("#sceneCitySelect").attr("value",a),setTimeout(function(){o(".cityBox").removeClass("hide")},0)});var i=o("#cityBox a");i.click(function(){var r=o("#sceneCitySelect").val();n.getAjaxScence(r),o(".scene-city").text(r),o(".scene-city").show(),o(".scene-change").show(),o(".scene-demo").hide()});var t=o(".citySelector");t.on("click",".cityslide",function(){var r=o("#sceneCitySelect").val();n.getAjaxScence(r),o(".scene-city").text(r),o(".scene-city").show(),o(".scene-change").show(),o(".scene-demo").hide()}),o("#sceneCitySelect").on("keypress",function(r){setTimeout(function(){if(r.keyCode==13){var a=o("#sceneCitySelect").val();n.getAjaxScence(a),o(".scene-city").text(a),o(".scene-city").show(),o(".scene-change").show(),o(".scene-demo").hide()}},300)}),o(document).click(function(r){if(o(".scene-demo").css("display")=="block"&&r.target.className!="scene-change"){var a="\u676D\u5DDE",u=/[^\u4E00-\u9FA5]/g,d=o(".scene-city"),l=o("#sceneCitySelect").val(),c="";p(l.replace(u,"")+"|")!=-1&&l.replace(u,"")!=""?(c=l.replace(u,""),n.getAjaxScence(c)):c=a,o(".scene-city").text(c),o(".scene-city").show(),o(".scene-change").show(),o(this).hide(),o(".scene-demo").hide()}});function p(r){for(var a=0;a<Vcity.allCity.length-1;++a)if(Vcity.allCity[a].indexOf(r)==0)return a;return-1}},getAjaxScence:function(e){o(".scene .scene-ul li").hide();var n=o(".scene .scene-ul");n.css("background","url(//static.ebanhui.com/ebh/tpl/wnl/images/onloading.gif) no-repeat center"),o.ajax({type:"get",async:!1,url:"https://wthrcdn.xx.cn/weather_mini?city="+e+"&callback=flightHandler",dataType:"jsonp",jsonp:"callback",jsonpCallback:"flightHandler",success:function(s){if(n.css("background","none"),s.status==1e3){var i=s.data,t=i.aqi,p="";t<=50&&t>0&&(p="\u4F18\u79C0"),t<=100&&t>50&&(p="\u826F\u597D"),t<=150&&t>100&&(p="\u4E00\u822C"),t<=200&&t>150&&(p="\u5F88\u5DEE"),t>200&&(p="\u5F88\u5DEE"),o(".scene-airquality").text(t+" "+p),t||(p="\u6682\u7F3A",o(".scene-airquality").text(p));for(var r="",a="",u=/[\u4E00-\u9FA5]/g,d=[],l=[],c=o(".scene-ul li"),f=0;f<3;++f){var m=o("#day"+f);switch(d[f]=i.forecast[f].low.replace(u,""),l[f]=i.forecast[f].high.replace(u,""),i.forecast[f].type){case"\u591A\u4E91":r="cloud.png",a="cloud2.png";break;case"\u6674":r="fine.png",a="fine2.png";break;case"\u9634":r="overcast.png",a="overcast2.png";break;case"\u5C0F\u96E8":r="small_rain.png",a="small_rain2.png";break;case"\u5C0F\u5230\u4E2D\u96E8":r="stom_rain.png",a="stom_rain2.png";break;case"\u5927\u96E8":r="big_rain.png",a="big_rain2.png";break;case"\u4E2D\u5230\u5927\u96E8":r="big_rain.png",a="big_rain2.png";break;case"\u66B4\u96E8":r="mbig_rain.png",a="mbig_rain2.png";break;case"\u5927\u66B4\u96E8":r="mbig_rain.png",a="mbig_rain2.png";break;case"\u7279\u5927\u66B4\u96E8":r="mbig_rain.png",a="mbig_rain2.png";break;case"\u5927\u5230\u66B4\u96E8":r="mbig_rain.png",a="mbig_rain2.png";break;case"\u66B4\u96E8\u5230\u5927\u66B4\u96E8":r="mbig_rain.png",a="mbig_rain2.png";break;case"\u5927\u66B4\u96E8\u5230\u7279\u5927\u66B4\u96E8":r="mbig_rain.png",a="mbig_rain2.png";break;case"\u96E8\u5939\u96EA":r="rain_snow.png",a="rain_snow2.png";break;case"\u9635\u96EA":r="quick_snow.png",a="quick_snow2.png";break;case"\u5C0F\u96EA":r="small_snow.png",a="small_snow2.png";break;case"\u5C0F\u5230\u4E2D\u96EA":r="mid_snow.png",a="mid_snow2.png";break;case"\u4E2D\u96EA":r="mid_snow.png",a="mid_snow2.png";break;case"\u4E2D\u5230\u5927\u96EA":r="mid_big_snow.png",a="mid_big_snow2.png";break;case"\u5927\u5230\u66B4\u96EA":r="big_snow.png",a="big_snow2.png";break;case"\u96FE":r="fog.png",a="fog2.png";break;case"\u6C99\u5C18\u66B4":r="sand.png",a="sand2.png";break;case"\u6D6E\u5C18":r="sand.png",a="sand2.png";break;case"\u626C\u6C99":r="sand.png",a="sand2.png";break;case"\u5F3A\u6C99\u5C18\u66B4":r="sand.png",a="sand2.png";break;case"\u96FE\u973E":r="sand.png",a="sand2.png";break;case"\u51BB\u96E8":r="ice_rain.png",a="ice_rain2.png";break;case"\u4E2D\u96E8":r="mid_rain.png",a="mid_rain2.png";break;case"\u96F7\u9635\u96E8\u4F34\u6709\u51B0\u96F9":r="quick_rain_ice.png",a="quick_rain_ice2.png";break;case"\u9635\u96E8":r="quick_rain.png",a="quick_rain2.png";break;case"\u96F7\u9635\u96E8":r="lquick_rain.png",a="lquick_rain2.png";break;case"\u65E0\u5929\u6C14\u7C7B\u578B":r="unknown.png",a="unknown2.png";break;default:r="unknown.png",a="unknown2.png";break}var h=c.eq(f),w=i.forecast[f];h.find(".scene-date").text(w.date),h.hasClass("scene-on")?(h.find(".scene-icon").attr("src","//static.ebanhui.com/ebh/tpl/wnl/images/"+r),h.find(".scene-temp").html(i.wendu+"<b>\xBA</b>")):(h.find(".scene-icon").attr("src","//static.ebanhui.com/ebh/tpl/wnl/images/"+a),h.find(".scene-temp").html(" ")),h.find(".scene-weather").text(w.type),h.find(".scene-tempSection").text(d[f]+"~"+l[f]);var v=w.fengli,y=v.replace("<![CDATA[","",w.fengli);y=y.replace("]]>","",y),h.find(".scene-wind").text(w.fengxiang+" "+y)}o(".scene-city").text(e),o(".scene .scene-ul li").show()}else n.css("background","url(//static.ebanhui.com/ebh/tpl/wnl/images/wrong.png) no-repeat center"),o(".scene .scene-ul li").hide()},error:function(){n.css("background","url(//static.ebanhui.com/ebh/tpl/wnl/images/wrong.png) no-repeat center"),o(".scene .scene-ul li").hide()}})},course:function(){var e=this;e.$course=o(".module[data-type=course]");for(var n=0,s=e.$course.length;n<s;n++){var i=e.$course.eq(n);e.bindCourseEvent(i)}},bindCourseEvent:function(e){var n=this,s=e.attr("data-course");if(!s)return!1;var i=JSON.parse(s);i.item=e;var t=e.find(".navHeader"),p=t.html();n.bindCourseClickTapEvent(i,t,p)},bindCourseClickTapEvent:function(e,n,s){var i=this;n.on("click",".module[data-type=text]",function(){if(i.postAjaxCourseIng)return!1;var t=o(this).find(".box").text().trim();i.carrySeletStyle(t,n,s),i.getSelectClassid(e,t)}),i.getSelectHover(e,n,s)},getSelectClassid:function(e,n){var s=this,i=e.options,t=[];i.forEach(function(p){n==p.name?t=[p.id]:Array.isArray(p.child)&&Array.from(p.child).forEach(function(r){n==r.name&&(t=[p.id,r.id])})}),t.length>0?(e.classify=t,e.condition=""):(e.classify=[],e.condition=n),e.condition=="\u5168\u90E8"&&(e.condition=void 0),s.getAjaxCourse(e)},getSelectHover:function(e,n,s){var i=this,t=e.classify;if(n.length>0){if(!t)i.carrySeletStyle("\u5168\u90E8",n,s);else if(t){var p=e.options;t[0]&&p.forEach(function(r){r.id==t[0]&&(t[1]?r.child.forEach(function(a){a.id==t[1]&&i.carrySeletStyle(a.name,n,s)}):i.carrySeletStyle(r.name,n,s))})}}i.getAjaxCourse(e)},carrySeletStyle:function(e,n,s){n.html(s);var i=n.find(".module[data-type=text]");Array.from(i).forEach(function(t){var p=o(t);if(p.find(".box").text().trim()==e){var r=p.find("style.hover");if(r.length>0)r.html(r.text().replace(/:hover/,""));else{var a=p.css("backgroundColor");p.css({color:a=="rgba(0, 0, 0, 0)"?"#fff":a,backgroundColor:p.css("color")})}}})},getAjaxCourse:function(e){var n=this;n.postAjaxCourseIng=!0,o.ajax({type:"get",url:"/api/course/getDressCourseInfoByIds?projectid=12",data:{condition:e.condition,courseIds:e.courseIds?e.courseIds.join(","):e.courseIds,mainClassify:e.classify[0],childClassify:e.classify[1],beginNum:e.startNum,endNum:e.endNum},contentType:"application/json;charset=utf-8",dataType:"json",success:function(s){s.success&&(clearTimeout(n.postAjaxCourseIngtime),n.postAjaxCourseIngtime=setTimeout(function(){n.postAjaxCourseIng=!1},200),n.renderCourse(e,s.data))},error:function(s){console.log("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25")}})},renderCourse:function(e,n){var s="",i,t=function(c){var f="/pages/info.html?cid="+c.courseId;return parseInt(c.courseType)==2||parseInt(c.courseType)==4?f="/pages/bundle.html?cid="+c.courseId:f="/pages/info.html?cid="+c.courseId,f},p=function(c){var f=c.courseType,m=c.price;return parseInt(f)==1||parseInt(f)==3?m>0?"/design/designstatic/design/image/course/signup"+(parseInt(e.sLState)?e.sLState:"")+".png":"/design/designstatic/design/image/course/free"+(parseInt(e.sLState)?e.sLState:"")+".png":"/design/designstatic/design/image/course/package"+(parseInt(e.sLState)?e.sLState:"")+".png"},r=function(c){return c.price>0?c.courseType=="1"||c.courseType=="3"?"\uFFE5"+c.price/100+"/"+c.deadline+"\u5929":"\uFFE5"+c.price/100:"\u514D\u8D39"};switch(e.styleType){case"wzlb":i=function(c){var f="";return parseInt(c.courseType)==2||parseInt(c.courseType)==4?f="/pages/bundle.html?cid="+c.courseId:f="/pages/info.html?cid="+c.courseId,'<li><a href="'+f+'"><span class="title">'+c.courseName+'</span><span class="teacher">'+c.mainTeacher+"</span></a></li>"};break;case"xtwlb":i=function(c){return'<li> <a href="'+t(c)+'"> <div class="coverBox"> <div class="maskBox"> <img src="'+(c.cover?(window.cdnPath||"")+c.cover:"/design/designstatic/common/image/course/defult.jpg")+'"/> <div class="coverMask">'+(parseInt(e.sDesc)==1?c.introduce:"")+"</div> </div>"+(parseInt(e.sLabel)==1?'<div class="courseState courseState'+(parseInt(e.sLState)?e.sLState:"")+'" style="background-image: url('+p(c)+')"></div>':"")+' </div> <p class="title" title="'+c.courseName+'">'+c.courseName+"</p>"+(parseInt(e.sTeacher)==1?'<p class="teacher">'+c.mainTeacher+"</p>":"")+' <p class="info">'+(parseInt(e.sWareCount)==1?'<span class="sWareCount"><i class="iconfont icon-time-circle"></i> '+c.coursewareCount+"\u8BFE\u65F6</span>":"")+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+c.popularityCount+"</span>":"")+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+r(c)+"</span>":"")+" </p> </a> </li>"};break;case"twlb":i=function(c){return'<li> <a href="'+t(c)+'"> <div class="coverBox"> <img src="'+(c.cover?(window.cdnPath||"")+c.cover:"/design/designstatic/common/image/course/defult.jpg")+'"/>'+(parseInt(e.sLabel)==1?'<div class="courseState courseState'+(parseInt(e.sLState)?e.sLState:"")+'" style="background-image: url('+p(c)+')"></div>':"")+' </div> <div class="rightBox"> <p><span class="title">'+c.courseName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+r(c)+"</span>":"")+"</p>"+(parseInt(e.sDesc)==1?'<p class="introduce" title="'+c.introduce+'"> '+c.introduce+" </p>":"")+(parseInt(e.sTeacher)==1?'<p class="teacher">'+c.mainTeacher+"</p>":"")+' <p class="info">'+(parseInt(e.sWareCount)==1?'<span class="sWareCount"><i class="iconfont icon-time-circle"></i> '+c.coursewareCount+"\u8BFE\u65F6</span>":"")+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+c.popularityCount+"</span>":"")+" </p> </div> </a> </li>"};break;case"ttlb":var a="";parseInt(n[0].courseType)==2||parseInt(n[0].courseType)==4?a="/pages/bundle.html?cid="+n[0].courseId:a="/pages/info.html?cid="+n[0].courseId,s+='<li class="one"><a style="padding-left: 170px;height: 110px;" href="'+a+'"><div class="imgBox"><img src="'+(window.cdnPath||"")+n[0].cover+'"/><div class="hoverPreLever"></div></div><span class="title">'+n[0].courseName+'</span><span class="teacher">'+n[0].mainTeacher+'</span><span class="introduce">'+n[0].introduce+"</span></a></li>",i=function(c){var f="";return parseInt(c.courseType)==2||parseInt(c.courseType)==4?f="/pages/bundle.html?cid="+c.courseId:f="/pages/info.html?cid="+c.courseId,'<li><a href="'+f+'"><span class="title">'+c.courseName+'</span><span class="teacher">'+c.mainTeacher+"</span></a></li>"};break;case"btrqlb":i=function(c){return'<li> <a href="'+t(c)+'"> <div class="rightBox"> <p><span class="title">'+c.courseName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+r(c)+"</span>":"")+"</p>"+(parseInt(e.sDesc)==1?'<p class="introduce" title="'+c.introduce+'">'+c.introduce+"</p>":"")+(parseInt(e.sTeacher)==1?'<p class="teacher">'+c.mainTeacher+"</p>":"")+' <p class="info">'+(parseInt(e.sWareCount)==1?'<span class="sWareCount"><i class="iconfont icon-time-circle"></i> '+c.coursewareCount+"\u8BFE\u65F6</span>":"")+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+c.popularityCount+"</span>":"")+" </p> </div> </a> </li>"};break}for(var u=0,d=n.length;u<d;u++)if(!(e.styleType=="ttlb"&&u==0)){var l=n[u];s+=i(l)}e.item.find("ul").html(s)},courseWare:function(){var e=this;e.$courseware=o(".module[data-type=courseware]");for(var n=0,s=e.$courseware.length;n<s;n++){var i=e.$courseware.eq(n);e.getAjaxCourseware(i)}},getAjaxCourseware:function(e){var n=this,s=e.attr("data-courseware");if(!s)return!1;var i=JSON.parse(s);i.item=e,o.ajax({type:"get",url:"/api/course/getCourseWareInfoByIds?projectid=12",data:{courseWareIds:i.courseWareIds?i.courseWareIds.join(","):i.courseWareIds,beginNum:i.startNum,endNum:i.endNum,isIndex:1},contentType:"application/json",dataType:"json",success:function(t){t.success&&n.renderCourseware(i,t.data)},error:function(t){console.log("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25")}})},isLiveUrl:function(e){var n=e.courseWareType+"",s=e.courseWareId,i=e.courseId,t=e.price,p="",r=!1;switch(n){case"1":r=!0;break;case"2":r=!0;break;case"3":r=!0;break;case"4":r=!0;break;case"5":r=!0;break;default:r=!1}return p=t?"/pages/ware.html?cid="+i+"&rid="+s:"/pages/info.html?cid="+i,p},renderCourseware:function(e,n){var s=this,i="",t;switch(e.styleType){case"wzlb":t=function(u){return'<li><a href="'+s.isLiveUrl(u)+'"><span class="title">'+u.courseWareName+'</span><span class="teacher">'+u.realName+"</span></a></li>"};break;case"xtwlb":t=function(u){return'<li> <a href="'+s.isLiveUrl(u)+'"> <div class="coverBox"> <div class="maskBox"> <img src="'+(u.cover?(window.cdnPath||"")+u.cover:"/design/designstatic/common/image/course/jxzb_ware.png")+'"/> <div class="coverMask">'+(parseInt(e.sDesc)==1?u.introduce:"")+'</div> </div> </div> <p class="title" title="'+u.courseWareName+'">'+u.courseWareName+"</p>"+(parseInt(e.sTeacher)==1?'<p class="teacher">'+u.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+u.popularityCount+"</span>":"")+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+(u.price?"\uFFE5"+JSON.parse(u.price)[0]/100+"/"+JSON.parse(u.price)[1]+"\u5929":"\u514D\u8D39")+"</span>":"")+" </p> </a> </li>"};break;case"twlb":t=function(u){return'<li> <a href="'+s.isLiveUrl(u)+'"> <div class="coverBox"> <img src="'+(u.cover?(window.cdnPath||"")+u.cover:"/design/designstatic/common/image/course/jxzb_ware.png")+'"/> </div> <div class="rightBox"> <p><span class="title">'+u.courseWareName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+(u.price?"\uFFE5"+JSON.parse(u.price)[0]/100+"/"+JSON.parse(u.price)[1]+"\u5929":"\u514D\u8D39")+"</span>":"")+"</p>"+(parseInt(e.sDesc)==1?'<p class="introduce" title="'+u.introduce+'">'+u.introduce+"</p>":"")+(parseInt(e.sTeacher)==1?'<p class="teacher">'+u.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+u.popularityCount+"</span>":"")+" </p> </div> </a> </li>"};break;case"ttlb":i+='<li class="one"><a href="'+s.isLiveUrl(n[0])+'" style="padding-left: 170px;height: 110px;"><img src="'+(window.cdnPath||"")+n[0].cover+'"/><span class="title">'+n[0].courseWareName+'</span><span class="teacher">'+n[0].realName+'</span><span class="introduce" style="display:block;">'+n[0].introduce+"</span></a></li>",t=function(u){return'<li><a href="'+s.isLiveUrl(u)+'"><span class="title">'+u.courseWareName+'</span><span class="teacher">'+u.realName+"</span></a></li>"};break;case"btrqlb":t=function(u){return'<li> <a href="'+s.isLiveUrl(u)+'"> <div class="rightBox"> <p><span class="title">'+u.courseWareName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+(u.price?"\uFFE5"+JSON.parse(u.price)[0]/100+"/"+JSON.parse(u.price)[1]+"\u5929":"\u514D\u8D39")+"</span>":"")+"</p>"+(parseInt(e.sDesc)==1?'<p class="introduce" title="'+u.introduce+'">'+u.introduce+"</p>":"")+(parseInt(e.sTeacher)==1?'<p class="teacher">'+u.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+u.popularityCount+"</span>":"")+" </p> </div> </a> </li>"};break;default:}for(var p=0,r=n.length;p<r;p++)if(!(e.styleType=="ttlb"&&p==0)){var a=n[p];i+=t(a)}e.item.find("ul").html(i)},information:function(e){var n=this;n.$article=o(".module[data-type=article]");for(var s=0,i=n.$article.length;s<i;s++){var t=n.$article.eq(s);n.getAjaxArticle(t)}},getAjaxArticle:function(e){var n=this,s=e.attr("data-article");if(!s)return!1;var i=JSON.parse(s);i.item=e,o.ajax({type:"get",url:"/api/disk/firstHomepageDetail?projectid=12",data:{InfoTypeId:i.classify[i.classify.length-1],beginNum:i.startNum,endNum:i.endNum,isAll:i.isAll},contentType:"application/json",dataType:"json",success:function(t){t.success&&n.renderArticle(i,t.data)},error:function(t){console.log("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25")}})},getTimeString:function(e){if(new Date(parseInt(e))=="Invalid Date"&&new Date(parseInt(e)*1e3)=="Invalid Date")return"--";var n=new Date(parseInt(e)),s=n.getFullYear(),i=n.getMonth()+1,t=n.getDate();return s+"-"+i+"-"+t},renderArticle:function(e,n){var s=this,i="",t,p=function(l){return location.port=="81"?`/pubinfo/${l}.shtml`:`/pubinfo/${l}.shtml`};switch(e.styleType){case"wzlb":t=function(l){return'<li><a href="'+p(l.infoID)+'"><span class="title">'+l.title+'</span><span class="teacher">'+s.getTimeString(l.gmtCreate)+"</span></a></li>"};break;case"xtwlb":t=function(l){return'<li> <a href="'+p(l.infoID)+'"> <div class="coverBox"> <div class="maskBox"> <img src="'+(window.cdnPath||"")+l.computerPicPath+'"/> <div class="coverMask">'+l.introduce+'</div> </div> </div> <p class="title" title="'+l.title+'">'+l.title+"</p>"+(parseInt(e.sTeacher)==1?'<p class="teacher">'+l.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+l.viewCount+"</span>":"")+(parseInt(e.sDate)==1?'<span class="sDate">'+s.getTimeString(l.gmtCreate)+"</span>":"")+" </p> </a> </li>"};break;case"twlb":t=function(l){return'<li> <a href="'+p(l.infoID)+'"> <div class="coverBox"> <img src="'+(window.cdnPath||"")+l.computerPicPath+'"/> </div> <div class="rightBox"> <p><span class="title">'+l.title+'</span></p> <p class="introduce" title="'+l.introduce+'">'+l.introduce+"</p>"+(parseInt(e.sTeacher)==1?'<p class="teacher">'+l.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+l.viewCount+"</span>":"")+(parseInt(e.sDate)==1?'<span class="sDate">'+s.getTimeString(l.gmtCreate)+"</span>":"")+" </p> </div> </a> </li>"};break;case"ttlb":t=function(l,c){return c==0?'<li class="one"><a href="'+p(l.infoID)+'" style="padding-left: 170px;height: 110px;"><img src="'+(window.cdnPath||"")+l.computerPicPath+'"/><span class="title">'+l.title+'</span><span class="teacher">'+s.getTimeString(l.gmtCreate)+'</span><span class="introduce">'+l.detail+"</span></a></li>":'<li><a href="'+p(l.infoID)+'"><span class="title">'+l.title+'</span><span class="teacher">'+s.getTimeString(l.gmtCreate)+"</span></a></li>"};break;case"btrqlb":t=function(l){return'<li><a href="'+p(l.infoID)+'"><div class="rightBox"> <p><span class="title">'+l.title+'</span></p> <p class="introduce" title="'+l.introduce+'"> '+l.introduce+" </p>"+(parseInt(e.sTeacher)==1?'<p class="teacher">'+l.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+l.viewCount+"</span>":"")+(parseInt(e.sDate)==1?'<span class="sDate">'+s.getTimeString(l.gmtCreate)+"</span>":"")+" </p></div></a></li>"};break;default:}for(var r=document.createElement("div"),a=0,u=n.length;a<u;a++){var d=n[a];d.computerPicPath=d.computerPicPath?JSON.parse(d.computerPicPath)[0].sourcePath:"/design/designstatic/common/image/information/defult.jpg",r.innerHTML=d.detail,d.detail=r.innerText,i+=t(d,a)}e.item.find("ul").html(i)},picture:function(){var e=this,n=o(".module[data-type=picture]");if(n.length<1)return!1;for(var s=o(window).width(),i=o(window).height(),t=o(document).height(),p=0,r=n.length;p<r;p++){var a=n.eq(p),u=a.find("img").attr("src");d(u,function(l,c){var f=parseInt(a[0].style.width);if(f>1440&&f<s){var m=(f-1440)/2;a.css({maxWidth:f+"px",left:"-"+m+"px"}),a.find("img").css({maxWidth:f+"px"})}else if(s>1440&&f>s){var m=(s-1440)/2;a.css({maxWidth:s+"px",left:"-"+m+"px"}),a.find("img").css({maxWidth:s+"px"})}else s<1440&&f>s&&(a.css({maxWidth:"1440px",left:"0px"}),a.find("img").css({maxWidth:"1440px"}))})}o(window).resize(function(){s=o(window).width();for(var l=0,c=n.length;l<c;l++){var f=n.eq(l),m=f.find("img").attr("src");d(m,function(h,w){var v=parseInt(f[0].style.width);if(v>1440&&v<s){var y=(v-1440)/2;f.css({maxWidth:v+"px",left:"-"+y+"px"}),f.find("img").css({maxWidth:v+"px"})}else if(s>1440&&v>s){var y=(s-1440)/2;f.css({maxWidth:s+"px",left:"-"+y+"px"}),f.find("img").css({maxWidth:s+"px"})}else s<1440&&v>s&&(f.css({maxWidth:"1440px",left:"0px"}),f.find("img").css({maxWidth:"1440px"}))})}});function d(l,c){var f=new Image;f.src=l,f.complete?c(f.width,f.height):f.onload=function(){c(f.width,f.height)}}},getAjaxRoomInfo:function(){var e=this;o.ajax({type:"get",url:"/api/disk/home?projectid=12",dataType:"json",success:function(n){n.success&&(window.roominfo=n.data,parseInt(n.data.type)==3&&e.Render(n.data))}})},Render:function(e){var n=this;n.summary(e.introduction),n.QRcode(e.wechatQRCode),n.logo(e.logo),n.documentTitle(e),n.licence(e.licence)},summary:function(e){var n=this;if(n.$introduce=o(".module[data-type=introduce]"),n.$introduce.length<1)return!1;for(var s=0,i=n.$introduce.length;s<i;s++){var t=n.$introduce.eq(s);t.find(".box").html(e)}},QRcode:function(e){var n=this;if(n.$qrcode=o(".module[data-type=qrcode]"),n.$qrcode.length<1)return!1;for(var s=0,i=n.$qrcode.length;s<i;s++){var t=n.$qrcode.eq(s);t.attr("data-qrcode")||(t.html(""),t.qrcode(location.href))}},logo:function(e){var n=this;if(n.$logo=o(".module[data-type=logo]"),n.$logo.length<1)return!1;for(var s=0,i=n.$logo.length;s<i;s++){var t=n.$logo.eq(s);t.find("img").attr("src",(window.cdnPath||"")+e)}},documentTitle:function(e){var n=o("title");e.subhead?window.location.pathname=="/"?n.html(e.schoolName+"-"+e.subhead):n.html(n.text()+"-"+e.subhead):window.location.pathname=="/"&&n.html(e.schoolName)},licence:function(e){var n=o("#recordNumber");n.length>0?e?n.html(e):n.hide():o("body").append('<div style="height:32px;line-height:32px;text-align: center;">'+e+"</div>")},setAnimation:function(){var e=this;e.animArr=[];for(var n=o(".module"),s=0,i=n.length;s<i;s++){var t=n.eq(s),p=t.css("animationName");p!="none"&&(t.css("animationIterationCount")!="infinite"&&(t.attr("data-kui-anim",p),t.css("animationName","")),e.animArr.push(t))}}};A.init()})(jQuery,window);