|
@@ -1,31 +1,38 @@
|
|
|
import { store } from "@/store/store";
|
|
|
import { httpApp } from "@/plugins/axiosApp";
|
|
|
-import { Setting, UISetting, HistoryQueryParams } from "@/types";
|
|
|
+import {
|
|
|
+ Setting,
|
|
|
+ UISetting,
|
|
|
+ HistoryQueryParams,
|
|
|
+ MarkStore,
|
|
|
+ Group,
|
|
|
+ Task,
|
|
|
+ CommonResponse,
|
|
|
+} from "@/types";
|
|
|
|
|
|
/** 清除评卷任务(之前锁住的任务之类的) */
|
|
|
export async function clearMarkTask() {
|
|
|
- return httpApp.post("/mark/clear");
|
|
|
+ return httpApp.post<void>("/mark/clear");
|
|
|
}
|
|
|
|
|
|
/** 获取评卷设置 */
|
|
|
export async function getSetting() {
|
|
|
- return httpApp.post("/mark/getSetting");
|
|
|
+ return httpApp.post<Setting>("/mark/getSetting");
|
|
|
}
|
|
|
|
|
|
/** 获取评卷状态 */
|
|
|
export async function getStatus() {
|
|
|
- return httpApp.post("/mark/getStatus");
|
|
|
+ return httpApp.post<MarkStore["status"]>("/mark/getStatus");
|
|
|
}
|
|
|
|
|
|
/** 获取评卷分组 */
|
|
|
export async function getGroup() {
|
|
|
- return httpApp.post("/mark/getGroup");
|
|
|
+ return httpApp.post<Group[]>("/mark/getGroup");
|
|
|
}
|
|
|
|
|
|
/** 获取评卷任务 */
|
|
|
export async function getTask() {
|
|
|
- const res = await httpApp.post("/mark/getTask");
|
|
|
- return res;
|
|
|
+ return httpApp.post<Task>("/mark/getTask");
|
|
|
}
|
|
|
|
|
|
/** 更新评卷UI */
|
|
@@ -36,7 +43,7 @@ export async function updateUISetting(
|
|
|
const form = new FormData();
|
|
|
uiSetting && form.append("uiSetting", JSON.stringify(uiSetting));
|
|
|
mode && form.append("mode", mode);
|
|
|
- return httpApp.post("/mark/updateSetting", form);
|
|
|
+ return httpApp.post<void>("/mark/updateSetting", form);
|
|
|
}
|
|
|
|
|
|
/** 获取评卷历史任务 */
|
|
@@ -53,7 +60,7 @@ export async function getHistoryTask({
|
|
|
form.append("order", order);
|
|
|
form.append("sort", sort);
|
|
|
secretNumber && form.append("secretNumber", secretNumber);
|
|
|
- return httpApp.post("/mark/getHistory", form);
|
|
|
+ return httpApp.post<Task[]>("/mark/getHistory", form);
|
|
|
}
|
|
|
|
|
|
/** 保存评卷任务(正常保存) */
|
|
@@ -66,12 +73,9 @@ export async function saveTask() {
|
|
|
markResult.spent = Date.now() - store.currentTask.__markStartTime;
|
|
|
markResult = { ...markResult };
|
|
|
|
|
|
- return httpApp.post("/mark/saveTask", markResult, { setGlobalMask: true });
|
|
|
-}
|
|
|
-
|
|
|
-/** 获取分组列表 */
|
|
|
-export async function getGroups() {
|
|
|
- return httpApp.post("/mark/getGroup");
|
|
|
+ return httpApp.post<CommonResponse>("/mark/saveTask", markResult, {
|
|
|
+ setGlobalMask: true,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/** 获取用户信息 */
|
|
@@ -79,7 +83,7 @@ export async function changeUserInfo(name: string, password?: string) {
|
|
|
const form = new FormData();
|
|
|
form.append("name", name);
|
|
|
password && form.append("password", password);
|
|
|
- return httpApp.post("/mark/changeName", form);
|
|
|
+ return httpApp.post<void>("/mark/changeName", form);
|
|
|
}
|
|
|
|
|
|
/** 评卷用户退出 */
|
|
@@ -91,7 +95,7 @@ export function doLogout() {
|
|
|
export async function doSwitchGroup(markerId: number) {
|
|
|
const form = new FormData();
|
|
|
form.append("markerId", "" + markerId);
|
|
|
- return httpApp.post("/mark/subjectSelect", form);
|
|
|
+ return httpApp.post<CommonResponse>("/mark/subjectSelect", form);
|
|
|
}
|
|
|
|
|
|
/** 评卷用户选择试卷的问题类型 */
|
|
@@ -110,7 +114,7 @@ export async function doProblemType(problemId: number) {
|
|
|
markResult.spent = Date.now() - store.currentTask.__markStartTime;
|
|
|
markResult = { ...markResult };
|
|
|
|
|
|
- return httpApp.post("/mark/saveTask", markResult);
|
|
|
+ return httpApp.post<CommonResponse>("/mark/saveTask", markResult);
|
|
|
}
|
|
|
|
|
|
/** 评卷用户选择试卷的为未选做 */
|
|
@@ -128,5 +132,5 @@ export async function doUnselectiveType() {
|
|
|
markResult.spent = Date.now() - store.currentTask.__markStartTime;
|
|
|
markResult = { ...markResult };
|
|
|
|
|
|
- return httpApp.post("/mark/saveTask", markResult);
|
|
|
+ return httpApp.post<CommonResponse>("/mark/saveTask", markResult);
|
|
|
}
|