|
@@ -1,7 +1,8 @@
|
|
|
import { defineComponent, reactive, watch } from "vue";
|
|
|
import state from "/src/state";
|
|
|
-import { sysMusicRecordAdd } from "../../api";
|
|
|
+import { api_lessonTrainingSubmitTraining, sysMusicRecordAdd } from "../../api";
|
|
|
import { browser, getBehaviorId, getCampId } from "/src/utils";
|
|
|
+import { getQuery } from "/src/utils/queryString";
|
|
|
|
|
|
const recordData = reactive({
|
|
|
starTime: 0,
|
|
@@ -9,25 +10,37 @@ const recordData = reactive({
|
|
|
const handleRecord = () => {
|
|
|
// 不是练习模式不记录
|
|
|
if (state.modeType !== "practise") return;
|
|
|
+ const query = getQuery();
|
|
|
let total = Date.now() - recordData.starTime;
|
|
|
recordData.starTime = Date.now();
|
|
|
if (total < 0) total = 0;
|
|
|
- const body = {
|
|
|
- musicSheetId: state.examSongId,
|
|
|
- sysMusicScoreId: state.examSongId,
|
|
|
- feature: "CLOUD_STUDY_TRAIN",
|
|
|
- playTime: total / 1000,
|
|
|
- deviceType: browser().android ? "ANDROID" : "IOS",
|
|
|
- behaviorId: getBehaviorId()
|
|
|
- };
|
|
|
- sysMusicRecordAdd(body);
|
|
|
+
|
|
|
+ // sysMusicRecordAdd(body);
|
|
|
+ // 课后训练
|
|
|
+ if (query.lessonTrainingId) {
|
|
|
+ api_lessonTrainingSubmitTraining({
|
|
|
+ id: query.lessonTrainingId,
|
|
|
+ trainingTimes: total,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const body = {
|
|
|
+ musicSheetId: state.examSongId,
|
|
|
+ sysMusicScoreId: state.examSongId,
|
|
|
+ feature: "PRACTICE",
|
|
|
+ practiceSource: "PRACTICE",
|
|
|
+ playTime: total,
|
|
|
+ deviceType: browser().android ? "ANDROID" : "IOS",
|
|
|
+ behaviorId: getBehaviorId(),
|
|
|
+ };
|
|
|
+ // musicPracticeRecordSave(body);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
export const handleNoEndExit = () => {
|
|
|
- if (state.playState === 'play') {
|
|
|
- handleRecord()
|
|
|
- }
|
|
|
-}
|
|
|
+ if (state.playState === "play") {
|
|
|
+ handleRecord();
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* 记录练习时长, 仅记录练习模式的时长
|