liushengqiang 2 years ago
parent
commit
062618ecac
2 changed files with 33 additions and 9 deletions
  1. 8 7
      src/page-instrument/view-detail/index.tsx
  2. 25 2
      src/view/fingering/fingering-config.ts

+ 8 - 7
src/page-instrument/view-detail/index.tsx

@@ -129,17 +129,18 @@ export default defineComponent({
 			state.enableNotation = data.notation ? true : false;
 
 			// 映射声部ID
-			state.subjectId = mappingVoicePart(state.track as any, "COLEXIU");
+			state.subjectId = mappingVoicePart(state.track as any || state.subjectId, "INSTRUMENT");
+			// console.log("🚀 ~ state.subjectId:", state.subjectId, state.track as any , state.subjectId)
 			// 是否打击乐
-			state.isPercussion =
-				state.subjectId == 23 ||
-				state.subjectId == 113 ||
-				state.subjectId == 121 ||
-				isRhythmicExercises();
+			// state.isPercussion =
+			// 	state.subjectId == 23 ||
+			// 	state.subjectId == 113 ||
+			// 	state.subjectId == 121 ||
+			// 	isRhythmicExercises();
 
 			// 设置指法
 			state.fingeringInfo = subjectFingering(state.subjectId);
-			// console.log("🚀 ~ state.fingeringInfo:", state.fingeringInfo, state.subjectId, state.track)
+			console.log("🚀 ~ state.fingeringInfo:", state.fingeringInfo, state.subjectId, state.track)
 
 			// 检测是否原音和伴奏都有
 			if (!state.music || !state.accompany) {

+ 25 - 2
src/view/fingering/fingering-config.ts

@@ -23,9 +23,9 @@ type ITypeContent = {
 export type IVocals = "flute" | "clarinet" | "saxophone" | "trumpet" | "horn" | "trombone" | "up-bass-horn" | "small-drum" | "tuba" | "piccolo";
 
 /** 映射声部ID */
-export const mappingVoicePart = (id: number, soruce: "GYM" | "COLEXIU" | "ORCHESTRA"): number => {
+export const mappingVoicePart = (id: number | string, soruce: "GYM" | "COLEXIU" | "ORCHESTRA" | 'INSTRUMENT'): number => {
 	if (soruce === "GYM") {
-		return id;
+		return Number(id);
 	} else if (soruce === "COLEXIU") {
 		const subject: { [_key: string | number]: number } = {
 			Flute: 2,
@@ -61,6 +61,29 @@ export const mappingVoicePart = (id: number, soruce: "GYM" | "COLEXIU" | "ORCHES
 			9: 17,
 		  }
 		return subject[id];
+	} else if (soruce === 'INSTRUMENT'){
+		const subject: { [_key: string | number]: number } = {
+			Flute: 2,
+			Clarinet: 4,
+			Trombone: 14,
+			Tuba: 17,
+			Trumpet: 12,
+			Horn: 13,
+			AltoSaxophone: 6,
+			TenorSaxophone: 6,
+			Saxophone: 6,
+			UpBassHorn: 15,
+			Melodica: 137,
+			HulusiFlute: 136,
+			PanFlute: 135,
+			Ocarina: 134,
+			Recorder: 120,
+			Ukulele: 130,
+			Mouthorgan: 140,
+			Piano: 150,
+			1: 120,
+		  }
+		return subject[id];
 	}
 	return 0;
 };