2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
"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='<span class="price">'+(a.showPrice==1?a.price=="0"?'<span style="color: #43bc60;">\u514D\u8D39</span>':'<span style="color: #fa5353;font-size: 16px;">\uFFE5'+(a.price/100).toFixed(2)+"</span>":"")+"</span>",i='<span class="mainTeacher" title='+a.mainTeacher+">"+a.mainTeacher+"</span>",s=parseInt(a.orderCount)?'<span class="buynum">'+a.orderCount+"\u4EBA\u8D2D\u4E70</span>":"",o=parseInt(a.popularityCount)?'<span class="viewnum">'+a.popularityCount+"\u4EBA\u89C2\u770B</span>":"",t='<div class="course-info"><p>'+e+i+'</p><p style="clear: both;">'+s+o+"</p></div>";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='<div class="course-cover"><a class="course-link" href="'+u+'" target="_blank">',d='<a class="li-btn" href="'+u+'" target="_blank"><a class="item-name" href="'+u+'" title="'+r.courseName+'">'+r.courseName+"</a>"+m,w="<img src="+(cdnPath+r.cover)+">";r.originalCover&&(w="<img src="+(cdnPath+resetImgSrc(r.cover))+' data-errorcount="0" onerror="coverError("'+(cdnPath+r.cover)+'")" >'),l+="<li>"+d+w+"<div></div></a>";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='<a class="course-oper '+f.addClass+'" href="'+f.href+'" target="_blank">'+f.content+"</a>";l+=z,l+="</div>",l+=renderBottomInfo(r),l+="</a>",l+="</li>"}):x.forEach(function(r){l+='<div class="pdtit">'+r.classifyName+
|