Przeglądaj źródła

统计时长修改

skyblued 2 lat temu
rodzic
commit
4745651eda

+ 2 - 2
index.html

@@ -3,8 +3,8 @@
   <head>
     <meta charset="UTF-8" />
     <link rel="icon" href="/favicon.ico" />
-    <meta name="description" content="酷乐秀APP,器乐学习的不二选择" />
-    <title>酷乐秀</title>
+    <meta name="description" content="管乐团APP,器乐学习的不二选择" />
+    <title>管乐团云教练</title>
     <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
     <link href="/vant.css" rel="stylesheet">
 

+ 21 - 43
src/pages/detail/runtime.ts

@@ -888,50 +888,28 @@ const updatePlayTime = async (time: number) => {
   const behaviorId = sessionStorage.getItem('behaviorId') || search.behaviorId || initBehaviorId
   const prefix = getRequestHostname()
   const clientType = useClientType()
-  if (!state.evaluatingStatus) {
-    // 如果是后台不需要统计时长
-    if (clientType === 'web') return
-    try {
-      const res = await request.post('/musicPracticeRecord/save', {
-        prefix: prefix,
-        requestType: 'json',
-        data: {
-          musicSheetId: getLinkId(),
-          sysMusicScoreId: getLinkId(),
-          feature: search.feature,
-          playTime: time,
-          deviceType: getPlatform(),
-          behaviorId,
-        },
-      })
-      event.emit('updatePlayTimeSuccess', res.data)
-    } catch (error) {}
+  // 已有全局记录时长, 单独记录不需要了
+  // if (!state.evaluatingStatus) {
+  //   // 如果是后台不需要统计时长
+  //   if (clientType === 'web') return
+  //   try {
+  //     const res = await request.post('/musicPracticeRecord/save', {
+  //       prefix: prefix,
+  //       requestType: 'json',
+  //       data: {
+  //         musicSheetId: getLinkId(),
+  //         sysMusicScoreId: getLinkId(),
+  //         feature: search.feature,
+  //         playTime: time,
+  //         deviceType: getPlatform(),
+  //         behaviorId,
+  //       },
+  //     })
+  //     event.emit('updatePlayTimeSuccess', res.data)
+  //   } 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: search.feature,
-            deviceType: browserInfo.android ? 'ANDROID' : browserInfo.isApp ? 'IOS' : 'WEB',
-            behaviorId,
-            playTime: time,
-            musicSheetId: getLinkId(),
-          },
-          courseScheduleId: search.courseScheduleId,
-          lessonTrainingId: search.lessonTrainingId,
-          materialId: search.materialId,
-        },
-      })
-    } catch (error) {}
-  }
+  // }
+  
 }
 
 export const setAudioInit = () => {

+ 31 - 4
src/subpages/colexiu/App.tsx

@@ -5,7 +5,7 @@ import '../../app.d'
 import { useRoute } from 'vue-router'
 import { useClientType, useOriginSearch } from './uses'
 import request from '/src/helpers/request'
-import { getPlatform, getRequestHostname } from '/src/helpers/utils'
+import { browser, getPlatform, getRequestHostname } from '/src/helpers/utils'
 
 export default defineComponent({
   setup() {
@@ -23,7 +23,7 @@ export default defineComponent({
       if (client != 'student') return
       const search = useOriginSearch()
       const prefix = getRequestHostname()
-      const totalTime = Date.now() - startTime
+      const totalTime = (Date.now() - startTime) / 1000
       startTime = Date.now()
       const res = await request.post('/musicPracticeRecord/save', {
         prefix: prefix,
@@ -31,12 +31,39 @@ export default defineComponent({
         data: {
           musicSheetId: search.id,
           sysMusicScoreId: search.id,
-          feature: search.feature,
-          playTime: totalTime / 1000,
+          feature: 'PRACTICE',
+          practiceSource: 'PRACTICE',
+          playTime: totalTime,
           deviceType: getPlatform(),
           behaviorId: initBehaviorId,
         },
       })
+      //课后训练
+      if (search.lessonTrainingId) {
+        try {
+          console.log(prefix)
+          const browserInfo = browser()
+          const res = await request.post('/studentLessonTraining/lessonTrainingRecord', {
+            prefix: prefix,
+            requestType: 'json',
+            data: {
+              materialType: 'SONG',
+              record: {
+                clientType: (client as string)?.toLocaleUpperCase(),
+                practiceSource: 'LESSON_TRAINING',
+                feature: 'PRACTICE',
+                deviceType: browserInfo.android ? 'ANDROID' : browserInfo.isApp ? 'IOS' : 'WEB',
+                behaviorId: initBehaviorId,
+                playTime: totalTime,
+                musicSheetId: search.id,
+              },
+              courseScheduleId: search.courseScheduleId,
+              lessonTrainingId: search.lessonTrainingId,
+              materialId: search.materialId,
+            },
+          })
+        } catch (error) {}
+      }
     }
     let timer = null as any
     onMounted(() => {

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

@@ -149,7 +149,8 @@ const connect = async () => {
     platform: 'WEB',
     clientId: 'STUDENT',
     hertz: SettingState.sett.hertz,
-    feature: search.feature || 'PRACTICE',
+    feature: 'EVALUATION',
+    practiceSource: search.unitId ? 'UNIT_TEST' : 'PRACTICE',
     // 这里定义的是数字但是因为是通过input输入所以强制转化一次
     reactionTimeMs: parseFloat('' + SettingState.eva.reactionTimeMs) || 0,
     speed: runtime.speed,

+ 2 - 1
src/subpages/colexiu/popups/follow/index.tsx

@@ -42,7 +42,8 @@ const openToggleRecord = (open: boolean = true) => {
     const playTime = Date.now() - followTime.value
     if (followTime.value !== 0 && playTime > 0) {
       followTime.value = 0
-      updatePlayTime(playTime / 1000)
+      // 已有全局记录时长,不用单独记录了
+      // updatePlayTime(playTime / 1000)
     }
   }
 }