Browse Source

feat: 评卷页面增加最小评卷时长校验&刷新功能

chenhao 2 năm trước cách đây
mục cha
commit
1b36077e64
2 tập tin đã thay đổi với 27 bổ sung8 xóa
  1. 17 8
      src/modules/marking/mark/index.vue
  2. 10 0
      types/api.d.ts

+ 17 - 8
src/modules/marking/mark/index.vue

@@ -133,7 +133,7 @@ let currentTaskPool: ExtractApiResponse<'getMarkingTask'> = []
 const currentTask = ref<TaskInfoType>()
 
 const { fetch: getMarkingTask, loading, result: taskPool } = useFetch('getMarkingTask')
-const { fetch: submitMarkTask, loading: submitting, result: submitMarkStatus } = useFetch('submitMarkTask')
+const { fetch: submitMarkTask, loading: submitting } = useFetch('submitMarkTask')
 const { fetch: getMarkStatus, result: markStatus } = useFetch('getMarkStatus')
 
 const historyTaskChange = (task: HistoryTaskType) => {
@@ -187,12 +187,21 @@ const modelScore = ref<number[]>([])
 const onSubmit: InstanceType<typeof ScoringPanelWithConfirm>['onSubmit'] = async ({ question, scores, totalScore }) => {
   try {
     if (!currentTask.value?.taskId) {
+      scoringPanelVisible.value = true
       return
     }
+
+    const spentTime = getSpentTime()
+
+    const current = currentTask.value as FormalTaskType
+    if (current.minMarkTime && current.minMarkTime * 1000 > spentTime) {
+      scoringPanelVisible.value = true
+      return ElMessage.warning('阅卷速度过快')
+    }
     await submitMarkTask({
+      spentTime,
       markScore: totalScore,
       markScores: scores,
-      spentTime: getSpentTime(),
       problem: false,
       taskId: currentTask.value.taskId,
     })
@@ -266,7 +275,11 @@ const onBack = () => {
 
 /** 刷新 */
 const onRefresh = () => {
-  console.log('onRefresh')
+  getMarkStatus()
+
+  useFetch('clearCachedTasks')
+    .fetch()
+    .then(() => getNextTask(true))
 }
 
 /** 回评 */
@@ -322,11 +335,7 @@ watch(currentTask, () => {
   resume()
 })
 
-getMarkStatus()
-
-useFetch('clearCachedTasks')
-  .fetch()
-  .then(() => getNextTask(true))
+onRefresh()
 </script>
 
 <style scoped lang="scss">

+ 10 - 0
types/api.d.ts

@@ -474,13 +474,23 @@ declare module 'api-type' {
       totalScore: number
     }
     interface Task {
+      /** 大题号 */
       mainNumber: number
+      /** 大题名称 */
       mainTitle: string
+      /** 小题列表 */
       questionList: Question[]
+      /** 密号 */
       secretNumber: string
+      /** 科目代码 */
       subjectCode: string
+      /** 任务ID */
       taskId: number
+      /** 任务类型 */
       taskType: TaskType
+      /** 最小阅卷时长 */
+      minMarkTime: number
+      /** 试卷 path */
       url: string
     }