|
@@ -0,0 +1,198 @@
|
|
|
+<template>
|
|
|
+ <div
|
|
|
+ class="tw-flex tw-gap-4 tw-justify-between tw-items-center header-bg"
|
|
|
+ style="z-index: 10000; position: relative; font-size: 16px; height: 40px"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ {{ store.setting.subject?.name }}
|
|
|
+ </div>
|
|
|
+ <div class="tw-flex tw-gap-1">
|
|
|
+ <div>
|
|
|
+ 编号<span class="highlight-text">{{
|
|
|
+ store.currentTask?.secretNumber
|
|
|
+ }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ul class="tw-flex tw-gap-2 tw-mb-0">
|
|
|
+ <li @click="upScale" title="放大" style="line-height: 20px">
|
|
|
+ <PlusCircleOutlined
|
|
|
+ :style="{
|
|
|
+ 'font-size': '20px',
|
|
|
+ color: greaterThanOneScale ? 'red' : 'white',
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li @click="downScale" title="缩小" style="line-height: 20px">
|
|
|
+ <MinusCircleOutlined
|
|
|
+ :style="{
|
|
|
+ 'font-size': '20px',
|
|
|
+ color: lessThanOneScale ? 'red' : 'white',
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </li>
|
|
|
+ <li @click="normalScale" title="适应" style="line-height: 20px">
|
|
|
+ <FullscreenOutlined :style="{ 'font-size': '20px' }" />
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div @click="toggleSettingMode" style="line-height: 20px">
|
|
|
+ {{ modeName }} {{ store.setting.forceMode ? "" : "(切换)" }}
|
|
|
+ </div>
|
|
|
+ <div @click="toggleHistory" style="line-height: 20px" title="回看">
|
|
|
+ <HistoryOutlined :style="{ 'font-size': '20px' }" />
|
|
|
+ </div>
|
|
|
+ <div class="tw-flex tw-place-items-center">
|
|
|
+ <UserOutlined
|
|
|
+ :style="{ 'font-size': '18px' }"
|
|
|
+ style="line-height: 18px"
|
|
|
+ />{{ store.setting.marker?.name }}
|
|
|
+ </div>
|
|
|
+ <div class="tw-flex tw-place-items-center">
|
|
|
+ <PoweroffOutlined
|
|
|
+ :style="{ 'font-size': '18px' }"
|
|
|
+ style="line-height: 18px"
|
|
|
+ />退出
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+import { getGroups, getHistoryTask } from "@/api/markPage";
|
|
|
+import { computed, defineComponent } from "vue";
|
|
|
+import { store } from "./store";
|
|
|
+import {
|
|
|
+ PlusCircleOutlined,
|
|
|
+ MinusCircleOutlined,
|
|
|
+ FullscreenOutlined,
|
|
|
+ HistoryOutlined,
|
|
|
+ UserOutlined,
|
|
|
+ PoweroffOutlined,
|
|
|
+ ClockCircleOutlined,
|
|
|
+ QuestionCircleOutlined,
|
|
|
+} from "@ant-design/icons-vue";
|
|
|
+import { ModeEnum } from "@/types";
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ name: "MarkHeader",
|
|
|
+ components: {
|
|
|
+ PlusCircleOutlined,
|
|
|
+ MinusCircleOutlined,
|
|
|
+ FullscreenOutlined,
|
|
|
+ HistoryOutlined,
|
|
|
+ UserOutlined,
|
|
|
+ PoweroffOutlined,
|
|
|
+ ClockCircleOutlined,
|
|
|
+ QuestionCircleOutlined,
|
|
|
+ },
|
|
|
+ setup() {
|
|
|
+ const modeName = computed(() =>
|
|
|
+ store.setting.mode === ModeEnum.TRACK ? "轨迹模式" : "普通模式"
|
|
|
+ );
|
|
|
+ function toggleSettingMode() {
|
|
|
+ if (store.setting.mode === ModeEnum.TRACK) {
|
|
|
+ store.setting.mode = ModeEnum.COMMON;
|
|
|
+ } else {
|
|
|
+ store.setting.mode = ModeEnum.TRACK;
|
|
|
+ }
|
|
|
+ if (store.currentMarkResult) {
|
|
|
+ store.currentMarkResult.scoreList = [];
|
|
|
+ store.currentMarkResult.trackList = [];
|
|
|
+ }
|
|
|
+ if (store.currentTask) {
|
|
|
+ store.currentTask.questionList.forEach((q) => (q.score = null));
|
|
|
+ }
|
|
|
+ store.currentQuestion = undefined;
|
|
|
+ store.currentScore = undefined;
|
|
|
+ }
|
|
|
+ const progress = computed(() => {
|
|
|
+ const { totalCount, markedCount } = store.status;
|
|
|
+ if (totalCount <= 0) return 0;
|
|
|
+ let p = markedCount / totalCount;
|
|
|
+ if (p < 0.01 && markedCount >= 1) p = 0.01;
|
|
|
+ p = Math.floor(p * 100);
|
|
|
+ return p;
|
|
|
+ });
|
|
|
+ const group = computed(() => {
|
|
|
+ return store.groups.find((g) => g.number === store.setting.groupNumber);
|
|
|
+ });
|
|
|
+
|
|
|
+ const upScale = () => {
|
|
|
+ const s = store.setting.uiSetting["answer.paper.scale"];
|
|
|
+ if (s < 3)
|
|
|
+ store.setting.uiSetting["answer.paper.scale"] = +(s + 0.2).toFixed(1);
|
|
|
+ };
|
|
|
+ const downScale = () => {
|
|
|
+ const s = store.setting.uiSetting["answer.paper.scale"];
|
|
|
+ if (s > 0.2)
|
|
|
+ store.setting.uiSetting["answer.paper.scale"] = +(s - 0.2).toFixed(1);
|
|
|
+ };
|
|
|
+ const normalScale = () => {
|
|
|
+ store.setting.uiSetting["answer.paper.scale"] = 1;
|
|
|
+ };
|
|
|
+ const toggleHistory = () => {
|
|
|
+ store.historyOpen = !store.historyOpen;
|
|
|
+ };
|
|
|
+ const greaterThanOneScale = computed(() => {
|
|
|
+ return store.setting.uiSetting["answer.paper.scale"] > 1;
|
|
|
+ });
|
|
|
+ const lessThanOneScale = computed(() => {
|
|
|
+ return store.setting.uiSetting["answer.paper.scale"] < 1;
|
|
|
+ });
|
|
|
+
|
|
|
+ async function switchGroupDialog() {
|
|
|
+ const groups = await getGroups();
|
|
|
+ console.log(groups);
|
|
|
+ }
|
|
|
+
|
|
|
+ async function updateHistoryTask({
|
|
|
+ pageNumber = 1,
|
|
|
+ pageSize = 10,
|
|
|
+ order = "markerTime",
|
|
|
+ sort = "DESC",
|
|
|
+ secretNumber = null,
|
|
|
+ }: {
|
|
|
+ pageNumber: number; // 从1开始
|
|
|
+ pageSize: number;
|
|
|
+ order: "markerTime" | "markerScore";
|
|
|
+ sort: "ASC" | "DESC";
|
|
|
+ secretNumber: string | null;
|
|
|
+ }) {
|
|
|
+ const res = await getHistoryTask({
|
|
|
+ pageNumber,
|
|
|
+ pageSize,
|
|
|
+ order,
|
|
|
+ sort,
|
|
|
+ secretNumber,
|
|
|
+ });
|
|
|
+ if (res.data) {
|
|
|
+ store.historyTasks.push(res.data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ store,
|
|
|
+ modeName,
|
|
|
+ toggleSettingMode,
|
|
|
+ progress,
|
|
|
+ group,
|
|
|
+ upScale,
|
|
|
+ downScale,
|
|
|
+ normalScale,
|
|
|
+ greaterThanOneScale,
|
|
|
+ lessThanOneScale,
|
|
|
+ updateHistoryTask,
|
|
|
+ toggleHistory,
|
|
|
+ switchGroupDialog,
|
|
|
+ };
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.header-bg {
|
|
|
+ background-color: #5d6d7d;
|
|
|
+ color: white;
|
|
|
+}
|
|
|
+.highlight-text {
|
|
|
+ color: #ffe400;
|
|
|
+}
|
|
|
+</style>
|