Browse Source

Merge branch 'feature-tianyong' into gym-test

TIANYONG 8 months ago
parent
commit
25dfa4c946

+ 3 - 2
src/helpers/formateMusic.ts

@@ -689,8 +689,9 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
 		state.originAudioPlayRate = speeds[0] / state.originSpeed
 	}
 	console.log('是否是变速的曲子:',hasVaryingSpeed,speeds)
-
-	const repeats: any = Array.from(xmlParse.querySelectorAll('repeat'));
+	const hasCommon = xmlParse.querySelectorAll('part-name')?.[0]?.textContent === 'common';
+	const currentTrackIndex = hasCommon ? state.partIndex + 1 : state.partIndex;
+	const repeats: any = Array.from(xmlParse.querySelectorAll('part')?.[currentTrackIndex]?.querySelectorAll('repeat')) || [];
 	compatibleXmlPitchVoice(xmlParse);
 	// 获取作词、作曲家
 	getComposer(xmlParse);

+ 1 - 1
src/page-instrument/component/vip/index.tsx

@@ -85,7 +85,7 @@ export default defineComponent({
       })
       return () => (
          <>
-            <Popup zIndex={9999999} show={vipData.show} get-container="body" closeable onClickCloseIcon={handleClose} round>
+            <Popup zIndex={999999999999999999} show={vipData.show} get-container="body" closeable onClickCloseIcon={handleClose} round>
                <div class={styles.vip}>
                   <img src={TipsIcon} />
                   <p>{getContent.value}</p>

+ 3 - 3
src/page-instrument/header-top/index.tsx

@@ -668,8 +668,8 @@ export default defineComponent({
           }}
         >
           {/* 返回和标题 */}
-          {!(followData.start || evaluatingData.startBegin) &&  (
-            <div id="noticeBarRollDom" class={[styles.headTopLeftBox, state.playState == "play" && styles.headTopLeftHide]}>
+          {
+            <div id="noticeBarRollDom" class={[styles.headTopLeftBox, (state.playState == "play" || followData.practiceStart || evaluatingData.startBegin) && styles.headTopLeftHide]}>
               {
                 !query.isMove && !query.isHideBack && <img src={iconBack} class={["headTopBackBtn", styles.img, !headTopData.showBack && styles.hidenBack]} onClick={handleBack} />
               }
@@ -702,7 +702,7 @@ export default defineComponent({
                 )
               )}
             </div>
-          )}
+          }
 
           {/* 模式提醒 */}
           {/* {state.modeType === "practise" && (

+ 62 - 50
src/state.ts

@@ -723,7 +723,28 @@ const handlePlaying = () => {
       // 如果开启了预备拍
       const selectStartItem = state.sectionFirst ? state.sectionFirst : state.section[0];
       const selectEndItem = state.section[1];
-
+      if (currentTime - selectEndItem.endtime >= 0) {
+        console.log("选段播放结束", state.setting.repeatAutoPlay);
+        // 如果为选段评测模式
+        if (state.modeType === "evaluating" && state.isSelectMeasureMode) {
+          onEnded();
+          return;
+        }
+        // #8698 bug修复
+        if (state.modeType === "practise" && state.sectionStatus) {
+          // 练习作业,练习完一次需要增加练习次数
+          if (query.workRecord) {
+            HANDLE_WORK_ADD()
+          }
+          onEnded();
+          // state.activeNoteIndex = state.sectionFirst ? state.sectionFirst.i : state.section[0].i
+          // dynamicShowPlaySpeed(state.activeNoteIndex)
+          resetPlaybackToStart();
+          return;
+        }
+        item = selectStartItem;
+        setAudioCurrentTime(selectStartItem.time, selectStartItem.i);
+      }
       /**
        * #9374,反复小节的曲目播放错误, bug修复
        * 曲目:噢!苏珊娜-排箫-人音
@@ -750,28 +771,7 @@ const handlePlaying = () => {
       // if (Math.abs(selectEndItem.endtime - currentTime) < offset_duration) {
       // if (currentTime - selectEndItem.endtime > offset_duration) {
       //console.log(currentTime,selectEndItem.endtime)
-      if (currentTime - selectEndItem.endtime >= 0) {
-        console.log("选段播放结束", state.setting.repeatAutoPlay);
-        // 如果为选段评测模式
-        if (state.modeType === "evaluating" && state.isSelectMeasureMode) {
-          onEnded();
-          return;
-        }
-        // #8698 bug修复
-        if (state.modeType === "practise" && state.sectionStatus) {
-          // 练习作业,练习完一次需要增加练习次数
-          if (query.workRecord) {
-            HANDLE_WORK_ADD()
-          }
-          onEnded();
-          // state.activeNoteIndex = state.sectionFirst ? state.sectionFirst.i : state.section[0].i
-          // dynamicShowPlaySpeed(state.activeNoteIndex)
-          resetPlaybackToStart();
-          return;
-        }
-        item = selectStartItem;
-        setAudioCurrentTime(selectStartItem.time, selectStartItem.i);
-      }
+
     }
     gotoNext(item);
     dynamicShowPlaySpeed(item.i, true);
@@ -1061,13 +1061,13 @@ export const gotoNext = (note: any, skipNote?: boolean) => {
   // 赋值音符id
   osmd.cursor.noteGraphicalId = state.times[state.activeNoteIndex].id;
   // 设置光标位置
-  nextTick(() => {
-      if (osmd.cursor.noteGraphicalId) {
-      const { x, y } = document.getElementById(`vf-${osmd.cursor.noteGraphicalId}`)?.getBoundingClientRect() || { x: 0, y: 0}
-      osmd.cursor.cursorElement.style.left = x + "px";
-      // cursorElement.style.top = y + "px";
-    }
-  })
+  // nextTick(() => {
+  //     if (osmd.cursor.noteGraphicalId) {
+  //     const { x, y } = document.getElementById(`vf-${osmd.cursor.noteGraphicalId}`)?.getBoundingClientRect() || { x: 0, y: 0}
+  //     osmd.cursor.cursorElement.style.left = x + "px";
+  //     // cursorElement.style.top = y + "px";
+  //   }
+  // })
   dynamicShowPlaySpeed(state.activeNoteIndex);
   if (prev && num - prev === 1) {
     // console.log('跳转音符',11111,osmd.cursor)
@@ -1813,9 +1813,13 @@ const setState = (data: any, index: number) => {
     }
     state.enableEvaluation = false;
   }
-  if (storeData.isApp) {
+  if (storeData.isApp && !state.isPreView) {
     state.zoom = localStorage.getItem('scoreZoom') ? Number(localStorage.getItem('scoreZoom')) : state.zoom
   }
+  // 详情预览页面,曲谱比例
+  if (state.isPreView) {
+    state.zoom = query.zoom ? Number(query.zoom) : state.zoom;
+  }
   /**
    * 默认渲染什么谱面类型 & 能否转谱逻辑
    * 渲染类型:首先取url参数musicRenderType,没有该参数则取musicalInstruments字段匹配的当前分轨的defaultScore,没有匹配到则取默认值('firstTone')
@@ -2122,6 +2126,10 @@ watch(
         if(state.sectionFirst && measureNum === state.sectionFirst.MeasureNumberXML && state.section.length === 2){
           item?.querySelector('.vf-custom-bg')?.setAttribute("fill", "rgba(255, 193, 48, 0.15)")
         }
+        // 如果是选段,超出选段时,不添加背景色
+        if (state.section.length === 2 && state.activeMeasureIndex > state.section[1].MeasureNumberXML) {
+          item.querySelector('.vf-custom-bg')?.setAttribute("fill", "transparent")
+        }
       } else {
         // 有选段只清除选段处的
         if (state.section.length === 2) {
@@ -2288,27 +2296,31 @@ export const handleGuide = async () => {
     }
 };
 
+// 手动设置音符指针位置
 export const resetCursorPosition = () => {
-  if (metronomeData.cursorMode === 1) {
-    const currentActives: HTMLElement[] = Array.from(document.querySelectorAll(".dotActive"));
-    currentActives.forEach((currentActive) => {
-      currentActive?.classList.remove("dotActive");
-    })
-    // const currentDot = document.querySelector(`.noteIndex_${state.activeNoteIndex}`)
-    const noteId = state.times[state.activeNoteIndex].id;
-    const domId = "vf" + noteId;
-    const currentDot = document.querySelector(`[data-vf=${domId}]`)?.parentElement
-    if (currentDot) {
-      setTimeout(() => {
-        currentDot.classList.add('dotActive')
-      }, 0);
+  nextTick(() => {
+    if (metronomeData.cursorMode === 1) {
+      const currentActives: HTMLElement[] = Array.from(document.querySelectorAll(".dotActive"));
+      currentActives.forEach((currentActive) => {
+        currentActive?.classList.remove("dotActive");
+      })
+      // const currentDot = document.querySelector(`.noteIndex_${state.activeNoteIndex}`)
+      const noteId = state.times[state.activeNoteIndex].id;
+      const domId = "vf" + noteId;
+      const currentDot = document.querySelector(`[data-vf=${domId}]`)?.parentElement
+      if (currentDot) {
+        setTimeout(() => {
+          currentDot.classList.add('dotActive')
+        }, 0);
+      }
+      currentDot?.classList.add('dotActive')
+    } else {
+      const currentActives: HTMLElement[] = Array.from(document.querySelectorAll(".dotActive"));
+      currentActives.forEach((currentActive) => {
+        currentActive?.classList.remove("dotActive");
+      })
     }
-  } else {
-    const currentActives: HTMLElement[] = Array.from(document.querySelectorAll(".dotActive"));
-    currentActives.forEach((currentActive) => {
-      currentActive?.classList.remove("dotActive");
-    })
-  }
+  })
 }
 
 

+ 1 - 1
src/view/plugins/toggleMusicSheet/choosePartName/index.module.less

@@ -43,7 +43,7 @@
         padding: 10px 0;
         &.stickyTit{
           position: sticky;
-          top: 0;
+          top: -1px;
           background-color: #fff;
         }
         .tit{