MarkHeader.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <div
  3. v-if="store.setting && store.setting.subject.name"
  4. class="tw-flex tw-gap-2 tw-justify-between tw-items-center header-container"
  5. >
  6. <a-tooltip>
  7. <template #title>回评</template>
  8. <div
  9. class="
  10. tw-flex tw-place-content-center tw-cursor-pointer tw-relative
  11. menu
  12. "
  13. :class="[store.historyOpen && 'menu-toggled']"
  14. @click="store.toggleHistory"
  15. >
  16. <span class="tw-inline-flex tw-place-content-center">
  17. <img
  18. src="./images/left-menu.svg"
  19. :class="[store.historyOpen && 'svg-red']"
  20. />
  21. </span>
  22. <div v-if="store.historyOpen" class="triangle"></div>
  23. </div>
  24. </a-tooltip>
  25. <div style="max-width: 12%; margin-left: -20px">
  26. <a
  27. class="
  28. tw-text-white
  29. tw-block
  30. tw-overflow-ellipsis
  31. tw-overflow-hidden
  32. tw-whitespace-nowrap
  33. header-big-text
  34. "
  35. :title="store.setting.subject.name"
  36. href="/mark/subject-select"
  37. @dragstart.prevent="() => {}"
  38. >
  39. {{
  40. `${store.setting.subject.code ?? ""}-${
  41. store.setting.subject.name ?? ""
  42. }`
  43. }}
  44. </a>
  45. </div>
  46. <div class="tw-flex" style="margin: 0 -20px 0 -40px">
  47. <a-tooltip>
  48. <template #title>
  49. 问题卷{{ store.status.problemCount }}
  50. <br />
  51. 待仲裁{{ store.status.arbitrateCount }}
  52. </template>
  53. <img src="./images/problems.svg" />
  54. </a-tooltip>
  55. </div>
  56. <div v-if="store.setting.statusValue === 'TRIAL'">试评</div>
  57. <div class="tw-flex tw-gap-1">
  58. <div style="min-width: 105px">
  59. <span class="header-small-text">编号</span>
  60. <span class="highlight-text">
  61. {{ store.currentTask?.secretNumber ?? "-" }}
  62. </span>
  63. </div>
  64. <div
  65. v-if="store.currentTask && store.currentTask.objectiveScore !== null"
  66. >
  67. <span class="header-small-text">客观分</span>
  68. <span class="highlight-text">
  69. {{ store.currentTask.objectiveScore }}
  70. </span>
  71. </div>
  72. </div>
  73. <div v-show="store.status.totalCount" class="tw-flex tw-gap-2">
  74. <span style="display: inline-flex; height: 16px; min-width: 55px">
  75. <span class="header-small-text">已评</span>
  76. <transition-group name="count-animation" tag="span">
  77. <span
  78. :key="store.status.personCount || 0"
  79. class="highlight-text"
  80. style="display: block"
  81. >
  82. {{ store.status.personCount }}
  83. </span>
  84. </transition-group>
  85. </span>
  86. <span v-if="store.setting.topCount">
  87. <span class="header-small-text">分配</span>
  88. <span class="highlight-text">{{ store.setting.topCount ?? "-" }}</span>
  89. </span>
  90. <span style="display: inline-flex; height: 16px; min-width: 55px">
  91. <span class="header-small-text">未评</span>
  92. <transition-group name="count-animation" tag="span">
  93. <span
  94. :key="todoCount || 0"
  95. class="highlight-text"
  96. style="display: block"
  97. >
  98. {{ todoCount }}
  99. </span>
  100. </transition-group>
  101. </span>
  102. <span style="display: inline-flex; height: 16px; min-width: 60px">
  103. <span class="header-small-text">进度</span>
  104. <transition-group name="count-animation" tag="span">
  105. <span
  106. :key="progress || '-'"
  107. class="highlight-text"
  108. style="display: block"
  109. >
  110. {{ progress }}%
  111. </span>
  112. </transition-group>
  113. </span>
  114. </div>
  115. <div class="tw-flex tw-place-items-center">
  116. <a-tooltip>
  117. <template #title>
  118. 评卷时间段
  119. <br />
  120. {{
  121. store.setting.startTime > 0
  122. ? $filters.datetimeFilter(store.setting.startTime)
  123. : "-"
  124. }}
  125. <br />~<br />
  126. {{
  127. store.setting.endTime > 0
  128. ? $filters.datetimeFilter(store.setting.endTime)
  129. : "-"
  130. }}
  131. </template>
  132. <img
  133. src="./images/time.png"
  134. style="width: 16px; height: 16px"
  135. class="svg-red-hover"
  136. />
  137. </a-tooltip>
  138. </div>
  139. <div class="tw-flex">
  140. <a-dropdown class="header-bg-color">
  141. <template v-if="!store.setting.forceMode" #overlay>
  142. <a-menu>
  143. <a-menu-item key="1" @click="toggleSettingMode">
  144. {{ exchangeModeName }}
  145. </a-menu-item>
  146. </a-menu>
  147. </template>
  148. <a-button
  149. style="
  150. color: rgba(255, 255, 255, 0.5);
  151. border: none;
  152. display: flex;
  153. align-items: center;
  154. "
  155. >
  156. <img
  157. src="./images/trackmode.png"
  158. style="
  159. width: 11px;
  160. height: 12px;
  161. display: inline;
  162. margin-right: 2px;
  163. "
  164. />
  165. {{ modeName }}
  166. <div v-if="!store.setting.forceMode" class="dropdown-triangle"></div>
  167. </a-button>
  168. </a-dropdown>
  169. </div>
  170. <a-popover
  171. v-if="!store.isScanImage"
  172. title="小助手"
  173. trigger="hover"
  174. class="tw-cursor-pointer"
  175. >
  176. <template #content>
  177. <table class="assistant-table">
  178. <tr v-if="store.setting.statusValue !== 'TRIAL'">
  179. <td>问题卷</td>
  180. <td><a-button @click="openProblemModal">选择问题类型</a-button></td>
  181. </tr>
  182. </table>
  183. </template>
  184. <div class="tw-flex tw-items-center">
  185. <img
  186. src="./images/assistant.png"
  187. style="width: 10px; height: 12px; margin-right: 2px"
  188. />
  189. <span>小助手</span>
  190. <div class="dropdown-triangle"></div>
  191. </div>
  192. </a-popover>
  193. <a-popover
  194. v-if="store.isScanImage"
  195. trigger="hover"
  196. class="tw-cursor-pointer"
  197. >
  198. <template #title>
  199. <span
  200. style="
  201. color: var(--app-main-text-color);
  202. font-size: var(--app-title-font-size);
  203. "
  204. >
  205. 小助手
  206. </span>
  207. </template>
  208. <template #content>
  209. <table class="assistant-table">
  210. <tr v-if="store.setting.subject.paperUrl">
  211. <td>试卷</td>
  212. <td>
  213. <a-switch
  214. v-model:checked="store.setting.uiSetting['paper.modal']"
  215. />
  216. </td>
  217. </tr>
  218. <tr v-if="store.setting.subject.answerUrl">
  219. <td>答案</td>
  220. <td>
  221. <a-switch
  222. v-model:checked="store.setting.uiSetting['answer.modal']"
  223. />
  224. </td>
  225. </tr>
  226. <tr>
  227. <td>全卷</td>
  228. <td><a-switch v-model:checked="store.allPaperModal" /></td>
  229. </tr>
  230. <tr v-if="store.setting.sheetView">
  231. <td>原图</td>
  232. <td>
  233. <a-switch v-model:checked="store.sheetViewModal" />
  234. </td>
  235. </tr>
  236. <tr>
  237. <td>缩略图</td>
  238. <td>
  239. <a-switch
  240. v-model:checked="store.setting.uiSetting['minimap.modal']"
  241. />
  242. </td>
  243. </tr>
  244. <tr>
  245. <td>特殊标记</td>
  246. <td>
  247. <a-switch
  248. v-model:checked="store.setting.uiSetting['specialTag.modal']"
  249. />
  250. </td>
  251. </tr>
  252. <tr v-if="store.setting.statusValue !== 'TRIAL'">
  253. <td>问题卷</td>
  254. <td>
  255. <a-button
  256. type="text"
  257. style="
  258. color: var(--app-primary-button-bg-color);
  259. margin-right: -15px;
  260. height: 25px;
  261. "
  262. @click="openProblemModal"
  263. >
  264. 选择问题类型
  265. </a-button>
  266. </td>
  267. </tr>
  268. <tr v-if="store.isScanImage">
  269. <td>分数/标记大小</td>
  270. <td>
  271. <a-slider
  272. v-model:value="store.setting.uiSetting['score.fontSize.scale']"
  273. :min="0.5"
  274. :step="0.1"
  275. :max="2"
  276. style="margin: 0"
  277. />
  278. </td>
  279. </tr>
  280. </table>
  281. </template>
  282. <div class="tw-flex tw-items-center">
  283. <img
  284. src="./images/assistant.png"
  285. style="width: 10px; height: 12px; margin-right: 2px"
  286. />
  287. <span>小助手</span>
  288. <div class="dropdown-triangle"></div>
  289. </div>
  290. </a-popover>
  291. <div
  292. class="tw-flex tw-place-content-center tw-cursor-pointer tw-items-center"
  293. style="max-width: 8%"
  294. :title="store.setting.groupTitle + '-' + store.setting.groupNumber"
  295. @click="openSwitchGroupModal"
  296. >
  297. <img
  298. src="./images/group.png"
  299. style="width: 10px; height: 12px; margin-right: 2px"
  300. />
  301. <div class="tw-overflow-ellipsis tw-overflow-hidden tw-whitespace-nowrap">
  302. {{ "分组:" + store.setting.groupNumber }}
  303. </div>
  304. <div v-if="store.groups.length > 1" class="dropdown-triangle"></div>
  305. </div>
  306. <div class="tw-flex tw-gap-4">
  307. <div
  308. class="tw-flex tw-place-items-center tw-cursor-pointer"
  309. @click="openProfileModal"
  310. >
  311. <!-- <UserOutlined /> -->
  312. {{ store.setting.userName }}
  313. </div>
  314. <div
  315. class="tw-flex tw-place-items-center tw-cursor-pointer"
  316. @click="logout"
  317. >
  318. <!-- <PoweroffOutlined /> -->
  319. 退出
  320. </div>
  321. <a-tooltip placement="bottomRight" :overlayStyle="{ width: '58px' }">
  322. <template #title>给分板</template>
  323. <div
  324. class="tw-flex tw-place-content-center tw-cursor-pointer menu"
  325. :class="[
  326. store.isScoreBoardVisible && store.currentTask && 'menu-toggled',
  327. ]"
  328. @click="store.toggleScoreBoard"
  329. >
  330. <span class="tw-inline-flex tw-place-content-center tw-relative">
  331. <img
  332. src="./images/right-menu.svg"
  333. :class="[store.isScoreBoardVisible && 'svg-red']"
  334. />
  335. </span>
  336. <div
  337. v-if="store.isScoreBoardVisible && store.currentTask"
  338. class="triangle"
  339. ></div>
  340. </div>
  341. </a-tooltip>
  342. </div>
  343. </div>
  344. <MarkChangeProfile ref="changeProfileRef" />
  345. <MarkSwitchGroupDialog ref="switchGroupRef" />
  346. <MarkProblemDialog ref="problemRef" />
  347. </template>
  348. <script setup lang="ts">
  349. import { doLogout, updateUISetting } from "@/api/markPage";
  350. import { watchEffect } from "vue";
  351. import { store } from "@/store/store";
  352. import { ModeEnum } from "@/types";
  353. import MarkChangeProfile from "./MarkChangeProfile.vue";
  354. import MarkSwitchGroupDialog from "./MarkSwitchGroupDialog.vue";
  355. import MarkProblemDialog from "./MarkProblemDialog.vue";
  356. import { isNumber } from "lodash-es";
  357. import { Modal } from "ant-design-vue";
  358. let modeName = $computed(() =>
  359. store.setting.mode === ModeEnum.TRACK ? "轨迹模式" : "普通模式"
  360. );
  361. let exchangeModeName = $computed(() =>
  362. store.setting.mode === ModeEnum.TRACK ? "普通模式" : "轨迹模式"
  363. );
  364. async function toggleSettingMode() {
  365. if (store.isTrackMode) {
  366. store.setting.mode = ModeEnum.COMMON;
  367. } else {
  368. store.setting.mode = ModeEnum.TRACK;
  369. }
  370. await updateUISetting(store.setting.mode);
  371. const body = document.querySelector("body");
  372. if (body) body.innerHTML = "重新加载中...";
  373. // 等待一秒后,重新加载页面
  374. await new Promise((resolve) => setTimeout(resolve, 1000));
  375. window.location.reload();
  376. }
  377. let progress = $computed(() => {
  378. const { totalCount, markedCount } = store.status;
  379. if (typeof totalCount !== "number" || totalCount === 0) return 0;
  380. let p = markedCount / totalCount;
  381. if (p < 0.01 && markedCount >= 1) p = 0.01;
  382. p = Math.floor(p * 100);
  383. return p;
  384. });
  385. const logout = () => {
  386. doLogout();
  387. };
  388. let changeProfileRef = $ref<InstanceType<typeof MarkChangeProfile>>();
  389. const openProfileModal = () => {
  390. // @ts-ignore https://github.com/vuejs/vue-next/issues/4397
  391. // eslint-disable-next-line @typescript-eslint/no-unsafe-call
  392. changeProfileRef?.showModal();
  393. };
  394. let switchGroupRef = $ref<InstanceType<typeof MarkSwitchGroupDialog>>();
  395. const openSwitchGroupModal = () => {
  396. // @ts-ignore https://github.com/vuejs/vue-next/issues/4397
  397. // eslint-disable-next-line @typescript-eslint/no-unsafe-call
  398. switchGroupRef?.showModal();
  399. };
  400. let problemRef = $ref<InstanceType<typeof MarkProblemDialog>>();
  401. const openProblemModal = () => {
  402. // @ts-ignore https://github.com/vuejs/vue-next/issues/4397
  403. // eslint-disable-next-line @typescript-eslint/no-unsafe-call
  404. problemRef?.showModal();
  405. };
  406. watchEffect(() => {
  407. if (
  408. isNumber(store.setting.topCount) &&
  409. store.setting.topCount > 0 &&
  410. store.setting.topCount === store.status.personCount
  411. ) {
  412. Modal.confirm({
  413. centered: true,
  414. mask: true,
  415. zIndex: 6000,
  416. maskStyle: { opacity: 0.97 },
  417. content: `分配任务份已完成,是否继续?`,
  418. okText: "继续",
  419. cancelText: "退出",
  420. onCancel: logout,
  421. });
  422. }
  423. });
  424. let todoCount = $computed(() =>
  425. typeof store.status.totalCount === "number"
  426. ? store.status.totalCount - store.status.markedCount
  427. : "-"
  428. );
  429. </script>
  430. <style scoped>
  431. .header-bg-color {
  432. background-color: var(--header-bg-color);
  433. }
  434. .header-container {
  435. position: relative;
  436. height: 56px;
  437. line-height: 16px;
  438. background-color: var(--header-bg-color);
  439. color: rgba(255, 255, 255, 0.5);
  440. }
  441. .menu {
  442. width: 56px;
  443. height: 56px;
  444. padding: 20px;
  445. }
  446. .menu:hover,
  447. .menu-toggled {
  448. background-color: rgba(255, 255, 255, 0.2);
  449. }
  450. .header-container span {
  451. vertical-align: middle;
  452. }
  453. .header-big-text {
  454. font-size: 20px;
  455. line-height: 30px;
  456. }
  457. .header-small-text {
  458. font-size: var(--app-secondary-font-size);
  459. }
  460. .highlight-text {
  461. color: white;
  462. font-size: var(--app-title-font-size);
  463. }
  464. .header-bg-color.ant-btn:hover {
  465. background-color: var(--app-ant-select-bg-override-color) !important;
  466. }
  467. .assistant-table {
  468. z-index: 5500;
  469. border-collapse: separate;
  470. border-spacing: 0 1em;
  471. color: var(--app-bold-text-color);
  472. width: 240px;
  473. }
  474. .assistant-table tr td:nth-child(2) {
  475. text-align: right;
  476. }
  477. .svg-red {
  478. filter: invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg)
  479. brightness(104%) contrast(97%);
  480. }
  481. .svg-red-hover:hover {
  482. filter: invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg)
  483. brightness(104%) contrast(97%);
  484. }
  485. .triangle {
  486. background-color: white;
  487. width: 10px;
  488. height: 10px;
  489. clip-path: polygon(0 100%, 100% 100%, 50% 0);
  490. position: absolute;
  491. bottom: -2px;
  492. }
  493. .dropdown-triangle {
  494. background-color: #8c8d9b;
  495. width: 7px;
  496. height: 5px;
  497. clip-path: polygon(0 0, 100% 0, 50% 100%);
  498. margin-left: 4px;
  499. }
  500. .count-animation-enter-active,
  501. .count-animation-leave-active {
  502. transition: all 1.2s ease-in-out;
  503. }
  504. .count-animation-enter-from,
  505. .count-animation-leave-to {
  506. opacity: 0;
  507. transform: translateY(18px);
  508. }
  509. </style>