index-legacy-4dc5b35d.js 3.8 KB

1
  1. System.register(["./index-legacy-fa96eed7.js"],(function(e,i){"use strict";var t,n,a,o,r,d,s,l,m,u,c,p,v,g,_,h,b,w,x,S,f,y,I,M,T=document.createElement("style");return T.textContent="body{overflow:hidden}._skeleton_bwm6i_4{position:fixed;left:0;top:0;width:100vw;height:100vh;padding:.53333rem .8rem;background-color:#fff;z-index:1000;--van-skeleton-paragraph-height: .8rem}._detail_bwm6i_15{width:100vw;height:auto;overflow:hidden;--header-height: 1.65333rem;background:transparent;position:relative}._detail_bwm6i_15 ._mask_bwm6i_23{position:absolute;z-index:6;width:100%;height:100%}._detail_bwm6i_15 ._container_bwm6i_29{margin:0;border-radius:.26667rem}._detail_bwm6i_15 #osmdCanvasPage1{position:relative!important}._detail_bwm6i_15 #musicAndSelection{height:initial!important;max-height:initial!important}._detail_bwm6i_15 .smoothAnimationBox{height:0!important;overflow:hidden}\n",document.head.appendChild(T),{setters:[e=>{t=e.d,n=e.g,a=e.n,o=e.c,r=e.m,d=e.bR,s=e.ae,l=e.h,m=e.au,u=e.bU,c=e.bV,p=e.a0,v=e.V,g=e.bW,_=e.bX,h=e.aC,b=e.aF,w=e.bY,x=e.bZ,S=e.aG,f=e.b_,y=e.b$,I=e.c0,M=e.c1}],execute:function(){const i="_detail_bwm6i_15",T="_mask_bwm6i_23",N="_container_bwm6i_29";e("default",t({name:"simple-detail",setup(){const e=n(),t=a({isLoading:!0,currentTime:0,totalTime:0}),L=e=>{var i,n,a,o;let d={};try{d="string"==typeof(null==e?void 0:e.data)?JSON.parse(e.data):e.data}catch(h){console.error("parse_error: Invalid JSON data received")}if("api_play"===(null===(i=d)||void 0===i?void 0:i.api)&&(console.log("h5开始播放"),r.playState="play",P()),"api_paused"===(null===(n=d)||void 0===n?void 0:n.api)){var s,l;const e=null===(s=d)||void 0===s||null===(l=s.content)||void 0===l?void 0:l.currentTime;console.log("暂停播放",e),r.playState="paused",0===e&&setTimeout((()=>{t.currentTime=0,r.activeNoteIndex=0,r.activeMeasureIndex=r.times[0].MeasureNumberXML,F(!0)}),200)}var m,p,v;if("api_updateProgress"===(null===(a=d)||void 0===a?void 0:a.api)&&(console.log("拖动的进度",r.playState),"paused"===r.playState&&(t.currentTime=null!==(m=null===(p=d)||void 0===p||null===(v=p.content)||void 0===v?void 0:v.currentTime)&&void 0!==m?m:t.currentTime,r.activeNoteIndex=0,r.activeMeasureIndex=r.times[0].MeasureNumberXML,F(!0))),"api_playProgress"===(null===(o=d)||void 0===o?void 0:o.api)){var g,_;const e=null===(g=d)||void 0===g||null===(_=g.content)||void 0===_?void 0:_.currentTime;if(e){if(e<t.currentTime){r.activeNoteIndex=0;let i=u(e)||r.times[0];i.i===r.activeNoteIndex&&(r.activeMeasureIndex=i.MeasureNumberXML),e<=r.times[0].fixtime&&c(!0)}t.currentTime=e}}};o((async()=>{const i=e.id||"";r.isSimplePage=!0,r.partIndex=e["part-index"]?Number(e["part-index"]):0,await d(i,"open"),t.isLoading=!1,r.isSingleLine=!0,window.addEventListener("message",L)})),s((()=>{r.isSimplePage=!1,window.removeEventListener("message",L)}));const C=async e=>{var i;const t=null===(i=document.getElementById("scrollContainer"))||void 0===i?void 0:i.getBoundingClientRect().height;r.osmd=e,0===r.originSpeed&&(r.originSpeed=r.speed=e.bpm||e.Sheet.userStartTempoInBPM||100);const n=(p.get("speeds")||{})[r.examSongId]||r.speed||e.bpm||e.Sheet.userStartTempoInBPM;n&&v(n),g(),_(),r.times=h(e),console.log("🚀 ~ state.times:",r.times,r),b((()=>{r.activeMeasureIndex=r.times[0].MeasureNumberXML,M()})),w(r.times),x(),S(),console.log("渲染完成",t),window.parent.postMessage({api:"api_musicPage",height:t},"*"),f({height:t})},F=e=>{const i=t.currentTime;let n=u(i)||r.times[0];n&&y(n,e),r.activeNoteIndex=(null==n?void 0:n.i)||0,r.isSingleLine&&I(i,!0)},P=()=>{if("play"!==r.playState)return void console.log("暂停播放");let e=Date.now();requestAnimationFrame((()=>{Date.now()-e<16.7?(F(),P()):setTimeout((()=>{F(),P()}),16.7)}))};return()=>l("div",{class:i},[l("div",{class:T},null),l("div",{id:"scrollContainer",class:[N,"hideCursor"]},[!t.isLoading&&l(m,{onRendered:C,musicColor:"#FFFFFF"},null)])])}}))}}}));