Sfoglia il codice sorgente

Merge branch 'feature-tianyong' into gym-online

TIANYONG 7 mesi fa
parent
commit
32190e0ca0

+ 10 - 0
src/page-instrument/custom-plugins/ExerciseStatistics/index.tsx

@@ -5,6 +5,7 @@ import request from "/src/utils/request";
 import { getSecondRPM } from "/src/utils";
 import state from '/src/state'
 import { headTopData } from "/src/page-instrument/header-top/index";
+import { followData } from "/src/view/follow-practice/index"
 
 // 练习统计
 export default defineComponent({
@@ -42,6 +43,15 @@ export default defineComponent({
                 handleStop()
             }
         })
+		// 监听跟练播放
+		watch(() => state.hasFollowResult, () => {
+			console.log('跟练录音11111',state.hasFollowResult,followData.start)
+            if (followData.practiceStart && state.hasFollowResult){
+                handleStart()
+            } else if (!followData.practiceStart) {
+                handleStop()
+            }
+        })		
 		onMounted(() => {
 			getTime();
 		});

+ 5 - 1
src/state.ts

@@ -595,6 +595,8 @@ const state = reactive({
   headTopHeight: 0,
   /** 是否是自动重播,练习模式开启自动重播时,播放前不需要再次计算播放倍率了,还是按照上次的播放倍率播放音频 */
   isAutoRePlay: false,
+  /** 跟练,是否收到了录音的回调 */
+  hasFollowResult: false,  
 });
 const browserInfo = browser();
 let offset_duration = 0;
@@ -639,7 +641,9 @@ export const onPlay = () => {
 /** 播放模式结束自动重播 */
 const autoResetPlay = () => {
   if (state.modeType !== "practise") return;
-  skipNotePlay(0, true);
+  // 如果是选段需要跳转到预备小节或者选段内的第一小节,否则跳转到第一小节
+  const targetIdx = state.section.length === 2 ? state.sectionFirst?.i || state.section[1].i : 0;
+  skipNotePlay(targetIdx, true);
   // 没有开启自动重播, 不是练习模式
   if (!state.setting.repeatAutoPlay) return;
   offsetTop = 0;

+ 2 - 0
src/view/follow-practice/index.tsx

@@ -115,6 +115,7 @@ export const handleFollowStart = async () => {
 		followData.practiceStart = false;
 	} else {
 		followData.dontAccredit = false;
+		state.hasFollowResult = true;
 		// 从头开始跟练,跟练模式开始前,增加播放系统节拍器
 		if (state.activeNoteIndex === 0) {
 			const tickend = await handleStartTick();
@@ -150,6 +151,7 @@ export const handleFollowEnd = () => {
 	onClear();
 	followData.start = false;
 	followData.practiceStart = false;
+	state.hasFollowResult = false
 	openToggleRecord(false);
 	followData.index = 0;
 	console.log("结束");