|
@@ -88,7 +88,7 @@ const { push, replace } = useRouter()
|
|
|
|
|
|
const { getSpentTime, resume } = useTime()
|
|
|
|
|
|
-type TaskType = ExtractApiResponse<'getMarkingTask'>['taskType'] | 'default' | 'remarking'
|
|
|
+type TaskType = ExtractArrayValue<ExtractApiResponse<'getMarkingTask'>>['taskType'] | 'default' | 'remarking'
|
|
|
|
|
|
const markStatusIcon: Partial<Record<TaskType, string>> = {
|
|
|
FORMAL: MarkingStatus,
|
|
@@ -119,11 +119,15 @@ const {
|
|
|
onViewStandard,
|
|
|
} = useMarkHeader()
|
|
|
|
|
|
-type TaskInfoType = ExtractApiResponse<'getMarkingTask'> | ExtractArrayValue<ExtractApiResponse<'getMarkHistory'>>
|
|
|
+type TaskInfoType =
|
|
|
+ | ExtractArrayValue<ExtractApiResponse<'getMarkingTask'>>
|
|
|
+ | ExtractArrayValue<ExtractApiResponse<'getMarkHistory'>>
|
|
|
+
|
|
|
+let currentTaskPool: ExtractApiResponse<'getMarkingTask'> = []
|
|
|
|
|
|
const currentTask = ref<TaskInfoType>()
|
|
|
|
|
|
-const { fetch: getMarkingTask, loading } = useFetch('getMarkingTask')
|
|
|
+const { fetch: getMarkingTask, loading, result: taskPool } = useFetch('getMarkingTask')
|
|
|
const { fetch: submitMarkTask, loading: submitting, result: submitMarkStatus } = useFetch('submitMarkTask')
|
|
|
const { fetch: getMarkStatus, result: markStatus } = useFetch('getMarkStatus')
|
|
|
|
|
@@ -133,13 +137,26 @@ const historyTaskChange = (task: TaskInfoType) => {
|
|
|
}
|
|
|
|
|
|
const getNextTask = () => {
|
|
|
- getMarkingTask().then((task) => (currentTask.value = task))
|
|
|
+ currentTask.value = currentTaskPool.shift()
|
|
|
+ if (currentTaskPool.length < 2) {
|
|
|
+ getMarkingTask()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-getNextTask()
|
|
|
+watch(taskPool, () => {
|
|
|
+ if (taskPool.value) {
|
|
|
+ currentTaskPool = currentTaskPool.concat(taskPool.value)
|
|
|
+ if (currentTaskPool.length && !currentTask.value) {
|
|
|
+ getNextTask()
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+useFetch('clearCachedTasks').fetch().then(getNextTask)
|
|
|
|
|
|
watch(currentTask, () => {
|
|
|
resume()
|
|
|
+ console.log(currentTask.value)
|
|
|
scoringPanelVisible.value = true
|
|
|
})
|
|
|
|
|
@@ -176,6 +193,7 @@ const onSubmit: InstanceType<typeof ScoringPanelWithConfirm>['onSubmit'] = async
|
|
|
taskId: currentTask.value.taskId,
|
|
|
})
|
|
|
await getNextTask()
|
|
|
+ await getMarkStatus()
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
scoringPanelVisible.value = true
|