filesbox/web/dist/design/designstatic/front/routine/js/electives.js
2024-07-26 14:10:54 +08:00

2 lines
4.2 KiB
JavaScript

function list(l,c,t,s,r){$.ajax({headers:{token:getCookie("token"),resolution:window.screen.width+"*"+window.screen.height},type:"GET",url:"/api/course/getSelectionCourseList?projectid=12",data:{sortType:l,currentPage:r,sortord:7,mainClassify:c,condition:s,childClassify:t},dataType:"json",async:!0,success:function(o){for(var n=o.data,a="",h="",i=0,u=n.list.length;i<u;i++){var e=n.list[i],f=e.courseId;a+="<li>",e.isPay==!0?(a+='<a style="width:100%;height:100%;display:block;" href="/myroom/#/learn/center" target="_blank"></a>',a+='<a class="item-name" href="/myroom/#/learn/center" target="_blank" title='+e.courseName+">"+e.courseName+"</a>",a+='<div class="course-cover">',a+='<a class="course-link" href="/myroom/#/learn/center" target="_blank">'):e.courseType==2?(a+='<a style="width:100%;height:100%;display:block;" href="/pages/routine/bundle.html?cid='+e.courseId+'" target="_blank">',a+='<a class="item-name" href="/pages/routine/bundle.html?cid='+e.courseId+'" target="_blank" title='+e.courseName+">"+e.courseName+"</a>",a+='<div class="course-cover">',a+='<a class="course-link" href="/pages/routine/bundle.html?cid='+e.courseId+'" target="_blank">'):(a+='<a style="width:100%;height:100%;display:block;" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank">',a+='<a class="item-name" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank" title='+e.courseName+">"+e.courseName+"</a>",a+='<div class="course-cover">',a+='<a class="course-link" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank">'),a+="<img src="+((window.cdnPath||"")+e.cover)+">",a+="<div><p>"+e.introduce+"</p></div>",a+="</a>",e.isPay==!0?a+='<a class="course-oper study" href="/myroom/#/learn/center" target="_blank">\u7ACB\u5373\u5B66\u4E60</a>':e.type==1?a+='<a class="course-oper secondkill" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank">\u9650\u65F6\u79D2\u6740</a>':e.type==2?a+='<a class="course-oper collage" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank">\u62FC\u56E2\u5546\u54C1</a>':e.type==3?a+='<a class="course-oper redprice" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank">\u780D\u4EF7\u5546\u54C1</a>':e.courseType==2?a+='<a class="course-oper coursepack" href="/pages/routine/bundle.html?cid='+e.courseId+'" target="_blank">\u8BFE\u7A0B\u5305</a>':a+='<a class="course-oper" href="/pages/routine/info.html?cid='+e.courseId+'" target="_blank">\u7ACB\u5373\u62A5\u540D</a>',a+="</div>",a+='<a class="course-info" href="javascript:void(0);">',a+='<span class="speaker" title='+e.mainTeacher+">"+e.mainTeacher+"</span> ",a+="</a>",a+="</a>",a+="</li>"}$("#pagination1").pagination({currentPage:r,totalPage:Math.ceil(n.total/20),count:5,callback:function(d){list(tab,c,t,s,d)}}),n.list.length==0?$(".coursemain ul").html("<div class='nodata'></div>"):$(".coursemain ul").html(a)}})}var keyWord=getPar("keyword"),classifyData=[],tab="",pid="",cid="",keyWord="";$(".filterrig").on("click","a",function(){var l=$(this);if(l.text()=="\u5168\u90E8")$(".plate-nav2 a").hide(),$(".filterrig a").removeClass("curs"),pid="",cid="",keyWord="",$(this).addClass("curs");else if(l.hasClass("pid")){$(".plate-nav2").show(),$(".plate-nav a").removeClass("curs"),$(this).addClass("curs"),pid=l.attr("tabs");for(var c=[],t=0,s=classifyData.length;t<s;t++){var r=classifyData[t];r.courseClassifyId==pid&&(c=r.children)}var o="";for(cid="",z=0,lenz=c.length;z<lenz;z++){var r=c[z];z==0&&(o+='<a class="cid curs" tabs="" href="javascript:void(0);">\u5168\u90E8 </a>'),o+='<a class="cid" tabs="'+r.courseClassifyId+'" href="javascript:void(0);">'+r.classifyName+"</a>"}$(".plate-nav2").html(o)}else l.hasClass("cid")&&($(".plate-nav2 a").removeClass("curs"),$(this).addClass("curs"),cid=l.attr("tabs"));list(tab,pid,cid,keyWord,1)}),$(".searchtxt").val(keyWord),$(".searchbtn").on("click",function(){keyWord=$(".searchtxt").val(),list(tab,pid,cid,keyWord,1)});function getCookie(l){for(var c=document.cookie,t=c.split("; "),s=0;s<t.length;s++){var r=t[s].split("=");if(r[0]==l)return r[1]}return""}function getPar(l){var c=decodeURI(decodeURI(location.search)),t=c.indexOf(l+"=");if(t==-1)return"";var s=c.slice(l.length+t+1),r=s.indexOf("&");return r!=-1&&(s=s.slice(0,r)),s}