"use strict";var cdnPath="",wapurl=window.location.origin+"/pages/wap/elective.html"+window.location.search;/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)&&(window.location.href=wapurl);var pid=getPar("mainClassify")?+getPar("mainClassify"):void 0,cid=getPar("childClassify")?+getPar("childClassify"):void 0,keyWord=getPar("keyword"),classifyData=[],classifyData2=[],classifyData3=[],classifyData4=[],classifyData5=[],classifyData6=[],tab="";keyWord="";function getCookie(a){var e=document.cookie.match(new RegExp("(^| )"+a+"=([^;]*)(;|$)"));return e?unescape(e[2]):""}function getPar(a){var e=decodeURI(decodeURI(window.location.search)),i=e.indexOf(a+"=");if(i===-1)return"";var s=e.slice(a.length+i+1),o=s.indexOf("&");return o!==-1&&(s=s.slice(0,o)),s}function coverError(a){var e=event.target;parseInt(e.dataset.errorcount)==0?(e.setAttribute("data-errorcount",1),e.src=a):parseInt(e.dataset.errorcount)==1&&(e.setAttribute("data-errorcount",2),e.src="/static/common/image/course/defult.jpg")}function resetImgSrc(a){var e=a.replace(/([^.]*).([^.]*)$/g,"$1!large.$2");return e}function renderBottomInfo(a){var e=''+(a.showPrice==1?a.price=="0"?'\u514D\u8D39':'\uFFE5'+(a.price/100).toFixed(2)+"":"")+"",i=''+a.orderCount+"\u4EBA\u8D2D\u4E70":"",o=parseInt(a.popularityCount)?''+a.popularityCount+"\u4EBA\u89C2\u770B":"",t='
";return t}function list(a,e,i,s,o){if(e||i||s)var t="/api/course/getSelectionCourseList?projectid=12";else var t="/api/course/getAllSelectionCourseList?projectid=12";var n=12;$.ajax({headers:{token:getCookie("token"),resolution:window.screen.width+"*"+window.screen.height},type:"GET",url:t,data:{sortType:a,currentPage:o,sortord:7,mainClassify:e,condition:s,childClassify:i,pageSize:n,needPage:"1"},dataType:"json",async:!0,success:function(P){var I=P.data,l="",S="",x=I.list||[];e||i||s?x.forEach(function(r){var c=r.isPay,g=c===void 0?!1:c,h=+r.courseType,p=+r.type,C=+r.price,u=void 0,v=getPar("att")?"&att="+decodeURIComponent(getPar("att")):"",b=getPar("vcardId")?"&vcardId="+decodeURIComponent(getPar("vcardId")):"",y=getPar("shareId")?"&shareId="+decodeURIComponent(getPar("shareId")):"";g?u="/myroom/#/learn/detail/"+r.courseId:h===2||h===4?u="/pages/bundle.html?cid="+r.courseId+v+b+y:u="/pages/info.html?cid="+r.courseId+v+b+y,r.isAllAudio&&(u="/liveclass/songsheet.html?courseId="+r.courseId+v+b+y);var j=r.cover,m='',d=''+r.courseName+""+m,w="
";r.originalCover&&(w="
'),l+="
"+d+w+"";var f={};g?f={addClass:"study",href:"/myroom/#/learn/detail/"+r.courseId,content:"\u7ACB\u5373\u5B66\u4E60"}:p===1?f={addClass:"secondkill",href:"/pages/info.html?cid="+r.courseId,content:"\u9650\u65F6\u79D2\u6740"}:p===2?f={addClass:"collage",href:"/pages/info.html?cid="+r.courseId,content:"\u62FC\u56E2\u5546\u54C1"}:p===3?f={addClass:"redprice",href:"/pages/info.html?cid="+r.courseId,content:"\u780D\u4EF7\u5546\u54C1"}:C===0?f={addClass:"freeup",href:"/pages/info.html?cid="+r.courseId,content:"\u514D"}:h===2||h===4?f={addClass:"coursepack",href:"/pages/bundle.html?cid="+r.courseId,content:"\u8BFE\u7A0B\u5305"}:f={addClass:"",href:"/pages/info.html?cid="+r.courseId,content:"\u7ACB\u5373\u8D2D\u4E70"};var z=''+f.content+"";l+=z,l+=" ",l+=renderBottomInfo(r),l+="",l+=""}):x.forEach(function(r){l+=''+r.classifyName+"
",r.courseList.forEach(function(c){var g=c.isPay,h=g===void 0?!1:g,p=+c.courseType,C=+c.type,u=+c.price,v=void 0;h?v="/myroom/#/learn/detail/"+c.courseId:p===2||p===4?v="/pages/bundle.html?cid="+c.courseId:v="/pages/info.html?cid="+c.courseId;var b=c.cover,y='',j=''+c.courseName+""+y,m="
";c.originalCover&&(m="
'),l+="
"+j+m+"";var d={};h?d={addClass:"study",href:"/myroom/#/learn/detail/"+c.courseId,content:"\u7ACB\u5373\u5B66\u4E60"}:C===1?d={addClass:"secondkill",href:"/pages/info.html?cid="+c.courseId,content:"\u9650\u65F6\u79D2\u6740"}:C===2?d={addClass:"collage",href:"/pages/info.html?cid="+c.courseId,content:"\u62FC\u56E2\u5546\u54C1"}:C===3?d={addClass:"redprice",href:"/pages/info.html?cid="+c.courseId,content:"\u780D\u4EF7\u5546\u54C1"}:u===0?d={addClass:"freeup",href:"/pages/info.html?cid="+c.courseId,content:"\u514D"}:p===2||p===4?d={addClass:"coursepack",href:"/pages/bundle.html?cid="+c.courseId,content:"\u8BFE\u7A0B\u5305"}:d={addClass:"",href:"/pages/info.html?cid="+c.courseId,content:"\u7ACB\u5373\u8D2D\u4E70"};var w=''+d.content+"";l+=w,l+=" ",l+=renderBottomInfo(c),l+="",l+=""})});var k=I.result?I.result.totalPage:1,N=I.hasNextPage?o+parseInt(k):o;$("#pagination2").pagination({currentPage:o,totalPage:N,isShow:!1,keepShowPN:!0,count:4,prevPageText:'',nextPageText:'',callback:function(c){list(tab,e,i,s,c)}});var E=x.length>0?l:"";$(".coursemain ul").html(E)}})}list(1,pid,cid,keyWord,1),$(".filterrig").on("click","a",function(){var a=$(this);if(a.text()==="\u5168\u90E8")$(".plate-nav2,.plate-nav3,.plate-nav4,.plate-nav5,.plate-nav6").hide(),$(".filterrig a").removeClass("curs"),pid="",cid="",keyWord="",$(this).addClass("curs");else if(a.hasClass("cid")){var e=a.attr("zindex")||0;if(e==5)cid=a.attr("tabs"),$(".plate-nav6 a").removeClass("curs"),$(this).addClass("curs");else if(e==4){cid=a.attr("tabs"),$(".plate-nav5 a").removeClass("curs"),$(".plate-nav6").hide(),$(this).addClass("curs");var i=classifyData5.filter(function(o){return o.courseClassifyId==cid});if(classifyData6=(i[0]||{}).children||[],classifyData6.length){var s='\u5168\u90E8 ';classifyData6.forEach(function(o){s+=''+o.classifyName+""}),$(".plate-nav6").html(s),$(".plate-nav6").show()}}else if(e==3){cid=a.attr("tabs"),$(".plate-nav4 a").removeClass("curs"),$(".plate-nav5,.plate-nav6").hide(),$(this).addClass("curs");var i=classifyData4.filter(function(t){return t.courseClassifyId==cid});if(classifyData5=(i[0]||{}).children||[],classifyData5.length){var s='\u5168\u90E8 ';classifyData5.forEach(function(n){s+=''+n.classifyName+""}),$(".plate-nav5").html(s),$(".plate-nav5").show()}}else if(e==2){cid=a.attr("tabs"),$(".plate-nav3 a").removeClass("curs"),$(".plate-nav4,.plate-nav5,.plate-nav6").hide(),$(this).addClass("curs");var i=classifyData3.filter(function(t){return t.courseClassifyId==cid});if(classifyData4=(i[0]||{}).children||[],classifyData4.length){var s='\u5168\u90E8 ';classifyData4.forEach(function(n){s+=''+n.classifyName+""}),$(".plate-nav4").html(s),$(".plate-nav4").show()}}else if(e==1){cid=a.attr("tabs"),$(".plate-nav2 a").removeClass("curs"),$(".plate-nav3,.plate-nav4,.plate-nav5,.plate-nav6").hide(),$(this).addClass("curs");var i=classifyData2.filter(function(t){return t.courseClassifyId==cid});if(classifyData3=(i[0]||{}).children||[],classifyData3.length){var s='\u5168\u90E8 ';classifyData3.forEach(function(n){s+=''+n.classifyName+""}),$(".plate-nav3").html(s),$(".plate-nav3").show()}}else{pid=a.attr("tabs"),$(".plate-nav a").removeClass("curs"),$(".plate-nav2,.plate-nav3,.plate-nav4,.plate-nav5,.plate-nav6").hide(),$(this).addClass("curs");var i=classifyData.filter(function(t){return t.courseClassifyId==pid});if(classifyData2=i[0].children||[],classifyData2.length){var s='\u5168\u90E8 ';classifyData2.forEach(function(n){s+=''+n.classifyName+""}),$(".plate-nav2").html(s),$(".plate-nav2").show()}}}list(tab,pid,cid,keyWord,1)}),$(".searchtxt").val(keyWord),$(".searchbtn").on("click",function(){keyWord=$(".searchtxt").val(),list(tab,pid,cid,keyWord,1)}),$.ajax({type:"GET",url:"/api/course/getClassifys?projectid=12",contentType:"application/json",dataType:"json",data:{needShare:!0,needOther:!1},async:!0,success:function(e){classifyData=e.data||[];var i="";if(classifyData.forEach(function(t){i+=''+t.classifyName+"",t.courseClassifyId===pid&&(classifyData2=t.children||[])}),$(".plate-nav").append(i),classifyData2.length){$(".plate-nav a").removeClass("curs"),$(".plate-nav a[tabs="+pid+"]").addClass("curs");var s='\u5168\u90E8 ';classifyData2.forEach(function(t){s+=''+t.classifyName+"",t.courseClassifyId===cid&&(classifyData3=t.children||[])}),$(".plate-nav2").html(s),$(".plate-nav2").show(),cid&&($(".plate-nav2 a").removeClass("curs"),$(".plate-nav2 a[tabs="+cid+"]").addClass("curs"))}if(classifyData3.length){var o='\u5168\u90E8 ';classifyData3.forEach(function(t){o+=''+t.classifyName+""}),$(".plate-nav3").html(o),$(".plate-nav3").show()}}}),$(".coursetit li").on("click",function(){$(".coursetit li").removeClass("curs"),$(this).addClass("curs"),tab=$(this).attr("tabs"),list(tab,pid,cid,keyWord,1)});function getGlobalDesignConfig(){var a=setInterval(function(){if(window.roominfo){clearInterval(a);var e=window.roominfo.schoolId;$.getScript(cdnPath+"/uploads/common/designConfig/"+e+".js",function(){if(window.DesignConfig){var i=(window.DesignConfig.viewNum?"viewNumShow ":"")+(window.DesignConfig.buyNum?"buyNumShow ":"")+(window.DesignConfig.price?"priceShow ":"");$(".coursemain ul").addClass(i)}})}},200)}getGlobalDesignConfig();