<template>
  <CommonMarkHeader
    :isSingleStudent="isSingleStudent"
    :clearTasks="clearTasks"
    showScoreBoard
    showPaperAndAnswer
    :notShowHistoryToggle="true"
  >
    <slot name="taskInfo">
      <div>
        <span class="header-small-text">学号</span>
        <span class="highlight-text">
          {{ store.currentTask?.studentCode ?? "-" }}
        </span>
      </div>
      <div>
        <span class="header-small-text">姓名</span>
        <span class="highlight-text">
          {{ store.currentTask?.studentName ?? "-" }}
        </span>
      </div>
    </slot>
    <span>
      <span class="header-small-text">待校验</span>
      <span class="highlight-text">{{
        store.status.totalCount - store.status.markedCount || "-"
      }}</span>
    </span>

    <template v-if="route.query?.studentId" #studentInfo
      ><div class="highlight-text">
        考生：
        {{
          store.currentTask?.studentCode +
          " - " +
          store.currentTask?.studentName
        }}
      </div></template
    >
  </CommonMarkHeader>
</template>

<script setup lang="ts">
import { clearInspectedTask } from "@/api/inspectPage";
import { store } from "@/store/store";
import { useRoute } from "vue-router";
import CommonMarkHeader from "@/components/CommonMarkHeader.vue";

const route = useRoute();
let isSingleStudent = !!route.query.studentId;
const { studentId, subjectCode } = route.query as {
  studentId: string;
  subjectCode: string;
};

let clearTasks = clearInspectedTask.bind(null, studentId, subjectCode);
</script>
