|
|
-import{d as g,g as S,n as T,c as y,bF as f,m as t,bG as b,ae as h,h as s,av as _,a0 as v,V as P,bH as w,bI as x,aD as D,bJ as F,bK as L,bL as C,bM as M,bN as N,bO as B}from"./index-1ae0581a.js";const I="_skeleton_1ro2x_1",A="_detail_1ro2x_12",k="_container_1ro2x_20",d={skeleton:I,detail:A,container:k},V=g({name:"simple-detail",setup(){const r=S(),n=T({isLoading:!0,currentTime:0,totalTime:6e4}),l=e=>{var a;((a=e==null?void 0:e.data)==null?void 0:a.api)==="playProgress"&&e!=null&&e.data.data&&(t.playState="play",console.log(e.data))},u=e=>{var a,o,m;n.currentTime=(e==null?void 0:e.currentTime)||((a=e==null?void 0:e.content)==null?void 0:a.currentTime),n.totalTime=(e==null?void 0:e.totalDuration)||((o=e==null?void 0:e.content)==null?void 0:o.totalDuration),n.currentTime/1e3,((m=e==null?void 0:e.content)==null?void 0:m.totalDuration)>1e3&&n.currentTime>=n.totalTime};y(async()=>{const e=r.id||"";await f(e),n.isLoading=!1,t.isSingleLine=!0,t.isSimplePage=!0,b(u),window.addEventListener("message",l)}),h(()=>{t.isSimplePage=!1,window.removeEventListener("message",l)});const p=async e=>{console.log("渲染完成"),t.osmd=e,t.originSpeed===0&&(t.originSpeed=t.speed=e.bpm||e.Sheet.userStartTempoInBPM||100);const a=(v.get("speeds")||{})[t.examSongId]||t.speed||e.bpm||e.Sheet.userStartTempoInBPM;a&&P(a),w(),x(),t.times=D(e),console.log("🚀 ~ state.times:",t.times,t.subjectId,t),F(t.times),L(),C.isShow.value=!1,t.playState="play",i()},c=()=>{n.currentTime+=.03;const e=n.currentTime,a=n.totalTime;t.playProgress=e/a*100;let o=M(e);o&&N(o),t.isSingleLine&&B(e)},i=()=>{if(t.playState!=="play"){console.log("暂停播放");return}let e=Date.now();requestAnimationFrame(()=>{Date.now()-e<16.7?(c(),i()):setTimeout(()=>{c(),i()},16.7)})};return()=>s("div",{class:d.detail},[s("div",{id:"scrollContainer",class:[d.container,"hideCursor"]},[!n.isLoading&&s(_,{onRendered:p,musicColor:"#FFFFFF"},null)])])}});export{V as default};
|