MarkHeader.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div
  3. class="flex gap-4 justify-between items-center header-bg"
  4. style="z-index: 10000; position: relative; font-size: 16px; height: 40px"
  5. >
  6. <div>
  7. <a
  8. style="color: white; text-decoration: underline"
  9. href="/mark/subject-select"
  10. >{{ store.setting.subject?.name }}</a
  11. >
  12. </div>
  13. <div v-if="store.setting.statusValue === 'TRIAL'">试评</div>
  14. <div class="flex gap-1">
  15. <div>
  16. 编号<span class="highlight-text">{{
  17. store.currentTask?.studentCode
  18. }}</span>
  19. </div>
  20. <div
  21. v-if="store.currentTask && store.currentTask.objectiveScore !== null"
  22. >
  23. 客观分<span class="highlight-text">{{
  24. store.currentTask.objectiveScore
  25. }}</span>
  26. </div>
  27. </div>
  28. <ul class="flex gap-2 mb-0">
  29. <li>
  30. 已评<span class="highlight-text">{{ store.status.markedCount }}</span>
  31. </li>
  32. <li v-if="store.setting.topCount">
  33. 分配<span class="highlight-text">{{ store.setting.topCount }}</span>
  34. </li>
  35. <li>
  36. 未评<span class="highlight-text">{{
  37. store.status.totalCount - store.status.markedCount
  38. }}</span>
  39. </li>
  40. <li
  41. :title="`问题卷${store.status.problemCount}\n待仲裁${store.status.arbitrateCount}`"
  42. style="line-height: 20px"
  43. >
  44. <QuestionCircleOutlined :style="{ 'font-size': '20px' }" />
  45. </li>
  46. <li>
  47. 进度<span class="highlight-text">{{ progress }}%</span>
  48. </li>
  49. </ul>
  50. <ul class="flex gap-2 mb-0">
  51. <li @click="upScale" title="放大" style="line-height: 20px">
  52. <PlusCircleOutlined
  53. :style="{
  54. 'font-size': '20px',
  55. color: greaterThanOneScale ? 'red' : 'white',
  56. }"
  57. />
  58. </li>
  59. <li @click="downScale" title="缩小" style="line-height: 20px">
  60. <MinusCircleOutlined
  61. :style="{
  62. 'font-size': '20px',
  63. color: lessThanOneScale ? 'red' : 'white',
  64. }"
  65. />
  66. </li>
  67. <li @click="normalScale" title="适应" style="line-height: 20px">
  68. <FullscreenOutlined :style="{ 'font-size': '20px' }" />
  69. </li>
  70. </ul>
  71. <div @click="toggleSettingMode" style="line-height: 20px">
  72. {{ modeName }} {{ store.setting.forceMode ? "" : "(切换)" }}
  73. </div>
  74. <div @click="toggleHistory" style="line-height: 20px" title="回看">
  75. <HistoryOutlined :style="{ 'font-size': '20px' }" />
  76. </div>
  77. <div
  78. class="flex place-items-center"
  79. :title="
  80. '评卷时间段:' +
  81. $filters.datetimeFilter(store.setting.startTime) +
  82. ' ~ ' +
  83. $filters.datetimeFilter(store.setting.startTime)
  84. "
  85. >
  86. <ClockCircleOutlined
  87. :style="{ 'font-size': '20px' }"
  88. style="line-height: 20px"
  89. />
  90. </div>
  91. <div>{{ group?.title }}(切换)</div>
  92. <div class="flex place-items-center">
  93. <UserOutlined
  94. :style="{ 'font-size': '18px' }"
  95. style="line-height: 18px"
  96. />{{ store.setting.marker?.name }}
  97. </div>
  98. <div class="flex place-items-center">
  99. <PoweroffOutlined
  100. :style="{ 'font-size': '18px' }"
  101. style="line-height: 18px"
  102. />退出
  103. </div>
  104. </div>
  105. </template>
  106. <script lang="ts">
  107. import { getHistoryTask } from "@/api/markPage";
  108. import { computed, defineComponent } from "vue";
  109. import { store } from "./store";
  110. import {
  111. PlusCircleOutlined,
  112. MinusCircleOutlined,
  113. FullscreenOutlined,
  114. HistoryOutlined,
  115. UserOutlined,
  116. PoweroffOutlined,
  117. ClockCircleOutlined,
  118. QuestionCircleOutlined,
  119. } from "@ant-design/icons-vue";
  120. import { ModeEnum } from "@/types";
  121. export default defineComponent({
  122. name: "MarkHeader",
  123. components: {
  124. PlusCircleOutlined,
  125. MinusCircleOutlined,
  126. FullscreenOutlined,
  127. HistoryOutlined,
  128. UserOutlined,
  129. PoweroffOutlined,
  130. ClockCircleOutlined,
  131. QuestionCircleOutlined,
  132. },
  133. setup() {
  134. const modeName = computed(() =>
  135. store.setting.mode === ModeEnum.TRACK ? "轨迹模式" : "普通模式"
  136. );
  137. function toggleSettingMode() {
  138. if (store.setting.mode === ModeEnum.TRACK) {
  139. store.setting.mode = ModeEnum.COMMON;
  140. } else {
  141. store.setting.mode = ModeEnum.TRACK;
  142. }
  143. }
  144. const progress = computed(() => {
  145. const { totalCount, markedCount } = store.status;
  146. if (totalCount <= 0) return 0;
  147. let p = markedCount / totalCount;
  148. if (p < 0.01 && markedCount >= 1) p = 0.01;
  149. p = Math.floor(p * 100);
  150. return p;
  151. });
  152. const group = computed(() => {
  153. return store.groups.find((g) => g.number === store.setting.groupNumber);
  154. });
  155. const upScale = () => {
  156. const s = store.setting.uiSetting["answer.paper.scale"];
  157. if (s < 3)
  158. store.setting.uiSetting["answer.paper.scale"] = +(s + 0.2).toFixed(1);
  159. };
  160. const downScale = () => {
  161. const s = store.setting.uiSetting["answer.paper.scale"];
  162. if (s > 0.2)
  163. store.setting.uiSetting["answer.paper.scale"] = +(s - 0.2).toFixed(1);
  164. };
  165. const normalScale = () => {
  166. store.setting.uiSetting["answer.paper.scale"] = 1;
  167. };
  168. const toggleHistory = () => {
  169. store.historyOpen = !store.historyOpen;
  170. };
  171. const greaterThanOneScale = computed(() => {
  172. return store.setting.uiSetting["answer.paper.scale"] > 1;
  173. });
  174. const lessThanOneScale = computed(() => {
  175. return store.setting.uiSetting["answer.paper.scale"] < 1;
  176. });
  177. async function updateHistoryTask({
  178. pageNumber = 1,
  179. pageSize = 10,
  180. order = "markerTime",
  181. sort = "DESC",
  182. secretNumber = null,
  183. }: {
  184. pageNumber: number; // 从1开始
  185. pageSize: number;
  186. order: "markerTime" | "markerScore";
  187. sort: "ASC" | "DESC";
  188. secretNumber: string | null;
  189. }) {
  190. const res = await getHistoryTask({
  191. pageNumber,
  192. pageSize,
  193. order,
  194. sort,
  195. secretNumber,
  196. });
  197. if (res.data) {
  198. store.historyTasks.push(res.data);
  199. }
  200. }
  201. return {
  202. store,
  203. modeName,
  204. toggleSettingMode,
  205. progress,
  206. group,
  207. upScale,
  208. downScale,
  209. normalScale,
  210. greaterThanOneScale,
  211. lessThanOneScale,
  212. updateHistoryTask,
  213. toggleHistory,
  214. };
  215. },
  216. });
  217. </script>
  218. <style scoped>
  219. .header-bg {
  220. background-color: #5d6d7d;
  221. color: white;
  222. }
  223. .highlight-text {
  224. color: #ffe400;
  225. }
  226. </style>