liushengqiang 2 سال پیش
والد
کامیت
b8042c17b6

+ 20 - 13
src/page-gym/evaluat-model/sound-effect/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, reactive, ref, watch } from "vue";
+import { defineComponent, onMounted, reactive, ref, watch } from "vue";
 import { Popover, Icon } from "vant";
 import icons from "../icons/index.json";
 import iconChild from "./icons/child.png";
@@ -15,6 +15,7 @@ export default defineComponent({
 	name: "sound-effect",
 	emits: ["close"],
 	setup(props, { emit }) {
+		const soundEffectSuccess = ref(false)
 		const scoreData = getScoreData(state.subjectId);
 		const soundEffectData = reactive({
 			step: 0,
@@ -24,33 +25,39 @@ export default defineComponent({
 		watch(
 			() => evaluatingData.soundEffectFrequency,
 			() => {
-        // console.log('吹奏',evaluatingData.soundEffectFrequency , scoreData.frequency)
+				if (soundEffectSuccess.value) return;
+				// console.log('吹奏',evaluatingData.soundEffectFrequency , scoreData.frequency)
 				const trend =
 					Math.abs(evaluatingData.soundEffectFrequency - scoreData.frequency) <= 10 ? 1 : evaluatingData.soundEffectFrequency > scoreData.frequency ? 2 : 0;
 				soundEffectData.step = trend;
 				if (trend !== 1) {
 					soundEffectData.time = Date.now();
 				}
-        // 持续时间达到3秒钟,效音成功
+				// 持续时间达到3秒钟,效音成功
 				if (Date.now() - soundEffectData.time > 3000) {
-					// console.log("效音完成");
-          emit('close')
+					console.log("效音完成");
+					soundEffectSuccess.value = true
+					emit("close");
 				}
 			}
 		);
 
 		/** 跳过本次 */
-		const handleSelect = (e: {text: string}) => {
-      if (e.text === '关闭校音'){
-        emit('close', true)
-        return
-      } 
-      emit('close')
+		const handleSelect = (e: { text: string }) => {
+			if (e.text === "关闭校音") {
+				emit("close", true);
+				return;
+			}
+			emit("close");
 		};
+
+		onMounted(() => {
+			soundEffectSuccess.value = false
+		})
 		return () => (
 			<div class={styles["sound-effect"]}>
 				<div class={styles.top}>
-					<div class={styles.back} onClick={() => emit('close')}>
+					<div class={styles.back} onClick={() => emit("close")}>
 						<img src={icons["arrow-left-background"]} />
 					</div>
 					<Popover trigger="click" class={styles.skibtns} actions={[{ text: "跳过本次" }, { text: "关闭校音" }]} onSelect={handleSelect}>
@@ -58,7 +65,7 @@ export default defineComponent({
 							reference: () => (
 								<div class={styles.rightSkipBtn}>
 									<span>跳过本次</span>
-									<Icon name="play" color="var(--van-primary-color)" class={styles.tran}/>
+									<Icon name="play" color="var(--van-primary-color)" class={styles.tran} />
 								</div>
 							),
 						}}

+ 1 - 1
src/page-gym/main.ts

@@ -12,7 +12,7 @@ import { setStoreData } from "../store";
 
 (function () {
 	const u = navigator.userAgent;
-	const blank = ["mteadev.dayaedu.com", "mteatest.dayaedu.com", "mteaonline.dayaedu.com", "192.168.3.114"];
+	const blank = ["mteadev.dayaedu.com", "mteatest.dayaedu.com", "mteaonline.dayaedu.com"];
 	const webBlank = ["mandev.dayaedu.com", "mantest.dayaedu.com", "manonline.dayaedu.com"];
 	const platformApi = blank.includes(location.hostname) ? "/api-teacher" : webBlank.includes(location.hostname) ? "/api-web" : "/api-student";
 	setStoreData({

+ 6 - 5
src/view/evaluating/index.tsx

@@ -67,6 +67,7 @@ export const handleStartEvaluat = () => {
 		// 切换到练习模式,卸载评测模块
 		evaluatingData.rendered = false;
 	}
+	evaluatingData.checkEnd = false;
 };
 
 const check_currentTime = () => {
@@ -132,7 +133,8 @@ export const connectWebsocket = async (content: any) => {
  * 执行检测
  */
 export const handlePerformDetection = async () => {
-	evaluatingData.checkEnd = false;
+	// 检测完成不检测了
+	if (evaluatingData.checkEnd) return
 	if (evaluatingData.checkStep === 0) {
 		// 检测耳机
 		const erji = await checkUseEarphone();
@@ -159,7 +161,6 @@ export const handlePerformDetection = async () => {
 	if (evaluatingData.checkStep === 10) {
 		// 连接websocket
 		evaluatingData.checkEnd = true;
-		evaluatingData.checkStep = 0;
 	}
 };
 
@@ -252,7 +253,7 @@ const recordStartTimePoint = async (res?: IPostMessage) => {
 	console.log("🚀 ~ 开始时间点:", evaluatingData.backtime, "已经录的时间:", Date.now() - inteveral, '记录时间点:', Date.now());
 	// 开始播放
 	playMusic();
-	// _audio.play();
+	// playTestMusic()
 };
 
 
@@ -262,7 +263,7 @@ const getTestCurrent = () => {
 	if (_c >= 500){
 		console.log('evaluatingData.backtime: ',  evaluatingData.backtime)
 		console.error('开始播放的延迟:', Date.now() - evaluatingData.backtime - 500)
-		// playMusic()
+		playMusic()
 		_audio.pause()
 		return
 	}
@@ -282,7 +283,7 @@ const playTestMusic = () => {
 	}
 	_audio.onloadedmetadata = () => {
 		console.log('测试音频加载完成')
-		// _audio.play();
+		_audio.play();
 	}
 	_audio.load()
 }

+ 7 - 1
src/view/music-score/index.module.less

@@ -12,11 +12,17 @@
         & > div {
             transform: scale(var(--music-zoom));
             transform-origin: left top;
-            transition: all .3s;
         }
         svg{
             overflow: visible;
         }
+        :global{
+            #osmdCanvasPage1{
+                position: absolute;
+                left: 0;
+                top: 0;
+            }
+        }
     }
 }
 .inGradualRange{