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