MarkHeader.vue 11 KB

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