index.94da7803.js 9.9 KB

1
  1. import{t as ae,d as Q,R as N,aq as ne,y as O,U as ie,b4 as oe,a0 as re,c as i,w as q,z as H,aW as U,an as G,a4 as se,bK as le,bL as ce,bB as de,aU as ue,D as me,r as E,b3 as fe,ah as ge,ag as be,f as ve,$ as he,F as ye,b5 as X,b7 as Y,V as _e,a5 as pe,q as z,al as Te,e as V,m as K,g as k,b9 as Ce}from"./index.1c621181.js";/* empty css */import{i as we,a as Ie,p as Be,b as xe}from"./icon-pause.8cbd74c0.js";import{q as Se}from"./index.339fc024.js";import{h as De}from"./useFee.c07e8de4.js";import{S as Ve,a as je}from"./index.78a302c3.js";const[Ne,j]=ae("slider"),Ae={min:q(0),max:q(100),step:q(1),range:Boolean,reverse:Boolean,disabled:Boolean,readonly:Boolean,vertical:Boolean,barHeight:H,buttonSize:H,activeColor:String,inactiveColor:String,modelValue:{type:[Number,Array],default:0}};var Le=Q({name:Ne,props:Ae,emits:["change","dragEnd","dragStart","update:modelValue"],setup(e,{emit:x,slots:T}){let C,g,h;const S=N(),n=N(),b=N(),w=ne(),I=O(()=>Number(e.max)-Number(e.min)),A=O(()=>{const a=e.vertical?"width":"height";return{background:e.inactiveColor,[a]:ie(e.barHeight)}}),p=a=>e.range&&Array.isArray(a),R=()=>{const{modelValue:a,min:o}=e;return p(a)?`${(a[1]-a[0])*100/I.value}%`:`${(a-Number(o))*100/I.value}%`},P=()=>{const{modelValue:a,min:o}=e;return p(a)?`${(a[0]-Number(o))*100/I.value}%`:"0%"},D=O(()=>{const o={[e.vertical?"height":"width"]:R(),background:e.activeColor};b.value&&(o.transition="none");const u=()=>e.vertical?e.reverse?"bottom":"top":e.reverse?"right":"left";return o[u()]=P(),o}),r=a=>{const o=+e.min,u=+e.max,v=+e.step;a=ue(a,o,u);const m=Math.round((a-o)/v)*v;return ce(o,m)},t=a=>{var o,u;const v=(o=a[0])!=null?o:Number(e.min),m=(u=a[1])!=null?u:Number(e.max);return v>m?[m,v]:[v,m]},s=(a,o)=>{p(a)?a=t(a).map(r):a=r(a),U(a,e.modelValue)||x("update:modelValue",a),o&&!U(a,h)&&x("change",a)},l=a=>{if(a.stopPropagation(),e.disabled||e.readonly)return;const{min:o,reverse:u,vertical:v,modelValue:m}=e,_=G(S),Z=()=>v?u?_.bottom-a.clientY:a.clientY-_.top:u?_.right-a.clientX:a.clientX-_.left,ee=v?_.height:_.width,L=Number(o)+Z()/ee*I.value;if(p(m)){const[W,$]=m,te=(W+$)/2;L<=te?s([L,$],!0):s([W,L],!0)}else s(L,!0)},c=a=>{e.disabled||e.readonly||(w.start(a),g=e.modelValue,p(g)?h=g.map(r):h=r(g),b.value="start")},B=a=>{if(e.disabled||e.readonly)return;b.value==="start"&&x("dragStart",a),se(a,!0),w.move(a),b.value="dragging";const o=G(S),u=e.vertical?w.deltaY.value:w.deltaX.value,v=e.vertical?o.height:o.width;let m=u/v*I.value;if(e.reverse&&(m=-m),p(h)){const _=e.reverse?1-C:C;g[_]=h[_]+m}else g=h+m;s(g)},d=a=>{e.disabled||e.readonly||(b.value==="dragging"&&(s(g,!0),x("dragEnd",a)),b.value="")},y=a=>typeof a=="number"?j("button-wrapper",["left","right"][a]):j("button-wrapper",e.reverse?"left":"right"),F=(a,o)=>{if(typeof o=="number"){const u=T[o===0?"left-button":"right-button"];if(u)return u({value:a})}return T.button?T.button({value:a}):i("div",{class:j("button"),style:de(e.buttonSize)},null)},M=a=>{const o=typeof a=="number"?e.modelValue[a]:e.modelValue;return i("div",{ref:n,role:"slider",class:y(a),tabindex:e.disabled?void 0:0,"aria-valuemin":e.min,"aria-valuenow":o,"aria-valuemax":e.max,"aria-disabled":e.disabled||void 0,"aria-readonly":e.readonly||void 0,"aria-orientation":e.vertical?"vertical":"horizontal",onTouchstartPassive:u=>{typeof a=="number"&&(C=a),c(u)},onTouchend:d,onTouchcancel:d,onClick:le},[F(o,a)])};return s(e.modelValue),oe(()=>e.modelValue),re("touchmove",B,{target:n}),()=>i("div",{ref:S,style:A.value,class:j({vertical:e.vertical,disabled:e.disabled}),onClick:l},[i("div",{class:j("bar"),style:D.value},[e.range?[M(0),M(1)]:M()])])}});const Ee=me(Le),ke="_playContent_jst3b_1",Re="_coursewarePlay_jst3b_7",Pe="_playModel_jst3b_12",Fe="_headerContainer_jst3b_21",Me="_backBtn_jst3b_34",Oe="_menu_jst3b_43",qe="_tabsContent_jst3b_49",ze="_loadWrap_jst3b_60",We="_itemDiv_jst3b_71",$e="_videoModel_jst3b_86",He="_rightFixedBtns_jst3b_100",Ue="_point_jst3b_106",Ge="_fullBtn_jst3b_111",Xe="_leftFixedBtns_jst3b_115",Ye="_prePoint_jst3b_121",Ke="_bottomFixedContainer_jst3b_138",Je="_time_jst3b_147",Qe="_slider_jst3b_154",Ze="_actions_jst3b_157",et="_actionBtn_jst3b_164",tt="_popup_jst3b_173",at="_overlayClass_jst3b_176";var f={playContent:ke,coursewarePlay:Re,playModel:Pe,headerContainer:Fe,backBtn:Me,menu:Oe,tabsContent:qe,loadWrap:ze,itemDiv:We,videoModel:$e,rightFixedBtns:He,point:Ue,fullBtn:Ge,leftFixedBtns:Xe,prePoint:Ye,bottomFixedContainer:Ke,time:Je,slider:Qe,actions:Ze,actionBtn:et,popup:tt,overlayClass:at},nt="./assets/icon-videobg.2414ec8d.png";function it(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Te(e)}const J={\u89C6\u9891:"VIDEO",\u56FE\u7247:"IMG",\u66F2\u76EE:"SONG"};var ut=Q({name:"exercise-after-class",setup(){const e=E({width:"100vw"}),x=()=>{let r=Math.min(screen.width,screen.height),t=Math.max(screen.width,screen.height),s=r*(16/9);if(s>t){e.width="100vw";return}else e.width=s+"px"},T=(r=0)=>{x(),V({api:"setRequestedOrientation",content:{orientation:r}}),V({api:"setStatusBarVisibility",content:{isVisibility:r}})};T(),fe(()=>{T(1)});const C=ge();be();const g=C.query,h=ve(),S=N(),n=E({videoData:null,trainings:[],trainingTimes:0,itemList:[],showHead:!0,loading:!0,recordLoading:!1}),b=E({nowTime:0,model:!0,timer:null,item:null}),w=async()=>{var r,t,s;try{const l=await K.post(k.platformApi+`/studentLessonTraining/trainingRecord/${g.courseScheduleId}?userId=${(t=(r=k.user)==null?void 0:r.data)==null?void 0:t.id}`,{hideLoading:!0});if(Array.isArray((s=l==null?void 0:l.data)==null?void 0:s.trainings))return l.data.trainings}catch{}return[]},I=async r=>{Array.isArray(r)&&(n.trainings=r.map(t=>{try{t.trainingContent=JSON.parse(t.trainingContent)}catch{t.trainingContent=""}return{...t,currentTime:0,duration:100,paused:!0,loop:!1,videoEle:null,timer:null,muted:!0,autoplay:!0}}),n.itemList=n.trainings.filter(t=>t.materialId==C.query.materialId),n.videoData=n.itemList[0],D())};he(async()=>{const r=await w();I(r),De()});const A=()=>{V({api:"back"})},p=N(),R=E({firstIndex:0,open:!1,activeIndex:-1,tabActive:"",tabName:"",itemActive:"",itemName:""}),P=async r=>{var l;if(n.recordLoading)return;console.log("\u8BB0\u5F55\u89C2\u770B\u6B21\u6570"),n.recordLoading=!0;const t=C.query,s={materialType:"VIDEO",record:{sourceTime:r.duration,clientType:k.platformType,feature:"LESSON_TRAINING",deviceType:h.android?"ANDROID":h.isApp?"IOS":"WEB"},courseScheduleId:t.courseScheduleId,lessonTrainingId:t.lessonTrainingId,materialId:((l=n.videoData)==null?void 0:l.materialId)||""};try{const c=await K.post(k.platformApi+"/studentLessonTraining/lessonTrainingRecord",{data:s,hideLoading:!0})}catch{}n.recordLoading=!1;try{const c=await w();if(Array.isArray(c)){const B=c.find(d=>{var y;return d.materialId==((y=n.videoData)==null?void 0:y.materialId)});B&&(n.videoData.trainingTimes=B.trainingTimes,D())}}catch{}},D=()=>{var r,t,s,l;if(((r=n==null?void 0:n.videoData)==null?void 0:r.trainingTimes)!=0&&((t=n==null?void 0:n.videoData)==null?void 0:t.trainingTimes)+""===((l=(s=n.videoData)==null?void 0:s.trainingContent)==null?void 0:l.practiceTimes)){const c=n.trainings.findIndex(d=>{var y;return d.materialId==((y=n.videoData)==null?void 0:y.materialId)}),B=c===n.trainings.length-1;Ce({title:"\u8BFE\u540E\u4F5C\u4E1A",message:"\u4F60\u5DF2\u5B8C\u6210\u8BE5\u7EC3\u4E60~",confirmButtonColor:"var(--van-primary)",confirmButtonText:B?"\u5B8C\u6210":"\u4E0B\u4E00\u9898",cancelButtonText:"\u7EE7\u7EED"}).then(()=>{if(B)V({api:"goBack"});else{const d=n.trainings[c+1];if((d==null?void 0:d.type)===J.\u89C6\u9891&&(n.itemList=[d],n.videoData=d,D()),(d==null?void 0:d.type)===J.\u66F2\u76EE){T(1),A();const y=Se.stringify({id:d.content,courseScheduleId:g.courseScheduleId,lessonTrainingId:g.lessonTrainingId,materialId:d.materialId});let F=`${location.origin}/orchestra-music-score/?`+y;V({api:"openAccompanyWebView",content:{url:F,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}})}}}).catch(()=>{n.trainings[c].currentTime=0})}};return()=>{let r;return i("div",{class:f.playContent},[i("div",{class:f.coursewarePlay,style:{width:e.width}},[i(Ve,{style:{height:"100%"},ref:p,showIndicators:!1,loop:!1,vertical:!0,lazyRender:!0,touchable:!1,duration:0},it(r=n.itemList.map((t,s)=>i(je,null,{default:()=>[i(ye,null,[i("div",{class:f.itemDiv,onClick:()=>{clearTimeout(t.timer),b.model=!b.model}},[i("video",{playsinline:"false",preload:"auto",class:"player",poster:nt,"data-vid":t.id,src:t.content,loop:t.loop,autoplay:t.autoplay,muted:t.muted,onLoadedmetadata:async l=>{const c=l.target;t.duration=c.duration,t.videoEle=c,t.loaded=!0},onTimeupdate:l=>{if(!t.loaded)return;const c=l.target;t.currentTime=c.currentTime},onPlay:()=>{console.log("\u64AD\u653E"),t.paused=!1,t.muted&&(t.muted=!1,t.videoEle.pause())},onPause:()=>{console.log("\u6682\u505C"),t.paused=!0},onEnded:()=>P(t)},[i("source",{src:t.content,type:"video/mp4"},null)])]),i(X,{name:"bottom"},{default:()=>[b.model&&!t.muted&&i("div",{class:f.bottomFixedContainer},[i("div",{class:f.time},[i("span",null,[Y(t.currentTime)]),i("span",null,[Y(t.duration)])]),i("div",{class:f.slider},[t.duration&&i(Ee,{buttonSize:16,modelValue:t.currentTime,min:0,max:t.duration},null)]),i("div",{class:f.actions},[i("div",{class:f.actionBtn},[t.paused?i("img",{src:we,onClick:l=>{var c;clearTimeout(t.timer),(c=t.videoEle)==null||c.play(),t.paused=!1,t.timer=setTimeout(()=>{b.model=!1},4e3)}},null):i("img",{src:Ie,onClick:l=>{var c;clearTimeout(t.timer),(c=t.videoEle)==null||c.pause(),t.paused=!0}},null)])])])]}),t.muted&&i("div",{class:f.loadWrap},[i(_e,{animationData:Be},null)])])]})))?r:{default:()=>[r]}),i(X,{name:"top"},{default:()=>{var t,s,l;return[b.model&&i("div",{class:f.headerContainer,ref:S},[i("div",{class:f.backBtn,onClick:()=>A()},[i(pe,{name:xe},null),z("\u8FD4\u56DE")]),i("div",{class:f.menu},[R.tabName]),i("div",{class:f.nums},[z("\u7EC3\u4E60\u6B21\u6570\uFF1A"),((t=n.videoData)==null?void 0:t.trainingTimes)||0,z("/"),((l=(s=n.videoData)==null?void 0:s.trainingContent)==null?void 0:l.practiceTimes)||0])])]}})])])}}});export{ut as default};