Browse Source

feat: api: 'endEvaluating' 延迟200ms调用

TIANYONG 1 year ago
parent
commit
8080996211
1 changed files with 25 additions and 21 deletions
  1. 25 21
      src/subpages/colexiu/buttons/evaluating.tsx

+ 25 - 21
src/subpages/colexiu/buttons/evaluating.tsx

@@ -256,13 +256,15 @@ const sendOffsetTime = (offsetTime: number) => {
 
 const cancelTheEvaluation = () => {
   const search = useOriginSearch()
-  postMessage({ api: 'endEvaluating', content: { musicScoreId: search.id } })
-  playStatus.value = 'stop'
-  RuntimeUtils.pause()
-  RuntimeUtils.resetPlayStatus()
-  RuntimeUtils.clearIntervalTimeline()
-  RuntimeUtils.setCurrentTime(0)
-  Toast.clear()
+  setTimeout(() => {
+    postMessage({ api: 'endEvaluating', content: { musicScoreId: search.id } })
+    playStatus.value = 'stop'
+    RuntimeUtils.pause()
+    RuntimeUtils.resetPlayStatus()
+    RuntimeUtils.clearIntervalTimeline()
+    RuntimeUtils.setCurrentTime(0)
+    Toast.clear()
+  }, 200);
 }
 
 const stopPlay = () => {
@@ -373,21 +375,23 @@ const playerStop = () => {
     message: '评分中...',
     type: 'loading',
   })
-  postMessage(
-    {
-      api: 'endEvaluating',
-      content: {
-        musicScoreId: useOriginSearch().id,
+  setTimeout(() => {
+    postMessage(
+      {
+        api: 'endEvaluating',
+        content: {
+          musicScoreId: useOriginSearch().id,
+        },
       },
-    },
-    (evt) => {
-      console.log('调用endEvaluating结束', evt)
-      endloading.value = false
-      evaluating.value = false
-      // RuntimeUtils.setCaptureMode()
-    }
-  )
-  RuntimeUtils.endCapture()
+      (evt) => {
+        console.log('调用endEvaluating结束', evt)
+        endloading.value = false
+        evaluating.value = false
+        // RuntimeUtils.setCaptureMode()
+      }
+    )
+    RuntimeUtils.endCapture()
+  },200)
 }
 export const evaluatPlayerStop = playerStop