2 lines
28 KiB
JavaScript
2 lines
28 KiB
JavaScript
(function(o,S){var A={init:function(){var e=this;window.tsnfors=e.getPar("targetServerNameForOverride")||e.getPar("host")?"?targetServerNameForOverride="+(e.getPar("targetServerNameForOverride")||e.getPar("host")):"",e.aHrefClick(),e.fixed(),e.advert(),e.serach(),e.calendar(),e.baiduMap(),e.weather(),e.course(),e.courseWare(),e.getAjaxRoomInfo(),e.setAnimation()},getPar:function(e,n){var s=n||document.location.href,a=s.indexOf(e+"=");if(a==-1)return"";var t=s.slice(e.length+a+1),u=t.indexOf("&");return u!=-1&&(t=t.slice(0,u)),t},aHrefClick:function(){for(var e=o("a[href]"),n=[],s=0,a=e.length;s<a;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(u){u.stopPropagation();var i=window.user,r=o(this).attr("clickUrl"),p=function(l){l=="STUDENT"?r.indexOf("/pay/#")>-1?window.location.href=r.indexOf("/pay/#/")>-1?r:window.basePath?"/"+window.basePath+"#/":"/#/":window.location.href=r.indexOf("/myroom/#/")>-1?r:window.basePath?"/"+window.basePath+"#/":"/#/":window.location.href=r.indexOf("/aroom/#/")>-1?r:window.basePath?"/"+window.basePath+"#/":"/#/"},d=function(){i.loginLayer(function(l){l.success&&i.isLogin(function(c){c.success&&p(c.data.userTypeExact)})})};getCookie("token")||getCookie("stoken")?i.isLogin(function(l){l.success?p(l.data.userTypeExact):d()}):d()})},fixed:function(){for(var e=this,n=o(".module[data-fixed]"),s=0,a=n.length;s<a;s++){var t=n.eq(s),u=parseInt(t.css("left")),i=t.parent().width(),r=u-i/2;t.attr("data-fixed")=="fixedTop"?t.css({position:"fixed",top:t.attr("data-fixedvalue")+"px",left:"50%",marginLeft:r+"px",zIndex:999}):t.attr("data-fixed")=="fixedBottom"&&t.css({position:"fixed",top:"auto",bottom:t.attr("data-fixedvalue")+"px",left:"50%",marginLeft:r+"px",zIndex:999})}},advert:function(){var e=this,n=o(".module[data-type=suspend]");if(n.length<1)return!1;var s=3,a=100,t=o(window).width(),u=o(window).height(),i=o(document).height();o(window).resize(function(){t=o(window).width();for(var k=0,I=n.length;k<I;k++){var h=n.eq(k);if(h.attr("data-suspend")){var T=o.parseJSON(h.attr("data-suspend"));if(T.type=="dynamic"){var b=h[0].parentElement.offsetLeft,x=h[0].parentElement.offsetTop;h.css({left:-b,top:-x,zIndex:999})}}}});for(var r={},p=0,d=n.length;p<d;p++){var l=n.eq(p);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,g=f+l[0].offsetLeft,y=m+l[0].offsetTop;if(c.type=="dynamic")l.css({left:-f,top:-m,zIndex:999}),function(k,I,h){var T=0,b=0,x=0,B,D,C=!0,N=!0,j=parseInt(I.css("width")),W=parseInt(I.css("height")),P=t-j,_=i-W;I.css({transition:"transform "+a/1e3+"s linear",cursor:"pointer"}),r["fn"+h]=function(O,M){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),O.css({transform:"translate("+b+"px, "+x+"px)"})},r["int"+h]=setInterval(function(){r["fn"+h](I,h)},a),I.hover(function(){clearInterval(r["int"+h])},function(){r["int"+h]=setInterval(function(){r["fn"+h](I,h)},a)})}(c,l,p);else{var v=parseInt(t)-parseInt(l.css("width")),w=parseInt(u)-parseInt(l.css("height"));l.css({position:"fixed",left:g<0?0:g>v?"auto":g,right:g>v?0:"auto",top:y>u?w:y,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 a=e.$search.eq(n);(function(t){var u=t.find(".searchBtn"),i=t.find("input");u.on("click",function(){i.val()?S.location.href="/pages/elective.html?keyword="+i.val():S.location.href="/pages/elective.html"})})(a)}},calendar:function(){var e=this;if(e.$calendar=o(".module[data-type=calendar]"),e.$calendar.length<1)return!1;loadScriptmin.apply(e,["/design/designstatic/design/js/simple-calendar.js",function(n){for(var s=0,a=n.length;s<a;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 a=e.$Map.eq(n),t=JSON.parse(a.attr("data-map")),u=a.attr("data-mid");self["map"+u]=new BMap.Map(u),self["myGeo"+u]=new BMap.Geocoder,self["map"+u].enableScrollWheelZoom(!0);var i=new BMap.ScaleControl({anchor:BMAP_ANCHOR_TOP_LEFT}),r=new BMap.NavigationControl,p=new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_RIGHT,type:BMAP_NAVIGATION_CONTROL_SMALL});self["map"+u].addControl(i),self["map"+u].addControl(r),self["map"+u].addControl(p),self["myGeo"+u].getPoint(t.address,function(d){if(d){e.point=d,e.city=t.city,self["map"+u].centerAndZoom(d,16);var l=new BMap.Marker(d);self["map"+u].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(i){var r=e;o(".scene-city").hide(),o(".scene-change").hide(),o(".scene-demo").show(),o(".blackone").show(),o("#sceneCitySelect").attr("value",r),setTimeout(function(){o(".cityBox").removeClass("hide")},0)});var a=o("#cityBox a");a.click(function(){var i=o("#sceneCitySelect").val();n.getAjaxScence(i),o(".scene-city").text(i),o(".scene-city").show(),o(".scene-change").show(),o(".scene-demo").hide()});var t=o(".citySelector");t.on("click",".cityslide",function(){var i=o("#sceneCitySelect").val();n.getAjaxScence(i),o(".scene-city").text(i),o(".scene-city").show(),o(".scene-change").show(),o(".scene-demo").hide()}),o("#sceneCitySelect").on("keypress",function(i){setTimeout(function(){if(i.keyCode==13){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()}},300)}),o(document).click(function(i){if(o(".scene-demo").css("display")=="block"&&i.target.className!="scene-change"){var r="\u676D\u5DDE",p=/[^\u4E00-\u9FA5]/g,d=o(".scene-city"),l=o("#sceneCitySelect").val(),c="";u(l.replace(p,"")+"|")!=-1&&l.replace(p,"")!=""?(c=l.replace(p,""),n.getAjaxScence(c)):c=r,o(".scene-city").text(c),o(".scene-city").show(),o(".scene-change").show(),o(this).hide(),o(".scene-demo").hide()}});function u(i){for(var r=0;r<Vcity.allCity.length-1;++r)if(Vcity.allCity[r].indexOf(i)==0)return r;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 a=s.data,t=a.aqi,u="";t<=50&&t>0&&(u="\u4F18\u79C0"),t<=100&&t>50&&(u="\u826F\u597D"),t<=150&&t>100&&(u="\u4E00\u822C"),t<=200&&t>150&&(u="\u5F88\u5DEE"),t>200&&(u="\u5F88\u5DEE"),o(".scene-airquality").text(t+" "+u),t||(u="\u6682\u7F3A",o(".scene-airquality").text(u));for(var i="",r="",p=/[\u4E00-\u9FA5]/g,d=[],l=[],c=o(".scene-ul li"),f=0;f<3;++f){var m=o("#day"+f);switch(d[f]=a.forecast[f].low.replace(p,""),l[f]=a.forecast[f].high.replace(p,""),a.forecast[f].type){case"\u591A\u4E91":i="cloud.png",r="cloud2.png";break;case"\u6674":i="fine.png",r="fine2.png";break;case"\u9634":i="overcast.png",r="overcast2.png";break;case"\u5C0F\u96E8":i="small_rain.png",r="small_rain2.png";break;case"\u5C0F\u5230\u4E2D\u96E8":i="stom_rain.png",r="stom_rain2.png";break;case"\u5927\u96E8":i="big_rain.png",r="big_rain2.png";break;case"\u4E2D\u5230\u5927\u96E8":i="big_rain.png",r="big_rain2.png";break;case"\u66B4\u96E8":i="mbig_rain.png",r="mbig_rain2.png";break;case"\u5927\u66B4\u96E8":i="mbig_rain.png",r="mbig_rain2.png";break;case"\u7279\u5927\u66B4\u96E8":i="mbig_rain.png",r="mbig_rain2.png";break;case"\u5927\u5230\u66B4\u96E8":i="mbig_rain.png",r="mbig_rain2.png";break;case"\u66B4\u96E8\u5230\u5927\u66B4\u96E8":i="mbig_rain.png",r="mbig_rain2.png";break;case"\u5927\u66B4\u96E8\u5230\u7279\u5927\u66B4\u96E8":i="mbig_rain.png",r="mbig_rain2.png";break;case"\u96E8\u5939\u96EA":i="rain_snow.png",r="rain_snow2.png";break;case"\u9635\u96EA":i="quick_snow.png",r="quick_snow2.png";break;case"\u5C0F\u96EA":i="small_snow.png",r="small_snow2.png";break;case"\u5C0F\u5230\u4E2D\u96EA":i="mid_snow.png",r="mid_snow2.png";break;case"\u4E2D\u96EA":i="mid_snow.png",r="mid_snow2.png";break;case"\u4E2D\u5230\u5927\u96EA":i="mid_big_snow.png",r="mid_big_snow2.png";break;case"\u5927\u5230\u66B4\u96EA":i="big_snow.png",r="big_snow2.png";break;case"\u96FE":i="fog.png",r="fog2.png";break;case"\u6C99\u5C18\u66B4":i="sand.png",r="sand2.png";break;case"\u6D6E\u5C18":i="sand.png",r="sand2.png";break;case"\u626C\u6C99":i="sand.png",r="sand2.png";break;case"\u5F3A\u6C99\u5C18\u66B4":i="sand.png",r="sand2.png";break;case"\u96FE\u973E":i="sand.png",r="sand2.png";break;case"\u51BB\u96E8":i="ice_rain.png",r="ice_rain2.png";break;case"\u4E2D\u96E8":i="mid_rain.png",r="mid_rain2.png";break;case"\u96F7\u9635\u96E8\u4F34\u6709\u51B0\u96F9":i="quick_rain_ice.png",r="quick_rain_ice2.png";break;case"\u9635\u96E8":i="quick_rain.png",r="quick_rain2.png";break;case"\u96F7\u9635\u96E8":i="lquick_rain.png",r="lquick_rain2.png";break;case"\u65E0\u5929\u6C14\u7C7B\u578B":i="unknown.png",r="unknown2.png";break;default:i="unknown.png",r="unknown2.png";break}var g=c.eq(f),y=a.forecast[f];g.find(".scene-date").text(y.date),g.hasClass("scene-on")?(g.find(".scene-icon").attr("src","//static.ebanhui.com/ebh/tpl/wnl/images/"+i),g.find(".scene-temp").html(a.wendu+"<b>\xBA</b>")):(g.find(".scene-icon").attr("src","//static.ebanhui.com/ebh/tpl/wnl/images/"+r),g.find(".scene-temp").html(" ")),g.find(".scene-weather").text(y.type),g.find(".scene-tempSection").text(d[f]+"~"+l[f]);var v=y.fengli,w=v.replace("<![CDATA[","",y.fengli);w=w.replace("]]>","",w),g.find(".scene-wind").text(y.fengxiang+" "+w)}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 a=e.$course.eq(n);e.bindCourseEvent(a)}},bindCourseEvent:function(e){var n=this,s=e.attr("data-course");if(!s)return!1;var a=JSON.parse(s);a.item=e;var t=e.find(".navHeader"),u=t.html();n.bindCourseClickTapEvent(a,t,u)},bindCourseClickTapEvent:function(e,n,s){var a=this;n.on("click",".module[data-type=text]",function(){if(a.postAjaxCourseIng)return!1;var t=o(this).find(".box").text().trim();a.carrySeletStyle(t,n,s),a.getSelectClassid(e,t)}),a.getSelectHover(e,n,s)},getSelectClassid:function(e,n){var s=this,a=e.options,t=[];a.forEach(function(u){n==u.name?t=[u.id]:Array.isArray(u.child)&&Array.from(u.child).forEach(function(i){n==i.name&&(t=[u.id,i.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 a=this,t=e.classify;if(n.length>0){if(!t)a.carrySeletStyle("\u5168\u90E8",n,s);else if(t){var u=e.options;t[0]&&u.forEach(function(i){i.id==t[0]&&(t[1]?i.child.forEach(function(r){r.id==t[1]&&a.carrySeletStyle(r.name,n,s)}):a.carrySeletStyle(i.name,n,s))})}}a.getAjaxCourse(e)},carrySeletStyle:function(e,n,s){n.html(s);var a=n.find(".module[data-type=text]");Array.from(a).forEach(function(t){var u=o(t);if(u.find(".box").text().trim()==e){var i=u.find("style.hover");if(i.length>0)i.html(i.text().replace(/:hover/,""));else{var r=u.css("backgroundColor");u.css({color:r=="rgba(0, 0, 0, 0)"?"#fff":r,backgroundColor:u.css("color")})}}})},getAjaxCourse:function(e){var n=this;n.postAjaxCourseIng=!0,o.ajax({type:"get",url:"/api/course/getDressCourseInfoByIds"+window.tsnfors,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="",a,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},u=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"},i=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":a=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":a=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('+u(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">'+i(c)+"</span>":"")+" </p> </a> </li>"};break;case"twlb":a=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('+u(c)+')"></div>':"")+' </div> <div class="rightBox"> <p><span class="title">'+c.courseName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+i(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 r="";parseInt(n[0].courseType)==2||parseInt(n[0].courseType)==4?r="/pages/bundle.html?cid="+n[0].courseId:r="/pages/info.html?cid="+n[0].courseId,s+='<li class="one"><a style="padding-left: 170px;height: 110px;" href="'+r+'"><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>",a=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":a=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">'+i(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 p=0,d=n.length;p<d;p++)if(!(e.styleType=="ttlb"&&p==0)){var l=n[p];s+=a(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 a=e.$courseware.eq(n);e.getAjaxCourseware(a)}},getAjaxCourseware:function(e){var n=this,s=e.attr("data-courseware");if(!s)return!1;var a=JSON.parse(s);a.item=e,o.ajax({type:"get",url:"/api/course/getCourseWareInfoByIds"+window.tsnfors,data:{courseWareIds:a.courseWareIds?a.courseWareIds.join(","):a.courseWareIds,beginNum:a.startNum,endNum:a.endNum,isIndex:1},contentType:"application/json",dataType:"json",success:function(t){t.success&&n.renderCourseware(a,t.data)},error:function(t){console.log("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25")}})},isLiveUrl:function(e){var n=e.courseWareType+"",s=e.courseWareId,a=e.courseId,t=e.price,u="",i=!1;switch(n){case"1":i=!0;break;case"2":i=!0;break;case"3":i=!0;break;case"4":i=!0;break;case"5":i=!0;break;default:i=!1}return u=t?"/pages/ware.html?cid="+a+"&rid="+s:"/course/"+a+".shtml?cid="+a,u},renderCourseware:function(e,n){var s=this,a="",t;switch(e.styleType){case"wzlb":t=function(p){return'<li><a href="'+s.isLiveUrl(p)+'"><span class="title">'+p.courseWareName+'</span><span class="teacher">'+p.realName+"</span></a></li>"};break;case"xtwlb":t=function(p){return'<li> <a href="'+s.isLiveUrl(p)+'"> <div class="coverBox"> <div class="maskBox"> <img src="'+(p.cover?(window.cdnPath||"")+p.cover:"/design/designstatic/common/image/course/jxzb_ware.png")+'"/> <div class="coverMask">'+(parseInt(e.sDesc)==1?p.introduce:"")+'</div> </div> </div> <p class="title" title="'+p.courseWareName+'">'+p.courseWareName+"</p>"+(parseInt(e.sTeacher)==1?'<p class="teacher">'+p.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+p.popularityCount+"</span>":"")+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+(p.price?"\uFFE5"+JSON.parse(p.price)[0]/100+"/"+JSON.parse(p.price)[1]+"\u5929":"\u514D\u8D39")+"</span>":"")+" </p> </a> </li>"};break;case"twlb":t=function(p){return'<li> <a href="'+s.isLiveUrl(p)+'"> <div class="coverBox"> <img src="'+(p.cover?(window.cdnPath||"")+p.cover:"/design/designstatic/common/image/course/jxzb_ware.png")+'"/> </div> <div class="rightBox"> <p><span class="title">'+p.courseWareName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+(p.price?"\uFFE5"+JSON.parse(p.price)[0]/100+"/"+JSON.parse(p.price)[1]+"\u5929":"\u514D\u8D39")+"</span>":"")+"</p>"+(parseInt(e.sDesc)==1?'<p class="introduce" title="'+p.introduce+'">'+p.introduce+"</p>":"")+(parseInt(e.sTeacher)==1?'<p class="teacher">'+p.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+p.popularityCount+"</span>":"")+" </p> </div> </a> </li>"};break;case"ttlb":a+='<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(p){return'<li><a href="'+s.isLiveUrl(p)+'"><span class="title">'+p.courseWareName+'</span><span class="teacher">'+p.realName+"</span></a></li>"};break;case"btrqlb":t=function(p){return'<li> <a href="'+s.isLiveUrl(p)+'"> <div class="rightBox"> <p><span class="title">'+p.courseWareName+"</span>"+(parseInt(e.sPriceDate)==1?'<span class="sPriceDate">'+(p.price?"\uFFE5"+JSON.parse(p.price)[0]/100+"/"+JSON.parse(p.price)[1]+"\u5929":"\u514D\u8D39")+"</span>":"")+"</p>"+(parseInt(e.sDesc)==1?'<p class="introduce" title="'+p.introduce+'">'+p.introduce+"</p>":"")+(parseInt(e.sTeacher)==1?'<p class="teacher">'+p.realName+"</p>":"")+' <p class="info">'+(parseInt(e.sNum)==1?'<span class="sNum"><i class="iconfont icon-eye"></i>'+p.popularityCount+"</span>":"")+" </p> </div> </a> </li>"};break;default:}for(var u=0,i=n.length;u<i;u++)if(!(e.styleType=="ttlb"&&u==0)){var r=n[u];a+=t(r)}e.item.find("ul").html(a)},information:function(e){var n=this;n.$article=o(".module[data-type=article]");for(var s=0,a=n.$article.length;s<a;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 a=JSON.parse(s);a.item=e,o.ajax({type:"get",url:"/api/disk/firstHomepageDetail"+window.tsnfors,data:{InfoTypeId:a.classify[a.classify.length-1],beginNum:a.startNum,endNum:a.endNum,isAll:a.isAll},contentType:"application/json",dataType:"json",success:function(t){t.success&&n.renderArticle(a,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(),a=n.getMonth()+1,t=n.getDate();return s+"-"+a+"-"+t},renderArticle:function(e,n){var s=this,a="",t,u=function(l){return location.port=="81","/pubinfo/"+l+".shtml"};switch(e.styleType){case"wzlb":t=function(l){return'<li><a href="'+u(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="'+u(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="'+u(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="'+u(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="'+u(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="'+u(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 i=document.createElement("div"),r=0,p=n.length;r<p;r++){var d=n[r];d.computerPicPath=d.computerPicPath?JSON.parse(d.computerPicPath)[0].sourcePath:"/design/designstatic/common/image/information/defult.jpg",i.innerHTML=d.detail,d.detail=i.innerText,a+=t(d,r)}e.item.find("ul").html(a)},picture:function(){var e=this,n=o(".module[data-type=picture]");if(n.length<1)return!1;for(var s=o(window).width(),a=o(window).height(),t=o(document).height(),u=0,i=n.length;u<i;u++){var r=n.eq(u),p=r.find("img").attr("src");d(p,function(l,c){var f=parseInt(r[0].style.width);if(f>1440&&f<s){var m=(f-1440)/2;r.css({maxWidth:f+"px",left:"-"+m+"px"}),r.find("img").css({maxWidth:f+"px"})}else if(s>1440&&f>s){var m=(s-1440)/2;r.css({maxWidth:s+"px",left:"-"+m+"px"}),r.find("img").css({maxWidth:s+"px"})}else s<1440&&f>s&&(r.css({maxWidth:"1440px",left:"0px"}),r.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(g,y){var v=parseInt(f[0].style.width);if(v>1440&&v<s){var w=(v-1440)/2;f.css({maxWidth:v+"px",left:"-"+w+"px"}),f.find("img").css({maxWidth:v+"px"})}else if(s>1440&&v>s){var w=(s-1440)/2;f.css({maxWidth:s+"px",left:"-"+w+"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"+window.tsnfors,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),setTimeout(function(){n.showLoginModal(e.loginPopup)},200)},showLoginModal:function(e){var n=sessionStorage.getItem("loginPopup")||0;sessionStorage.setItem("loginPopup",1);var s=function(){window.user&&window.user.loginLayer(function(a){parseInt(a.code)==200&&a.success&&window.location.reload()})};!n&&e&&window.user&&window.user.isLogin(function(a){a.success||s()})},summary:function(e){var n=this;if(n.$introduce=o(".module[data-type=introduce]"),n.$introduce.length<1)return!1;for(var s=0,a=n.$introduce.length;s<a;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,a=n.$qrcode.length;s<a;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,a=n.$logo.length;s<a;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,a=n.length;s<a;s++){var t=n.eq(s),u=t.css("animationName");u!="none"&&(t.css("animationIterationCount")!="infinite"&&(t.attr("data-kui-anim",u),t.css("animationName","")),e.animArr.push(t))}}};A.init()})(jQuery,window);
|