瀏覽代碼

feat: 异常流程从结束评测改成取消评测

TIANYONG 1 年之前
父節點
當前提交
58976e5ab0
共有 1 個文件被更改,包括 14 次插入7 次删除
  1. 14 7
      src/view/evaluating/index.tsx

+ 14 - 7
src/view/evaluating/index.tsx

@@ -489,7 +489,7 @@ export const handleEndBegin = () => {
 /**
  * 取消评测
  */
-export const handleCancelEvaluat = () => {
+export const handleCancelEvaluat = (cancelType?: string) => {
 	evaluatingData.evaluatings = {};
 	evaluatingData.startBegin = false;
 	// 关闭提示
@@ -502,14 +502,21 @@ export const handleCancelEvaluat = () => {
 			status: 200,
 		},
 	});
-	// 取消评测
-	cancelEvaluating();
+	/**
+	 * 异常状态是取消评测(cancelEvaluating),正常结束时结束评测(endEvaluating)
+	 */
+	if (cancelType === "cancel") {
+		// 取消评测
+		cancelEvaluating();
+	} else {
+		endEvaluating({
+			musicScoreId: state.examSongId,
+		});
+	}
 	// 停止播放
 	handleStopPlay();
 	console.log('评测结束2')
-	endEvaluating({
-		musicScoreId: state.examSongId,
-	});
+
 	// 如果开启了摄像头, 结束录制视频
 	if (state.setting.camera) {
 		console.log("结束录制视频");
@@ -580,7 +587,7 @@ const handleAccompanyError = (res?: IPostMessage) => {
 				}
 				// 评测中
 				if (state.modeType === "evaluating" && evaluatingData.startBegin) {
-					handleCancelEvaluat();
+					handleCancelEvaluat('cancel');
 				}
 				if (tickData.show) {
 					tickData.tickEnd = true