1 |
- import{d as e,I as a,H as t,o as i,j as l,a as o,T as n,aS as s,n as u,F as r,K as d,h as v,r as m,k as c,f as p,s as g,q as y,l as _,t as h,V as f,P as b,B as S,i as w,e as T,N as C}from"./index-4563f371.js";import{T as j,S as D,V as L,p as x,i as k}from"./tcplayer.min-9dde8a7a.js";import{S as I,a as E}from"./index-4ac95303.js";import{u as B,a as N}from"./index-5e8610b4.js";import{b as P}from"./function-call-d06527a8.js";const A={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"},M=""+new URL("icon-play-e9875d7d.svg",import.meta.url).href,O=""+new URL("icon-pause-7c9eee52.svg",import.meta.url).href,F=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:v}){const{item:m,modal:c}=a(e),p=t(),g="video"+Date.now()+Math.floor(100*Math.random()),y=()=>{p.value&&(d((()=>{var e;null==(e=p.value)||e.pause()})),p.value.poster(m.value.coverImg),p.value.src(m.value.content),p.value.loop(m.value.loop),p.value.autoplay(m.value.autoplay),p.value.one("loadedmetadata",(()=>{var e,a,t,i;const l=p.value;m.value.duration=l.duration(),m.value.videoEle=l,m.value.loaded=!0,v("loadedmetadata",p.value),m.value.muted=!1,null==(e=p.value)||e.muted(!1),null==(a=p.value)||a.volume(1),m.value.autoplay&&p.value?null==(t=p.value)||t.play():(null==(i=p.value)||i.pause(),setTimeout((()=>{var e;null==(e=p.value)||e.pause()}),100))})),p.value.on("timeupdate",(()=>{if(!m.value.loaded)return;const e=p.value;m.value.currentTime=e.currentTime(),v("timeupdate")})),p.value.on("ended",(()=>{v("ended",m.value)})),p.value.on("pause",(()=>{var e;m.value.paused=!0,null==(e=p.value)||e.pause(),setTimeout((()=>{var e;null==(e=p.value)||e.pause()}),100),v("pause")})),p.value.on("play",(()=>{var e,a,t;m.value.paused=!1,m.value.muted&&(m.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",(()=>{v("seeked")})),p.value.on("seeking",(()=>{v("seeking")})),p.value.on("waiting",(()=>{v("waiting")})),p.value.on("error",(()=>{v("error")})))};return i((()=>{p.value=j(g,{appID:"",controls:!1,loop:m.value.loop,muted:!1}),y()})),l((()=>e.item),(()=>{p.value.autoplay(m.value.autoplay),y()})),()=>o(r,null,[o("div",{"class":A.itemDiv,onClick:()=>{clearTimeout(m.value.timer),v("changeModal",!c.value)}},[o("video",{id:g,style:{height:"100%",width:"100%"},playsinline:"false",preload:"auto","class":"player","data-vid":m.value.id,src:m.value.content},[o("source",{src:m.value.content,type:"video/mp4"},null)]),o("div",{"class":A.videoSection},null)]),o(n,{name:"bottom"},{"default":()=>[c.value&&!m.value.muted&&o("div",{"class":A.bottomFixedContainer},[o("div",{"class":A.time},[o("span",null,[s(m.value.currentTime)]),u("/"),o("span",null,[s(m.value.duration)])]),o("div",{"class":A.slider},[m.value.duration&&o(D,{buttonSize:16,modelValue:m.value.currentTime,min:0,max:m.value.duration},null)]),o("div",{"class":A.actions},[o("div",{"class":A.actionBtn},[m.value.paused?o("img",{src:M,onClick:()=>{var e;clearTimeout(m.value.timer),null==(e=m.value.videoEle)||e.play(),m.value.paused=!1,m.value.timer=setTimeout((()=>{v("changeModal",!1)}),4e3)}},null):o("img",{src:O,onClick:()=>{var e;clearTimeout(m.value.timer),null==(e=m.value.videoEle)||e.pause(),m.value.paused=!0}},null)])])])]})])}}),R=e({name:"exercise-after-class",setup(){const e=v(),a=m({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(),D=j.query,M=t(),O=m({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}),R=m({nowTime:0,model:!0,timer:null,item:null}),U=async e=>{try{const a=await T.post(g.platformApi+"/studentCourseHomework/findStudentHomeworkCourseware",{hideLoading:!0,data:{courseScheduleId:D.courseScheduleId,type:D.type}});if(Array.isArray(null==a?void 0:a.data)){const t=(null==a?void 0:a.data)||[];return t.forEach((a=>{a.times>a.trainingTimes&&(O.isPlayAll=!1),a.id+""==(e||j.query.materialId)&&(J.tabName=a.musicScoreName)})),t}}catch(a){}return[]},q=async(e,a)=>{Array.isArray(e)&&(O.trainings=e.map((e=>({...e,currentTime:0,duration:100,paused:!0,loop:!1,videoEle:null,timer:null,muted:"UNLOCK"!==e.useStatus,autoplay:"UNLOCK"===e.useStatus}))),O.itemList=O.trainings.filter((e=>e.id==(a||j.query.materialId))),O.videoData=O.itemList[0],"1"===O.disableScreenRecordingFlag&&G())},V=t(),H=B(1e3,{controls:!0});H.pause();let K=null;const W=(e,a)=>{var t,i;a?null==(t=e.videoEle)||t.play():null==(i=e.videoEle)||i.pause()},G=async()=>{const e=await C({api:"getDeviceStatus",content:{type:"video"}}),{status:a}=(null==e?void 0:e.content)||{};"1"==a&&(O.itemList.forEach((e=>e.autoPlay=!1)),Q(),(()=>{var e;const a=null==(e=O.videoData)?void 0:e.videoEle;a&&(K=setInterval((()=>{a.paused()||(a.pause(),clearInterval(K)),a.pause()}),100)),setTimeout((()=>{clearInterval(K)}),3e3)})(),O.visiableStatus=!1,P({title:"温馨提示",message:"课件内容请勿录屏",beforeClose:()=>new Promise((e=>{C({api:"getDeviceStatus",content:{type:"video"}}).then((a=>{const t=a.content;"1"==(null==t?void 0:t.status)?(W(O.videoData,!1),e(!1)):(W(O.videoData,!0),e(!0)),X()}))}))}))};i((async()=>{var e;await(async()=>{try{const e=await T.get(g.platformApi+"/sysConfig/queryByParamName",{params:{paramName:"disable_screen_recording_flag"}});O.disableScreenRecordingFlag=e.data.paranValue||""}catch(e){}})();const a=await U();if(q(a),"STUDENT"===g.platformType&&"LOCK"===(null==(e=O.videoData)?void 0:e.useStatus))return y(O.videoData.lessonCoursewareId,"LESSON","exercise"),void d((()=>{h({api:"courseLoading",content:{show:!1,type:"fullscreen"}})}));X(),O.visiableStatus&&(O.itemList[0].muted=!0,O.itemList[0].autoplay=!1),"1"===O.disableScreenRecordingFlag&&(_("setVideoPlayer",(e=>{var a;"pause"==(null==(a=null==e?void 0:e.content)?void 0:a.status)&&G()})),h({api:"limitScreenRecord",content:{type:1}})),"STUDENT"===g.platformType&&(V.value=N((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))}));const z=t(),J=m({firstIndex:0,open:!1,activeIndex:-1,tabActive:"",tabName:"",itemActive:"",itemName:""}),Q=()=>{O.itemList.forEach((e=>{var a;null==(a=e.videoEle)||a.pause()}))},X=()=>{var e,a,t;if(0!=(null==(e=null==O?void 0:O.videoData)?void 0:e.trainingTimes)&&(null==(a=null==O?void 0:O.videoData)?void 0:a.trainingTimes)>=(null==(t=O.videoData)?void 0:t.times)){let e=!1,a=0,t=-1,i=!0;O.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,O.visiableConfirmText=e?"完成":"下一题",O.visiableStatus=!0,O.itemIndex=a,O.isLastIndex=e}},Y=()=>{if(O.isLastIndex)h({api:"goBack"});else{O.itemList=[],O.videoData={};const e=O.trainings[O.itemIndex+1];e.musicScoreName&&(J.tabName=e.musicScoreName),O.itemList=[e],O.videoData=e,"LOCK"===O.videoData.useStatus?y(O.videoData.lessonCoursewareId,"LESSON","exercise"):X()}O.visiableStatus=!1},Z=()=>{O.visiableStatus=!1};return l(e,(e=>{Q(),"visible"==e&&(h({api:"setRequestedOrientation",content:{orientation:0}},(()=>{})),(async()=>{var e;if(g.vipShow)return;const a=await U(O.videoData.id);if(q(a,O.videoData.id),"STUDENT"===g.platformType&&"LOCK"===(null==(e=O.videoData)?void 0:e.useStatus))return y(O.videoData.lessonCoursewareId,"LESSON","exercise"),void d((()=>{h({api:"courseLoading",content:{show:!1,type:"fullscreen"}})}));X(),O.visiableStatus&&(O.itemList[0].muted=!0,O.itemList[0].autoplay=!1)})())})),()=>{let e;return o("div",{"class":A.playContent},[o("div",{"class":A.coursewarePlay,style:{width:a.width}},[o(I,{style:{height:"100%"},ref:z,showIndicators:!1,loop:!1,vertical:!0,lazyRender:!0,touchable:!1,duration:0},(t=e=O.itemList.map((e=>o(E,null,{"default":()=>[o(r,null,[o(F,{item:e,isMember:O.isMember,modal:R.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(R.timer),R.model=!0,H.pause()},onEnded:()=>(async()=>{var e;if(O.recordLoading||O.expireTimeFlag)return;O.recordLoading=!0;const a={id:(null==(e=O.videoData)?void 0:e.id)||""};try{await T.get(g.platformApi+"/studentCourseHomework/addStudentHomeworkRecord",{params:a,hideLoading:!0})}catch(t){}O.recordLoading=!1;try{const e=await U();if(Array.isArray(e)){const a=e.find((e=>{var a;return e.id==(null==(a=O.videoData)?void 0:a.id)}));a&&(O.videoData.trainingTimes=a.trainingTimes,X())}}catch(t){}})(),onChangeModal:e=>{R.model=e}},null),e.muted&&o("div",{"class":A.loadWrap},[o(L,{animationData:x},null)])])]}))),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!w(t)?e:{"default":()=>[e]})),o(n,{name:"top"},{"default":()=>{var e,a;return[R.model&&o("div",{"class":A.headerContainer,ref:M},[o("div",{"class":A.backBtn,onClick:()=>{h({api:"back"})}},[o(f,{name:k},null),u("返回")]),o("div",{"class":A.menu},[J.tabName]),o("div",{"class":A.nums},[u("练习次数:"),(null==(e=O.videoData)?void 0:e.trainingTimes)||0,u("/"),(null==(a=O.videoData)?void 0:a.times)||0])])]}})]),o(b,{show:O.visiableStatus,"onUpdate:show":e=>O.visiableStatus=e,"class":A.visiablePopup,closeOnClickOverlay:!1},{"default":()=>[o("div",{"class":A.title},[u("温馨提示")]),o("p",{"class":A.content},[u("您已完成该练习~")]),o("div",{"class":A.btnGroup},[o(S,{round:!0,block:!0,onClick:Z},{"default":()=>[u("继续")]}),o(S,{color:"#01C1B5",round:!0,block:!0,onClick:Y},{"default":()=>[O.visiableConfirmText]})])]})]);var t}}});export{R as default};
|