|
@@ -1,4 +1,4 @@
|
|
-import { Transition, defineComponent, onMounted, reactive, watch, defineAsyncComponent, computed } from "vue";
|
|
|
|
|
|
+import { Transition, defineComponent, onMounted, reactive, watch, defineAsyncComponent, computed, onUnmounted } from "vue";
|
|
import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat } from "/src/view/evaluating";
|
|
import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat } from "/src/view/evaluating";
|
|
import Earphone from "./earphone";
|
|
import Earphone from "./earphone";
|
|
import styles from "./index.module.less";
|
|
import styles from "./index.module.less";
|
|
@@ -38,6 +38,7 @@ type TCriteria = "frequency" | "amplitude" | "decibels";
|
|
*/
|
|
*/
|
|
let actualBeatLength = 0;
|
|
let actualBeatLength = 0;
|
|
let calculateInfo: any = {};
|
|
let calculateInfo: any = {};
|
|
|
|
+let checkErjiTimer: any = null
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: "evaluat-model",
|
|
name: "evaluat-model",
|
|
@@ -133,9 +134,15 @@ export default defineComponent({
|
|
evaluatingData.earphoneMode = true;
|
|
evaluatingData.earphoneMode = true;
|
|
evaluatingData.earPhoneType = res?.content?.type || "";
|
|
evaluatingData.earPhoneType = res?.content?.type || "";
|
|
if (evaluatingData.earPhoneType === "有线耳机") {
|
|
if (evaluatingData.earPhoneType === "有线耳机") {
|
|
|
|
+ clearTimeout(checkErjiTimer);
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
evaluatingData.earphoneMode = false;
|
|
evaluatingData.earphoneMode = false;
|
|
}, 3000);
|
|
}, 3000);
|
|
|
|
+ } else {
|
|
|
|
+ // 如果没有佩戴有限耳机,需要持续检测耳机状态
|
|
|
|
+ checkErjiTimer = setTimeout(() => {
|
|
|
|
+ checkEarphoneStatus();
|
|
|
|
+ }, 1000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log("检测结束,生成数据", evaluatingData.websocketState, evaluatingData.startBegin, evaluatingData.checkEnd);
|
|
console.log("检测结束,生成数据", evaluatingData.websocketState, evaluatingData.startBegin, evaluatingData.checkEnd);
|
|
@@ -431,6 +438,11 @@ export default defineComponent({
|
|
api_finishDelayCheck(handleFinishDelayCheck);
|
|
api_finishDelayCheck(handleFinishDelayCheck);
|
|
api_retryEvaluating(handRetryEvaluating);
|
|
api_retryEvaluating(handRetryEvaluating);
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
+ clearTimeout(checkErjiTimer);
|
|
|
|
+ });
|
|
|
|
+
|
|
return () => (
|
|
return () => (
|
|
<div>
|
|
<div>
|
|
<div class={styles.operatingBtn}>
|
|
<div class={styles.operatingBtn}>
|
|
@@ -471,6 +483,7 @@ export default defineComponent({
|
|
<Earphone
|
|
<Earphone
|
|
earphoneType={evaluatingData.earPhoneType}
|
|
earphoneType={evaluatingData.earPhoneType}
|
|
onClose={() => {
|
|
onClose={() => {
|
|
|
|
+ clearTimeout(checkErjiTimer);
|
|
evaluatingData.earphoneMode = false;
|
|
evaluatingData.earphoneMode = false;
|
|
// handlePerformDetection();
|
|
// handlePerformDetection();
|
|
checkEarphoneStatus("start");
|
|
checkEarphoneStatus("start");
|