liushengqiang 2 سال پیش
والد
کامیت
f56bdf3ac8
2فایلهای تغییر یافته به همراه13 افزوده شده و 3 حذف شده
  1. 2 2
      src/report-share/orchestra-share/index.tsx
  2. 11 1
      src/report-share/orchestra-share/share-top/index.tsx

+ 2 - 2
src/report-share/orchestra-share/index.tsx

@@ -1,5 +1,5 @@
 import { Skeleton } from "vant";
-import { defineComponent, onBeforeMount, onBeforeUnmount, onMounted, reactive, Transition } from "vue";
+import { computed, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, reactive, Transition } from "vue";
 import { formateTimes } from "../../helpers/formateMusic";
 import state, { isRhythmicExercises } from "../../state";
 import { setGlobalData } from "../../utils";
@@ -97,7 +97,7 @@ export default defineComponent({
 			state.accompany = data.metronomeUrl || data.metronomeUrl;
 			state.midiUrl = data.midiUrl;
 			state.parentCategoriesId = data.musicTag;
-			state.playMode = data.audioType === "MP3" ? "mp3" : "midi";
+			state.playMode = data.audioType === "MP3" ? "MP3" : "MIDI";
 			state.originSpeed = state.speed = data.speed;
 			state.track = data.track;
 			state.enableNotation = data.notation ? true : false;

+ 11 - 1
src/report-share/orchestra-share/share-top/index.tsx

@@ -9,6 +9,7 @@ import iconShiyi from "./image/icon-shiyi.png";
 import iconhuifang from "./image/icon-huifang.png";
 import { Icon, Popup } from "vant";
 import TheVideo from "/src/components/the-video";
+import TheAudio from "/src/components/the-audio";
 
 type IItemType = "intonation" | "cadence" | "integrity";
 
@@ -39,6 +40,15 @@ export default defineComponent({
 			// itemType.value = type;
 		};
 
+		// 资源类型
+		const mediaType = computed((): "audio" | "video" => {
+			const subfix = (scoreData.value.videoFilePath || "").split(".").pop();
+			if (subfix === "wav" || subfix === "mp3") {
+				return "audio";
+			}
+			return "video";
+		});
+
 		return () => (
 			<div class={styles.headerTop}>
 				<div class={styles.left}>
@@ -84,7 +94,7 @@ export default defineComponent({
 					</div> */}
 				</div>
 				<Popup class={["popup-custom", "van-scale", styles.popup]} transition="van-scale" v-model:show={showVideo.value} closeable>
-					<TheVideo src={showVideo.value ? scoreData.value.videoFilePath : ''} />
+					{mediaType.value === 'video' ? <TheVideo src={showVideo.value ? scoreData.value.videoFilePath : ""} /> : <TheAudio src={showVideo.value ? scoreData.value.videoFilePath : ""} />}
 				</Popup>
 			</div>
 		);