1 |
- import{d as e,U as a,Q as t,o as i,S as l,a as n,T as o,aS as s,m as u,F as r,V as d,R as m,r as v,h as c,f as p,s as g,l as _,p as h,L as y,P as f,B as b,i as w,e as T,X as S}from"./index-232a7449.js";import{T as j,S as C,V as x,p as k,i as D}from"./tcplayer.min-f3b84473.js";import{a as L,h as B,b as P}from"./useFee-2d9dce12.js";import{S as A,a as I}from"./index-0f37f75c.js";import{u as M,a as E}from"./index-725b9e0a.js";const F={playContent:"_playContent_1ghmj_1",coursewarePlay:"_coursewarePlay_1ghmj_7",playModel:"_playModel_1ghmj_13",headerContainer:"_headerContainer_1ghmj_22",backBtn:"_backBtn_1ghmj_35",menu:"_menu_1ghmj_44",tabsContent:"_tabsContent_1ghmj_50",loadWrap:"_loadWrap_1ghmj_61",itemDiv:"_itemDiv_1ghmj_72",videoSection:"_videoSection_1ghmj_87",videoModel:"_videoModel_1ghmj_95",rightFixedBtns:"_rightFixedBtns_1ghmj_109",point:"_point_1ghmj_115",fullBtn:"_fullBtn_1ghmj_120",leftFixedBtns:"_leftFixedBtns_1ghmj_124",prePoint:"_prePoint_1ghmj_130",bottomFixedContainer:"_bottomFixedContainer_1ghmj_147",time:"_time_1ghmj_156",slider:"_slider_1ghmj_162",actions:"_actions_1ghmj_169",actionBtn:"_actionBtn_1ghmj_177",popup:"_popup_1ghmj_187",overlayClass:"_overlayClass_1ghmj_190",visiablePopup:"_visiablePopup_1ghmj_225",title:"_title_1ghmj_239",content:"_content_1ghmj_245",btnGroup:"_btnGroup_1ghmj_251"},R=""+new URL("icon-play-e9875d7d.svg",import.meta.url).href,N=""+new URL("icon-pause-7c9eee52.svg",import.meta.url).href,U=""+new URL("icon-videobg-2414ec8d.png",import.meta.url).href,O=e({name:"video-class",props:{item:{type:Object,"default":()=>({})},isMember:{type:Boolean,"default":!0},modal:{type:Boolean,"default":!0}},emits:["loadedmetadata","togglePlay","ended","reset","error","close","changeModal","pause","seeked","seeking","waiting","timeupdate"],setup(e,{emit:m}){const{item:v,modal:c}=a(e),p=t(),g="video"+Date.now()+Math.floor(100*Math.random()),_=()=>{p.value&&(d((()=>{var e;null==(e=p.value)||e.pause()})),p.value.poster(e.item.coverImg),p.value.src(e.item.content),p.value.loop(e.item.loop),p.value.autoplay(e.item.autoplay),p.value.one("loadedmetadata",(()=>{var e,a,t,i,l,n;const o=p.value;v.value.duration=o.duration(),v.value.videoEle=o,v.value.loaded=!0,m("loadedmetadata",p.value),v.value.autoplay&&p.value?(v.value.muted=!1,null==(e=p.value)||e.muted(!1),null==(a=p.value)||a.volume(1),null==(t=p.value)||t.play()):(v.value.muted=!1,null==(i=p.value)||i.muted(!1),null==(l=p.value)||l.volume(1),null==(n=p.value)||n.pause())})),p.value.on("timeupdate",(()=>{if(!v.value.loaded)return;const e=p.value;v.value.currentTime=e.currentTime(),m("timeupdate")})),p.value.on("ended",(()=>{m("ended",v.value)})),p.value.on("pause",(()=>{var e;v.value.paused=!0,null==(e=p.value)||e.pause(),setTimeout((()=>{var e;null==(e=p.value)||e.pause()}),100),m("pause")})),p.value.on("play",(()=>{var e,a,t;v.value.paused=!1,v.value.muted&&(v.value.muted=!1,null==(e=p.value)||e.muted(!1),null==(a=p.value)||a.volume(1),null==(t=p.value)||t.pause())})),p.value.on("seeked",(()=>{m("seeked")})),p.value.on("seeking",(()=>{m("seeking")})),p.value.on("waiting",(()=>{m("waiting")})),p.value.on("error",(()=>{m("error")})))};return i((()=>{p.value=j(g,{appID:"",controls:!1,loop:v.value.loop,muted:!1}),_()})),l((()=>e.item),(()=>{_()})),()=>n(r,null,[n("div",{"class":F.itemDiv,onClick:()=>{clearTimeout(v.value.timer),m("changeModal",!c.value)}},[n("video",{id:g,style:{height:"100%",width:"100%"},playsinline:"false",preload:"auto","class":"player",poster:U,"data-vid":v.value.id,src:v.value.content},[n("source",{src:v.value.content,type:"video/mp4"},null)]),n("div",{"class":F.videoSection},null)]),n(o,{name:"bottom"},{"default":()=>[c.value&&!v.value.muted&&n("div",{"class":F.bottomFixedContainer},[n("div",{"class":F.time},[n("span",null,[s(v.value.currentTime)]),u("/"),n("span",null,[s(v.value.duration)])]),n("div",{"class":F.slider},[v.value.duration&&n(C,{buttonSize:16,modelValue:v.value.currentTime,min:0,max:v.value.duration},null)]),n("div",{"class":F.actions},[n("div",{"class":F.actionBtn},[v.value.paused?n("img",{src:R,onClick:()=>{var e;clearTimeout(v.value.timer),null==(e=v.value.videoEle)||e.play(),v.value.paused=!1,v.value.timer=setTimeout((()=>{m("changeModal",!1)}),4e3)}},null):n("img",{src:N,onClick:()=>{var e;clearTimeout(v.value.timer),null==(e=v.value.videoEle)||e.pause(),v.value.paused=!0}},null)])])])]})])}}),V=e({name:"exercise-after-class",setup(){const e=m(),a=v({width:"100vw"}),s=(e=0)=>{(()=>{const e=Math.min(screen.width,screen.height)*(16/9);e>Math.max(screen.width,screen.height)?a.width="100vw":a.width=e+"px"})(),h({api:"setRequestedOrientation",content:{orientation:e}}),h({api:"setStatusBarVisibility",content:{isVisibility:e}})};s(),c((()=>{s(1)}));const j=p(),C=j.query,R=t(),N=v({disableScreenRecordingFlag:"0",visiableStatus:!1,visiableConfirmText:"下一题",isLastIndex:!1,itemIndex:0,isMember:!1,videoData:null,trainings:[],expireTimeFlag:!1,trainingTimes:0,itemList:[],showHead:!0,loading:!0,recordLoading:!1,isPlayBaseStatus:!0,isPlayAll:!0}),U=v({nowTime:0,model:!0,timer:null,item:null}),V=async()=>{try{const e=await T.post(g.platformApi+"/studentCourseHomework/findStudentHomeworkCourseware",{hideLoading:!0,data:{courseScheduleId:C.courseScheduleId,type:C.type}});if(Array.isArray(null==e?void 0:e.data)){const a=(null==e?void 0:e.data)||[];return a.forEach((e=>{e.times>e.trainingTimes&&(N.isPlayAll=!1),e.id+""==j.query.materialId&&(X.tabName=e.musicScoreName)})),a}}catch(e){}return[]},q=t(),H=M(1e3,{controls:!0});H.pause();let W=null;const G=(e,a)=>{var t,i;a?null==(t=e.videoEle)||t.play():null==(i=e.videoEle)||i.pause()},z=async()=>{const e=await S({api:"getDeviceStatus",content:{type:"video"}}),{status:a}=(null==e?void 0:e.content)||{};"1"==a&&(N.itemList.forEach((e=>e.autoPlay=!1)),J(),(()=>{var e;const a=null==(e=N.videoData)?void 0:e.videoEle;a&&(W=setInterval((()=>{a.paused()||(a.pause(),clearInterval(W)),a.pause()}),100)),setTimeout((()=>{clearInterval(W)}),3e3)})(),N.visiableStatus=!1,P({title:"温馨提示",message:"课件内容请勿录屏",beforeClose:()=>new Promise((e=>{S({api:"getDeviceStatus",content:{type:"video"}}).then((a=>{const t=a.content;"1"==(null==t?void 0:t.status)?(G(N.videoData,!1),e(!1)):(G(N.videoData,!0),e(!0)),K()}))}))}))};i((async()=>{await(async()=>{try{const e=await T.get(g.platformApi+"/sysConfig/queryByParamName",{params:{paramName:"disable_screen_recording_flag"}});N.disableScreenRecordingFlag=e.data.paranValue||""}catch(e){}})(),(async e=>{Array.isArray(e)&&(N.trainings=e.map((e=>({...e,currentTime:0,duration:100,paused:!0,loop:!1,videoEle:null,timer:null,muted:!B(),autoplay:!!B()}))),N.itemList=N.trainings.filter((e=>e.id==j.query.materialId)),N.videoData=N.itemList[0],"1"===N.disableScreenRecordingFlag&&z(),K())})(await V()),"STUDENT"!==g.platformType||(N.isMember=L(),N.isMember)?("1"===N.disableScreenRecordingFlag&&(_("setVideoPlayer",(e=>{var a;"pause"==(null==(a=null==e?void 0:e.content)?void 0:a.status)&&z()})),h({api:"limitScreenRecord",content:{type:1}})),"STUDENT"===g.platformType&&(q.value=E((async()=>{await(async()=>{try{if("STUDENT"===g.platformType){const e=H.counter.value;if(e<=0)return;H.counter.value=0,await T.post("".concat(g.platformApi,"/studentCoursewarePlayRecord/save"),{data:{playTime:e}})}}catch(e){}})()}),5e3))):d((()=>{h({api:"courseLoading",content:{show:!1,type:"fullscreen"}})}))}));const Q=t(),X=v({firstIndex:0,open:!1,activeIndex:-1,tabActive:"",tabName:"",itemActive:"",itemName:""}),J=()=>{N.itemList.forEach((e=>{var a;null==(a=e.videoEle)||a.pause()}))},K=()=>{var e,a,t;if(0!=(null==(e=null==N?void 0:N.videoData)?void 0:e.trainingTimes)&&(null==(a=null==N?void 0:N.videoData)?void 0:a.trainingTimes)>=(null==(t=N.videoData)?void 0:t.times)){let e=!1,a=0,t=-1,i=!0;N.trainings.forEach(((e,a)=>{e.times>e.trainingTimes&&-1===t&&(t=a),e.times>e.trainingTimes&&(i=!1)})),a=-1!=t?t-1:-1,e=i,N.visiableConfirmText=e?"完成":"下一题",N.visiableStatus=!0,N.itemIndex=a,N.isLastIndex=e}},Y=()=>{if(N.isLastIndex)h({api:"goBack"});else{const e=N.trainings[N.itemIndex+1];e.musicScoreName&&(X.tabName=e.musicScoreName),N.itemList=[e],N.videoData=e,K()}N.visiableStatus=!1},Z=()=>{N.visiableStatus=!1};return l(e,(e=>{J(),"visible"==e&&h({api:"setRequestedOrientation",content:{orientation:0}},(()=>{}))})),()=>{let e;return n("div",{"class":F.playContent},[n("div",{"class":F.coursewarePlay,style:{width:a.width}},[n(A,{style:{height:"100%"},ref:Q,showIndicators:!1,loop:!1,vertical:!0,lazyRender:!0,touchable:!1,duration:0},(t=e=N.itemList.map((e=>n(I,null,{"default":()=>[n(r,null,[n(O,{item:e,isMember:N.isMember,modal:U.model,onSeeked:()=>{H.isActive.value&&H.pause()},onSeeking:()=>{H.isActive.value&&H.pause()},onWaiting:()=>{H.isActive.value&&H.pause()},onTimeupdate:()=>{const a=e.videoEle;!H.isActive.value&&(null==a?void 0:a.currentTime())>0&&!(null==a?void 0:a.paused())&&H.resume()},onPause:()=>{clearTimeout(U.timer),U.model=!0,H.pause()},onEnded:()=>(async()=>{var e;if(N.recordLoading||N.expireTimeFlag)return;N.recordLoading=!0;const a={id:(null==(e=N.videoData)?void 0:e.id)||""};try{await T.get(g.platformApi+"/studentCourseHomework/addStudentHomeworkRecord",{params:a,hideLoading:!0})}catch(t){}N.recordLoading=!1;try{const e=await V();if(Array.isArray(e)){const a=e.find((e=>{var a;return e.id==(null==(a=N.videoData)?void 0:a.id)}));a&&(N.videoData.trainingTimes=a.trainingTimes,K())}}catch(t){}})(),onChangeModal:e=>{U.model=e}},null),e.muted&&n("div",{"class":F.loadWrap},[n(x,{animationData:k},null)])])]}))),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!w(t)?e:{"default":()=>[e]})),n(o,{name:"top"},{"default":()=>{var e,a;return[U.model&&n("div",{"class":F.headerContainer,ref:R},[n("div",{"class":F.backBtn,onClick:()=>{h({api:"back"})}},[n(y,{name:D},null),u("返回")]),n("div",{"class":F.menu},[X.tabName]),n("div",{"class":F.nums},[u("练习次数:"),(null==(e=N.videoData)?void 0:e.trainingTimes)||0,u("/"),(null==(a=N.videoData)?void 0:a.times)||0])])]}})]),n(f,{show:N.visiableStatus,"onUpdate:show":e=>N.visiableStatus=e,"class":F.visiablePopup,closeOnClickOverlay:!1},{"default":()=>[n("div",{"class":F.title},[u("温馨提示")]),n("p",{"class":F.content},[u("您已完成该练习~")]),n("div",{"class":F.btnGroup},[n(b,{round:!0,block:!0,onClick:Z},{"default":()=>[u("继续")]}),n(b,{color:"#01C1B5",round:!0,block:!0,onClick:Y},{"default":()=>[N.visiableConfirmText]})])]})]);var t}}});export{V as default};
|