Parcourir la source

Update index.tsx

lex il y a 1 an
Parent
commit
a2027ee897
1 fichiers modifiés avec 18 ajouts et 24 suppressions
  1. 18 24
      src/page-instrument/view-figner-listen/index.tsx

+ 18 - 24
src/page-instrument/view-figner-listen/index.tsx

@@ -41,7 +41,7 @@ export default defineComponent({
     const subject = code || "pan-flute";
 
     // 设置屏幕方向
-    api_setRequestedOrientation(["pan-flute", "hulusi-flute", "piccolo"].includes(subject) ? 1 : 0);
+    api_setRequestedOrientation(["hulusi-flute", "piccolo"].includes(subject) ? 1 : 0);
 
     const data = reactive({
       loading: true,
@@ -372,7 +372,10 @@ export default defineComponent({
 
     /** 音符切换 */
     const noteChangeShow = () => {
+      // 播放音阶时不能切换
       if (playStatus.gamut) return;
+      // 开始答题不能切换
+      if (playStatus.action) return;
       if (data.noteType === "all") {
         data.noteType = "#c";
       } else {
@@ -859,29 +862,17 @@ export default defineComponent({
                           if (playAction.listenLock) return;
                           if (playStatus.action) {
                             playAction.userAnswer = note;
-                            if (note.realKey === playAction.standardAnswer.realKey) {
-                              playAction.userAnswerStatus = 1;
-                              if (data.fingeringMode === "listenMode") {
-                                data.realKey = note.realKey;
-                                await fingeringPlay(note, 1000);
-                                ressetMode(false, 0);
-                                data.realKey = 0;
-                                playAction.listenLock = false;
-                              } else {
-                                ressetMode();
-                              }
+                            // 判断用户答题
+                            playAction.userAnswerStatus = note.realKey === playAction.standardAnswer.realKey ? 1 : 2;
+                            if (data.fingeringMode === "listenMode") {
+                              playAction.listenLock = true;
+                              data.realKey = note.realKey;
+                              await fingeringPlay(note, 1000);
+                              ressetMode(note.realKey === playAction.standardAnswer.realKey ? true : false, 0);
+                              data.realKey = 0;
+                              playAction.listenLock = false;
                             } else {
-                              playAction.userAnswerStatus = 2;
-                              if (data.fingeringMode === "listenMode") {
-                                playAction.listenLock = true;
-                                data.realKey = note.realKey;
-                                await fingeringPlay(note, 1000);
-                                ressetMode(false, 0);
-                                data.realKey = 0;
-                                playAction.listenLock = false;
-                              } else {
-                                ressetMode(false);
-                              }
+                              ressetMode(note.realKey === playAction.standardAnswer.realKey ? true : false);
                             }
                           } else {
                             noteClick(note);
@@ -896,7 +887,10 @@ export default defineComponent({
                         <div
                           class={[
                             styles.noteKey,
-                            ((data.realKey === note.realKey && !playStatus.action) || (data.realKey === note.realKey && playAction.showAnswerLoading) || (playStatus.action && playAction.userAnswerStatus === 2 && playAction.userAnswer.realKey === note.realKey)) && styles.keyActive,
+                            ((data.realKey === note.realKey && !playStatus.action) ||
+                              (playStatus.action && ((playAction.showAnswerLoading && playAction.standardAnswer.realKey === note.realKey) || (playAction.userAnswerStatus === 1 && playAction.userAnswer.realKey === note.realKey))) ||
+                              (playStatus.action && playAction.userAnswerStatus === 2 && playAction.userAnswer.realKey === note.realKey)) &&
+                              styles.keyActive,
                           ]}
                         >
                           {/* 显示对应的点 */}