Browse Source

fix: 小节背景bug修复

TIANYONG 8 months ago
parent
commit
d520516fb0
3 changed files with 16 additions and 11 deletions
  1. 13 10
      src/state.ts
  2. BIN
      src/view/audio-list/img/refresh_anim.gif
  3. 3 1
      src/view/audio-list/loading.tsx

+ 13 - 10
src/state.ts

@@ -664,8 +664,8 @@ const handlePlaying = () => {
         // #8698 bug修复
         if (state.modeType === "practise" && state.sectionStatus) {
           onEnded();
-          state.activeNoteIndex = state.sectionFirst ? state.sectionFirst.i : state.section[0].i
-          dynamicShowPlaySpeed(state.activeNoteIndex)
+          // state.activeNoteIndex = state.sectionFirst ? state.sectionFirst.i : state.section[0].i
+          // dynamicShowPlaySpeed(state.activeNoteIndex)
           resetPlaybackToStart();
           return;
         }
@@ -1093,10 +1093,6 @@ const formateSelectMearure = (_list: any[]): any[] => {
     startItemINdex = state.sectionFirst ? state.sectionFirst.i : startItemINdex;
   }
   skipNotePlay(startItemINdex, startItemINdex === 0);
-  const currentItem: any = (state.sectionStatus && state.section.length === 2) ? state.sectionFirst || state.section[0] : state.times[state.activeNoteIndex];
-  if (currentItem.measureSpeed && query.workRecord === undefined) {
-    handleSetSpeed(currentItem.measureSpeed);
-  }
   return list;
 };
 
@@ -1181,6 +1177,11 @@ export const hanldeDirectSelection = (list: any[]) => {
   state.sectionStatus = true;
   setTimeout(() => {
     state.section = formateSelectMearure(list);
+    // 选段完成后,需要根据预报小节的速度,设置右下角显示的速度
+    const currentItem: any = (state.sectionStatus && state.section.length === 2) ? state.sectionFirst || state.section[0] : state.times[state.activeNoteIndex];
+    if (currentItem.measureSpeed && query.workRecord === undefined) {
+      handleSetSpeed(currentItem.measureSpeed);
+    }
     console.log('选段小节', state.section)
   }, 0);
 };
@@ -1665,8 +1666,9 @@ watch(
     // const matchMeasureNum = state.activeMeasureIndex - needReduceMultipleRestNum - 1
     // console.log('选中的小节',matchMeasureNum,'需要减去的小节',needReduceMultipleRestNum,'当前的小节',state.activeMeasureIndex)
     state.vfmeasures.forEach((item: any, idx: number) => {
-      const measureNum = item.getAttribute('data-num') ? Number(item.getAttribute('data-num')) : 1;
-      if (measureNum === state.activeMeasureIndex) {
+      const measureNum = item.getAttribute('data-num') ? Number(item.getAttribute('data-num')) : -1;
+      const nextMeasureNum = state.vfmeasures[idx+1]?.getAttribute('data-num') ? Number(state.vfmeasures[idx+1]?.getAttribute('data-num')) : -1;
+      if (measureNum >= 0 && (measureNum === state.activeMeasureIndex || (measureNum < state.activeMeasureIndex && nextMeasureNum > state.activeMeasureIndex)) ) {
         item.querySelector('.vf-custom-bg')?.setAttribute("fill", "#132D4C")
         item.querySelector('.vf-custom-bot')?.setAttribute("fill", "#040D1E")
       } else {
@@ -1731,8 +1733,9 @@ watch(
     }else{
       // 恢复选段前
       state.vfmeasures.forEach((item: any, idx: number) => {
-        const measureNum = item.getAttribute('data-num') ? Number(item.getAttribute('data-num')) : 1;
-        if (measureNum === state.activeMeasureIndex) {
+        const measureNum = item.getAttribute('data-num') ? Number(item.getAttribute('data-num')) : -1;
+        const nextMeasureNum = state.vfmeasures[idx+1]?.getAttribute('data-num') ? Number(state.vfmeasures[idx+1]?.getAttribute('data-num')) : -1;
+        if (measureNum >= 0 && (measureNum === state.activeMeasureIndex || (measureNum < state.activeMeasureIndex && nextMeasureNum > state.activeMeasureIndex)) ) {
           item.querySelector('.vf-custom-bg')?.setAttribute("fill", "#132D4C")
           item.querySelector('.vf-custom-bot')?.setAttribute("fill", "#040D1E")
         } else {

BIN
src/view/audio-list/img/refresh_anim.gif


+ 3 - 1
src/view/audio-list/loading.tsx

@@ -5,6 +5,7 @@ import styles from "./index.module.less"
 import state from "/src/state"
 import { Vue3Lottie } from "vue3-lottie";
 import animBg from "./img/refresh_anim.json";
+import animGif from "./img/refresh_anim.gif";
 
 export default defineComponent({
    name: "loading",
@@ -19,7 +20,8 @@ export default defineComponent({
       return () =>
          !state.audioDone && (
             <div class={styles.loadingPop}>
-               <Vue3Lottie class={styles.lottie} animationData={animBg}></Vue3Lottie>
+               <img class={styles.lottie} src={animGif} />
+               {/* <Vue3Lottie class={styles.lottie} animationData={animBg}></Vue3Lottie> */}
                <div class={styles.loadingTip}>{props.tipText}</div>
             </div>
          )