浏览代码

fix: 练习评测practiceSource传参修改

TIANYONG 1 年之前
父节点
当前提交
bf7d0d614d
共有 1 个文件被更改,包括 26 次插入22 次删除
  1. 26 22
      src/subpages/colexiu/buttons/evaluating.tsx

+ 26 - 22
src/subpages/colexiu/buttons/evaluating.tsx

@@ -394,7 +394,7 @@ const connect = async () => {
     clientId: 'STUDENT',
     hertz: SettingState.sett.hertz,
     feature: 'EVALUATION',
-    practiceSource: search.unitId ? 'UNIT_TEST' : 'PRACTICE',
+    practiceSource: (search.resourceType && search.resourceType === 'practice') ? 'UNIT_TEST_PRACTICE' : search.unitId ? 'UNIT_TEST' : 'PRACTICE',
     // 这里定义的是数字但是因为是通过input输入所以强制转化一次
     reactionTimeMs: parseFloat('' + SettingState.eva.reactionTimeMs) || 0,
     speed: runtime.speed,
@@ -454,13 +454,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()
+  }, 500);
 }
 
 const stopPlay = () => {
@@ -571,21 +573,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()
+  }, 500);
 }
 export const evaluatPlayerStop = playerStop