瀏覽代碼

Merge branch 'iteration-beat-one'

lex 1 年之前
父節點
當前提交
0e83fd8d4c

+ 2 - 2
src/page-instrument/view-detail/index.tsx

@@ -161,6 +161,8 @@ export default defineComponent({
       const track = data.code || data.track;
       state.track = track ? track.replace(/ /g, "").toLocaleLowerCase() : "";
       state.enableNotation = data.notation ? true : false;
+      // 是否是合奏,先根据background判断
+      state.isConcert = data.background?.length > 1;
 
       // console.log("🚀 ~ state.subjectId:", state.subjectId, state.track as any , state.subjectId)
       // 是否打击乐
@@ -191,8 +193,6 @@ export default defineComponent({
 
       //课堂乐器, 渲染类型: 五线谱, 简谱
       state.musicRenderType = query.musicRenderType || EnumMusicRenderType.firstTone;
-      // 是否是合奏,先根据background判断
-      state.isConcert = data.background?.length > 1;
       console.log("state对象", state);
     };
 

+ 54 - 19
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) => {
@@ -300,11 +302,15 @@ export default defineComponent({
     };
 
     onBeforeMount(async () => {
+      if (browser().isApp) {
+        state.platform = "APP" as IPlatform;
+      } else {
+        state.platform = query.platform?.toLocaleUpperCase() || "";
+      }
+
       if (state.platform === IPlatform.PC) {
         document.title = "听音练习";
       }
-
-      state.platform = query.platform?.toLocaleUpperCase() || "";
       await getSubjects();
       __init();
     });
@@ -329,7 +335,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) {
@@ -348,14 +356,21 @@ export default defineComponent({
         emit("close");
         return;
       } else if (state.platform === IPlatform.PC) {
-        // 老师端,首页
-        window.parent.postMessage(
-          {
-            api: "iframe_exit",
-          },
-          "*"
-        );
-        return;
+        console.log(1, query);
+        if (query.matchMedia == 1) {
+          // 老师端,首页
+          window.parent.postMessage(
+            {
+              api: "iframe_exit",
+            },
+            "*"
+          );
+          return;
+        } else {
+          window.close();
+          return;
+        }
+
         // if (fingerData.fingeringInfo.orientation === 0) {
         // 	api_setRequestedOrientation(1);
         // }
@@ -425,6 +440,7 @@ export default defineComponent({
         if (val === "hidden") {
           console.log("页面隐藏停止播放");
           handleStop();
+          gaumntPause();
         }
       }
     );
@@ -432,6 +448,7 @@ export default defineComponent({
     const changePlay = (res: any) => {
       if (res?.data?.api === "setPlayState") {
         handleStop();
+        gaumntPause();
       }
     };
 
@@ -693,7 +710,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 +742,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 +805,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,18 +881,25 @@ 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);
                   // 设置屏幕方向
                   setTimeout(() => {
+                    data.paddingTop = "";
+                    data.paddingLeft = "";
                     __init();
                   }, 100);
                 }}
@@ -884,8 +908,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} />
@@ -972,7 +1007,7 @@ export default defineComponent({
                 {playAction.userAnswerStatus === 1 && <div class={[styles.tipsT, styles.playSuccess]}></div>}
                 {playAction.userAnswerStatus === 2 && <div class={[styles.tipsT, styles.playError]}></div>}
 
-                {(data.noteType !== "#c" && orientationDirection.value === 0 || orientationDirection.value === 1) && (
+                {((data.noteType !== "#c" && (orientationDirection.value === 0 || (orientationDirection.value === 1 && state.platform === IPlatform.PC))) || (orientationDirection.value === 1 && state.platform === IPlatform.APP)) && (
                   <Button class={styles.noteBtn} onClick={() => scrollNoteBox("left")}>
                     <Icon name="arrow-left" />
                   </Button>
@@ -1056,7 +1091,7 @@ export default defineComponent({
                     </div>
                   </div>
                 </div>
-                {(data.noteType !== "#c" && orientationDirection.value === 0 || orientationDirection.value === 1) && (
+                {((data.noteType !== "#c" && (orientationDirection.value === 0 || (orientationDirection.value === 1 && state.platform === IPlatform.PC))) || (orientationDirection.value === 1 && state.platform === IPlatform.APP)) && (
                   <Button class={styles.noteBtn} onClick={() => scrollNoteBox("right")}>
                     <Icon name="arrow" />
                   </Button>

+ 1 - 0
src/view/fingering/fingering-config.ts

@@ -101,6 +101,7 @@ export const mappingVoicePart = (id: number | string, soruce: "GYM" | "COLEXIU"
     if (typeof code === "string") {
       code = code.toLocaleLowerCase().replace(/ /g, "");
     }
+    console.log(code, "1212");
     const subject: { [_key: string | number]: any } = {
       flute: 2,
       clarinet: 4,