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