Bläddra i källkod

课件播放切换,停止播放

liushengqiang 2 år sedan
förälder
incheckning
188b79ba6e
1 ändrade filer med 15 tillägg och 1 borttagningar
  1. 15 1
      src/page-instrument/view-figner/index.tsx

+ 15 - 1
src/page-instrument/view-figner/index.tsx

@@ -1,4 +1,4 @@
-import { PropType, computed, defineComponent, nextTick, onBeforeMount, onMounted, reactive } from "vue";
+import { PropType, computed, defineComponent, nextTick, onBeforeMount, onMounted, onUnmounted, reactive } from "vue";
 import styles from "./index.module.less";
 import icons from "./image/icons.json";
 import { FIGNER_INSTRUMENT_DATA, IFIGNER_INSTRUMENT_Note } from "/src/view/figner-preview";
@@ -209,6 +209,20 @@ export default defineComponent({
 				}
 			}
 		);
+		/** 课件播放 */
+		const changePlay = (res: any) => {
+			if (res?.data?.api === "setPlayState") {
+				handleStop();
+			}
+		};
+
+		onMounted(() => {
+			window.addEventListener("message", changePlay);
+		});
+
+		onUnmounted(() => {
+			window.removeEventListener("message", changePlay);
+		});
 		return () => {
 			const relationship = fingerData.subject?.relationship?.[data.realKey] || [];
 			const rs: number[] = Array.isArray(relationship[1])