浏览代码

fix: 评测bug修复

TIANYONG 1 年之前
父节点
当前提交
066b81273d

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

@@ -35,7 +35,7 @@ export const headTopData = reactive({
   settingMode: false,
   /** 切换模式 */
   handleChangeModeType(value: "practise" | "follow" | "evaluating") {
-    if (!state.enableEvaluation) return
+    if (value === 'evaluating' && !state.enableEvaluation) return
     // 跟练模式,光标只有音符模式,无节拍模式
     if (value === 'follow' && metronomeData.cursorMode === 2) {
       metronomeData.cursorMode = 1

+ 1 - 1
src/page-instrument/view-detail/index.tsx

@@ -172,7 +172,7 @@ export default defineComponent({
       state.isSpecialBookCategory = !classids.includes(data.musicSheetCategoriesId) 
 
       // 设置指法
-      const code = mappingVoicePart(state.trackId, "INSTRUMENT");
+      const code = mappingVoicePart(state.subjectId, "INSTRUMENT");
       state.fingeringInfo = subjectFingering(code);
       console.log("🚀 ~ state.fingeringInfo:", code, state.fingeringInfo, state.trackId, state.track);
 

+ 5 - 50
src/view/fingering/fingering-config.ts

@@ -57,8 +57,7 @@ export type IVocals =
 export const mappingVoicePart = (
 	id: number | string,
 	soruce: "GYM" | "COLEXIU" | "ORCHESTRA" | "INSTRUMENT"
-): number | string => {
-	console.log(1)
+): number => {
 	if (soruce === "GYM") {
 		return Number(id);
 	} else if (soruce === "COLEXIU") {
@@ -98,41 +97,11 @@ export const mappingVoicePart = (
 		return subject[id];
 	} else if (soruce === "INSTRUMENT") {
 		let code = id;
-		// if (typeof code === "string") {
-		// 	//code = code.toLocaleLowerCase().replace(/ /g, "");
-		// 	code = code.toLocaleLowerCase().split(' ')[0]
-		// }
+		if (typeof code === "string") {
+			code = code.toLocaleLowerCase().replace(/ /g, "");
+		}
 		const subject: { [_key: string | number]: any } = {
-			"Flute 1": 2,
-			"Flute 2": 2,
-			"Oboe": 4,
-			"Clarinet in Bb 1": 4,
-			"Clarinet in Bb 2": 4,
-			"Alto Clarinet in Eb": 4,
-			"Bass Clarinet in Bb": 4,
-			"Bassoon": 1,
-			"Alto Saxophone": 5,
-			"Tenor Saxophone": 5,
-			"Baritone Saxophone": 5,
-			"Trumpet in Bb 1": 12,
-			"Trumpet in Bb 2": 12,
-			"Horn in F": 13,
-			"Trombone 1": 14,
-			"Trombone 2": 14,
-			"Euphonium": 15,
-			"Tuba": 17,
-			"Chimes": 1,
-			"Bells": 1,
-			"Xylophone": 1,
-			"Snare Drum": 1,
-			"Bass Drum": 1,
-			"Triangle": 1,
-			"Suspended Cymbal": 1,
-			"Crash Cymbals": 1,
-			"Concert Toms": 1,
-			"Timpani": 1,
 			flute: 2,
-			oboe: 4,
 			clarinet: 4,
 			trombone: 14,
 			tuba: 17,
@@ -154,33 +123,19 @@ export const mappingVoicePart = (
 			1: "pan-flute",
 			2: "ocarina",
 			5: "melodica",
-			26: 12,
 			tenorrecorder: "piccolo",
 			woodwind: "hulusi-flute",
 			panpipes: "pan-flute",
 			ocarina: "ocarina",
 			nai: "melodica",
 		};
-		let _track;
-		if (typeof code === 'string') {
-			for (let sKey in subject) {
-				if(sKey === code) {
-					_track = subject[sKey]
-					break;
-				}
-			}
-		} else {
-			_track = subject.code
-		}
-		// const _track = typeof code === 'string' ? Object.keys(subject).filter((key) => key.includes(String(code)) || String(code).includes(key))[0] : code
-		return _track;
+		return subject[code] || 0;
 	}
 	return 0;
 };
 
 /** 声部的指法配置信息 */
 export const subjectFingering = (subjectId: number | string): IFingering => {
-	subjectId = isNaN(Number(subjectId)) ? subjectId : Number(subjectId)
 	switch (subjectId) {
 		case 2: // 长笛
 			return {