123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- import { store } from "@/store/app";
- import { httpApp } from "@/plugins/axiosApp";
- import {
- Setting,
- UISetting,
- HistoryQueryParams,
- MarkStore,
- Group,
- Task,
- CommonResponse,
- } from "@/types";
- import vls from "@/utils/storage";
- const getMarkInfo = () => {
- return vls.get("mark", {});
- };
- /** 清除评卷任务(之前锁住的任务之类的) */
- export async function clearMarkTask() {
- return httpApp.post<void>("/api/mark/clear", {}, { params: getMarkInfo() });
- }
- /** 获取评卷设置 */
- export async function getSetting() {
- return httpApp.post<Setting>(
- "/api/mark/getSetting",
- {},
- { params: getMarkInfo() }
- );
- }
- /** 获取评卷状态 */
- export async function getStatus(questionModel: Setting["questionModal"]) {
- return httpApp.post<MarkStore["status"]>(
- "/api/mark/getStatus",
- {},
- { params: { questionModel, ...getMarkInfo() } }
- );
- }
- /** 获取评卷分组 */
- export async function getGroup() {
- return httpApp.post<Group[]>(
- "/api/mark/getGroup",
- {},
- { params: getMarkInfo() }
- );
- }
- /** 获取评卷任务 */
- export async function getTask(questionModal: Setting["questionModal"]) {
- return httpApp.post<Task>(
- "/api/mark/getTask",
- {},
- { params: { questionModal, ...getMarkInfo() } }
- );
- }
- /** 更新评卷UI */
- export async function updateUISetting(
- mode?: Setting["mode"],
- uiSetting?: UISetting,
- questionModal?: Setting["questionModal"]
- ) {
- return httpApp.post<void>(
- "/api/mark/updateSetting",
- {},
- {
- params: {
- mode: mode || undefined,
- uiSetting: uiSetting ? JSON.stringify(uiSetting) : undefined,
- questionModal: questionModal || undefined,
- ...getMarkInfo(),
- },
- }
- );
- }
- /** 获取评卷历史任务 */
- export async function getHistoryTask({
- pageNumber = 1,
- pageSize = 20,
- order = "markerTime",
- sort = "DESC",
- secretNumber = null,
- markerScore = null,
- }: HistoryQueryParams) {
- return httpApp.post<Task[]>(
- "/api/mark/getHistory",
- {},
- {
- params: {
- pageNumber,
- pageSize,
- order,
- sort,
- secretNumber,
- markerScore,
- ...getMarkInfo(),
- },
- }
- );
- }
- /** 保存评卷任务(正常保存) */
- export async function saveTask() {
- if (!store.currentTask?.markResult) return;
- let markResult = store.currentTask.markResult;
- markResult.problem = false;
- markResult.problemType = undefined;
- markResult.problemRemark = undefined;
- markResult.unselective = false;
- markResult.spent = Date.now() - store.currentTask.__markStartTime;
- markResult = { ...markResult };
- return httpApp.post<CommonResponse>("/api/mark/saveTask", markResult, {
- setGlobalMask: true,
- params: getMarkInfo(),
- });
- }
- /** 获取用户信息 */
- export async function changeUserInfo(name: string, password?: string) {
- return httpApp.post<void>(
- "/api/mark/changeName",
- {},
- {
- params: {
- name,
- password: password || undefined,
- },
- }
- );
- }
- /** 评卷用户退出 */
- export function doLogout() {
- // window.history.go(-1);
- window.close();
- }
- /** 评卷用户选择分组 */
- // ps:已经没用了 3.3.0
- export async function doSwitchGroup(markerId: number) {
- return httpApp.post<CommonResponse>(
- "/api/mark/subjectSelect",
- {},
- {
- params: { markerId, ...getMarkInfo() },
- }
- );
- }
- /** 评卷用户选择试卷的问题类型 */
- export async function doProblemType({ problemType, problemRemark }) {
- if (!store.currentTask?.markResult) return;
- let markResult = store.currentTask?.markResult;
- markResult.problem = true;
- markResult.unselective = false;
- markResult.problemType = problemType;
- markResult.problemRemark = problemRemark || undefined;
- markResult.markerScore = null;
- markResult.scoreList = [];
- markResult.specialTagList = [];
- markResult.trackList = [];
- markResult.spent = Date.now() - store.currentTask.__markStartTime;
- markResult = { ...markResult };
- return httpApp.post<CommonResponse>("/api/mark/saveTask", markResult, {
- params: getMarkInfo(),
- });
- }
- /** 评卷用户选择试卷的为未选做 */
- export async function doUnselectiveType() {
- if (!store.currentTask?.markResult) return;
- let markResult = store.currentTask?.markResult;
- markResult.problem = false;
- markResult.unselective = true;
- markResult.markerScore = -1;
- markResult.scoreList = [];
- markResult.specialTagList = [];
- markResult.trackList = [];
- markResult.spent = Date.now() - store.currentTask.__markStartTime;
- markResult = { ...markResult };
- return httpApp.post<CommonResponse>("/api/mark/saveTask", markResult, {
- params: getMarkInfo(),
- });
- }
- /** 获取评卷任务 */
- export async function getMarkTask(id: string) {
- return httpApp.post<boolean>(
- "/api/admin/mark/task/get_mark_track",
- {},
- { params: { id } }
- );
- }
- /** 打回评卷任务 */
- export async function doRejectTask(params: {
- id: string;
- rejectReason: string;
- }) {
- return httpApp.post<boolean>("/api/admin/mark/task/reject", {}, { params });
- }
|