liushengqiang пре 1 година
родитељ
комит
04a03f5f9e
2 измењених фајлова са 21 додато и 2 уклоњено
  1. 7 1
      src/page-colexiu/detail/index.tsx
  2. 14 1
      src/page-colexiu/header-top/index.tsx

+ 7 - 1
src/page-colexiu/detail/index.tsx

@@ -62,6 +62,7 @@ export default defineComponent({
 			const index = query["part-index"] ? parseInt(query["part-index"] as string) : 0;
 			const musicInfo = {
 				...res.data,
+				accompany: res.data.audioFileUrl,
 				...res.data.background[index],
 			};
 			// console.log("🚀 ~ musicInfo:", musicInfo);
@@ -93,7 +94,7 @@ export default defineComponent({
 			state.needTick = true; // data.isOpenMetronome;
 			state.isShowFingering = data.showFingering ? true : false;
 			state.music = data.audioFileUrl;
-			state.accompany = data.metronomeUrl || data.metronomeUrl;
+			state.accompany = data.accompany;
 			state.midiUrl = data.midiUrl;
 			state.parentCategoriesId = data.musicTag;
 			state.playMode = data.audioType === "MP3" ? "MP3" : "MIDI";
@@ -109,6 +110,11 @@ export default defineComponent({
 			// 设置指法
 			state.fingeringInfo = subjectFingering(state.subjectId);
 			// console.log("🚀 ~ state.fingeringInfo:", state.fingeringInfo, state.subjectId, state.track)
+
+			// 检测是否原音和伴奏都有
+			if (!state.music || !state.accompany) {
+				state.playSource = state.music ? "music" : "background";
+			}
 		};
 
 		const setCustom = () => {

+ 14 - 1
src/page-colexiu/header-top/index.tsx

@@ -48,6 +48,19 @@ export default defineComponent({
 
 		/** 按钮禁用 */
 
+		/** 原声按钮 */
+		const originBtn = computed(() => {
+			// 评测开始 禁用
+			if (state.modeType === "evaluating") return { display: true, disabled: true };
+			// 原声, 伴奏 少一个,就不能切换
+			if (!state.music || !state.accompany) return { display: true, disabled: true };
+
+			return {
+				disabled: false,
+				display: true,
+			};
+		});
+
 		/** 重播按钮显示条件 */
 		const resetBtnDisplay = computed(() => {
 			const currentTime = getAudioCurrentTime();
@@ -90,7 +103,7 @@ export default defineComponent({
 					</div>
 
 					<div
-						class={[styles.btn, disabledList.includes(state.modeType) && styles.disable]}
+						class={[styles.btn, originBtn.value.disabled && styles.disable]}
 						id="tips-step-6"
 						onClick={() => {
 							state.playSource = state.playSource === "music" ? "background" : "music";