Browse Source

Merge branch 'hqyDevNewVersion' of http://git.dayaedu.com/liushengqiang/music-score into feature-tianyong-newVersion

TIANYONG 1 year ago
parent
commit
741af74fdd

+ 27 - 14
src/page-instrument/header-top/index.tsx

@@ -398,6 +398,8 @@ export default defineComponent({
     });
     /** 模式切换按钮 */
     const toggleBtn = computed(() => {
+      // 不是演奏模式 影藏
+      if(state.playType !== "play") return { display: false, disabled: false }
       // 选择模式, url设置模式 不显示
       if (headTopData.modeType !== "show" || !headTopData.showBack) return { display: false, disabled: false };
       // 跟练开始, 评测开始 播放开始 隐藏
@@ -626,20 +628,19 @@ export default defineComponent({
               </div>
           }
           {/* 模式切换 */}
-          { 
-            state.playType === "play" &&
-              <div 
-                id={state.platform === IPlatform.PC ? "teacherTop-0" : "studnetT-0"}
-                style={{ display: toggleBtn.value.display ? "" : "none" }}
-                class={["driver-9", styles.modeChangeBox, toggleBtn.value.disabled && styles.disabled]} 
-                onClick={() => {
-                    handleRessetState();
-                    headTopData.modeType = "init";
-                }}
-              >
-                <img class={styles.img} src={iconMode} />
-                <div class={styles.title}>{state.modeType==="practise" ? '练习模式' : state.modeType==="follow" ? "跟练模式" : state.modeType==="evaluating" ? "评测模式" : ""}</div>
-              </div>
+          {
+            <div 
+              id={state.platform === IPlatform.PC ? "teacherTop-0" : "studnetT-0"}
+              style={{ display: toggleBtn.value.display ? "" : "none" }}
+              class={["driver-9", styles.modeChangeBox, toggleBtn.value.disabled && styles.disabled]} 
+              onClick={() => {
+                  handleRessetState();
+                  headTopData.modeType = "init";
+              }}
+            >
+              <img class={styles.img} src={iconMode} />
+              <div class={styles.title}>{state.modeType==="practise" ? '练习模式' : state.modeType==="follow" ? "跟练模式" : state.modeType==="evaluating" ? "评测模式" : ""}</div>
+            </div>
           }
           {/* 模式提醒 */}
           {
@@ -702,6 +703,12 @@ export default defineComponent({
                 } else {
                   handlerModeChange(oldPlayType, oldPlaySource, true);
                 }
+                showToast({
+                  message: state.playType === "play" ? "已切换为演奏场景" : "已切换为演唱场景",
+                  duration: 0,
+                  position: "top",
+                  className: "selectionToast",
+                });
               }}
             >
               <img style={{ display: state.playType === "play" ? "" : "none" }} class={styles.iconBtn} src={headImg(`perform.png`)} />
@@ -727,6 +734,12 @@ export default defineComponent({
                   }
                 }
                 handlerModeChange(oldPlayType, oldPlaySource);
+                showToast({
+                  message: state.playType === "play" ? (state.playSource === "music"?"已切换为原声":"已切换为伴奏") : (state.playSource === "music"?"已切换为范唱":(state.playSource === "background"?"已切换为伴唱":"已切换为唱名")),
+                  duration: 0,
+                  position: "top",
+                  className: "selectionToast",
+                });
               }}
             >
               <img style={{ display: state.playSource === "music" ? "" : "none" }} class={styles.iconBtn} src={state.playType === "play" ? headImg(`music.png`) : headImg(`music1.png`)} />

+ 1 - 1
src/page-instrument/header-top/settting/index.tsx

@@ -35,7 +35,7 @@ export default defineComponent({
         const formatterTimeMs = (value: any) => value = String(Math.min(3000, value));
 
         const notationList = computed(() => {
-            const list = state.enableNotation ? [{name:'五线谱',value:'staff'},{name:'首调',value:'firstTone'},{name:'固定谱',value:'fixedTone'}] : [{name:'首调',value:'firstTone'},{name:'固定谱',value:'fixedTone'}];
+            const list = state.enableNotation ? [{name:'五线谱',value:'staff'},{name:'首调',value:'firstTone'},{name:'固定调',value:'fixedTone'}] : [{name:'首调',value:'firstTone'},{name:'固定调',value:'fixedTone'}];
             return list;
         });
 

+ 0 - 17
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -104,11 +104,6 @@ export function destroySmoothAnimation() {
       aveSpeed: 0,
       clientWidth: 0
    })
-   Object.assign(moveState, {
-      oldIndex: -1,
-      progress: 0,
-      activeIndex: 0
-   })
 }
 
 /**
@@ -143,14 +138,7 @@ export function moveSmoothAnimationByPlayTime(time?: number) {
  * progress  当前音符到下一个音符的距离百分比
  * activeIndex 当前
  */
-const moveState = {
-   oldIndex: -1, // 上一次index
-   progress: 0,
-   activeIndex: 0
-}
 export function moveSmoothAnimation(progress: number, activeIndex: number, isMoveOsmd = true) {
-   moveState.progress = progress
-   moveState.activeIndex = activeIndex
    // if (!smoothAnimationState.isShow.value) {
    //    return
    // }
@@ -160,11 +148,6 @@ export function moveSmoothAnimation(progress: number, activeIndex: number, isMov
    const progressCalcIndex = Math.round(progress * _numberOfSegments)
    // // 当前的index
    let nowIndex = nextPointsIndex - _numberOfSegments + progressCalcIndex
-   // 当前计算的位置和上一次值一样时候不运行
-   if (moveState.oldIndex === nowIndex) {
-      return
-   }
-   moveState.oldIndex = nowIndex
    const nowPointsPos = smoothAnimationState.pointsPos[nowIndex]
    smoothAnimationState.canvasCtx?.clearRect(0, 0, smoothAnimationState.canvasDomWith, smoothAnimationState.canvasDomHeight)
    // 移动