MarkHeader.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div
  3. class="tw-flex tw-gap-4 tw-justify-between tw-items-center header-container tw-px-1"
  4. v-if="store.setting"
  5. >
  6. <div>
  7. {{ store.setting.subject.code + "-" + store.setting.subject.name }}
  8. </div>
  9. <div class="tw-flex tw-gap-1">
  10. <div>
  11. 编号<span class="highlight-text">{{
  12. store.currentTask?.secretNumber
  13. }}</span>
  14. </div>
  15. </div>
  16. <ul v-if="!isSingleStudent" class="tw-flex tw-gap-2 tw-mb-0">
  17. <li>
  18. 待复核<span class="highlight-text">{{ store.status.totalCount }}</span>
  19. </li>
  20. </ul>
  21. <ul class="tw-flex tw-gap-2 tw-mb-0">
  22. <li @click="upScale" title="放大">
  23. <ZoomInOutlined
  24. class="icon-font icon-font-size-20"
  25. :style="{
  26. color: greaterThanOneScale ? 'red' : 'white',
  27. }"
  28. />
  29. </li>
  30. <li @click="downScale" title="缩小">
  31. <ZoomOutOutlined
  32. class="icon-font icon-font-size-20"
  33. :style="{
  34. color: lessThanOneScale ? 'red' : 'white',
  35. }"
  36. />
  37. </li>
  38. <li @click="normalScale" title="适应">
  39. <FullscreenOutlined class="icon-font icon-font-size-20" />
  40. </li>
  41. </ul>
  42. <div @click="toggleHistory" v-if="!isSingleStudent" title="回看">
  43. <HistoryOutlined class="icon-font icon-font-size-20" />
  44. </div>
  45. <div class="tw-flex tw-place-items-center">
  46. <UserOutlined class="icon-font icon-with-text" />{{
  47. store.setting.userName
  48. }}
  49. </div>
  50. <div
  51. class="tw-flex tw-place-items-center tw-cursor-pointer"
  52. @click="closeWindow"
  53. >
  54. <PoweroffOutlined class="icon-font icon-with-text" />关闭
  55. </div>
  56. </div>
  57. </template>
  58. <script lang="ts">
  59. import { getInspectedHistory } from "@/api/inspectPage";
  60. import { computed, defineComponent, reactive, ref } from "vue";
  61. import { store } from "./store";
  62. import {
  63. ZoomInOutlined,
  64. ZoomOutOutlined,
  65. FullscreenOutlined,
  66. HistoryOutlined,
  67. UserOutlined,
  68. PoweroffOutlined,
  69. AlertOutlined,
  70. QuestionCircleOutlined,
  71. } from "@ant-design/icons-vue";
  72. import { useRoute } from "vue-router";
  73. export default defineComponent({
  74. name: "MarkHeader",
  75. components: {
  76. ZoomInOutlined,
  77. ZoomOutOutlined,
  78. FullscreenOutlined,
  79. HistoryOutlined,
  80. UserOutlined,
  81. PoweroffOutlined,
  82. AlertOutlined,
  83. QuestionCircleOutlined,
  84. },
  85. setup() {
  86. const route = useRoute();
  87. let isSingleStudent = ref(false);
  88. isSingleStudent.value = !!route.query.studentId;
  89. const {
  90. studentId,
  91. subjectCode,
  92. startScore,
  93. endScore,
  94. mainNumber,
  95. mainStartScore,
  96. mainEndScore,
  97. questionScore,
  98. } = route.query as {
  99. studentId: string;
  100. subjectCode: string;
  101. startScore: string;
  102. endScore: string;
  103. mainNumber: string;
  104. mainStartScore: string;
  105. mainEndScore: string;
  106. questionScore: string;
  107. };
  108. const upScale = () => {
  109. const s = store.setting.uiSetting["answer.paper.scale"];
  110. if (s < 3)
  111. store.setting.uiSetting["answer.paper.scale"] = +(s + 0.2).toFixed(1);
  112. };
  113. const downScale = () => {
  114. const s = store.setting.uiSetting["answer.paper.scale"];
  115. if (s > 0.2)
  116. store.setting.uiSetting["answer.paper.scale"] = +(s - 0.2).toFixed(1);
  117. };
  118. const normalScale = () => {
  119. store.setting.uiSetting["answer.paper.scale"] = 1;
  120. };
  121. const toggleHistory = () => {
  122. store.historyOpen = !store.historyOpen;
  123. };
  124. const greaterThanOneScale = computed(() => {
  125. return store.setting.uiSetting["answer.paper.scale"] > 1;
  126. });
  127. const lessThanOneScale = computed(() => {
  128. return store.setting.uiSetting["answer.paper.scale"] < 1;
  129. });
  130. async function updateHistoryTask({
  131. pageNumber = 1,
  132. pageSize = 10,
  133. }: {
  134. pageNumber: number; // 从1开始
  135. pageSize: number;
  136. }) {
  137. const res = await getInspectedHistory({
  138. pageNumber,
  139. pageSize,
  140. subjectCode,
  141. });
  142. if (res.data) {
  143. store.historyTasks.push(res.data);
  144. }
  145. }
  146. const closeWindow = () => {
  147. window.close();
  148. };
  149. return {
  150. store,
  151. isSingleStudent,
  152. upScale,
  153. downScale,
  154. normalScale,
  155. greaterThanOneScale,
  156. lessThanOneScale,
  157. updateHistoryTask,
  158. toggleHistory,
  159. closeWindow,
  160. };
  161. },
  162. });
  163. </script>
  164. <style scoped>
  165. .header-container {
  166. /* z-index: 10000; */
  167. position: relative;
  168. font-size: 16px;
  169. height: 40px;
  170. background-color: #5d6d7d;
  171. color: white;
  172. }
  173. .highlight-text {
  174. color: #ffe400;
  175. }
  176. .icon-font {
  177. display: block;
  178. }
  179. .icon-font-size-20 {
  180. font-size: 20px;
  181. }
  182. .icon-with-text {
  183. font-size: 18px;
  184. line-height: 18px;
  185. }
  186. </style>