liushengqiang %!s(int64=2) %!d(string=hai) anos
pai
achega
6b75a642f0

+ 4 - 4
src/page-instrument/evaluat-model/index.tsx

@@ -54,9 +54,9 @@ export default defineComponent({
 					evaluatingData.soundEffectMode = true;
 					return;
 				}
-				const delayTime = await api_getDeviceDelay();
-				console.log("🚀 ~ delayTime:", delayTime);
-				if (!delayTime) {
+				const delayData = await api_getDeviceDelay();
+				// console.log("🚀 ~ delayTime:", delayData);
+				if (delayData && delayData.content?.value < 0) {	
 					evaluatingData.soundEffectMode = true;
 					return;
 				}
@@ -245,7 +245,7 @@ export default defineComponent({
 		return () => (
 			<div>
 				<Transition name="pop-center">
-					{evaluatingData.websocketState && !evaluatingData.startBegin && (
+					{evaluatingData.websocketState && !evaluatingData.startBegin && evaluatingData.checkEnd && (
 						<div class={styles.startBtn} onClick={handleStartBegin}>
 							<img src={iconEvaluat.evaluatingStart} />
 						</div>

+ 1 - 1
src/page-instrument/header-top/settting/index.tsx

@@ -142,7 +142,7 @@ export default defineComponent({
 								}}
 							</Cell>
 
-							<Cell title="校音提醒" center>
+							<Cell title="延迟检测" center>
 								{{
 									extra: () => <Switch v-model={state.setting.soundEffect}></Switch>,
 								}}

+ 2 - 40
src/view/evaluating/index.tsx

@@ -33,7 +33,6 @@ import { IPostMessage } from "/src/utils/native-message";
 import { usePageVisibility } from "@vant/use";
 import { browser } from "/src/utils";
 import { getAudioCurrentTime, toggleMutePlayAudio } from "../audio-list";
-import testAudio from "./testAudio.mp3";
 
 const browserInfo = browser();
 export const evaluatingData = reactive({
@@ -74,7 +73,6 @@ export const handleStartEvaluat = () => {
 		// 切换到练习模式,卸载评测模块
 		evaluatingData.rendered = false;
 	}
-	evaluatingData.checkEnd = false;
 };
 
 const check_currentTime = () => {
@@ -289,46 +287,8 @@ const recordStartTimePoint = async (res?: IPostMessage) => {
 	// 开始播放
 	playMusic();
 
-	// playTestMusic()
 };
 
-const getTestCurrent = () => {
-	const _c = _audio.currentTime * 1000;
-	console.log("🚀 ~ 播放的时间测试:", _c);
-	if (_c >= 500) {
-		console.error("开始播放的延迟:", Date.now() - evaluatingData.backtime - 500);
-		_audio.pause();
-		// 延迟500毫秒播放
-		setTimeout(() => {
-			playMusic();
-		}, 2000);
-
-		return;
-	}
-	setTimeout(() => {
-		getTestCurrent();
-	}, 10);
-};
-
-const playTestMusic = () => {
-	// _audio = new Audio(state.music)
-	_audio = new Audio(testAudio);
-	// _audio.muted = true
-	// _audio.src = testAudio
-	_audio.onplay = () => {
-		console.log("开始播放测试");
-		getTestCurrent();
-	};
-	_audio.onloadedmetadata = () => {
-		console.log("测试音频加载完成");
-		console.log("开始播放的时间点", Date.now());
-		_audio.play();
-		setTimeout(() => {
-			console.log("结束播放的时间点", Date.now(), _audio.currentTime * 1000);
-		}, 500);
-	};
-	_audio.load();
-};
 
 /**
  * 结束评测
@@ -485,6 +445,8 @@ export default defineComponent({
 			console.log("加载评测模块成功");
 		});
 		onUnmounted(() => {
+			evaluatingData.checkEnd = false;
+			evaluatingData.rendered = false;
 			resetPlaybackToStart();
 			removeResult(handleScoreResult);
 			api_remove_recordStartTime(recordStartTimePoint);