|
@@ -151,7 +151,8 @@ addInterval(() => {
|
|
if (!preDrawing) {
|
|
if (!preDrawing) {
|
|
if (store.tasks.length < (store.setting.prefetchCount ?? 3)) {
|
|
if (store.tasks.length < (store.setting.prefetchCount ?? 3)) {
|
|
// 回看打开时,停止取任务
|
|
// 回看打开时,停止取任务
|
|
- if (!store.historyOpen) updateTask();
|
|
|
|
|
|
+ if (!store.historyOpen)
|
|
|
|
+ updateTask().catch((e) => console.log("定时获取任务出错", e));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, 5 * 1000);
|
|
}, 5 * 1000);
|
|
@@ -170,7 +171,9 @@ onMounted(async () => {
|
|
});
|
|
});
|
|
|
|
|
|
const __debounceUpdate = debounce(() => {
|
|
const __debounceUpdate = debounce(() => {
|
|
- updateUISetting(store.setting.mode, store.setting.uiSetting);
|
|
|
|
|
|
+ updateUISetting(store.setting.mode, store.setting.uiSetting).catch((e) =>
|
|
|
|
+ console.log("保存设置出错", e)
|
|
|
|
+ );
|
|
}, 3000);
|
|
}, 3000);
|
|
watch(
|
|
watch(
|
|
() => [store.setting.uiSetting, store.setting.mode],
|
|
() => [store.setting.uiSetting, store.setting.mode],
|
|
@@ -232,7 +235,7 @@ const unselectiveSubmit = async () => {
|
|
try {
|
|
try {
|
|
const res = await doUnselectiveType();
|
|
const res = await doUnselectiveType();
|
|
if (res?.data.success) {
|
|
if (res?.data.success) {
|
|
- message.success({ content: "未选做处理成功", duration: 3 });
|
|
|
|
|
|
+ void message.success({ content: "未选做处理成功", duration: 3 });
|
|
if (!store.historyOpen) {
|
|
if (!store.historyOpen) {
|
|
store.currentTask = undefined;
|
|
store.currentTask = undefined;
|
|
store.tasks.shift();
|
|
store.tasks.shift();
|
|
@@ -241,42 +244,51 @@ const unselectiveSubmit = async () => {
|
|
if (store.historyOpen) {
|
|
if (store.historyOpen) {
|
|
EventBus.emit("should-reload-history");
|
|
EventBus.emit("should-reload-history");
|
|
}
|
|
}
|
|
- updateStatus();
|
|
|
|
|
|
+ await updateStatus();
|
|
} else {
|
|
} else {
|
|
- message.error({ content: res?.data.message || "错误", duration: 5 });
|
|
|
|
|
|
+ void message.error({ content: res?.data.message || "错误", duration: 5 });
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log("未选做处理失败", error);
|
|
console.log("未选做处理失败", error);
|
|
- message.error({ content: "网络异常", duration: 5 });
|
|
|
|
|
|
+ void message.error({ content: "网络异常", duration: 5 });
|
|
await new Promise((res) => setTimeout(res, 1500));
|
|
await new Promise((res) => setTimeout(res, 1500));
|
|
window.location.reload();
|
|
window.location.reload();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
const saveTaskToServer = async () => {
|
|
const saveTaskToServer = async () => {
|
|
- const markResult = store.currentTask?.markResult;
|
|
|
|
|
|
+ if (!store.currentTask) return;
|
|
|
|
+ const markResult = store.currentTask.markResult;
|
|
if (!markResult) return;
|
|
if (!markResult) return;
|
|
|
|
|
|
const mkey = "save_task_key";
|
|
const mkey = "save_task_key";
|
|
|
|
|
|
- const errors = markResult.scoreList.reduce((p, c, index) => {
|
|
|
|
- const question = store.currentTask?.questionList[index]!;
|
|
|
|
|
|
+ type SubmitError = {
|
|
|
|
+ question: Question;
|
|
|
|
+ index: number;
|
|
|
|
+ error: string;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const errors = [] as Array<SubmitError>;
|
|
|
|
+ markResult.scoreList.forEach((score, index) => {
|
|
|
|
+ if (!store.currentTask) return;
|
|
|
|
+ const question = store.currentTask.questionList[index]!;
|
|
let error;
|
|
let error;
|
|
- if (!isNumber(c)) {
|
|
|
|
|
|
+ if (!isNumber(score)) {
|
|
error = `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`;
|
|
error = `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`;
|
|
- } else if (isNumber(question.maxScore) && c > question.maxScore) {
|
|
|
|
|
|
+ } else if (isNumber(question.maxScore) && score > question.maxScore) {
|
|
error = `${question.mainNumber}-${question.subNumber} 赋分大于最高分不能提交。`;
|
|
error = `${question.mainNumber}-${question.subNumber} 赋分大于最高分不能提交。`;
|
|
- } else if (isNumber(question.minScore) && c < question.minScore) {
|
|
|
|
|
|
+ } else if (isNumber(question.minScore) && score < question.minScore) {
|
|
error = `${question.mainNumber}-${question.subNumber} 赋分小于最低分不能提交。`;
|
|
error = `${question.mainNumber}-${question.subNumber} 赋分小于最低分不能提交。`;
|
|
}
|
|
}
|
|
if (error) {
|
|
if (error) {
|
|
- p.push({ question, index, error });
|
|
|
|
|
|
+ errors.push({ question, index, error });
|
|
}
|
|
}
|
|
- return p;
|
|
|
|
- }, [] as Array<{ question: Question; index: number; error: string }>);
|
|
|
|
|
|
+ });
|
|
if (errors.length !== 0) {
|
|
if (errors.length !== 0) {
|
|
console.log(errors);
|
|
console.log(errors);
|
|
const msg = errors.map((v) => h("div", `${v.error}`));
|
|
const msg = errors.map((v) => h("div", `${v.error}`));
|
|
- message.warning({
|
|
|
|
|
|
+ void message.warning({
|
|
content: h("span", ["校验失败", ...msg]),
|
|
content: h("span", ["校验失败", ...msg]),
|
|
duration: 10,
|
|
duration: 10,
|
|
key: mkey,
|
|
key: mkey,
|
|
@@ -300,7 +312,7 @@ const saveTaskToServer = async () => {
|
|
.map((q) => Math.round((q.score || 0) * 100))
|
|
.map((q) => Math.round((q.score || 0) * 100))
|
|
.reduce((acc, s) => acc + s, 0) / 100;
|
|
.reduce((acc, s) => acc + s, 0) / 100;
|
|
if (trackScores !== markResult.markerScore) {
|
|
if (trackScores !== markResult.markerScore) {
|
|
- message.error({
|
|
|
|
|
|
+ void message.error({
|
|
content: "轨迹分与总分不一致,请检查。",
|
|
content: "轨迹分与总分不一致,请检查。",
|
|
duration: 3,
|
|
duration: 3,
|
|
key: mkey,
|
|
key: mkey,
|
|
@@ -313,7 +325,7 @@ const saveTaskToServer = async () => {
|
|
markResult.trackList.length === 0 &&
|
|
markResult.trackList.length === 0 &&
|
|
markResult.specialTagList.length === 0
|
|
markResult.specialTagList.length === 0
|
|
) {
|
|
) {
|
|
- message.error({
|
|
|
|
|
|
+ void message.error({
|
|
content: "强制标记已开启,请至少使用一个标记。",
|
|
content: "强制标记已开启,请至少使用一个标记。",
|
|
duration: 5,
|
|
duration: 5,
|
|
key: mkey,
|
|
key: mkey,
|
|
@@ -322,11 +334,11 @@ const saveTaskToServer = async () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log("save task to server");
|
|
console.log("save task to server");
|
|
- message.loading({ content: "保存评卷任务...", key: mkey });
|
|
|
|
|
|
+ void message.loading({ content: "保存评卷任务...", key: mkey });
|
|
const res = (await saveTask()) as any;
|
|
const res = (await saveTask()) as any;
|
|
- updateStatus();
|
|
|
|
|
|
+ updateStatus().catch((e) => console.log("保存任务后获取status出错", e));
|
|
if (res.data.success && store.currentTask) {
|
|
if (res.data.success && store.currentTask) {
|
|
- message.success({ content: "保存成功", key: mkey, duration: 2 });
|
|
|
|
|
|
+ void message.success({ content: "保存成功", key: mkey, duration: 2 });
|
|
if (!store.historyOpen) {
|
|
if (!store.historyOpen) {
|
|
store.currentTask = undefined;
|
|
store.currentTask = undefined;
|
|
store.tasks.shift();
|
|
store.tasks.shift();
|
|
@@ -336,9 +348,9 @@ const saveTaskToServer = async () => {
|
|
}
|
|
}
|
|
} else if (res.data.message) {
|
|
} else if (res.data.message) {
|
|
console.log(res.data.message);
|
|
console.log(res.data.message);
|
|
- message.error({ content: res.data.message, key: mkey, duration: 10 });
|
|
|
|
|
|
+ void message.error({ content: res.data.message, key: mkey, duration: 10 });
|
|
} else if (!store.currentTask) {
|
|
} else if (!store.currentTask) {
|
|
- message.warn({ content: "暂无新任务", key: mkey, duration: 10 });
|
|
|
|
|
|
+ void message.warn({ content: "暂无新任务", key: mkey, duration: 10 });
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|