|
@@ -26,32 +26,44 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { doProblemType } from "@/api/markPage";
|
|
|
+import { doProblemType, getStatus } from "@/api/markPage";
|
|
|
import { message } from "ant-design-vue";
|
|
|
import { ref, defineComponent } from "vue";
|
|
|
-import { store } from "./store";
|
|
|
+import { removeCurrentMarkResult, store } from "./store";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: "MarkProblemDialog",
|
|
|
- setup() {
|
|
|
+ emits: ["should-reload-history"],
|
|
|
+ setup(props, { emit }) {
|
|
|
const visible = ref(false);
|
|
|
|
|
|
const showModal = () => {
|
|
|
visible.value = true;
|
|
|
};
|
|
|
|
|
|
+ // TODO: 和Mark.vue重复
|
|
|
+ const removeBrokenTask = () => {
|
|
|
+ removeCurrentMarkResult();
|
|
|
+ store.currentTask = undefined;
|
|
|
+ store.tasks.shift();
|
|
|
+ };
|
|
|
+
|
|
|
+ async function updateStatus() {
|
|
|
+ const res = await getStatus();
|
|
|
+ store.status = res.data;
|
|
|
+ }
|
|
|
+
|
|
|
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 res = await doProblemType(problemId);
|
|
|
+ if (res.data.success) {
|
|
|
+ message.success({ content: "问题卷处理成功", duration: 3 });
|
|
|
+ visible.value = false;
|
|
|
+ removeBrokenTask();
|
|
|
+ updateStatus();
|
|
|
+ emit("should-reload-history");
|
|
|
+ } else {
|
|
|
+ message.error({ content: res.data.message || "错误", duration: 5 });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const handleCancel = () => {
|