Bläddra i källkod

feat: 评测模式,检测耳机状态

TIANYONG 1 år sedan
förälder
incheckning
54a920e5a7

+ 19 - 4
src/pages/detail/CheckDelayPopup/index.module.less

@@ -28,14 +28,29 @@
     .leftAdorn {
         position: fixed;
         left: 0;
-        bottom: -1px;
-        width: 1.66rem;
+        bottom: -2px;
+        width: 1.9rem;
     }
     .rightAdorn {
         position: fixed;
         right: 0;
-        bottom: -1px;
-        width: 1.28rem;
+        bottom: -2px;
+        width: 1.5rem;
+    }
+}
+
+.delayPadBg {
+    .leftAdorn {
+        position: fixed;
+        left: 0;
+        bottom: -3px;
+        width: 2.3rem;
+    }
+    .rightAdorn {
+        position: fixed;
+        right: 0;
+        bottom: -3px;
+        width: 1.8rem;
     }
 }
 

+ 1 - 1
src/subpages/colexiu/buttons/evaluating.tsx

@@ -910,7 +910,7 @@ export default defineComponent({
       } else {
         RuntimeUtils.changeMode('background', 'all')
       }
-      // handleCheckEvaluatStatus()
+      handleCheckEvaluatStatus()
       // 如果为单元测验和课后训练,不清楚选段数据
       if (!unitTestData.isSelectMeasureMode) {
         detailState.section = []

+ 15 - 9
src/subpages/colexiu/uses/use-evaluat.ts

@@ -36,6 +36,7 @@ const soundNeedShow = () => {
  * @param res IPostMessage
  */
 export const setWiredStatus = (res?: IPostMessage) => {
+  console.log('检测耳机状态', res?.content)
   if (runtime.evaluatingStatus && !delayData.open) {
     permissionPopup.active = 'earphone'
     permissionPopup.show = !res?.content.checkIsWired
@@ -49,13 +50,17 @@ export const setWiredStatus = (res?: IPostMessage) => {
  */
 export const handleCheckEvaluatStatus = () => {
   // 是否需要效音
-  soundNeedShow()
+  // soundNeedShow()
   // 检测耳机状态
   // postMessage({ api: 'isWiredHeadsetOn' }, setWiredStatus)
   postMessage({ api: 'isWiredHeadsetOn' }, (evt) => {
     // console.log('🚀 ~ 耳机状态', evt)
-    permissionPopup.active = 'earphone'
-    permissionPopup.show = !evt?.content.checkIsWired
+    if (runtime.evaluatingStatus && !delayData.open) {
+      permissionPopup.active = 'earphone'
+      permissionPopup.show = !evt?.content.checkIsWired
+    } else {
+      permissionPopup.show = false
+    }
   })
 }
 
@@ -111,13 +116,14 @@ export const useWiredHeadsetCheck = () => {
     }
   )
 
-  onMounted(() => {
-    listenerMessage('listenerWiredStatus', setWiredStatus)
-  })
+  // onMounted(() => {
+  //   console.log('检测耳机状态')
+  //   listenerMessage('listenerWiredStatus', setWiredStatus)
+  // })
 
-  onBeforeUnmount(() => {
-    removeListenerMessage('listenerWiredStatus', setWiredStatus)
-  })
+  // onBeforeUnmount(() => {
+  //   removeListenerMessage('listenerWiredStatus', setWiredStatus)
+  // })
 
   return [wiredStatus]
 }