lex пре 1 година
родитељ
комит
0a1024313f
1 измењених фајлова са 29 додато и 7 уклоњено
  1. 29 7
      src/page-instrument/view-figner/index.tsx

+ 29 - 7
src/page-instrument/view-figner/index.tsx

@@ -238,7 +238,9 @@ export default defineComponent({
         data.noteType = "all";
       }
       resetMode(true, 0);
-      __init(false);
+      setTimeout(() => {
+        __init(false);
+      }, 100);
     };
 
     const __init = async (loadSong = true) => {
@@ -329,7 +331,9 @@ export default defineComponent({
         data.realKey = item.realKey;
       }
       data.noteAudio = data.soundFonts[item.realKey];
-      data.noteAudio.play();
+      if (data.noteAudio) {
+        data.noteAudio.play();
+      }
     };
     const handleStop = () => {
       if (data.noteAudio) {
@@ -425,6 +429,7 @@ export default defineComponent({
         if (val === "hidden") {
           console.log("页面隐藏停止播放");
           handleStop();
+          gaumntPause();
         }
       }
     );
@@ -432,6 +437,7 @@ export default defineComponent({
     const changePlay = (res: any) => {
       if (res?.data?.api === "setPlayState") {
         handleStop();
+        gaumntPause();
       }
     };
 
@@ -693,7 +699,7 @@ export default defineComponent({
             paddingTop: "3.1rem",
             paddingBottom: ".8rem",
           };
-        } else if (data.subject === "piccolo") {
+        } else if (data.subject === "piccolo" || data.subject === "baroque-recorder") {
           return {
             paddingTop: "4rem",
             paddingBottom: ".8rem",
@@ -725,7 +731,7 @@ export default defineComponent({
             paddingTop: "3.1rem",
             paddingBottom: "0rem",
           };
-        } else if (data.subject === "piccolo") {
+        } else if (data.subject === "piccolo" || data.subject === "baroque-recorder") {
           return {
             paddingTop: "3rem",
             paddingBottom: ".5rem",
@@ -788,7 +794,7 @@ export default defineComponent({
 
     // 屏幕方向 0 竖,1 横
     const orientationDirection = computed(() => {
-      return ["hulusi-flute", "piccolo"].includes(data.subject) ? 1 : 0;
+      return ["hulusi-flute", "piccolo", "baroque-recorder"].includes(data.subject) ? 1 : 0;
     });
 
     const resultImg = (note: any) => {
@@ -864,13 +870,18 @@ export default defineComponent({
                 placement="bottom"
                 class={styles.popoverContainer}
                 actions={data.subjects}
+                onUpdate:show={() => {
+                  // 播放音阶时不能切换
+                  if (playStatus.gamut) return;
+                  // 开始答题不能切换
+                  if (playStatus.action) return;
+                }}
                 onSelect={(val: any) => {
                   if (data.subject === val.value) return;
                   data.subject = val.value;
                   data.viewIndex = 0;
                   data.loadingDom = true;
                   fingerData.fingeringInfo = subjectFingering(data.subject);
-                  console.log(fingerData.fingeringInfo);
                   resetElement();
                   resetMode(true, 0);
                   api_setRequestedOrientation(orientationDirection.value);
@@ -884,8 +895,19 @@ export default defineComponent({
                   reference: () => (
                     <div
                       class={styles.baseBtn}
-                      onClick={() => {
+                      onClick={(e) => {
                         //
+                        // 播放音阶时不能切换
+                        if (playStatus.gamut) {
+                          e.stopPropagation();
+                          e.preventDefault();
+                        }
+                        // 开始答题不能切换
+                        // if (playStatus.action) return;
+                        if (playAction.listenLock) {
+                          e.stopPropagation();
+                          e.preventDefault();
+                        }
                       }}
                     >
                       <img src={icons.icon_change_instrument} />