MarkHeader.vue 7.1 KB

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