瀏覽代碼

小助手

Michael Wang 4 年之前
父節點
當前提交
9e1a2d7bea

+ 13 - 0
src/api/markPage.ts

@@ -144,3 +144,16 @@ export async function doSwitchGroup(markerId: number) {
   form.append("markerId", "" + markerId);
   return httpApp.post("/mark/subjectSelect", form);
 }
+
+/** 评卷用户选择试卷的问题类型 */
+export async function doProblemType(problemId: number) {
+  const markResult = findCurrentTaskMarkResult();
+  if (markResult) {
+    markResult.problem = true;
+    markResult.problemTypeId = problemId;
+
+    if (markResult.spent > 24 * 60 * 60 * 1000)
+      markResult.spent = Date.now() - markResult.spent;
+  }
+  return httpApp.post("/mark/saveTask", markResult);
+}

+ 56 - 4
src/features/mark/MarkHeader.vue

@@ -28,7 +28,7 @@
     </div>
     <ul class="tw-flex tw-gap-2 tw-mb-0">
       <li>
-        已评<span class="highlight-text">{{ store.status.markedCount }}</span>
+        已评<span class="highlight-text">{{ store.status.personCount }}</span>
       </li>
       <li v-if="store.setting.topCount">
         分配<span class="highlight-text">{{ store.setting.topCount }}</span>
@@ -110,16 +110,45 @@
     >
       <AlertOutlined class="icon-font icon-font-size-20" />
     </div>
+    <a-popover title="小助手" trigger="hover" class="tw-cursor-pointer">
+      <template #content>
+        <table class="assistant-table">
+          <tr>
+            <td>全卷</td>
+            <td><a-switch v-model:checked="allPaperChecked" /></td>
+          </tr>
+          <tr>
+            <td>缩略图</td>
+            <td><a-switch v-model:checked="miniMapChecked" /></td>
+          </tr>
+          <tr>
+            <td>特殊标记</td>
+            <td><a-switch v-model:checked="specialTagChecked" /></td>
+          </tr>
+          <tr>
+            <td>问题卷</td>
+            <td><a-button @click="openProblemModal">选择问题类型</a-button></td>
+          </tr>
+        </table>
+      </template>
+      <div class="tw-flex">
+        小助手
+        <DownOutlined
+          style="font-size: 12px; display: inline-block"
+          class="tw-self-center tw-ml-1"
+        />
+      </div>
+    </a-popover>
     <div
       @click="openSwitchGroupModal"
       class="tw-flex tw-place-content-center tw-cursor-pointer"
       style="max-width: 8%"
-      :title="group?.title"
+      :title="group?.title + '-' + group?.number"
     >
       <div
         class="tw-overflow-ellipsis tw-overflow-hidden tw-whitespace-nowrap tw-mr-1"
       >
-        {{ group?.title }}
+        {{ "分组:" + group?.number }}
       </div>
       <DownOutlined
         v-if="store.groups.length > 1"
@@ -145,10 +174,11 @@
   </div>
   <MarkChangeProfile ref="changeProfileRef" />
   <MarkSwitchGroupDialog ref="switchGroupRef" />
+  <MarkProblemDialog ref="problemRef" />
 </template>
 
 <script lang="ts">
