123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <div
- v-if="markStore.currentTask"
- class="mark-board-track is-mouse-board"
- :class="[
- markStore.isTrackMode && markStore.isScoreBoardCollapsed
- ? 'hide'
- : 'show',
- ]"
- >
- <div class="board-mode">
- <a-select
- v-model:value="normalMode"
- style="width: 120px"
- @change="normalModeChange"
- >
- <a-select-option value="keyboard">键盘给分</a-select-option>
- <a-select-option value="mouse">鼠标给分</a-select-option>
- </a-select>
- </div>
- <div class="board-header">
- <div class="board-header-left">
- <div class="board-header-info">
- <img src="@/assets/icons/icon-star.svg" /><span>总分</span>
- </div>
- <div class="board-header-score">
- <transition-group name="score-number-animation" tag="span">
- <span :key="markStore.currentTask.markResult?.markerScore || 0">{{
- markStore.currentTask.markResult?.markerScore
- }}</span>
- </transition-group>
- </div>
- </div>
- <qm-button
- v-if="props.isCheckAnswer && !hasModifyScore"
- class="board-header-submit"
- size="medium"
- type="primary"
- @click="checkSubmit"
- >
- 复核
- </qm-button>
- <qm-button
- v-else
- class="board-header-submit"
- size="medium"
- type="primary"
- @click="submit"
- >
- 提交
- </qm-button>
- </div>
- <div
- v-if="markStore.currentTask && markStore.currentTask.questionList"
- class="board-questions"
- :style="{
- flexGrow: 2,
- }"
- >
- <template
- v-for="(question, index) in markStore.currentTask.questionList"
- :key="index"
- >
- <div class="board-question-full-box">
- <div
- :id="'bq-' + question.mainNumber + '-' + question.subNumber"
- :class="[
- 'board-question',
- {
- 'is-current': isCurrentQuestion(question),
- 'is-disabled': isDisabledQuestion(question),
- },
- ]"
- @click="chooseQuestion(question)"
- >
- <div class="question-info">
- <div class="question-title" :title="question.title">
- {{ question.title }}
- </div>
- <div class="question-no">
- {{ question.mainNumber }}-{{ question.subNumber }}
- </div>
- </div>
- <div v-if="question.problem" class="question-score is-problem">
- 问题卷
- </div>
- <div
- v-else-if="isArbitrated(question)"
- class="question-score is-problem"
- >
- {{ getArbitratedStatusName(question) }}
- </div>
- <div v-else-if="!question.selfMark" class="question-score">
- 已评
- </div>
- <div v-else class="board-scores">
- <div
- v-for="(s, i) in questionScoreSteps(question)"
- :key="i"
- :class="[
- 'board-score',
- { 'is-current': isCurrentScore(question, s) },
- ]"
- @click="chooseScore(question, s)"
- >
- {{ s }}
- </div>
- </div>
- </div>
- </div>
- </template>
- </div>
- <div
- v-if="!isCheckAnswer && markStore.currentQuestion?.selfMark"
- class="board-footer"
- >
- <qm-button
- v-if="markStore.currentQuestion?.problem"
- class="board-clear"
- @click="cancelProblemQuestion"
- >
- 取消问题卷
- </qm-button>
- <qm-button v-else class="board-clear" @click="toMarkProblemQuestion">
- 标记问题卷
- </qm-button>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { ref } from "vue";
- import type { Question } from "@/types";
- import { useMarkStore } from "@/store";
- import useAutoChooseFirstQuestion from "../composables/useAutoChooseFirstQuestion";
- import useQuestion from "../composables/useQuestion";
- import useMakeTrack from "../composables/useMakeTrack";
- const markStore = useMarkStore();
- const {
- isDisabledQuestion,
- isArbitrated,
- getArbitratedStatusName,
- cancelProblemQuestion,
- toMarkProblemQuestion,
- } = useQuestion();
- const { chooseQuestion } = useAutoChooseFirstQuestion();
- const { makeCommonTrack } = useMakeTrack();
- const emit = defineEmits([
- "submit",
- "allZeroSubmit",
- "unselectiveSubmit",
- "checkSubmit",
- ]);
- const props = defineProps<{ isCheckAnswer?: boolean }>();
- const hasModifyScore = ref(false);
- // 切换给分模式
- const normalMode = ref(markStore.setting.uiSetting["normal.mode"] || "mouse");
- function normalModeChange(value: string) {
- markStore.setting.uiSetting["normal.mode"] = value;
- }
- function isCurrentQuestion(question: Question) {
- return (
- markStore.currentQuestion?.mainNumber === question.mainNumber &&
- markStore.currentQuestion?.subNumber === question.subNumber
- );
- }
- function chooseScore(question: Question, score: number) {
- if (isDisabledQuestion(question)) return;
- // 只要修改了分值,就当做已修改
- hasModifyScore.value = true;
- makeCommonTrack(question, score);
- }
- function isCurrentScore(question: Question, score: number) {
- const { __index } = question;
- const questionScore =
- markStore.currentTask &&
- markStore.currentTask.markResult &&
- markStore.currentTask.markResult.scoreList[__index];
- return questionScore === score;
- }
- function questionScoreSteps(question: Question) {
- if (!question) return [];
- const remainScore = Math.round(question.maxScore * 100) / 100;
- const steps = [];
- for (
- let i = 0;
- i <= remainScore;
- i = Math.round(i * 100 + question.intervalScore * 100) / 100
- ) {
- steps.push(i);
- }
- if (
- Math.round(remainScore * 100) % Math.round(question.intervalScore * 100) !==
- 0
- ) {
- steps.push(remainScore);
- }
- return steps;
- }
- function submit() {
- emit("submit");
- }
- function checkSubmit() {
- emit("checkSubmit");
- }
- const buttonHeightForSelective = $computed(() =>
- markStore.setting.selective && markStore.setting.enableAllZero
- ? "36px"
- : "76px"
- );
- </script>
- <style scoped>
- .mark-board-track-container {
- max-width: 290px;
- min-width: 290px;
- padding: 20px;
- max-height: calc(100vh - 56px - 0px);
- overflow: auto;
- z-index: 1001;
- transition: margin-right 0.5s;
- color: var(--app-small-header-text-color);
- }
- .mark-board-track-container.show {
- margin-right: 0;
- }
- .mark-board-track-container.hide {
- margin-right: -290px;
- }
- .top-container {
- background-color: var(--app-container-bg-color);
- }
- .total-score {
- color: var(--app-main-text-color);
- font-size: 32px;
- }
- .question {
- min-width: 80px;
- }
- .single-score {
- position: relative;
- width: 32px;
- height: 32px;
- font-size: var(--app-secondary-font-size);
- display: grid;
- place-content: center;
- background-color: var(--app-container-bg-color);
- border-radius: 30px;
- }
- .current-score {
- background-color: var(--app-score-color);
- color: white;
- }
- .all-zero-unselective-button {
- height: v-bind(buttonHeightForSelective);
- border-radius: 10px;
- padding: 7px;
- background-color: #4db9ff;
- border: none;
- }
- </style>
|