Prechádzať zdrojové kódy

fix: 取消评测,速度还原逻辑修改

TIANYONG 8 mesiacov pred
rodič
commit
78298ad24c

BIN
src/page-instrument/evaluat-model/icons/tip_erji.png


+ 13 - 12
src/page-instrument/evaluat-model/index.tsx

@@ -3,7 +3,7 @@ import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, han
 import Earphone from "./earphone";
 import styles from "./index.module.less";
 import SoundEffect from "./sound-effect";
-import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo, clearSelection, initSetPlayRate } from "/src/state";
+import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo, clearSelection, initSetPlayRate, resetBaseRate } from "/src/state";
 import { storeData } from "/src/store";
 import { browser } from "/src/utils";
 import { getNoteByMeasuresSlursStart } from "/src/helpers/formateMusic";
@@ -348,7 +348,8 @@ export default defineComponent({
         evaluatingData.oneselfCancleEvaluating = true;
         // handleCancelEvaluat();
         handleEndEvaluat(true, 'selfCancel');
-        evaluatingData.isBeginMask = true;
+        // evaluatingData.isBeginMask = true;
+        evaluatingData.evaluatings = {};
         state.playState = "paused";
       }
       resetPlaybackToStart();
@@ -483,16 +484,16 @@ export default defineComponent({
     // );
 
     // 手动取消评测,需要自动再次评测
-    watch(
-      () => evaluatingData.needReplayEvaluat,
-      (val) => {
-        if (val && evaluatingData.oneselfCancleEvaluating) {
-          setTimeout(() => {
-            startBtnHandle();
-          }, 500);
-        }
-      }
-    );
+    // watch(
+    //   () => evaluatingData.needReplayEvaluat,
+    //   (val) => {
+    //     if (val && evaluatingData.oneselfCancleEvaluating) {
+    //       setTimeout(() => {
+    //         startBtnHandle();
+    //       }, 500);
+    //     }
+    //   }
+    // );
 
     onMounted(async () => {
       // 如果打开了延迟检测开关,需要先发送开始检测的消息

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

@@ -53,6 +53,7 @@ export const headTopData = reactive({
     }
     if (value === "practise") {
       // state.playIngSpeed = state.speed
+      smoothAnimationState.isShow.value = state.setting.melodyLine;
     }
     if (value === "evaluating") {
       // 如果延迟检测资源还在加载中,给出提示

+ 2 - 0
src/page-instrument/header-top/modeView.tsx

@@ -16,6 +16,7 @@ import { Vue3Lottie } from "vue3-lottie";
 import { popImgs, hanldeConfirmPop, hanldeClosePop, evaluatingData } from "/src/view/evaluating"
 import { Popup } from "vant";
 import AbnormalPop from "/src/view/abnormal-pop";
+import { smoothAnimationState } from "../view-detail/smoothAnimation";
 
 export default defineComponent({
   name: "modeView",
@@ -106,6 +107,7 @@ export default defineComponent({
           src={backImg}
           class={styles.back}
           onClick={() => {
+            smoothAnimationState.isShow.value = state.setting.melodyLine;
             headTopData.modeType = "show";
           }}
         />

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

@@ -66,7 +66,12 @@ export default defineComponent({
                             state.isSingleLine && state.modeType === "practise" && !state.isCombineRender && !state.isPercussion && 
                                 <div class={styles.cellBox}>
                                 <div class={styles.tit}>旋律线</div>
-                                    <Switch v-model={smoothAnimationState.isShow.value}></Switch>
+                                    <Switch 
+                                        v-model={smoothAnimationState.isShow.value}
+                                        onChange={(value) => {
+                                            state.setting.melodyLine = value
+                                        }}                                        
+                                    ></Switch>
                                 </div>   
                         }                           
                         {

+ 5 - 3
src/page-instrument/simple-detail/index.tsx

@@ -42,9 +42,11 @@ export default defineComponent({
 				state.playState = 'paused';
 				if (currentTime === 0) {
 					// 坐标和小节都改为初始值
-					state.activeNoteIndex = 0
-					state.activeMeasureIndex = state.times[0].MeasureNumberXML;
-					handlePlaying(true);
+					setTimeout(() => {
+						state.activeNoteIndex = 0
+						state.activeMeasureIndex = state.times[0].MeasureNumberXML;
+						handlePlaying(true);
+					}, 0);
 				}
 			}
 			// 暂停状态下,拖动进度

+ 4 - 2
src/state.ts

@@ -424,7 +424,9 @@ const state = reactive({
     /** 反应时间 */
     reactionTimeMs: 0,
     /** 节拍器音量 */
-    beatVolume: 50
+    beatVolume: 50,
+    /** 旋律线开关 */
+    melodyLine: true,
   },
   /** 后台设置的基准评测频率 */
   baseFrequency: 440,
@@ -649,7 +651,7 @@ export const resetBaseRate = (idx?: number) => {
   const index = idx ? idx : 0;
   const currentItem: any = state.times[index];
   const currentSpeed = currentItem?.measureSpeed ? currentItem.measureSpeed : state.originSpeed;
-  // console.log('速度2',currentSpeed)
+  console.log('速度2',currentSpeed)
   state.speed = currentSpeed
   //state.activeNoteIndex = 0
   state.basePlayRate = 1;

+ 9 - 2
src/view/evaluating/index.tsx

@@ -35,7 +35,7 @@ import {
   api_startDelayCheck,
   api_closeDelayCheck,
 } from "/src/helpers/communication";
-import state, { IPlayState, clearSelection, handleStopPlay, onPlay, resetPlaybackToStart, togglePlay, initSetPlayRate } from "/src/state";
+import state, { IPlayState, clearSelection, handleStopPlay, onPlay, resetPlaybackToStart, togglePlay, initSetPlayRate, resetBaseRate } from "/src/state";
 import { IPostMessage } from "/src/utils/native-message";
 import { usePageVisibility } from "@vant/use";
 import { browser } from "/src/utils";
@@ -321,7 +321,7 @@ const handleScoreResult = (res?: IPostMessage) => {
       evaluatingData.soundEffectFrequency = body.frequency;
     }
     // 小节评分返回
-    if (header?.commond === "measureScore") {
+    if (header?.commond === "measureScore" && !evaluatingData.oneselfCancleEvaluating) {
       console.log("🚀 ~ 评测返回:", res);
       addMeasureScore(body);
     }
@@ -527,6 +527,13 @@ export const handleEndEvaluat = (isComplete = false, endType?: string) => {
   }
   setTimeout(() => {
     evaluatingData.startBegin = false;
+    if (endType === 'selfCancel') {
+      // 重置播放倍率
+      const item: any = (state.sectionStatus && state.section.length === 2) ? state.sectionFirst || state.section[0] : state.times[0];
+      state.activeNoteIndex = item.i;
+      state.activeMeasureIndex = item.MeasureNumberXML;
+      resetBaseRate(item.i);
+    }
   }, 500);
   evaluatingData.isComplete = isComplete;
   // 如果开启了摄像头, 结束录制视频