2 lines
31 KiB
JavaScript
2 lines
31 KiB
JavaScript
var cdnPath="",upLoadClicktag=0,wapurl=window.location.origin+"/pages/wap/ware.html"+window.location.search;/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)&&(window.location.href=wapurl);function getNeedSubscribe(r){var p=this;r&&r();return;var t}function request(r){var p=r.url,t=r.type||"GET",o=r.data,e=r.success,s=r.error,y=r.loading,i=r.noCloseLayer;y&&layer.load(2),$.ajax({headers:{token:getCookie("token")},type:t,url:p,contentType:"application/json",dataType:"json",data:o,async:!0,success:function(c){i||layer.closeAll(),e(c)},error:function(c){layer.closeAll(),s(c)}})}var retit,futit,videoAuditionSet,m3u8,rids=getPar("rid"),_w=parseInt($(window).width());$(".coursemain img").each(function(r){var p=$(this),t,o;$("<img/>").attr("src",$(p).attr("src")).load(function(){t=this.width,o=this.height,t>=_w&&$(p).css("width","100%").css("height","auto"),t<1200&&$(p).css("width",t+"px").css("height",o+"px")})}),rids||(window.location.href="/");var rtime,rtype,cid,isYouhui,courseOnlyBalance,userInfo,brond=!1,channels=getchannel();function nofind(){var r=event.srcElement;r.src="/static/common/image/course/fengmian.jpg",r.onerror=null}$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/common/mu/getAuditionM3u8.m3u8?projectid=45",data:{courseWareId:rids,onlyQuery:1},dataType:"json",async:!1,success:function(r){if(parseInt(r.code)==200)brond=!0,m3u8="/api/common/mu/getAuditionM3u8.m3u8?courseWareId="+rids;else{switch(parseInt(r.code)){case 403:r.message="\u8BFE\u4EF6\u6CA1\u6709\u8BBE\u7F6E\u8BD5\u542C!";break;case 404:r.message="\u8BFE\u4EF6\u89C6\u9891\u4E0D\u5B58\u5728!";break;case 503:r.message="\u8F6C\u7801\u672A\u5B8C\u6210!";break;case 406:r.message="\u8BD5\u542C\u8BBE\u7F6E\u4E0D\u6B63\u786E!";break}$(".curfengs").on("click",".bose",function(){layer.msg(r.message,{icon:5})})}}});function details(r){$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/jwt/getLoginUser?projectid=45",data:{},dataType:"json",async:!0,success:function(p){p.code==200&&(userInfo=p.data,r&&r(p))}}),$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseWareDetail?projectid=12",data:{courseId:getPar("cid"),courseWareId:rids},dataType:"json",async:!1,success:function(p){var t=p.data,o=t.introduce,e=window.location.href,s=t.courseWareName,y=rids,i=t.isPay,c=t.isInCart,T=t.cover;cid=t.courseId,courseOnlyBalance=t.courseOnlyBalance||0,videoAuditionSet=t.videoAuditionSet,retit=t.courseWareName,isYouhui=t.isDiscounts||!1;var d=t.price?JSON.parse(t.price):[];if(videoAuditionSet){var I=JSON.parse(videoAuditionSet);rtime=I.time,rtype=I.type;var u='<span class="bose"></span><img class="zaimg" src='+(cdnPath+T)+' onerror="nofind();" />'}else var u="<img src="+(cdnPath+T)+' onerror="nofind();" />';var f=new Array,w=new Array;w[0]={goodsId:y,price:d[0],goodsUrl:e,goodsType:2,goodsName:s,cover:T,introduce:o,endTime:d[1]},f[0]={courseWareId:y,courseWareName:s,orderTitle:s,orderType:2,price:d[0]},courseOnlyBalance==1&&(f[0]={courseWareId:y,courseWareName:s,orderTitle:s,orderType:2,price:d[0],paymentSource:"6"}),$(".curfengs").html(u);var a='<h2 class="curhtit">'+t.courseWareName+"</h2>";t.childClassifyName==""?a+='<p class="curint">'+t.mainClassifyName+" > "+t.courseName+"</p>":a+='<p class="curint">'+t.mainClassifyName+" > "+t.childClassifyName+" > "+t.courseName+"</p>",t.isFavorite==!0?(a+='<span class="curcolls">\u5DF2\u6536\u85CF</span>',a+='<span style="display:none;" class="curcoll">\u6536\u85CF</span>'):(a+='<span class="curcoll">\u6536\u85CF</span>',a+='<span style="display:none;" class="curcolls">\u5DF2\u6536\u85CF</span>'),a+='<span class="curshare">\u5206\u4EAB</span>',a+='<p class="cursimp" style="width: 100%" title='+t.introduce+">"+t.introduce+"</p>",a+='<p class="cursered">',d[0]?(a+='<span class="cursi">\uFFE5</span>'+(d[0]/100).toFixed(2)+"",a+="</p>",d[1]&&(a+='<p class="curexplain">\u81EA\u62A5\u540D\u4E4B\u65E5\u8D77<span class="curseorange">'+d[1]+"\u5929</span>\u6709\u6548</p>")):d[0]==0&&(a+='<span class="curselv">\u514D\u8D39</span>',a+="</p>",d[1]&&(a+='<p class="curexplain">\u81EA\u62A5\u540D\u4E4B\u65E5\u8D77<span class="curseorange">'+d[1]+"\u5929</span>\u6709\u6548</p>")),courseOnlyBalance==1?d[0]?t.isPay==!0?a+='<a class="cursign balancepay" href="javascript:void(0);">\u8FDB\u5165\u5B66\u4E60</a>':a+='<a class="cursign balancepay" href="javascript:void(0);">\u6211\u8981\u5B66\u4E60</a>':d[0]==0?t.isPay==!0?a+='<a class="cursign" href="javascript:void(0);">\u8FDB\u5165\u5B66\u4E60</a>':a+='<a class="cursign" href="javascript:void(0);">\u514D\u8D39\u62A5\u540D</a>':a+='<a class="goCourse" href="javascript:void(0);">\u8FD4\u56DE\u8BFE\u7A0B</a>':d[0]?t.isPay==!0?a+='<a class="cursign" href="javascript:void(0);">\u8FDB\u5165\u5B66\u4E60</a>':(c==!0?a+='<a class="curshop alertmessage" href="javascript:void(0);">\u52A0\u5165\u8D2D\u7269\u8F66</a>':a+='<a class="curshop" href="javascript:void(0);">\u52A0\u5165\u8D2D\u7269\u8F66</a>',a+='<a class="cursign" href="javascript:void(0);">\u7ACB\u5373\u62A5\u540D</a>'):d[0]==0?t.isPay==!0?a+='<a class="cursign" href="javascript:void(0);">\u8FDB\u5165\u5B66\u4E60</a>':a+='<a class="cursign" href="javascript:void(0);">\u514D\u8D39\u62A5\u540D</a>':a+='<a class="goCourse" href="javascript:void(0);">\u8FD4\u56DE\u8BFE\u7A0B</a>',$(".curwithin").html(a);var x=$(".coursemain").html(t.detail);x.find("img").length<1&&x.text()==""&&$(".coursemain").html("<div class='nodata'></div>"),$(".curcoll").on("click",function(){channels=getchannel(),user.isLogin(function(n){parseInt(n.code)==200?$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/collectCourseWare?projectid=37",contentType:"application/json",dataType:"json",async:!0,data:{courseWareId:rids,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel},success:function(l){$(".curcoll").hide(),$(".curcolls").show()}}):parseInt(n.code)==401||parseInt(n.code)==403?user.loginLayer(function(l){parseInt(l.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/cancelCollectCourseWare?projectid=37",data:{courseWareId:rids},dataType:"json",async:!0,success:function(l){$(".curcolls").hide(),$(".curcoll").show()}}):parseInt(n.code)==401||parseInt(n.code)==403?user.loginLayer(function(l){parseInt(l.code)==200&&details()}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})});var j="/static/front/images/shareBackground.png",v=t;$(".curshare").on("click",function(){v.userInfo=userInfo,v.iscourse=!0,v.courseName=v.courseWareName,user.isLogin(function(n){if(parseInt(n.code)==200){var l=window.imgEditor,h=this,g=n.data.userId,b=window.location.href;l.shareLayer(b,j,function(m){m.success||h.unlogin()},v)}else parseInt(n.code)==401||parseInt(n.code)==403?user.loginLayer(function(m){parseInt(m.code)==200&&details()}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}),$(".alertmessage").on("click",function(){layer.open({content:"\u5DF2\u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u3002",btn:["\u524D\u5F80\u8D2D\u7269\u8F66","\u786E\u8BA4"],yes:function(n,l){window.location.href="/pay/#/shopping"}})}),$(".goCourse").on("click",function(){window.location.href="/pages/info.html?cid="+getPar("cid")}),$(".cursign").on("click",function(){channels=getchannel(),upLoadClicktag==0&&(upLoadClicktag=1,user.isLogin(function(n){parseInt(n.code)==200?n.data.userTypeExact=="STUDENT"?i==!0?window.location.href="/myroom/#/learn/center":getNeedSubscribe(function(){courseOnlyBalance==1?layer.open({type:1,offset:"auto",title:"\u8BF7\u786E\u8BA4",skin:"balancepay-class",area:["300px","150px"],content:"\u8BE5\u8BFE\u4EF6\u9700\u8981\u6D88\u8017"+(d[0]||0)/100+"\u4F59\u989D",btn:["\u53D6\u6D88","\u786E\u8BA4\u52A0\u5165"],btnAlign:"c",yes:function(l,h){layer.closeAll()},btn2:function(l,h){channels.orderList=f,request({url:"/api/order/createOrder?projectid=22",data:JSON.stringify(channels),type:"POST",loading:!0,success:function(g){var b=g.code;g&&g.success?layer.open({type:1,offset:"auto",title:"\u52A0\u5165\u6210\u529F",skin:"balancepay-class",area:["300px","150px"],content:"\u524D\u5F80\u5B66\u4E60\u4E2D\u5FC3\u53EF\u76F4\u63A5\u5F00\u59CB\u5B66\u4E60",btn:["\u518D\u901B\u901B","\u7ACB\u5373\u524D\u5F80"],btnAlign:"c",yes:function(m,S){layer.closeAll()},btn2:function(m,S){window.location.href="/myroom/#/learn/center",layer.closeAll()}}):b=="605"?layer.open({type:1,offset:"auto",title:"\u4F59\u989D\u4E0D\u8DB3",skin:"balancepay-class",area:["300px","150px"],content:"\u8BF7\u5145\u503C\u540E\u518D\u8BD5",btn:["\u5173\u95ED","\u7ACB\u5373\u524D\u5F80"],btnAlign:"c",yes:function(m,S){layer.closeAll()},btn2:function(m,S){window.location.href="/myroom/#/personal/purse",layer.closeAll()}}):layer.open({type:1,offset:"auto",title:"\u63D0\u793A",skin:"balancepay-class",area:["300px","150px"],content:g.message||"\u62A5\u540D\u5931\u8D25",btn:["\u5173\u95ED"],btnAlign:"c",yes:function(m,S){layer.closeAll()}})}})}}):d[0]==0?(channels.orderList=f,$.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(l){layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){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:w,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(l){window.location.href="/pay/#/shopping"}})}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01"):parseInt(n.code)==401||parseInt(n.code)==403?user.loginLayer(function(l){parseInt(l.code)==200&&details(function(h){h.data.userTypeExact=="STUDENT"?i==!0?window.location.href="/myroom/#/learn/center":getNeedSubscribe(function(){courseOnlyBalance==1?layer.open({type:1,offset:"auto",title:"\u8BF7\u786E\u8BA4",skin:"balancepay-class",area:["300px","150px"],content:"\u8BE5\u8BFE\u4EF6\u9700\u8981\u6D88\u8017"+(d[0]||0)/100+"\u4F59\u989D",btn:["\u53D6\u6D88","\u786E\u8BA4\u52A0\u5165"],btnAlign:"c",yes:function(g,b){layer.closeAll()},btn2:function(g,b){channels.orderList=f,request({url:"/api/order/createOrder?projectid=22",data:JSON.stringify(channels),type:"POST",loading:!0,success:function(m){var S=m.code;m&&m.success?layer.open({type:1,offset:"auto",title:"\u52A0\u5165\u6210\u529F",skin:"balancepay-class",area:["300px","150px"],content:"\u524D\u5F80\u5B66\u4E60\u4E2D\u5FC3\u53EF\u76F4\u63A5\u5F00\u59CB\u5B66\u4E60",btn:["\u518D\u901B\u901B","\u7ACB\u5373\u524D\u5F80"],btnAlign:"c",yes:function(N,k){layer.closeAll()},btn2:function(N,k){window.location.href="/myroom/#/learn/center",layer.closeAll()}}):S=="605"?layer.open({type:1,offset:"auto",title:"\u4F59\u989D\u4E0D\u8DB3",skin:"balancepay-class",area:["300px","150px"],content:"\u8BF7\u5145\u503C\u540E\u518D\u8BD5",btn:["\u5173\u95ED","\u7ACB\u5373\u524D\u5F80"],btnAlign:"c",yes:function(N,k){layer.closeAll()},btn2:function(N,k){window.location.href="/myroom/#/personal/purse",layer.closeAll()}}):layer.open({type:1,offset:"auto",title:"\u63D0\u793A",skin:"balancepay-class",area:["300px","150px"],content:m.message||"\u62A5\u540D\u5931\u8D25",btn:["\u5173\u95ED"],btnAlign:"c",yes:function(N,k){layer.closeAll()}})}})}}):d[0]==0?(channels.orderList=f,$.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(g){layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){window.location.href="/myroom/#/learn/center",layer.closeAll()}})}})):d[0]==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=f,$.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(g){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:w,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(g){window.location.href="/pay/#/shopping"}})}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")}),setTimeout(function(){upLoadClicktag=0},300))}),$(".curshop").on("click",function(){channels=getchannel(),user.isLogin(function(n){parseInt(n.code)==200?n.data.userTypeExact=="STUDENT"?c==!0?($(".curshop").addClass("huise"),$(".alertmessage").removeClass("huise")):c==!1&&getNeedSubscribe(function(){$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/shoppingCart?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify({goodsList:w,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(l){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||parseInt(n.code)==403?user.loginLayer(function(l){parseInt(l.code)==200&&details(function(h){h.data.userTypeExact=="STUDENT"?c==!0?$(".curshop").addClass("huise"):getNeedSubscribe(function(){$.ajax({headers:{token:getCookie("token")},type:"POST",url:"/api/order/shoppingCart?projectid=22",contentType:"application/json",dataType:"json",data:JSON.stringify({goodsList:w,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(g){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")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})})}})}if(details(),brond&&videoAuditionSet){$(".curfengs").on("click",".bose",function(){$(".bose").hide(),$(".zaimg").hide(),$("#divid").show(),$(".curfengs").hide(),getPlayer("videod").play()});var video=createPlayer("videod"),testTime;$("#divid").append(video),init("videod","html5",m3u8,!1,!1,!0,"",function(){getPlayer("videod").on("pause",function(){var r=parseInt($("#videod .vjs-progress-holder").css("width")),p=parseInt($("#videod .vjs-play-progress").css("width"));p+3<r&&clearTimeout(testTime)}),getPlayer("videod").on("playing",function(){var r=parseInt($("#videod .vjs-progress-holder").css("width")),p=parseInt($("#videod .vjs-play-progress").css("width")),t=rtime*((r-p)/r);clearTimeout(testTime),testTime=setTimeout(function(){setSeek("videod",0),getPlayer("videod").pause(),getPlayer("videod").player_.isFullscreen_==!0&&getPlayer(videoPlayer.id_).exitFullscreen(),rtype==1||Array.isArray(rtype)&&rtype.length==1&&rtype[0]==1?layer.confirm("\u8BD5\u542C\u7ED3\u675F\uFF0C\u8BF7\u62A5\u540D\u540E\u89C2\u770B\u5B8C\u6574\u89C6\u9891\u3002",{btn:["\u7ACB\u5373\u62A5\u540D","\u6682\u4E0D\u62A5\u540D"],closeBtn:0},function(){$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseDetail?projectid=12",data:{courseId:getPar("cid")},dataType:"json",async:!0,success:function(o){var e=o.data,s=e.price,y=e.introduce,i=e.courseName,c=e.courseId,T=e.cover,d=e.isPay,I=e.deadline,u=e.personNumLimit,f=e.personNumLimit-e.personNumCount,w=e.isInCart;if(e.courseType==3)var a=3;else var a=1;var x=e.isInCart,j=window.location.href,v=e.parentCourseId,n=new Array,l=new Array;v==0?(l[0]={goodsId:c,price:s,goodsUrl:j,goodsType:a,goodsName:i,cover:T,operateType:1,introduce:y,endTime:I},n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s},courseOnlyBalance==1&&(n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s,paymentSource:"6"})):(l[0]={goodsId:c,price:s,goodsUrl:j,goodsType:a,goodsName:i,cover:T,sourceSchoolCourseId:v,operateType:1,introduce:y,endTime:I},n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s,sourceSchoolCourseId:v},courseOnlyBalance==1&&(n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s,sourceSchoolCourseId:v,paymentSource:"6"})),channels=getchannel(),e.isOpenSignUp==!0&&user.isLogin(function(h){parseInt(h.code)==200?h.data.userTypeExact=="STUDENT"?d==!0?window.location.href="/myroom/#/learn/center":f<=0&&u!=0?layer.alert("\u62A5\u540D\u4EBA\u6570\u5DF2\u6EE1\uFF01"):s==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=n,$.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(g){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:l,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(g){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01"):parseInt(h.code)==401||parseInt(h.code)==403?user.loginLayer(function(g){parseInt(g.code)==200&&details(function(b){b.data.userTypeExact=="STUDENT"?d==!0?window.location.href="/myroom/#/learn/center":f<=0&&u!=0?layer.alert("\u62A5\u540D\u4EBA\u6570\u5DF2\u6EE1\uFF01"):s==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=n,$.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(m){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:l,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(m){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}}),$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()},function(){$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()}):rtype==2||Array.isArray(rtype)&&rtype.length==1&&rtype[0]==2?layer.confirm("\u8BD5\u542C\u7ED3\u675F\uFF0C\u8BF7\u62A5\u540D\u540E\u89C2\u770B\u5B8C\u6574\u89C6\u9891\u3002",{btn:["\u7ACB\u5373\u62A5\u540D","\u6682\u4E0D\u62A5\u540D"],closeBtn:0},function(){$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseWareDetail?projectid=12",data:{courseId:getPar("cid"),courseWareId:rids},dataType:"json",async:!1,success:function(o){var e=o.data,s=e.introduce,y=window.location.href,i=e.courseWareName,c=getPar("rid"),T=e.isPay,d=e.isInCart,I=e.cover;retit=e.courseWareName;var u=e.price?JSON.parse(e.price):[0,0];if(e.videoAuditionSet){var f=JSON.parse(e.videoAuditionSet);rtime=f.time,rtype=f.type}var w=new Array,a=new Array;a[0]={goodsId:c,price:u[0],goodsUrl:y,goodsType:2,goodsName:i,cover:I,introduce:s,endTime:u[1]},w[0]={courseWareId:c,courseWareName:i,orderTitle:i,orderType:2,price:u[0]},channels=getchannel(),user.isLogin(function(x){parseInt(x.code)==200?x.data.userTypeExact=="STUDENT"?T==!0?window.location.href="/myroom/#/learn/center":u[0]==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=w,$.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(j){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:a,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(j){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01"):parseInt(x.code)==401||parseInt(x.code)==403?user.loginLayer(function(j){parseInt(j.code)==200&&details(function(v){v.data.userTypeExact=="STUDENT"?T==!0?window.location.href="/myroom/#/learn/center":u[0]==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=w,$.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(n){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:a,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(n){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}}),$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()},function(){$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()}):Array.isArray(rtype)&&rtype.length==2?(setTimeout(()=>{document.querySelector(".layui-layer-btn1").style.backgroundColor="#1E9FFF",document.querySelector(".layui-layer-btn1").style.color="white",document.querySelector(".layui-layer-btn1").style.borderColor="#1E9FFF",document.querySelector(".layui-layer-btn1").style.position="relative";var o=document.createElement("p");if(o.style.position="absolute",o.style.top="0px",o.style.left="0px",isYouhui){var e=document.createElement("img");e.setAttribute("src","/static/common/image/youhui.png"),e.style.width="20px",e.style.height="20px",o.appendChild(e)}document.querySelector(".layui-layer-btn1").appendChild(o)}),layer.confirm("\u8BD5\u542C\u7ED3\u675F\uFF0C\u8BF7\u62A5\u540D\u540E\u89C2\u770B\u5B8C\u6574\u89C6\u9891\u3002",{btn:["\u62A5\u540D\u672C\u8282\u8BFE","\u62A5\u540D\u672C\u8BFE\u7A0B","\u6682\u4E0D\u62A5\u540D"],btn3:function(){$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()},closeBtn:0},function(){$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseWareDetail?projectid=12",data:{courseId:getPar("cid"),courseWareId:rids},dataType:"json",async:!1,success:function(o){var e=o.data,s=e.introduce,y=window.location.href,i=e.courseWareName,c=getPar("rid"),T=e.isPay,d=e.isInCart,I=e.cover;retit=e.courseWareName;var u=e.price?JSON.parse(e.price):[0,0];if(e.videoAuditionSet){var f=JSON.parse(e.videoAuditionSet);rtime=f.time,rtype=f.type}var w=new Array,a=new Array;a[0]={goodsId:c,price:u[0],goodsUrl:y,goodsType:2,goodsName:i,cover:I,introduce:s,endTime:u[1]},w[0]={courseWareId:c,courseWareName:i,orderTitle:i,orderType:2,price:u[0]},channels=getchannel(),user.isLogin(function(x){parseInt(x.code)==200?x.data.userTypeExact=="STUDENT"?T==!0?window.location.href="/myroom/#/learn/center":u[0]==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=w,$.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(j){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:a,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(j){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01"):parseInt(x.code)==401||parseInt(x.code)==403?user.loginLayer(function(j){parseInt(j.code)==200&&details(function(v){v.data.userTypeExact=="STUDENT"?T==!0?window.location.href="/myroom/#/learn/center":u[0]==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=w,$.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(n){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:a,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(n){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}}),$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()},function(){$.ajax({headers:{token:getCookie("token")},type:"GET",url:"/api/course/getCourseDetail?projectid=12",data:{courseId:getPar("cid")},dataType:"json",async:!0,success:function(o){var e=o.data,s=e.price,y=e.introduce,i=e.courseName,c=e.courseId,T=e.cover,d=e.isPay,I=e.deadline,u=e.personNumLimit,f=e.personNumLimit-e.personNumCount,w=e.isInCart;if(e.courseType==3)var a=3;else var a=1;var x=e.isInCart,j=window.location.href,v=e.parentCourseId,n=new Array,l=new Array;v==0?(l[0]={goodsId:c,price:s,goodsUrl:j,goodsType:a,goodsName:i,cover:T,operateType:1,introduce:y,endTime:I},n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s},courseOnlyBalance==1&&(n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s,paymentSource:"6"})):(l[0]={goodsId:c,price:s,goodsUrl:j,goodsType:a,goodsName:i,cover:T,sourceSchoolCourseId:v,operateType:1,introduce:y,endTime:I},n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s,sourceSchoolCourseId:v},courseOnlyBalance==1&&(n[0]={courseId:c,courseName:i,orderTitle:i,orderType:a,price:s,sourceSchoolCourseId:v,paymentSource:"6"})),channels=getchannel(),e.isOpenSignUp==!0&&user.isLogin(function(h){parseInt(h.code)==200?h.data.userTypeExact=="STUDENT"?d==!0?window.location.href="/myroom/#/learn/center":f<=0&&u!=0?layer.alert("\u62A5\u540D\u4EBA\u6570\u5DF2\u6EE1\uFF01"):s==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=n,$.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(g){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:l,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(g){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01"):parseInt(h.code)==401||parseInt(h.code)==403?user.loginLayer(function(g){parseInt(g.code)==200&&details(function(b){b.data.userTypeExact=="STUDENT"?d==!0?window.location.href="/myroom/#/learn/center":f<=0&&u!=0?layer.alert("\u62A5\u540D\u4EBA\u6570\u5DF2\u6EE1\uFF01"):s==0?layer.open({type:1,offset:"auto",content:'<div style="padding: 20px 80px;">\u62A5\u540D\u6210\u529F\uFF0C\u8FDB\u5165\u5B66\u4E60\u4E2D\u5FC3\uFF01</div>',btn:"\u786E\u8BA4",btnAlign:"c",yes:function(){channels.orderList=n,$.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(m){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:l,pvid:channels.pvid,uvcid:channels.uvcid,shareUserId:channels.shareUserId,clientType:channels.channel}),async:!0,success:function(m){window.location.href="/pay/#/shopping"}}):layer.alert("\u53EA\u6709\u5B66\u751F\u8D26\u53F7\u624D\u80FD\u62A5\u540D\uFF01")})}):layer.alert("\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01")})}}),$(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show(),layer.closeAll()})):($(".bose").show(),$(".zaimg").show(),$("#divid").hide(),$(".curfengs").show())},t*1e3)})})}$.ajax({type:"GET",headers:{token:getCookie("token")},url:"/api/school/getSubheadByHostName?projectid=12",contentType:"application/json",dataType:"json",data:{},async:!0,success:function(r){r.data.subhead?futit="-"+r.data.subhead:futit="";var p="";p=retit+futit,$("title").html(p)}});function getchannel(){var r,p=localStorage.appAdapt===!0||localStorage.appAdapt==="true";if(p){var t=sessionStorage.getItem("ip")||"",o=sessionStorage.getItem("channel")||"",e=sessionStorage.getItem("gmtStart")||0,s=sessionStorage.getItem("sourceId")||0,y=sessionStorage.getItem("sourceJson")||"",i=sessionStorage.getItem("sourceType")||"";r={ip:t,channel:o,gmtStart:e,sourceId:s,sourceJson:y,sourceType:i}}else{r=sessionStorage.getItem("cluechannel")?JSON.parse(sessionStorage.getItem("cluechannel")):{};var t=sessionStorage.getItem("sourceip");r.ip=t||""}var c=getPar("channel")||"";return c&&(r.channel=c),r.uvcid=localStorage.uvcid||"",r.pvid=sessionStorage.getItem("pvid")||"",r}function getCookie(r){for(var p=document.cookie,t=p.split("; "),o=0;o<t.length;o++){var e=t[o].split("=");if(e[0]==r)return e[1]}return""}function getPar(r){var p=document.location.href,t=p.indexOf(r+"=");if(t==-1)return!1;var o=p.slice(r.length+t+1),e=o.indexOf("&");return e!=-1&&(o=o.slice(0,e)),o}
|