|
@@ -8,6 +8,8 @@ import { handleStartTick } from "/src/view/tick";
|
|
|
import { metronomeData } from "/src/helpers/metronome";
|
|
|
import { getDuration } from "/src/helpers/formateMusic";
|
|
|
import { OpenSheetMusicDisplay } from "/osmd-extended/src";
|
|
|
+import { browser, getBehaviorId } from "/src/utils";
|
|
|
+import { api_musicPracticeRecordSave } from "../../page-instrument/api";
|
|
|
|
|
|
export const followData = reactive({
|
|
|
list: [] as any, // 频率列表
|
|
@@ -18,6 +20,24 @@ export const followData = reactive({
|
|
|
earphone: false,
|
|
|
});
|
|
|
|
|
|
+// 记录跟练时长
|
|
|
+const handleRecord = (total: number) => {
|
|
|
+ if (total < 0) total = 0;
|
|
|
+ const totalTime = total / 1000;
|
|
|
+
|
|
|
+ const body = {
|
|
|
+ clientType: storeData.user.clientType,
|
|
|
+ musicSheetId: state.examSongId,
|
|
|
+ sysMusicScoreId: state.examSongId,
|
|
|
+ feature: "FOLLOW_UP_TRAINING",
|
|
|
+ practiceSource: "FOLLOW_UP_TRAINING",
|
|
|
+ playTime: totalTime,
|
|
|
+ deviceType: browser().android ? "ANDROID" : "IOS",
|
|
|
+ behaviorId: getBehaviorId(),
|
|
|
+ };
|
|
|
+ api_musicPracticeRecordSave(body);
|
|
|
+};
|
|
|
+
|
|
|
/** 点击跟练模式 */
|
|
|
export const toggleFollow = (notCancel = true) => {
|
|
|
state.modeType = state.modeType === "follow" ? "practise" : "follow";
|
|
@@ -40,6 +60,7 @@ const openToggleRecord = async (open: boolean = true) => {
|
|
|
} else {
|
|
|
const playTime = Date.now() - followTime.value;
|
|
|
if (followTime.value !== 0 && playTime > 0) {
|
|
|
+ handleRecord(playTime);
|
|
|
followTime.value = 0;
|
|
|
}
|
|
|
}
|