2
0

MarkHeader.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div
  3. class="tw-flex tw-gap-2 tw-justify-between tw-items-center header-container tw-px-1"
  4. v-if="store.setting && store.setting.subject.name"
  5. >
  6. <div style="max-width: 10%">
  7. <a
  8. class="tw-text-white tw-underline tw-block tw-overflow-ellipsis 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.personCount }}</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. <ZoomInOutlined
  53. class="icon-font icon-font-size-20 tw-cursor-pointer"
  54. :style="{
  55. color: greaterThanOneScale ? 'red' : 'white',
  56. }"
  57. />
  58. </li>
  59. <li @click="downScale" title="缩小">
  60. <ZoomOutOutlined
  61. class="icon-font icon-font-size-20 tw-cursor-pointer"
  62. :style="{
  63. color: lessThanOneScale ? 'red' : 'white',
  64. }"
  65. />
  66. </li>
  67. <li @click="normalScale" title="适应">
  68. <FullscreenOutlined
  69. class="icon-font icon-font-size-20 tw-cursor-pointer"
  70. />
  71. </li>
  72. </ul>
  73. <div>
  74. <a-dropdown class="header-bg-color">
  75. <template #overlay v-if="!store.setting.forceMode">
  76. <a-menu>
  77. <a-menu-item
  78. key="1"
  79. @click="toggleSettingMode"
  80. style="font-size: 16px"
  81. >
  82. {{ exchangeModeName }}
  83. </a-menu-item>
  84. </a-menu>
  85. </template>
  86. <a-button
  87. style="font-size: 16px; color: white !important; border: none"
  88. >
  89. {{ modeName }}
  90. <DownOutlined
  91. v-if="!store.setting.forceMode"
  92. style="display: inline-flex"
  93. />
  94. </a-button>
  95. </a-dropdown>
  96. </div>
  97. <div @click="toggleHistory" title="回看">
  98. <HistoryOutlined class="icon-font icon-font-size-20" />
  99. </div>
  100. <div
  101. class="tw-flex tw-place-items-center"
  102. :title="
  103. '评卷时间段:' +
  104. (store.setting.startTime > 0
  105. ? $filters.datetimeFilter(store.setting.startTime)
  106. : '-') +
  107. ' ~ ' +
  108. (store.setting.endTime > 0
  109. ? $filters.datetimeFilter(store.setting.endTime)
  110. : '-')
  111. "
  112. >
  113. <AlertOutlined class="icon-font icon-font-size-20" />
  114. </div>
  115. <a-popover title="小助手" trigger="hover" class="tw-cursor-pointer">
  116. <template #content>
  117. <table class="assistant-table">
  118. <tr v-if="store.setting.subject.paperUrl">
  119. <td>试卷</td>
  120. <td>
  121. <a-switch
  122. v-model:checked="store.setting.uiSetting['paper.modal']"
  123. />
  124. </td>
  125. </tr>
  126. <tr v-if="store.setting.subject.answerUrl">
  127. <td>答案</td>
  128. <td>
  129. <a-switch
  130. v-model:checked="store.setting.uiSetting['answer.modal']"
  131. />
  132. </td>
  133. </tr>
  134. <tr>
  135. <td>全卷</td>
  136. <td><a-switch v-model:checked="store.allPaperModal" /></td>
  137. </tr>
  138. <tr v-if="store.setting.sheetView">
  139. <td>原图</td>
  140. <td>
  141. <a-switch v-model:checked="store.sheetViewModal" />
  142. </td>
  143. </tr>
  144. <tr>
  145. <td>缩略图</td>
  146. <td>
  147. <a-switch
  148. v-model:checked="store.setting.uiSetting['minimap.modal']"
  149. />
  150. </td>
  151. </tr>
  152. <tr>
  153. <td>特殊标记</td>
  154. <td><a-switch v-model:checked="specialTagChecked" /></td>
  155. </tr>
  156. <tr v-if="store.setting.statusValue !== 'TRIAL'">
  157. <td>问题卷</td>
  158. <td><a-button @click="openProblemModal">选择问题类型</a-button></td>
  159. </tr>
  160. </table>
  161. </template>
  162. <div class="tw-flex">
  163. 小助手
  164. <DownOutlined
  165. style="font-size: 12px; display: inline-block"
  166. class="tw-self-center tw-ml-1"
  167. />
  168. </div>
  169. </a-popover>
  170. <div
  171. @click="openSwitchGroupModal"
  172. class="tw-flex tw-place-content-center tw-cursor-pointer"
  173. style="max-width: 8%"
  174. :title="group?.title + '-' + group?.number"
  175. >
  176. <div
  177. class="tw-overflow-ellipsis tw-overflow-hidden tw-whitespace-nowrap tw-mr-1"
  178. >
  179. {{ "分组:" + group?.number }}
  180. </div>
  181. <DownOutlined
  182. v-if="store.groups.length > 1"
  183. style="font-size: 12px; display: inline-block"
  184. class="tw-self-center"
  185. />
  186. </div>
  187. <div
  188. class="tw-flex tw-place-items-center tw-cursor-pointer"
  189. @click="openProfileModal"
  190. >
  191. <UserOutlined class="icon-font icon-with-text" />{{
  192. store.setting.userName
  193. }}
  194. </div>
  195. <div
  196. class="tw-flex tw-place-items-center tw-cursor-pointer"
  197. @click="logout"
  198. >
  199. <PoweroffOutlined class="icon-font icon-with-text" />
  200. 退出
  201. </div>
  202. </div>
  203. <MarkChangeProfile ref="changeProfileRef" />
  204. <MarkSwitchGroupDialog ref="switchGroupRef" />
  205. <MarkProblemDialog
  206. @should-reload-history="$emit('should-reload-history')"
  207. ref="problemRef"
  208. />
  209. </template>
  210. <script lang="ts">
  211. import { doLogout, getHistoryTask } from "@/api/markPage";
  212. import { computed, defineComponent, ref } from "vue";
  213. import { store } from "./store";
  214. import {
  215. ZoomInOutlined,
  216. ZoomOutOutlined,
  217. FullscreenOutlined,
  218. HistoryOutlined,
  219. UserOutlined,
  220. PoweroffOutlined,
  221. AlertOutlined,
  222. QuestionCircleOutlined,
  223. DownOutlined,
  224. } from "@ant-design/icons-vue";
  225. import { ModeEnum } from "@/types";
  226. import MarkChangeProfile from "./MarkChangeProfile.vue";
  227. import MarkSwitchGroupDialog from "./MarkSwitchGroupDialog.vue";
  228. import MarkProblemDialog from "./MarkProblemDialog.vue";
  229. export default defineComponent({
  230. name: "MarkHeader",
  231. components: {
  232. ZoomInOutlined,
  233. ZoomOutOutlined,
  234. FullscreenOutlined,
  235. HistoryOutlined,
  236. UserOutlined,
  237. DownOutlined,
  238. PoweroffOutlined,
  239. AlertOutlined,
  240. QuestionCircleOutlined,
  241. MarkChangeProfile,
  242. MarkSwitchGroupDialog,
  243. MarkProblemDialog,
  244. },
  245. emits: ["should-reload-history"],
  246. setup() {
  247. const modeName = computed(() =>
  248. store.setting.mode === ModeEnum.TRACK ? "轨迹模式" : "普通模式"
  249. );
  250. const exchangeModeName = computed(() =>
  251. store.setting.mode === ModeEnum.TRACK ? "普通模式" : "轨迹模式"
  252. );
  253. function toggleSettingMode() {
  254. if (store.setting.mode === ModeEnum.TRACK) {
  255. store.setting.mode = ModeEnum.COMMON;
  256. } else {
  257. store.setting.mode = ModeEnum.TRACK;
  258. }
  259. if (store.currentMarkResult) {
  260. store.currentMarkResult.scoreList = [];
  261. store.currentMarkResult.trackList = [];
  262. }
  263. if (store.currentTask) {
  264. store.currentTask.questionList.forEach((q) => (q.score = null));
  265. }
  266. store.currentQuestion = undefined;
  267. store.currentScore = undefined;
  268. }
  269. const progress = computed(() => {
  270. const { totalCount, markedCount } = store.status;
  271. if (totalCount <= 0) return 0;
  272. let p = markedCount / totalCount;
  273. if (p < 0.01 && markedCount >= 1) p = 0.01;
  274. p = Math.floor(p * 100);
  275. return p;
  276. });
  277. const group = computed(() => {
  278. return store.groups.find((g) => g.number === store.setting.groupNumber);
  279. });
  280. const upScale = () => {
  281. const s = store.setting.uiSetting["answer.paper.scale"];
  282. if (s < 3)
  283. store.setting.uiSetting["answer.paper.scale"] = +(s + 0.2).toFixed(1);
  284. };
  285. const downScale = () => {
  286. const s = store.setting.uiSetting["answer.paper.scale"];
  287. if (s > 0.2)
  288. store.setting.uiSetting["answer.paper.scale"] = +(s - 0.2).toFixed(1);
  289. };
  290. const normalScale = () => {
  291. store.setting.uiSetting["answer.paper.scale"] = 1;
  292. };
  293. const toggleHistory = () => {
  294. store.historyOpen = !store.historyOpen;
  295. };
  296. const greaterThanOneScale = computed(() => {
  297. return store.setting.uiSetting["answer.paper.scale"] > 1;
  298. });
  299. const lessThanOneScale = computed(() => {
  300. return store.setting.uiSetting["answer.paper.scale"] < 1;
  301. });
  302. async function updateHistoryTask({
  303. pageNumber = 1,
  304. pageSize = 10,
  305. order = "markerTime",
  306. sort = "DESC",
  307. secretNumber = null,
  308. }: {
  309. pageNumber: number; // 从1开始
  310. pageSize: number;
  311. order: "markerTime" | "markerScore";
  312. sort: "ASC" | "DESC";
  313. secretNumber: string | null;
  314. }) {
  315. const res = await getHistoryTask({
  316. pageNumber,
  317. pageSize,
  318. order,
  319. sort,
  320. secretNumber,
  321. });
  322. if (res.data) {
  323. store.historyTasks.push(res.data);
  324. }
  325. }
  326. const logout = () => {
  327. doLogout();
  328. };
  329. const changeProfileRef = ref(null);
  330. const openProfileModal = () => {
  331. // @ts-ignore
  332. changeProfileRef.value?.showModal();
  333. };
  334. const switchGroupRef = ref(null);
  335. const openSwitchGroupModal = () => {
  336. // @ts-ignore
  337. switchGroupRef.value?.showModal();
  338. };
  339. const problemRef = ref(null);
  340. const openProblemModal = () => {
  341. // @ts-ignore
  342. problemRef.value?.showModal();
  343. };
  344. const specialTagChecked = ref(false);
  345. return {
  346. store,
  347. modeName,
  348. exchangeModeName,
  349. toggleSettingMode,
  350. progress,
  351. group,
  352. upScale,
  353. downScale,
  354. normalScale,
  355. greaterThanOneScale,
  356. lessThanOneScale,
  357. updateHistoryTask,
  358. toggleHistory,
  359. logout,
  360. changeProfileRef,
  361. openProfileModal,
  362. switchGroupRef,
  363. openSwitchGroupModal,
  364. specialTagChecked,
  365. problemRef,
  366. openProblemModal,
  367. };
  368. },
  369. });
  370. </script>
  371. <style scoped>
  372. .header-bg-color {
  373. background-color: #5d6d7d;
  374. }
  375. .header-container {
  376. /* z-index: 10000; */
  377. position: relative;
  378. font-size: 16px;
  379. height: 40px;
  380. background-color: #5d6d7d;
  381. color: white;
  382. }
  383. .highlight-text {
  384. color: #ffe400;
  385. }
  386. .icon-font {
  387. display: block;
  388. }
  389. .icon-font-size-20 {
  390. font-size: 20px;
  391. }
  392. .line-height-20 {
  393. line-height: 20px;
  394. }
  395. .icon-with-text {
  396. font-size: 18px;
  397. line-height: 18px;
  398. }
  399. .header-bg-color.ant-btn:hover {
  400. background-color: #5d6d7d !important;
  401. }
  402. .assistant-table {
  403. border-collapse: separate;
  404. border-spacing: 0 0.5em;
  405. }
  406. </style>