|
@@ -15,11 +15,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, onUnmounted, watch, watchEffect } from "vue";
|
|
|
+import { onMounted, onUnmounted, watch } from "vue";
|
|
|
import { store } from "./store";
|
|
|
import { ModeEnum } from "@/types";
|
|
|
import type { SliceImage, SpecialTag, Track } from "@/types";
|
|
|
-import { isNumber } from "lodash";
|
|
|
// @ts-ignore
|
|
|
import CustomCursor from "custom-cursor.js";
|
|
|
import CommonMarkBody from "./CommonMarkBody.vue";
|
|
@@ -67,10 +66,14 @@ const makeScoreTrack = (
|
|
|
return;
|
|
|
}
|
|
|
// 是否保留当前的轨迹分
|
|
|
+ const questionScore =
|
|
|
+ store.currentTask &&
|
|
|
+ store.currentQuestion &&
|
|
|
+ store.currentTask.markResult.scoreList[store.currentQuestion.__index];
|
|
|
const ifKeepScore =
|
|
|
Math.round(
|
|
|
store.currentQuestion.maxScore * 100 -
|
|
|
- (store.currentQuestion.score || 0) * 100 -
|
|
|
+ (questionScore || 0) * 100 -
|
|
|
store.currentScore * 2 * 100
|
|
|
) / 100;
|
|
|
if (ifKeepScore < 0 && store.currentScore > 0) {
|
|
@@ -90,6 +93,12 @@ const makeScoreTrack = (
|
|
|
// Math.max(...markResult.trackList.map((t) => t.number))
|
|
|
// );
|
|
|
markResult.trackList = [...markResult.trackList, track];
|
|
|
+ const { __index, mainNumber, subNumber } = store.currentQuestion;
|
|
|
+ markResult.scoreList[__index] =
|
|
|
+ markResult.trackList
|
|
|
+ .filter((t) => t.mainNumber === mainNumber && t.subNumber === subNumber)
|
|
|
+ .map((t) => t.score)
|
|
|
+ .reduce((acc, v) => (acc += Math.round(v * 100)), 0) / 100;
|
|
|
}
|
|
|
item.trackList.push(track);
|
|
|
};
|
|
@@ -149,55 +158,6 @@ const makeTrack = (
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 轨迹模式下,添加轨迹,更新分数
|
|
|
-watch(
|
|
|
- () => store.currentTask?.markResult.trackList,
|
|
|
- () => {
|
|
|
- if (store.setting.mode !== ModeEnum.TRACK) return;
|
|
|
- const markResult = store.currentTask?.markResult;
|
|
|
- if (markResult) {
|
|
|
- const cq = store.currentQuestion;
|
|
|
- // 当无轨迹时,不更新;无轨迹时,将分数置null
|
|
|
- if (cq) {
|
|
|
- if (markResult.trackList.length > 0) {
|
|
|
- const cqTrackList = markResult.trackList.filter(
|
|
|
- (v) =>
|
|
|
- v.mainNumber === cq.mainNumber && v.subNumber === cq.subNumber
|
|
|
- );
|
|
|
- if (cqTrackList.length > 0) {
|
|
|
- cq.score =
|
|
|
- cqTrackList
|
|
|
- .map((v) => v.score)
|
|
|
- .reduce((acc, v) => (acc += Math.round(v * 100)), 0) / 100;
|
|
|
- } else {
|
|
|
- cq.score = null;
|
|
|
- }
|
|
|
- } else {
|
|
|
- // TODO: 不需要?如果此行代码生效,则无法清除最后一道题的分数 此时的场景是回评普通模式评的分,需要看见
|
|
|
- // cq.score = cq.__origScore;
|
|
|
- }
|
|
|
- }
|
|
|
- // renderPaperAndMark();
|
|
|
- }
|
|
|
- },
|
|
|
- { deep: true }
|
|
|
-);
|
|
|
-
|
|
|
-// question.score更新后,自动关联markResult.scoreList和markResult.markerScore
|
|
|
-watchEffect(() => {
|
|
|
- const markResult = store.currentTask?.markResult;
|
|
|
-
|
|
|
- if (markResult && store.currentTask) {
|
|
|
- const scoreList = store.currentTask.questionList.map((q) => q.score);
|
|
|
- markResult.scoreList = [...(scoreList as number[])];
|
|
|
- markResult.markerScore =
|
|
|
- (markResult.scoreList.filter((s) => isNumber(s)) as number[]).reduce(
|
|
|
- (acc, v) => (acc += Math.round(v * 100)),
|
|
|
- 0
|
|
|
- ) / 100;
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
watch(
|
|
|
() => store.setting.mode,
|
|
|
() => {
|