index-legacy-9c938089.js 3.8 KB

1
  1. System.register(["./index-legacy-262ec9e7.js"],(function(e,i){"use strict";var t,n,a,o,r,s,d,l,m,c,u,p,v,g,_,h,b,w,S,x,f,y,M,T,I=document.createElement("style");return I.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(I),{setters:[e=>{t=e.d,n=e.g,a=e.n,o=e.c,r=e.m,s=e.bU,d=e.ad,l=e.h,m=e.at,c=e.bX,u=e.bY,p=e.$,v=e.U,g=e.bZ,_=e.b_,h=e.aB,b=e.aE,w=e.b$,S=e.c0,x=e.aF,f=e.c1,y=e.c2,M=e.c3,T=e.c4}],execute:function(){const i="_detail_bwm6i_15",I="_mask_bwm6i_23",L="_container_bwm6i_29";e("default",t({name:"simple-detail",setup(){const e=n(),t=a({isLoading:!0,currentTime:0,totalTime:0}),N=e=>{var i,n,a,o;let s={};try{s="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=s)||void 0===i?void 0:i.api)&&(console.log("h5开始播放"),r.playState="play",P()),"api_paused"===(null===(n=s)||void 0===n?void 0:n.api)){var d,l;const e=null===(d=s)||void 0===d||null===(l=d.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=s)||void 0===a?void 0:a.api)&&(console.log("拖动的进度",r.playState),"paused"===r.playState&&(t.currentTime=null!==(m=null===(p=s)||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=s)||void 0===o?void 0:o.api)){var g,_;const e=null===(g=s)||void 0===g||null===(_=g.content)||void 0===_?void 0:_.currentTime;if(e){if(e<t.currentTime){r.activeNoteIndex=0;let i=c(e)||r.times[0];i.i===r.activeNoteIndex&&(r.activeMeasureIndex=i.MeasureNumberXML),e<=r.times[0].fixtime&&u(!0)}t.currentTime=e}}};o((async()=>{const i=e.id||"";r.isSimplePage=!0,await s(i,"open"),t.isLoading=!1,r.isSingleLine=!0,window.addEventListener("message",N)})),d((()=>{r.isSimplePage=!1,window.removeEventListener("message",N)}));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,T()})),w(r.times),S(),x(),console.log("渲染完成",t),window.parent.postMessage({api:"api_musicPage",height:t},"*"),f({height:t})},F=e=>{const i=t.currentTime;let n=c(i)||r.times[0];n&&y(n,e),r.activeNoteIndex=(null==n?void 0:n.i)||0,r.isSingleLine&&M(i)},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:I},null),l("div",{id:"scrollContainer",class:[L,"hideCursor"]},[!t.isLoading&&l(m,{onRendered:C,musicColor:"#FFFFFF"},null)])])}}))}}}));