Parcourir la source

feat: 乐器code

TIANYONG il y a 1 an
Parent
commit
79dcdb00ef

+ 2 - 2
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 } from "/src/state";
+import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo } from "/src/state";
 import { storeData } from "/src/store";
 import { browser } from "/src/utils";
 import { getNoteByMeasuresSlursStart } from "/src/helpers/formateMusic";
@@ -226,7 +226,7 @@ export default defineComponent({
       calculateInfo = formatTimes()
       const content = {
         musicXmlInfos: calculateInfo.datas,
-        subjectId: state.subjectId,
+        subjectId: state.musicalCode,
         detailId: state.detailId,
         examSongId: state.examSongId,
         xmlUrl: state.xmlUrl,

+ 4 - 1
src/state.ts

@@ -406,6 +406,8 @@ const state = reactive({
   subjectCodeId: 0 as number,
   /** 乐器codeId,用于匹配乐器指法、声部转调、特殊声部处理等 */
   musicalCodeId: 0 as number,
+  /** 乐器code,用于评测传参 */
+  musicalCode: '' as any,
   /** 合奏曲目是否合并展示 */
   isCombineRender: false,
   /** 小节的持续时长,以后台设置的播放速度计算 */
@@ -1006,8 +1008,9 @@ const setState = (data: any, index: number) => {
   const code = state.isConcert ? matchVoicePart(state.trackId, "CONCERT") : matchVoicePart(state.musicalCodeId, "SINGLE");
   state.fingeringInfo = subjectFingering(code);
   console.log("🚀 ~ state.fingeringInfo:", code, state.fingeringInfo, state.trackId, state.track);
-
   state.musicalCodeId = state.fingeringInfo?.id || 0
+  state.musicalCode = musicalInstrumentCodeInfo.find(item => item.id === state.musicalCodeId)?.code || state.trackId
+  ;(window as any).DYSubjectId = state.musicalCodeId
   // 如果切换的声轨没有指法,择指法开关置灰并且不可点击
   if (!state.fingeringInfo.name && state.setting.displayFingering) {
     state.setting.displayFingering = false

+ 22 - 22
src/view/fingering/fingering-config.ts

@@ -342,7 +342,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         direction: "transverse",
         height: "1.6rem",
         hasTizhi: true,
-        id: 8,
+        id: 1,
       };
     case 4: // 单簧管
       return {
@@ -350,7 +350,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         direction: "vertical",
         width: "3rem",
         hasTizhi: true,
-        id: 10,
+        id: 3,
       };
     case 5: // 萨克斯
     case 6: // 中音萨克斯
@@ -359,7 +359,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         direction: "vertical",
         width: "4.34rem",
         hasTizhi: true,
-        id: 9,
+        id: 5,
       };
     case 12: // 小号
       return {
@@ -375,7 +375,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         direction: "vertical",
         width: "4.98rem",
         hasTizhi: false,
-        id: 13,
+        id: 12,
       };
     case 14: // 长号
       return {
@@ -383,7 +383,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         direction: "transverse",
         height: "1.6rem",
         hasTizhi: false,
-        id: 12,
+        id: 13,
       };
     case 15: // 上低音号
       return {
@@ -399,7 +399,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         direction: "vertical",
         width: "4.34rem",
         hasTizhi: false,
-        id: 15,
+        id: 16,
       };
     case 120: // 短笛
       return {
@@ -408,7 +408,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         width: "3rem",
         orientation: 1,
         hasTizhi: true,
-        id: 4,
+        id: 2,
       };
     case "piccolo": // 德式竖笛
       return {
@@ -418,7 +418,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         orientation: 1,
         code: "竖笛",
         hasTizhi: true,
-        id: 4,
+        id: 37,
       };
     case "hulusi-flute": // 葫芦丝
       return {
@@ -428,7 +428,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         orientation: 1,
         code: "葫芦丝",
         hasTizhi: false,
-        id: 3,
+        id: 35,
       };
     case "pan-flute": // 排箫
       return {
@@ -439,7 +439,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         orientation: 0,
         code: "排箫",
         hasTizhi: false,
-        id: 1,
+        id: 33,
       };
     case "ocarina": // 陶笛
       return {
@@ -450,7 +450,7 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         orientation: 0,
         code: "陶笛",
         hasTizhi: false,
-        id: 2,
+        id: 34,
       };
     case "melodica": // 口风琴
       return {
@@ -460,18 +460,18 @@ export const subjectFingering = (subjectId: number | string): IFingering => {
         orientation: 0,
         code: "口风琴",
         hasTizhi: false,
-        id: 5,
+        id: 36,
       };
-	case "baroque-recorder": // 英式竖笛
-	  return {
-		name: "baroque-recorder",
-		direction: "vertical",
-		width: "3rem",
-		orientation: 1,
-		code: "竖笛",
-		hasTizhi: true,
-    id: 6,
-	  };	  
+    case "baroque-recorder": // 英式竖笛
+      return {
+        name: "baroque-recorder",
+        direction: "vertical",
+        width: "3rem",
+        orientation: 1,
+        code: "竖笛",
+        hasTizhi: true,
+        id: 38,
+      };	  
     default:
       return {};
   }