Browse Source

feat: 评测提示佩戴耳机

TIANYONG 1 year ago
parent
commit
7ab7864a61
2 changed files with 7 additions and 4 deletions
  1. 6 2
      src/page-instrument/evaluat-model/index.tsx
  2. 1 2
      src/view/evaluating/index.tsx

+ 6 - 2
src/page-instrument/evaluat-model/index.tsx

@@ -1,5 +1,5 @@
 import { Transition, defineComponent, onMounted, reactive, watch } from "vue";
-import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay } from "/src/view/evaluating";
+import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone } from "/src/view/evaluating";
 import Earphone from "./earphone";
 import styles from "./index.module.less";
 import SoundEffect from "./sound-effect";
@@ -60,7 +60,7 @@ export default defineComponent({
      * 执行检测
      */
     const handlePerformDetection = async () => {
-      console.log(evaluatingData.checkStep, evaluatingData, "检测");
+      console.log(evaluatingData.checkStep, evaluatingData, "检测123");
       // 检测完成不检测了
       if (evaluatingData.checkEnd) return;
       // 延迟检测
@@ -88,6 +88,10 @@ export default defineComponent({
       }
       // 效验完成
       if (evaluatingData.checkStep === 10) {
+        const erji = await checkUseEarphone();
+        if (!erji) {
+          evaluatingData.earphoneMode = true;
+        }
         evaluatingData.checkEnd = true;
         console.log("检测结束,生成数据");
         handleConnect();

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

@@ -171,7 +171,7 @@ export const sendEvaluatingOffsetTime = async (currentTime: number) => {
 };
 
 /** 检测耳机 */
-const checkUseEarphone = async () => {
+export const checkUseEarphone = async () => {
 	const res = await getEarphone();
 	return res?.content?.checkIsWired || false;
 };
@@ -197,7 +197,6 @@ export const connectWebsocket = async (content: any) => {
  * 执行检测
  */
 export const handlePerformDetection = async () => {
-	console.log(99999999999)
 	// 检测完成不检测了
 	if (evaluatingData.checkEnd) return;
 	// 延迟检测