Browse Source

课后训练

skyblued 2 years ago
parent
commit
b37c23075d
1 changed files with 29 additions and 31 deletions
  1. 29 31
      src/pages/detail/runtime.ts

+ 29 - 31
src/pages/detail/runtime.ts

@@ -883,15 +883,12 @@ export const refreshView = () => {
     }, 100)
     }, 100)
   }
   }
 }
 }
-type IFeature = 'UNIT_TEST' | 'PRACTICE' | 'EVALUATION' //UNIT_TEST("单元测试"),PRACTICE("练习"),EVALUATION("评测")
 const updatePlayTime = async (time: number) => {
 const updatePlayTime = async (time: number) => {
+  const search = useOriginSearch()
+  const behaviorId = sessionStorage.getItem('behaviorId') || search.behaviorId || initBehaviorId
+  const prefix = getRequestHostname()
+  const clientType = useClientType()
   if (!state.evaluatingStatus) {
   if (!state.evaluatingStatus) {
-    const search = useOriginSearch()
-    const behaviorId = sessionStorage.getItem('behaviorId') || search.behaviorId || initBehaviorId
-    const prefix = getRequestHostname()
-    const clientType = useClientType()
-    console.log("🚀 ~ clientType", clientType)
-    const feature: IFeature = (search.feature as IFeature) || 'PRACTICE'
     // 如果是后台不需要统计时长
     // 如果是后台不需要统计时长
     if (clientType === 'web') return
     if (clientType === 'web') return
     try {
     try {
@@ -901,7 +898,7 @@ const updatePlayTime = async (time: number) => {
         data: {
         data: {
           musicSheetId: getLinkId(),
           musicSheetId: getLinkId(),
           sysMusicScoreId: getLinkId(),
           sysMusicScoreId: getLinkId(),
-          feature,
+          feature: search.feature,
           playTime: time,
           playTime: time,
           deviceType: getPlatform(),
           deviceType: getPlatform(),
           behaviorId,
           behaviorId,
@@ -909,30 +906,31 @@ const updatePlayTime = async (time: number) => {
       })
       })
       event.emit('updatePlayTimeSuccess', res.data)
       event.emit('updatePlayTimeSuccess', res.data)
     } catch (error) {}
     } catch (error) {}
-    //课后训练
-    if (search.lessonTrainingId) {
-      try {
-        console.log(prefix)
-        const res = await request.post('/studentLessonTraining/lessonTrainingRecord', {
-          prefix: prefix,
-          requestType: 'json',
-          data: {
-            materialType: 'SONG',
-            record: {
-              clientType: (clientType as string)?.toLocaleUpperCase(),
-              feature: 'LESSON_TRAINING',
-              deviceType: browserInfo.android ? 'ANDROID' : browserInfo.isApp ? 'IOS' : 'WEB',
-              behaviorId,
-              playTime: time,
-              musicSheetId: getLinkId(),
-            },
-            courseScheduleId: search.courseScheduleId,
-            lessonTrainingId: search.lessonTrainingId,
-            materialId: search.materialId,
+    
+  }
+  //课后训练
+  if (search.lessonTrainingId) {
+    try {
+      console.log(prefix)
+      const res = await request.post('/studentLessonTraining/lessonTrainingRecord', {
+        prefix: prefix,
+        requestType: 'json',
+        data: {
+          materialType: 'SONG',
+          record: {
+            clientType: (clientType as string)?.toLocaleUpperCase(),
+            feature: search.feature,
+            deviceType: browserInfo.android ? 'ANDROID' : browserInfo.isApp ? 'IOS' : 'WEB',
+            behaviorId,
+            playTime: time,
+            musicSheetId: getLinkId(),
           },
           },
-        })
-      } catch (error) {}
-    }
+          courseScheduleId: search.courseScheduleId,
+          lessonTrainingId: search.lessonTrainingId,
+          materialId: search.materialId,
+        },
+      })
+    } catch (error) {}
   }
   }
 }
 }