|
@@ -1,16 +1,16 @@
|
|
|
import { Transition, defineComponent, onMounted, reactive, watch, defineAsyncComponent, computed, onUnmounted } from "vue";
|
|
|
-import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat } from "/src/view/evaluating";
|
|
|
+import { connectWebsocket, evaluatingData, handleEndBegin, handleStartBegin, handleStartEvaluat, handleViewReport, startCheckDelay, checkUseEarphone, handleCancelEvaluat, checkMinInterval, handleEndEvaluat } from "/src/view/evaluating";
|
|
|
import Earphone from "./earphone";
|
|
|
import styles from "./index.module.less";
|
|
|
import SoundEffect from "./sound-effect";
|
|
|
-import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo, clearSelection } from "/src/state";
|
|
|
+import state, { handleRessetState, resetPlaybackToStart, musicalInstrumentCodeInfo, clearSelection, initSetPlayRate } from "/src/state";
|
|
|
import { storeData } from "/src/store";
|
|
|
import { browser } from "/src/utils";
|
|
|
import { getNoteByMeasuresSlursStart } from "/src/helpers/formateMusic";
|
|
|
import { Icon, Popup, showToast, closeToast, showLoadingToast } from "vant";
|
|
|
import EvaluatResult from "./evaluat-result";
|
|
|
import EvaluatAudio from "./evaluat-audio";
|
|
|
-import { api_getDeviceDelay, api_openAdjustRecording, api_proxyServiceMessage, api_videoUpdate, getEarphone, api_back, api_startDelayCheck, api_cancelDelayCheck, api_closeDelayCheck, api_finishDelayCheck, api_retryEvaluating, api_remove_finishDelayCheck } from "/src/helpers/communication";
|
|
|
+import { api_getDeviceDelay, api_openAdjustRecording, api_proxyServiceMessage, api_videoUpdate, getEarphone, api_back, api_startDelayCheck, api_cancelDelayCheck, api_remove_cancelDelayCheck, api_closeDelayCheck, api_finishDelayCheck, api_retryEvaluating, api_remove_finishDelayCheck } from "/src/helpers/communication";
|
|
|
import EvaluatShare from "./evaluat-share";
|
|
|
import { Vue3Lottie } from "vue3-lottie";
|
|
|
import startData from "./data/start.json";
|
|
@@ -196,7 +196,7 @@ export default defineComponent({
|
|
|
const note = getNoteByMeasuresSlursStart(item);
|
|
|
// #8701 bug: 评测模式,是以曲谱本身的速度进行评测,所以rate取1,不需要转换
|
|
|
// const rate = state.speed / state.originSpeed;
|
|
|
- const rate = 1;
|
|
|
+ const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
|
|
|
const difftime = item.difftime;
|
|
|
const start = difftime + (item.sourceRelativeTime || item.relativeTime) - starTime;
|
|
|
const end = difftime + (item.sourceRelaEndtime || item.relaEndtime) - starTime;
|
|
@@ -261,10 +261,13 @@ export default defineComponent({
|
|
|
/** 连接websocket */
|
|
|
const handleConnect = async () => {
|
|
|
const behaviorId = localStorage.getItem("behaviorId") || localStorage.getItem("BEHAVIORID") || undefined;
|
|
|
- let rate = state.speed / state.originSpeed;
|
|
|
- rate = parseFloat(rate.toFixed(2));
|
|
|
+ // let rate = state.speed / state.originSpeed;
|
|
|
+ const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
|
|
|
+ // rate = parseFloat(rate.toFixed(2));
|
|
|
console.log("速度比例", rate, "速度", state.speed);
|
|
|
calculateInfo = formatTimes();
|
|
|
+ // 评测的速度,如果是选段,则选选段开头小节的速度
|
|
|
+ const evaluatSpeed = state.sectionStatus && state.section.length === 2 && state.section[0].measureSpeed ? state.section[0].measureSpeed * state.basePlayRate : state.speed;
|
|
|
const content = {
|
|
|
musicXmlInfos: calculateInfo.datas,
|
|
|
subjectId: state.musicalCode,
|
|
@@ -277,12 +280,12 @@ export default defineComponent({
|
|
|
clientId: storeData.platformType === "STUDENT" ? "student" : storeData.platformType === "TEACHER" ? "teacher" : "education",
|
|
|
hertz: state.setting.frequency,
|
|
|
reactionTimeMs: state.setting.reactionTimeMs ? Number(state.setting.reactionTimeMs) : 0,
|
|
|
- speed: state.speed,
|
|
|
+ speed: evaluatSpeed,
|
|
|
heardLevel: state.setting.evaluationDifficulty,
|
|
|
// beatLength: Math.round((state.fixtime * 1000) / rate),
|
|
|
beatLength: actualBeatLength,
|
|
|
evaluationCriteria: state.evaluationStandard,
|
|
|
- speedRate: rate, // 播放倍率
|
|
|
+ speedRate: parseFloat(rate.toFixed(2)), // 播放倍率
|
|
|
};
|
|
|
await connectWebsocket(content);
|
|
|
// state.playSource = "music";
|
|
@@ -296,15 +299,14 @@ export default defineComponent({
|
|
|
resetPlaybackToStart();
|
|
|
return;
|
|
|
} else if (evaluatingData.resultData?.recordIdStr || evaluatingData.resultData?.recordId) {
|
|
|
- let rate = state.speed / state.originSpeed;
|
|
|
- rate = parseFloat(rate.toFixed(2));
|
|
|
+ const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
|
|
|
// 上传云端
|
|
|
// evaluatModel.evaluatUpdateAudio = true;
|
|
|
api_openAdjustRecording({
|
|
|
recordId: evaluatingData.resultData?.recordIdStr || evaluatingData.resultData?.recordId,
|
|
|
title: state.examSongName || "曲谱演奏",
|
|
|
coverImg: state.coverImg,
|
|
|
- speedRate: rate, // 播放倍率
|
|
|
+ speedRate: parseFloat(rate.toFixed(2)), // 播放倍率
|
|
|
musicRenderType: state.musicRenderType,
|
|
|
musicSheetId: state.examSongId,
|
|
|
'part-index': state.partIndex
|
|
@@ -327,8 +329,8 @@ export default defineComponent({
|
|
|
} else if (type === "selfCancel") {
|
|
|
// 再来一次,需要手动取消评测,不生成评测记录,不显示评测结果弹窗
|
|
|
evaluatingData.oneselfCancleEvaluating = true;
|
|
|
- handleCancelEvaluat();
|
|
|
- startBtnHandle();
|
|
|
+ // handleCancelEvaluat();
|
|
|
+ handleEndEvaluat(true, 'selfCancel');
|
|
|
}
|
|
|
resetPlaybackToStart();
|
|
|
evaluatingData.resulstMode = false;
|
|
@@ -390,6 +392,7 @@ export default defineComponent({
|
|
|
});
|
|
|
}
|
|
|
// console.log('异常流程3')
|
|
|
+ initSetPlayRate();
|
|
|
// 检测APP端socket状态
|
|
|
const res: any = await startCheckDelay();
|
|
|
if (res?.checked) {
|
|
@@ -418,6 +421,7 @@ export default defineComponent({
|
|
|
evaluatingData.socketErrorPop = false;
|
|
|
if (res?.content) {
|
|
|
evaluatingData.checkEnd = true;
|
|
|
+ state.setting.soundEffect = false;
|
|
|
checkEarphoneStatus();
|
|
|
}
|
|
|
};
|
|
@@ -431,9 +435,33 @@ export default defineComponent({
|
|
|
return evaluatingData.earphoneMode && !state.isLoading && !state.hasDriverPop;
|
|
|
});
|
|
|
|
|
|
+ watch(
|
|
|
+ () => state.setting.soundEffect,
|
|
|
+ (val) => {
|
|
|
+ if (val) {
|
|
|
+ headTopData.settingMode = false
|
|
|
+ api_startDelayCheck({});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ // 手动取消评测,需要自动再次评测
|
|
|
+ watch(
|
|
|
+ () => evaluatingData.hideResultModal,
|
|
|
+ (val) => {
|
|
|
+ if (val && evaluatingData.oneselfCancleEvaluating) {
|
|
|
+ setTimeout(() => {
|
|
|
+ startBtnHandle();
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
// 如果打开了延迟检测开关,需要先发送开始检测的消息
|
|
|
- if (state.setting.soundEffect) {
|
|
|
+ const delayData = await api_getDeviceDelay();
|
|
|
+ console.log('设备的延迟值',delayData.content?.value)
|
|
|
+ if (state.setting.soundEffect || (delayData && delayData.content?.value < 0)) {
|
|
|
await api_startDelayCheck({});
|
|
|
} else {
|
|
|
evaluatingData.checkEnd = true;
|
|
@@ -448,6 +476,7 @@ export default defineComponent({
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
api_remove_finishDelayCheck(handleFinishDelayCheck);
|
|
|
+ api_remove_cancelDelayCheck(handleCancelDelayCheck);
|
|
|
clearTimeout(checkErjiTimer);
|
|
|
checkErjiTimer = null;
|
|
|
});
|
|
@@ -466,8 +495,24 @@ export default defineComponent({
|
|
|
)}
|
|
|
{evaluatingData.websocketState && evaluatingData.startBegin && (
|
|
|
<>
|
|
|
- <img class={styles.iconBtn} src={headImg("icon_reset.png")} onClick={() => handleEvaluatResult("selfCancel")} />
|
|
|
- <img class={styles.iconBtn} src={headImg("submit.png")} onClick={() => handleEndBegin()} />
|
|
|
+ <img class={styles.iconBtn} src={headImg("icon_reset.png")} onClick={() => {
|
|
|
+ // 校验评测最小间隔时间
|
|
|
+ const currentTime = +new Date();
|
|
|
+ // 开始评测和结束评测的间隔时间小于800毫秒,则不处理
|
|
|
+ if (currentTime - evaluatingData.recordingTime < 800) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ handleEvaluatResult("selfCancel")
|
|
|
+ }} />
|
|
|
+ <img class={styles.iconBtn} src={headImg("submit.png")} onClick={() => {
|
|
|
+ // 校验评测最小间隔时间
|
|
|
+ const currentTime = +new Date();
|
|
|
+ // 开始评测和结束评测的间隔时间小于800毫秒,则不处理
|
|
|
+ if (currentTime - evaluatingData.recordingTime < 800) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ handleEndBegin()
|
|
|
+ }} />
|
|
|
</>
|
|
|
)}
|
|
|
</div>
|