liushengqiang пре 2 година
родитељ
комит
b9ca201888
1 измењених фајлова са 15 додато и 2 уклоњено
  1. 15 2
      src/page-orchestra/header-top/index.tsx

+ 15 - 2
src/page-orchestra/header-top/index.tsx

@@ -1,4 +1,4 @@
-import { Transition, computed, defineComponent, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
+import { Transition, computed, defineComponent, onBeforeUnmount, onMounted, onUnmounted, reactive, ref, watch } from "vue";
 import styles from "./index.module.less";
 import styles from "./index.module.less";
 import store from "store";
 import store from "store";
 
 
@@ -20,7 +20,7 @@ import { handle_stopFollow } from "../follow-model";
 import Camera from "./camera";
 import Camera from "./camera";
 import iconCamera from "./image/icon-camera-off.png";
 import iconCamera from "./image/icon-camera-off.png";
 import iconCameraOn from "./image/icon-camera-on.png";
 import iconCameraOn from "./image/icon-camera-on.png";
-import iconEvaluat from '../evaluat-model/icons/evaluating.json'
+import iconEvaluat from "../evaluat-model/icons/evaluating.json";
 
 
 export const headData = reactive({
 export const headData = reactive({
 	speedShow: false,
 	speedShow: false,
@@ -191,6 +191,13 @@ export default defineComponent({
 			api_back();
 			api_back();
 		};
 		};
 
 
+		/** 课件播放 */
+		const changePlay = (res: any) => {
+			if (res?.data?.api === "setPlayState") {
+				togglePlay("paused");
+			}
+		};
+
 		onMounted(() => {
 		onMounted(() => {
 			api_suspendPlay(() => {
 			api_suspendPlay(() => {
 				if (state.modeType === "practise") {
 				if (state.modeType === "practise") {
@@ -201,6 +208,12 @@ export default defineComponent({
 					handle_stopFollow();
 					handle_stopFollow();
 				}
 				}
 			});
 			});
+
+			window.addEventListener("message", changePlay);
+		});
+
+		onUnmounted(() => {
+			window.removeEventListener("message", changePlay);
 		});
 		});
 
 
 		// 设置改变触发
 		// 设置改变触发