-import { doLogout, getGroups, getHistoryTask } from "@/api/markPage";
+import { doLogout, getHistoryTask } from "@/api/markPage";
 import { computed, defineComponent, ref } from "vue";
 import { store } from "./store";
 import {
@@ -165,6 +195,7 @@ import {
 import { ModeEnum } from "@/types";
 import MarkChangeProfile from "./MarkChangeProfile.vue";
 import MarkSwitchGroupDialog from "./MarkSwitchGroupDialog.vue";
+import MarkProblemDialog from "./MarkProblemDialog.vue";
 
 export default defineComponent({
   name: "MarkHeader",
@@ -180,6 +211,7 @@ export default defineComponent({
     QuestionCircleOutlined,
     MarkChangeProfile,
     MarkSwitchGroupDialog,
+    MarkProblemDialog,
   },
   setup() {
     const modeName = computed(() =>
@@ -282,6 +314,17 @@ export default defineComponent({
       switchGroupRef.value?.showModal();
     };
 
+    const problemRef = ref(null);
+
+    const openProblemModal = () => {
+      // @ts-ignore
+      problemRef.value?.showModal();
+    };
+
+    const allPaperChecked = ref(false);
+    const miniMapChecked = ref(false);
+    const specialTagChecked = ref(false);
+
     return {
       store,
       modeName,
@@ -301,6 +344,11 @@ export default defineComponent({
       openProfileModal,
       switchGroupRef,
       openSwitchGroupModal,
+      allPaperChecked,
+      miniMapChecked,
+      specialTagChecked,
+      problemRef,
+      openProblemModal,
     };
   },
 });
@@ -338,4 +386,8 @@ export default defineComponent({
 .header-bg-color.ant-btn:hover {
   background-color: #5d6d7d !important;
 }
+.assistant-table {
+  border-collapse: separate;
+  border-spacing: 0 0.5em;
+}
 </style>

+ 7 - 2
src/features/mark/MarkHistory.vue

@@ -3,8 +3,13 @@
     :style="{ display: store.historyOpen ? 'block' : 'none' }"
     class="history-container tw-px-1"
   >
-    <div class="tw-p-1" style="text-align: end">
-      <a-button shape="circle" @click="store.historyOpen = false">
+    <div class="tw-p-1 tw-flex tw-justify-between tw-place-items-center">
+      <div class="tw-text-xl">回评</div>
+      <a-button
+        class="tw-content-end"
+        shape="circle"
+        @click="store.historyOpen = false"
+      >
         <template #icon><CloseOutlined /></template>
       </a-button>
     </div>

+ 83 - 0
src/features/mark/MarkProblemDialog.vue

@@ -0,0 +1,83 @@
+<template>
+  <a-modal
+    title="选择试卷的问题类型"
+    v-model:visible="visible"
+    @cancel="handleCancel"
+    width="240px"
+  >
+    <template #footer>
+      <a-button key="back" @click="handleCancel">取消</a-button>
+    </template>
+    <table class="group-table">
+      <tr>
+        <th>问题类型</th>
+        <th class="tw-text-right">操作</th>
+      </tr>
+      <tr v-for="(problem, index) in store.setting.problemTypes" :key="index">
+        <td>{{ problem.name }}</td>
+        <td class="tw-text-right">
+          <qm-button type="primary" @click="chooseProblemType(problem.id)"
+            >选择</qm-button
+          >
+        </td>
+      </tr>
+    </table>
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { doProblemType } from "@/api/markPage";
+import { message } from "ant-design-vue";
+import { ref, defineComponent } from "vue";
+import { store } from "./store";
+
+export default defineComponent({
+  name: "MarkProblemDialog",
+  setup() {
+    const visible = ref(false);
+
+    const showModal = () => {
+      visible.value = true;
+    };
+
+    const chooseProblemType = async (problemId: number) => {
+      const res = await doProblemType(problemId).then((res) => {
+        if (res.data.success) {
+          message.success({ content: "问题卷处理成功", duration: 3 });
+          visible.value = false;
+          store.currentTask = undefined;
+          store.tasks.shift();
+          // todo: fetch next
+        } else {
+          message.error({ content: res.data.message || "错误", duration: 5 });
+        }
+      });
+    };
+
+    const handleCancel = () => {
+      visible.value = false;
+    };
+
+    return {
+      store,
+      visible,
+      showModal,
+      chooseProblemType,
+      handleCancel,
+    };
+  },
+});
+</script>
+
+<style scoped>
+.group-table {
+  width: 100%;
+
+  border-collapse: separate;
+  border-spacing: 0 0.5em;
+}
+
+.current-group {
+  background-color: lightblue;
+}
+</style>

+ 7 - 13
src/features/mark/MarkSwitchGroupDialog.vue

@@ -1,10 +1,5 @@
 <template>
-  <a-modal
-    title="切换分组"
-    v-model:visible="visible"
-    @ok="handleOk"
-    @cancel="handleCancel"
-  >
+  <a-modal title="切换分组" v-model:visible="visible">
     <table class="group-table">
       <tr>
         <th>分组号</th>
@@ -27,6 +22,9 @@
         </td>
       </tr>
     </table>
+    <template #footer>
+      <a-button key="back" @click="handleCancel">取消</a-button>
+    </template>
   </a-modal>
 </template>
 <script lang="ts">
@@ -73,13 +71,8 @@ export default defineComponent({
       });
     };
 
-    const handleOk = () => {
-      visible.value = false;
-    };
     const handleCancel = () => {
-      // user.name = store.setting.userName;
-      // user.password = "";
-      // user.confirmPassword = "";
+      visible.value = false;
     };
 
     return {
@@ -89,7 +82,6 @@ export default defineComponent({
       progress,
       isCurrentGroup,
       chooseGroup,
-      handleOk,
       handleCancel,
     };
   },
@@ -99,6 +91,8 @@ export default defineComponent({
 <style scoped>
 .group-table {
   width: 100%;
+  border-collapse: separate;
+  border-spacing: 0 0.5em;
 }
 
 .current-group {