Explorar o código

Merge branch 'feature-tianyong' into gym-test

TIANYONG hai 9 meses
pai
achega
8887c0223f

+ 2 - 1
src/helpers/formateMusic.ts

@@ -690,7 +690,8 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
 	if (speeds.length === 0) {
 		;(window as any).baseMeasureSpeed = state.originSpeed
 	} else {
-		state.originAudioPlayRate = speeds[0] / state.originSpeed
+		// 当前谱面的速度转为4分音符速度 因为我们速度比例转为4分音符了
+		state.originAudioPlayRate = speedBeatTo({unit:state.speedBeatUnit, speed:speeds[0]}, "1/4") / state.originSpeed
 	}
 	console.log('是否是变速的曲子:',hasVaryingSpeed,speeds)
 	let repeats: any = [];

+ 15 - 1
src/helpers/metronome.ts

@@ -324,6 +324,11 @@ class Metronome {
 			// console.log("🚀 ~ measureNumberXML", measureNumberXML, note)
 			// console.log("🚀 ~ measureNumberXML", note)
 			const measureListIndex = measureNumberXML - 1;
+			// 当渐快渐慢的时候  不播节拍器
+			if(isWithinRange(state.gradual, measureListIndex)){
+				xmlNumber = measureNumberXML;
+				continue
+			}
 			if (measureNumberXML > -1) {
 				if (measureNumberXML != xmlNumber) {
 					// 弱起的时候 根据音符结尾时间减去音符开头时间,得到的不是正常小节的时间,然后平均分配节拍之后,当前节拍间隔会非常短 这里弱起取整个小节的时间
@@ -688,5 +693,14 @@ function hideCursorTip() {
 		}, 2000);
 	}
 }
-
+function isWithinRange(ranges:any[], index:number) {
+	for (const range of ranges) {
+		const start = range[0].measureIndex;
+		const end = range[1].measureIndex;
+		if (index >= start && index < end) {
+			return true;
+		}
+	}
+	return false;
+}
 export default Metronome;

+ 7 - 2
src/page-instrument/custom-plugins/recording-time/index.tsx

@@ -15,8 +15,9 @@ const handleRecord = () => {
 	recordData.starTime = Date.now();
 	if (total < 0) total = 0;
 	const totalTime = total / 1000;
-
-	const body = {
+	const query: any = getQuery();
+	
+	const body: any = {
 		clientType: storeData.user.clientType,
 		musicSheetId: state.examSongId,
 		sysMusicScoreId: state.examSongId,
@@ -26,6 +27,10 @@ const handleRecord = () => {
 		deviceType: browser().android ? "ANDROID" : "IOS",
 		behaviorId: getBehaviorId(),
 	};
+	// 如果是作业模式,需要添加作业id
+	if (query.workRecord || query.evaluatingRecord) {
+		body.lessonDetailId = query.workRecord || query.evaluatingRecord
+	}
 	api_musicPracticeRecordSave(body);
 };
 

+ 6 - 2
src/page-instrument/evaluat-model/evaluat-result/index.tsx

@@ -46,7 +46,7 @@ export default defineComponent({
       // 评测的速度,如果是选段,则选选段开头小节的速度
       const evaluatSpeed = state.sectionStatus && state.section.length === 2 && state.section[0].measureSpeed ? state.section[0].measureSpeed * state.basePlayRate : state.speed;  
       const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率    
-      const body = {
+      const body: any = {
         deviceType: browser().android ? "ANDROID" : "IOS", // 设备类型
         intonation: evaluatingData.resultData.intonation, // 音准
         cadence: evaluatingData.resultData.cadence, // 节奏
@@ -66,8 +66,12 @@ export default defineComponent({
         recordFilePath: evaluatingData.resultData.url, // 录音文件路径
         delFlag: evaluatingData.oneselfCancleEvaluating,
         instrumentId: state.instrumentId,
-        playRate: rate
+        playRate: rate,
       };
+      // 如果是评测作业模式,需要添加作业id
+      if (query.evaluatingRecord) {
+        body.lessonDetailId = query.evaluatingRecord
+      }
       data.saveLoading = true;
       const res = await api_musicPracticeRecordSave(body);
       if (res?.code === 200) {

+ 4 - 1
src/view/music-score/index.module.less

@@ -82,7 +82,10 @@
 .inGradualRange{
    :global{
         #cursorImg-0{
-            // opacity: 0 !important;
+            opacity: 0 !important;
+        }
+        .node-dot {
+            opacity: 0 !important;
         }
    } 
 }