Browse Source

feat: 演奏模式不显示歌词

TIANYONG 9 tháng trước cách đây
mục cha
commit
2f08281c44

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

@@ -696,7 +696,12 @@ export default defineComponent({
                   state.playType = "play";
                   state.playSource = state.music ? "music" : "background";
                 }
-                handlerModeChange(oldPlayType, oldPlaySource, true);
+                // 有歌词的时候,切换播放模式,需要重新渲染谱面
+                if (state.xmlHasLyric) {
+                  refreshMusicSvg();
+                } else {
+                  handlerModeChange(oldPlayType, oldPlaySource, true);
+                }
               }}
             >
               <img style={{ display: state.playType === "play" ? "" : "none" }} class={styles.iconBtn} src={headImg(`perform.png`)} />

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

@@ -181,6 +181,7 @@ export default defineComponent({
       state.times = formateTimes(osmd);
       // state.times = resetFrequency(state.times);
       state.times = setNoteHalfTone(state.times);
+      state.xmlHasLyric = state.times.some((item: any) => item?.formatLyricsEntries?.length)
       console.log("🚀 ~ state.times:", state.times, state.subjectId, state);
       nextTick(() => {
         state.activeMeasureIndex = state.times[0].MeasureNumberXML;

+ 2 - 0
src/state.ts

@@ -516,6 +516,8 @@ const state = reactive({
   hasDriverPop: false,
   /** 播放倍率不等于1,或者是选段评测,APP暂时不支持保存演奏,需要给出提示 */
   noSavePopShow: true,
+  /** xml里面是否有歌词 */
+  xmlHasLyric: false,
 });
 const browserInfo = browser();
 let offset_duration = 0;

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

@@ -95,6 +95,7 @@ export default defineComponent({
 				// pageBackgroundColor: '#609FCF',
 				renderSingleHorizontalStaffline: state.isSingleLine ? true : false,
 				autoGenerateMultipleRestMeasuresFromRestMeasures: state.isSingleLine ? false : true, // 连续休止小节是否合并显示
+				drawLyrics: (state.playType === 'sing' && state.isSimplePage) ? true : false, // 演唱模式才渲染歌词,simple页面不显示歌词
 				// darkMode: true, // 暗黑模式
 				// pageFormat: 'A4_P',
 				// autoBeam: true,