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

2 lines
16 KiB
JavaScript

var cdnPath="",wapurl=window.location.origin+"/pages/wap/bundle.html"+window.location.search;getPar("cid")||(window.location.href="/");var urls=location.search;if(urls.indexOf("?")!=-1){/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)&&(window.location.href=wapurl);var ster=urls.substr(1),sty=ster.split("&"),cide=sty[0].split("cid="),usid=ster.split("&uid=")}var deusid=usid[1]?usid[1].split(","):[],sceneId=getPar("sceneId")||"",sceneType=getPar("sceneType")?getPar("sceneType"):0,urlpd=window.location.href,futit,retit,userInfo,channels=getchannel();function details(i){$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/jwt/getLoginUser?projectid=45",data:{},dataType:"json",async:!0,success:function(d){if(d.code==200){userInfo=d.data,i&&i(d);for(var e=d.data.userId,r="",o="",u="\u8BFE\u7A0B\u8BE6\u60C5",v="",h=deusid,t=[],y=0;y<h.length;y++)e!=parseInt(h[y])&&t.push(h[y]);for(var y=0,f=t.length;y<f;y++){var g=t[y];y<3&&(v+=","+g)}v=usid[0]+"&uid="+e+v,r=window.location.origin+window.location.pathname+"?"+v,window.history.replaceState(o,u,r);var X=window.location.origin+"/pages/wap/bundle.html"+window.location.search;if(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)){var b=document.referrer;b.indexOf("?")==-1&&(window.location.href=X)}}}}),$.ajax({headers:{token:getCookie("token")},type:"GET",contentType:"application/json",url:"/api/course/getCourseDetail?projectid=12",data:{courseId:getPar("cid"),isFromLive:sceneType=="1"?1:void 0,sceneId:sceneId||void 0},dataType:"json",async:!0,success:function(d){var e=d.data,r=e.introduce,o=e.personNumLimit,u=e.personNumLimit-e.personNumCount,v=e.isInCart,h=e.deadline,t=e.price,y=window.location.href,f=e.courseName,h=e.deadline;retit=e.courseName;var g=e.courseId,X=e.isPay,b=e.cover,de=e.isInCart;if(e.courseType==3)var J=3;else var J=4;var le=location.search;if(le.indexOf("?")!=-1)var Y=le.substr(1),he=Y.split("&"),xe=he[0].split("cid="),pe=Y.split("&uid=");var M=window.location.origin+window.location.pathname+"?"+Y,E=pe[1]?pe[1].split(","):[],G=e.parentCourseId,L=new Array,m=new Array;e.parentCourseId==0?(L[0]={goodsId:g,price:t,goodsUrl:M,goodsType:J,goodsName:f,cover:b,introduce:r,endTime:h},m[0]={courseId:g,courseName:f,orderTitle:f,orderType:J,price:t,firstLevelId:E[1],secondLevelId:E[2],thirdLevelId:E[3]}):(L[0]={goodsId:g,price:t,goodsUrl:M,goodsType:J,goodsName:f,cover:b,sourceSchoolCourseId:G,introduce:r,endTime:h},m[0]={courseId:g,courseName:f,orderTitle:f,orderType:J,price:t,firstLevelId:E[1],secondLevelId:E[2],thirdLevelId:E[3],sourceSchoolCourseId:G}),sceneType==1&&(m[0].sceneType="1",m[0].sceneId=sceneId);var ye="<img src="+(cdnPath+e.cover)+" />";$(".curfeng").html(ye);var s='<h2 class="curhtit">'+e.courseName+"</h2>";e.childClassifyName==""?s+='<p class="curint">'+e.mainClassifyName+"</p>":s+='<p class="curint">'+e.mainClassifyName+" > "+e.childClassifyName+"</p>",e.isFavorite==!0?(s+='<span class="curcolls">\u5DF2\u6536\u85CF</span>',s+='<span style="display:none;" class="curcoll">\u6536\u85CF</span>'):(s+='<span class="curcoll">\u6536\u85CF</span>',s+='<span style="display:none;" class="curcolls">\u5DF2\u6536\u85CF</span>'),s+='<span class="curshare">\u5206\u4EAB</span>',s+='<p class="cursimp">'+r+"</p>",s+='<p class="cursered">',e.price==0?s+='<span class="curselv">\u514D\u8D39</span>':(s+='<span class="cursi">\uFFE5</span>'+(e.price/100).toFixed(2)+"",s+='<span class="cursezhe">\uFFE5'+(e.oldPrice/100).toFixed(2)+"</span>"),s+="</p>",e.deadline==0?s+='<p class="curexplain">\u81EA\u8D2D\u4E70\u4E4B\u65E5\u8D77<span class="curseorange">\u6C38\u4E45\u6709\u6548':s+='<p class="curexplain">\u81EA\u8D2D\u4E70\u4E4B\u65E5\u8D77<span class="curseorange">'+e.deadline+"\u5929</span>\u6709\u6548",e.personNumLimit!=0&&(s+='<span class="ml10" style="color:#b2b2b2;">\u5DF2\u8D2D\u4E70<span class="redes">'+e.personNumCount+"</span>/"+e.personNumLimit+"</span>"),s+="</p>",e.isOpenSignUp==!0?e.isPay==!0?s+='<a class="cursign" href="javascript:void(0);">\u8FDB\u5165\u5B66\u4E60</a>':e.price==0?s+='<a class="cursign" href="javascript:void(0);">\u514D\u8D39\u62A5\u540D</a>':(v==!0?s+='<a class="curshop huise" href="javascript:void(0);">\u52A0\u5165\u8D2D\u7269\u8F66</a>':s+='<a class="curshop" href="javascript:void(0);">\u52A0\u5165\u8D2D\u7269\u8F66</a>',s+='<a class="cursign" href="javascript:void(0);">\u7ACB\u5373\u8D2D\u4E70</a>'):(s+='<a class="curshop huise" href="javascript:void(0);">\u52A0\u5165\u8D2D\u7269\u8F66</a>',s+='<a class="cursign huise" href="javascript:void(0);">\u7ACB\u5373\u8D2D\u4E70</a>');for(var l="",Z=0,ge=e.courseSubList.length;Z<ge;Z++){var I=e.courseSubList[Z];l+='<div class="detailedlist">',l+='<img class="detailedico" src='+(cdnPath+I.cover)+" />",l+='<div class="detarig">',l+='<div class="detailedrig">',l+='<h2 class="detailedtit">'+I.courseName+"</h2>",I.childClassifyName==""?l+='<p class="detailedlie">'+I.mainClassifyName+"</p>":l+='<p class="detailedlie">'+I.mainClassifyName+" > "+I.childClassifyName+"</p>",l+='<p class="detailedmain">'+I.introduce+"</p>",l+='<p class="detaileder">',I.price==0?l+='<span class="curselv">\u514D\u8D39</span>':(l+='<span class="detailedred">\uFFE5'+(I.price*(e.price/e.oldPrice)/100).toFixed(2)+"</span>",l+='<span class="detailedzhe">\uFFE5'+(I.price/100).toFixed(2)+"</span>"),l+="</p>",l+="</div>",l+='<a class="detailedar" href="/pages/info.html?cid='+I.courseId+'">\u67E5\u770B\u8BE6\u60C5</a>',l+="</div>",l+="</div>"}$(".detailed").html(l),$(".curwithin").html(s),$(".coursemain").html(e.detail)==""?$(".coursemain").html("<div class='nodata'></div>"):$(".coursemain").html(e.detail),$(".active span").html(e.courseCount),$(".curcoll").on("click",function(){channels=getchannel(),user.isLogin(function(n){parseInt(n.code)==200?$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/collectCourse?projectid=37",data:{courseId:g,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel},dataType:"json",async:!0,success:function(p){$(".curcoll").hide(),$(".curcolls").show()}}):parseInt(n.code)==401?user.loginLayer(function(p){parseInt(p.code)==200&&details()}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}),$(".curcolls").on("click",function(){user.isLogin(function(n){parseInt(n.code)==200?$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/cancelCollectCourse?projectid=37",data:{courseId:g},dataType:"json",async:!0,success:function(p){$(".curcolls").hide(),$(".curcoll").show()}}):parseInt(n.code)==401?user.loginLayer(function(p){parseInt(p.code)==200&&details()}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})});var Ie="/static/front/images/shareBackground.png",R=e;$(".curshare").on("click",function(){R.userInfo=userInfo,R.iscourse=!0,user.isLogin(function(n){if(parseInt(n.code)==200){var p=window.imgEditor,N=this,A=n.data.userId,j=window.location.href;p.shareLayer(j,Ie,function(C){C.success||N.unlogin()},R)}else parseInt(n.code)==401?user.loginLayer(function(C){parseInt(C.code)==200&&details()}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}),$(".cursign").on("click",function(){channels=getchannel(),e.isOpenSignUp==!0&&user.isLogin(function(n){parseInt(n.code)==200?n.data.userTypeExact=="STUDENT"?X==!0?window.location.href="/myroom/#/learn/center":u<=0&&o!=0?layer.alert("\u8D2D\u4E70\u4EBA\u6570\u5DF2\u6EE1\uFF01"):t==0?(channels.orderList=m,layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u8D2D\u4E70\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/createOrder?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify(channels),async:!0,success:function(p){window.location.href="/myroom/#/learn/center"}}),layer.closeAll()}})):$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/shoppingCart?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify({goodsList:coverUid(L),pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(p){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u8D2D\u4E70\uFF01"):parseInt(n.code)==401?user.loginLayer(function(p){parseInt(p.code)==200&&details(function(N){if(N.data.userTypeExact=="STUDENT"){var A=N.data.userId,j="",C="",ee="\u8BFE\u7A0B\u8BE6\u60C5",T="",B=location.search;if(B.indexOf("?")!=-1)var _=B.substr(1),ae=_.split("&"),me=ae[0].split("cid="),z=_.split("&uid=");for(var w=z[1]?z[1].split(","):[],x=w,S=[],c=0;c<x.length;c++)A!=parseInt(x[c])&&S.push(x[c]);for(var c=0,re=S.length;c<re;c++){var se=S[c];c<3&&(T+=","+se)}T=usid[0]+"&uid="+A+T,j=window.location.origin+window.location.pathname+"?"+T,window.history.replaceState(C,ee,j),$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseDetail?projectid=12",data:{courseId:getPar("cid"),isFromLive:sceneType=="1"?1:void 0,sceneId:sceneId||void 0},dataType:"json",async:!0,success:function(Q){var a=Q.data,Te=a.courseId,D=a.price,ie=a.introduce,we=window.location.href,k=a.courseName,H=a.courseId,oe=a.cover,ue=a.isPay,ne=a.deadline;retit=a.courseName,hid=a.activityId;var ve=a.personNumLimit,fe=a.personNumLimit-a.personNumCount,Le=a.isInCart;if(types=a.type,a.courseType==3)var O=3;else var O=1;var Ne=a.isInCart,q=location.search;if(q.indexOf("?")!=-1)var U=q.substr(1),te=U.split("&"),je=te[0].split("cid="),K=U.split("&uid=");var ce=window.location.origin+window.location.pathname+"?"+U,P=K[1]?K[1].split(","):[],V=a.parentCourseId,F=new Array,W=new Array;V==0?(W[0]={goodsId:H,price:D,goodsUrl:ce,goodsType:O,goodsName:k,cover:oe,operateType:1,introduce:ie,endTime:ne},F[0]={courseId:H,courseName:k,orderTitle:k,orderType:O,price:D,firstLevelId:P[1],secondLevelId:P[2],thirdLevelId:P[3]}):(W[0]={goodsId:H,price:D,goodsUrl:ce,goodsType:O,goodsName:k,cover:oe,sourceSchoolCourseId:V,operateType:1,introduce:ie,endTime:ne},F[0]={courseId:H,courseName:k,orderTitle:k,orderType:O,price:D,firstLevelId:P[1],secondLevelId:P[2],thirdLevelId:P[3],sourceSchoolCourseId:V}),sceneType==1&&(F[0].sceneType="1",F[0].sceneId=sceneId),ue==!0?window.location.href="/myroom/#/learn/center":fe<=0&&ve!=0?layer.alert("\u8D2D\u4E70\u4EBA\u6570\u5DF2\u6EE1\uFF01"):D==0?(channels.orderList=F,layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u8D2D\u4E70\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/createOrder?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify(channels),async:!0,success:function(Ce){window.location.href="/myroom/#/learn/center"}}),layer.closeAll()}})):$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/shoppingCart?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify({goodsList:coverUid(W),pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(Ce){window.location.href="/pay/#/shopping"}})}})}else layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u8D2D\u4E70\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}),$(".curshop").on("click",function(){channels=getchannel(),e.isOpenSignUp==!0&&user.isLogin(function(n){parseInt(n.code)==200?n.data.userTypeExact=="STUDENT"?v==!0?$(".curshop").addClass("huise"):u==0&&o!=0?layer.alert("\u8D2D\u4E70\u4EBA\u6570\u5DF2\u6EE1\uFF01"):de==!1&&$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/shoppingCart?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify({goodsList:coverUid(L),pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(p){details(),layer.msg("\u52A0\u5165\u6210\u529F",{time:1500})}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u52A0\u5165\u8D2D\u7269\u8F66\uFF01"):parseInt(n.code)==401?user.loginLayer(function(p){parseInt(p.code)==200&&details(function(N){if(N.data.userTypeExact=="STUDENT"){var A=N.data.userId,j="",C="",ee="\u8BFE\u7A0B\u8BE6\u60C5",T="",B=location.search;if(B.indexOf("?")!=-1)var _=B.substr(1),ae=_.split("&"),me=ae[0].split("cid="),z=_.split("&uid=");for(var w=z[1]?z[1].split(","):[],x=w,S=[],c=0;c<x.length;c++)A!=parseInt(x[c])&&S.push(x[c]);for(var c=0,re=S.length;c<re;c++){var se=S[c];c<3&&(T+=","+se)}T=usid[0]+"&uid="+A+T,j=window.location.origin+window.location.pathname+"?"+T,window.history.replaceState(C,ee,j),$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseDetail?projectid=12",data:{courseId:getPar("cid"),isFromLive:sceneType=="1"?1:void 0,sceneId:sceneId||void 0},dataType:"json",async:!0,success:function(Q){var a=Q.data,Te=a.courseId,D=a.price,ie=a.introduce,we=window.location.href,k=a.courseName,H=a.courseId,oe=a.cover,ue=a.isPay,ne=a.deadline;retit=a.courseName,hid=a.activityId;var ve=a.personNumLimit,fe=a.personNumLimit-a.personNumCount,Le=a.isInCart;if(types=a.type,a.courseType==3)var O=3;else var O=1;var Ne=a.isInCart,q=location.search;if(q.indexOf("?")!=-1)var U=q.substr(1),te=U.split("&"),je=te[0].split("cid="),K=U.split("&uid=");var ce=window.location.origin+window.location.pathname+"?"+U,P=K[1]?K[1].split(","):[],V=a.parentCourseId,F=new Array,W=new Array}}),G==0?(L[0]={goodsId:g,price:t,goodsUrl:M,goodsType:ctype,goodsName:f,cover:b,operateType:1,introduce:r,endTime:h},m[0]={courseId:g,courseName:f,orderTitle:f,orderType:ctype,price:t,firstLevelId:w[1],secondLevelId:w[2],thirdLevelId:w[3]}):(L[0]={goodsId:g,price:t,goodsUrl:M,goodsType:ctype,goodsName:f,cover:b,sourceSchoolCourseId:G,operateType:1,introduce:r,endTime:h},m[0]={courseId:g,courseName:f,orderTitle:f,orderType:ctype,price:t,firstLevelId:w[1],secondLevelId:w[2],thirdLevelId:w[3],sourceSchoolCourseId:G}),sceneType==1&&(m[0].sceneType="1",m[0].sceneId=sceneId),v==!0?$(".curshop").addClass("huise"):u==0&&o!=0?layer.alert("\u8D2D\u4E70\u4EBA\u6570\u5DF2\u6EE1\uFF01"):de==!1&&$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/shoppingCart?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify({goodsList:coverUid(L),pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(Q){details(),layer.msg("\u52A0\u5165\u6210\u529F",{time:1500})}})}else layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u52A0\u5165\u8D2D\u7269\u8F66\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}),$.ajax({type:"GET",headers:{token:getCookie("token")},url:"/api/school/getSubheadByHostName?projectid=12",contentType:"application/json",dataType:"json",data:{},async:!0,success:function(n){n.data.subhead?futit="-"+n.data.subhead:futit="";var p="";p=retit+futit,$("title").html(p)}})}})}$(function(){setTimeout("details()",10)});function getchannel(){var i,d=localStorage.appAdapt===!0||localStorage.appAdapt==="true";if(d){var e=sessionStorage.getItem("ip")||"",r=sessionStorage.getItem("channel")||"",o=sessionStorage.getItem("gmtStart")||0,u=sessionStorage.getItem("sourceId")||0,v=sessionStorage.getItem("sourceJson")||"",h=sessionStorage.getItem("sourceType")||"";i={ip:e,channel:r,gmtStart:o,sourceId:u,sourceJson:v,sourceType:h}}else{i=sessionStorage.getItem("cluechannel")?JSON.parse(sessionStorage.getItem("cluechannel")):{};var e=sessionStorage.getItem("sourceip");i.ip=e||""}var t=getPar("channel")||"";return t&&(i.channel=t),i.uvcid=localStorage.uvcid||"",i.pvid=sessionStorage.getItem("pvid")||"",i}function getCookie(i){for(var d=document.cookie,e=d.split("; "),r=0;r<e.length;r++){var o=e[r].split("=");if(o[0]==i)return o[1]}return""}function coverUid(i){var d=i[0].goodsUrl,e=getParUrl("uid",d).split(","),r=decrypt(localStorage.encryptId),o=r.split(",");if(e.length<5&&r){for(var u=[e[0]],v=0,h=o.length;v<h;v++){var t=o[v];e[0]!=t&&u.length<4&&u.push(t)}var y=d.split("uid")[0]+"uid="+u.join(",");i[0].goodsUrl=y}return i}function getPar(i){var d=document.location.href,e=d.indexOf(i+"=");if(e==-1)return!1;var r=d.slice(i.length+e+1),o=r.indexOf("&");return o!=-1&&(r=r.slice(0,o)),r}function getParUrl(i,d){var e=d||document.location.href,r=e.indexOf(i+"=");if(r==-1)return!1;var o=e.slice(i.length+r+1),u=o.indexOf("&");return u!=-1&&(o=o.slice(0,u)),o}