Browse Source

是否使用节拍器

黄琪勇 2 months ago
parent
commit
7cc8a286d8

+ 2 - 2
src/page-instrument/header-top/speed/index.module.less

@@ -168,7 +168,6 @@
             .speedSel{
                 margin-top: 20px;
                 padding-bottom: 18px;
-                border-bottom: 1px solid #D5E0ED;
                 display: flex;
                 justify-content: space-between;
                 & > div{
@@ -191,7 +190,8 @@
                 pointer-events: none;
             }
             .metronome{
-                margin-top: 18px;
+                padding-top: 18px;
+                border-top: 1px solid #D5E0ED;
                 display: flex;
                 justify-content: space-between;
                 align-items: center;

+ 12 - 9
src/page-instrument/header-top/speed/index.tsx

@@ -136,15 +136,18 @@ export default defineComponent({
 							<div onClick={()=>{ speed.value = 100 }}>100</div>
 							<div onClick={()=>{ speed.value = 110 }}>110</div>
 						</div>
-						<div class={styles.metronome}>
-							<div class={styles.tit}>节拍器</div>
-							<Switch 
-								class={switchLoading.value ? styles.switchLoading : ''}
-								v-model:modelValue={metronomeDisable.value} 
-								loading={switchLoading.value}
-								onChange={toggleSwitch}			
-							></Switch>
-						</div>
+						{
+							state.isMixBeat && 
+							<div class={styles.metronome}>
+								<div class={styles.tit}>节拍器</div>
+								<Switch 
+									class={switchLoading.value ? styles.switchLoading : ''}
+									v-model:modelValue={metronomeDisable.value} 
+									loading={switchLoading.value}
+									onChange={toggleSwitch}			
+								></Switch>
+							</div>
+						}
 					</div>
 				</div>
 			</div>

+ 19 - 12
src/state.ts

@@ -370,6 +370,8 @@ const state = reactive({
   needTick: false,
   /** 演唱模式是否需要节拍器 */
   needSingTick: false,
+  /** 是否能使用节拍器  */
+  isMixBeat: true,
   /** 曲谱实例 */
   osmd: null as unknown as OpenSheetMusicDisplay,
   /**是否是特殊乐谱类型, 主要针对管乐迷  */
@@ -1354,6 +1356,8 @@ const getMusicInfo = async (res: any) => {
   state.isScoreRender = res.data?.isScoreRender
   // 是否默认显示总谱
   state.defaultScoreRender = res.data?.defaultScoreRender
+  // 是否显示节拍器
+  state.isMixBeat = res.data?.isMixBeat
   let partIndex = query["part-index"] ? parseInt(query["part-index"]) : -1 // -1为partIndex没有值的时候
   // 如果是评测报告,会有默认的分轨index
   if (state.isEvaluatReport) {
@@ -1504,18 +1508,21 @@ function initMusicSource(data: any, tracks: string[], partIndex: number, workRec
     state.mingSong = fanSongObj?.solmizationFileUrl
     state.mingSongGirl = fanSongObj?.femaleSolmizationFileUrl
   }
-  Object.assign(state.beatSong, {
-    music: musicObj?.audioBeatMixUrl,
-    accompany: accompanyObj?.audioBeatMixUrl,
-    fanSong: fanSongObj?.audioBeatMixUrl,
-    banSong: banSongObj?.audioBeatMixUrl
-  })
-  // 如果没有男唱名
-  if(!fanSongObj?.solmizationBeatUrl){
-    state.beatSong.mingSong = fanSongObj?.femaleSolmizationBeatUrl
-  }else{
-    state.beatSong.mingSong = fanSongObj?.solmizationBeatUrl
-    state.beatSong.mingSongGirl = fanSongObj?.femaleSolmizationBeatUrl
+  // 当使用节拍器的时候才加载节拍器音频
+  if(state.isMixBeat) {
+    Object.assign(state.beatSong, {
+      music: musicObj?.audioBeatMixUrl,
+      accompany: accompanyObj?.audioBeatMixUrl,
+      fanSong: fanSongObj?.audioBeatMixUrl,
+      banSong: banSongObj?.audioBeatMixUrl
+    })
+    // 如果没有男唱名
+    if(!fanSongObj?.solmizationBeatUrl){
+      state.beatSong.mingSong = fanSongObj?.femaleSolmizationBeatUrl
+    }else{
+      state.beatSong.mingSong = fanSongObj?.solmizationBeatUrl
+      state.beatSong.mingSongGirl = fanSongObj?.femaleSolmizationBeatUrl
+    }
   }
   return {
     index,