Browse Source

feat: 单曲多声轨合并展示

TIANYONG 1 year ago
parent
commit
7e6aa3a889
4 changed files with 11 additions and 8 deletions
  1. 1 1
      osmd-extended
  2. 1 1
      src/page-instrument/view-detail/index.tsx
  3. 8 5
      src/state.ts
  4. 1 1
      src/view/music-score/index.tsx

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit c61975028e8f71a7448a92ba440fc9297a17a2ed
+Subproject commit 9d41c99bb92f1a836080f4a62e44211dbec45379

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

@@ -360,7 +360,7 @@ export default defineComponent({
             {/* 作业 */}
             {query.workRecord && <WorkIndex />}
             {/* 曲谱列表 */}
-            {state.playState == "play" || followData.start || evaluatingData.startBegin || query.workRecord || query.modelType || state.platform === IPlatform.PC ? null : <TheMusicList />}
+            {state.playState == "play" || followData.start || evaluatingData.startBegin || query.workRecord || query.modelType || state.platform === IPlatform.PC || query.isCbs ? null : <TheMusicList />}
           </>
         )}
 

+ 8 - 5
src/state.ts

@@ -278,6 +278,8 @@ const state = reactive({
   canSelectTracks: "",
   /** 声部codeId,用于匹配乐器指法、声部转调、特殊声部处理等 */
   subjectCodeId: 0 as number,
+  /** 合奏曲目是否合并展示 */
+  isCombineRender: false,
 });
 const browserInfo = browser();
 let offset_duration = 0;
@@ -756,7 +758,6 @@ const getMusicInfo = (res: any) => {
   };
   console.log("🚀 ~ musicInfo:", musicInfo);
   setState(musicInfo, index);
-  setCustom();
 };
 
 const setState = (data: any, index: number) => {
@@ -775,6 +776,8 @@ const setState = (data: any, index: number) => {
   state.examSongId = data.id + "";
   state.examSongName = data.name;
   state.coverImg = data.musicCover ?? "";
+  state.isCombineRender = data.musicSheetType === "SINGLE" && data.musicSheetSoundList?.length > 1
+  setCustom(state.isCombineRender ? data.musicSheetSoundList?.length : 0);
   // 解析扩展字段
   if (data.extConfigJson) {
     try {
@@ -796,7 +799,7 @@ const setState = (data: any, index: number) => {
   state.originSpeed = state.speed = data.playSpeed;
   const track = data.code || data.track;
   state.track = track ? track.replace(/ /g, "").toLocaleLowerCase() : "";
-  state.enableNotation = data.isConvertibleScore ? true : false;
+  state.enableNotation = data.isConvertibleScore === null ? true : data.isConvertibleScore;
   state.isConcert = data.musicSheetType === "CONCERT" ? true : false;
   state.canSelectTracks = data.multiTracksSelection;
   // 开启预备小节
@@ -840,8 +843,8 @@ const setState = (data: any, index: number) => {
   console.log("state对象", state);
 };
 
-const setCustom = () => {
-  if (state.extConfigJson.multitrack) {
-    setGlobalData("multitrack", state.extConfigJson.multitrack);
+const setCustom = (trackNum?: number) => {
+  if (trackNum || state.extConfigJson.multitrack) {
+    setGlobalData("multitrack", trackNum || state.extConfigJson.multitrack);
   }
 };

+ 1 - 1
src/view/music-score/index.tsx

@@ -58,7 +58,7 @@ export default defineComponent({
 		const getXML = async () => {
 			const res = await fetch(state.xmlUrl).then((response) => response.text());
 			const xml = formatXML(res);
-			musicData.score = onlyVisible(xml, state.partIndex);
+			musicData.score = state.isCombineRender ? xml : onlyVisible(xml, state.partIndex);
 			if (state.gradualTimes) {
 				state.gradual = getGradualLengthByXml(xml);
 			}