|
@@ -12,8 +12,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script lang="ts">
|
|
|
-import { computed, defineComponent, onMounted, ref } from "vue";
|
|
|
+<script setup lang="ts">
|
|
|
+import { computed, onMounted, ref } from "vue";
|
|
|
import {
|
|
|
clearInspectedTask,
|
|
|
getInspectedSetting,
|
|
@@ -29,194 +29,171 @@ import { useRoute } from "vue-router";
|
|
|
import MarkBody from "./MarkBody.vue";
|
|
|
import MarkHistory from "./MarkHistory.vue";
|
|
|
import MarkBoardInspect from "./MarkBoardInspect.vue";
|
|
|
-import { Question, Task } from "@/types";
|
|
|
+import type { Question, Task } from "@/types";
|
|
|
import { message } from "ant-design-vue";
|
|
|
|
|
|
-export default defineComponent({
|
|
|
- name: "Inspect",
|
|
|
- components: {
|
|
|
- MarkHeader,
|
|
|
- MarkBody,
|
|
|
- MarkHistory,
|
|
|
- MarkBoardInspect,
|
|
|
- },
|
|
|
- setup: () => {
|
|
|
- const route = useRoute();
|
|
|
- let isSingleStudent = !!route.query.studentId;
|
|
|
- const {
|
|
|
- studentId,
|
|
|
- subjectCode,
|
|
|
- startScore,
|
|
|
- endScore,
|
|
|
- mainNumber,
|
|
|
- mainStartScore,
|
|
|
- mainEndScore,
|
|
|
- questionScore,
|
|
|
- } = route.query as {
|
|
|
- studentId: string;
|
|
|
- subjectCode: string;
|
|
|
- startScore: string;
|
|
|
- endScore: string;
|
|
|
- mainNumber: string;
|
|
|
- mainStartScore: string;
|
|
|
- mainEndScore: string;
|
|
|
- questionScore: string;
|
|
|
- };
|
|
|
-
|
|
|
- async function updateClearTask() {
|
|
|
- await clearInspectedTask(studentId, subjectCode);
|
|
|
- }
|
|
|
+const route = useRoute();
|
|
|
+let isSingleStudent = !!route.query.studentId;
|
|
|
+const {
|
|
|
+ studentId,
|
|
|
+ subjectCode,
|
|
|
+ startScore,
|
|
|
+ endScore,
|
|
|
+ mainNumber,
|
|
|
+ mainStartScore,
|
|
|
+ mainEndScore,
|
|
|
+ questionScore,
|
|
|
+} = route.query as {
|
|
|
+ studentId: string;
|
|
|
+ subjectCode: string;
|
|
|
+ startScore: string;
|
|
|
+ endScore: string;
|
|
|
+ mainNumber: string;
|
|
|
+ mainStartScore: string;
|
|
|
+ mainEndScore: string;
|
|
|
+ questionScore: string;
|
|
|
+};
|
|
|
+
|
|
|
+async function updateClearTask() {
|
|
|
+ await clearInspectedTask(studentId, subjectCode);
|
|
|
+}
|
|
|
|
|
|
- async function updateSetting() {
|
|
|
- const settingRes = await getInspectedSetting();
|
|
|
- store.setting.fileServer = settingRes.data.fileServer;
|
|
|
- store.setting.userName = settingRes.data.userName;
|
|
|
- store.setting.uiSetting = {
|
|
|
- "answer.paper.scale": 1,
|
|
|
- "score.board.collapse": false,
|
|
|
- };
|
|
|
- store.setting.splitConfig = settingRes.data.splitConfig;
|
|
|
- }
|
|
|
- async function updateStatus() {
|
|
|
- const res = await getInspectedTaskStatus({
|
|
|
- subjectCode,
|
|
|
- mainNumber,
|
|
|
- startScore,
|
|
|
- endScore,
|
|
|
- mainStartScore,
|
|
|
- mainEndScore,
|
|
|
- questionScore,
|
|
|
- });
|
|
|
- if (res.data.valid) store.status = res.data;
|
|
|
- }
|
|
|
- async function updateTask() {
|
|
|
- // const mkey = "fetch_task_key";
|
|
|
- message.info({ content: "获取任务中...", duration: 2 });
|
|
|
- let res;
|
|
|
- if (isSingleStudent) {
|
|
|
- res = await getSingleStuTask();
|
|
|
- } else {
|
|
|
- res = await getOneOfStuTask();
|
|
|
- }
|
|
|
- // message.success({ content: "获取成功", key: mkey });
|
|
|
+async function updateSetting() {
|
|
|
+ const settingRes = await getInspectedSetting();
|
|
|
+ store.setting.fileServer = settingRes.data.fileServer;
|
|
|
+ store.setting.userName = settingRes.data.userName;
|
|
|
+ store.setting.uiSetting = {
|
|
|
+ "answer.paper.scale": 1,
|
|
|
+ "score.board.collapse": false,
|
|
|
+ };
|
|
|
+ store.setting.splitConfig = settingRes.data.splitConfig;
|
|
|
+}
|
|
|
+async function updateStatus() {
|
|
|
+ const res = await getInspectedTaskStatus({
|
|
|
+ subjectCode,
|
|
|
+ mainNumber,
|
|
|
+ startScore,
|
|
|
+ endScore,
|
|
|
+ mainStartScore,
|
|
|
+ mainEndScore,
|
|
|
+ questionScore,
|
|
|
+ });
|
|
|
+ if (res.data.valid) store.status = res.data;
|
|
|
+}
|
|
|
+async function updateTask() {
|
|
|
+ // const mkey = "fetch_task_key";
|
|
|
+ message.info({ content: "获取任务中...", duration: 2 });
|
|
|
+ let res;
|
|
|
+ if (isSingleStudent) {
|
|
|
+ res = await getSingleStuTask();
|
|
|
+ } else {
|
|
|
+ res = await getOneOfStuTask();
|
|
|
+ }
|
|
|
+ // message.success({ content: "获取成功", key: mkey });
|
|
|
+
|
|
|
+ if (res.data.studentId) {
|
|
|
+ let rawTask = res.data as Task;
|
|
|
+ rawTask.sliceUrls = rawTask.sliceUrls.map(
|
|
|
+ (s) => store.setting.fileServer + s
|
|
|
+ );
|
|
|
+ rawTask.sheetUrls = rawTask.sheetUrls?.map(
|
|
|
+ (s) => store.setting.fileServer + s
|
|
|
+ );
|
|
|
+ rawTask.jsonUrl = store.setting.fileServer + rawTask.jsonUrl;
|
|
|
+ store.currentTask = res.data;
|
|
|
+ if (store.currentTask) store.setting.subject = store.currentTask.subject;
|
|
|
+ } else {
|
|
|
+ store.message = res.data.message;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- if (res.data.studentId) {
|
|
|
- let rawTask = res.data as Task;
|
|
|
- rawTask.sliceUrls = rawTask.sliceUrls.map(
|
|
|
- (s) => store.setting.fileServer + s
|
|
|
- );
|
|
|
- rawTask.sheetUrls = rawTask.sheetUrls?.map(
|
|
|
- (s) => store.setting.fileServer + s
|
|
|
- );
|
|
|
- rawTask.jsonUrl = store.setting.fileServer + rawTask.jsonUrl;
|
|
|
- store.currentTask = res.data;
|
|
|
- if (store.currentTask)
|
|
|
- store.setting.subject = store.currentTask.subject;
|
|
|
- } else {
|
|
|
- store.message = res.data.message;
|
|
|
- }
|
|
|
- }
|
|
|
+const shouldReloadHistory = ref(0);
|
|
|
|
|
|
- const shouldReloadHistory = ref(0);
|
|
|
+async function reloadAndfetchTask() {
|
|
|
+ await updateClearTask();
|
|
|
+ await updateSetting();
|
|
|
+ await fetchTask();
|
|
|
+}
|
|
|
|
|
|
- async function reloadAndfetchTask() {
|
|
|
- await updateClearTask();
|
|
|
- await updateSetting();
|
|
|
- await fetchTask();
|
|
|
- }
|
|
|
+async function fetchTask() {
|
|
|
+ !isSingleStudent && (await updateStatus());
|
|
|
+ await updateTask();
|
|
|
+}
|
|
|
|
|
|
- async function fetchTask() {
|
|
|
- !isSingleStudent && (await updateStatus());
|
|
|
- await updateTask();
|
|
|
- }
|
|
|
+onMounted(async () => {
|
|
|
+ // await updateClearTask();
|
|
|
+ // await updateSetting();
|
|
|
+ // await fetchTask(); // mark-header 会调用 (watchEffect)
|
|
|
+});
|
|
|
|
|
|
- onMounted(async () => {
|
|
|
- // await updateClearTask();
|
|
|
- // await updateSetting();
|
|
|
- // await fetchTask(); // mark-header 会调用 (watchEffect)
|
|
|
- });
|
|
|
+async function getSingleStuTask() {
|
|
|
+ return getSingleInspectedTask(studentId);
|
|
|
+}
|
|
|
|
|
|
- async function getSingleStuTask() {
|
|
|
- return getSingleInspectedTask(studentId);
|
|
|
- }
|
|
|
+async function getOneOfStuTask() {
|
|
|
+ return getOneOfInspectedTask({
|
|
|
+ subjectCode,
|
|
|
+ mainNumber,
|
|
|
+ startScore,
|
|
|
+ endScore,
|
|
|
+ mainStartScore,
|
|
|
+ mainEndScore,
|
|
|
+ questionScore,
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- async function getOneOfStuTask() {
|
|
|
- return getOneOfInspectedTask({
|
|
|
- subjectCode,
|
|
|
- mainNumber,
|
|
|
- startScore,
|
|
|
- endScore,
|
|
|
- mainStartScore,
|
|
|
- mainEndScore,
|
|
|
- questionScore,
|
|
|
- });
|
|
|
+const realStudentId = computed(
|
|
|
+ () => (isSingleStudent ? studentId : store.currentTask?.studentId) as string
|
|
|
+);
|
|
|
+const saveTaskToServer = async () => {
|
|
|
+ console.log("save inspect task to server");
|
|
|
+ const mkey = "save_task_key";
|
|
|
+ message.loading({ content: "保存评卷任务...", key: mkey });
|
|
|
+ const res = (await saveInspectedTask(realStudentId.value)) as any;
|
|
|
+ if (res.data.success && store.currentTask) {
|
|
|
+ message.success({ content: "复核成功", key: mkey, duration: 2 });
|
|
|
+ if (!store.historyOpen) {
|
|
|
+ store.currentTask = undefined;
|
|
|
+ if (!isSingleStudent) fetchTask();
|
|
|
+ } else {
|
|
|
+ shouldReloadHistory.value = Date.now();
|
|
|
}
|
|
|
-
|
|
|
- const realStudentId = computed(
|
|
|
- () =>
|
|
|
- (isSingleStudent ? studentId : store.currentTask?.studentId) as string
|
|
|
- );
|
|
|
- const saveTaskToServer = async () => {
|
|
|
- console.log("save inspect task to server");
|
|
|
- const mkey = "save_task_key";
|
|
|
- message.loading({ content: "保存评卷任务...", key: mkey });
|
|
|
- const res = (await saveInspectedTask(realStudentId.value)) as any;
|
|
|
- if (res.data.success && store.currentTask) {
|
|
|
- message.success({ content: "复核成功", key: mkey, duration: 2 });
|
|
|
- if (!store.historyOpen) {
|
|
|
- store.currentTask = undefined;
|
|
|
- if (!isSingleStudent) fetchTask();
|
|
|
- } else {
|
|
|
- shouldReloadHistory.value = Date.now();
|
|
|
- }
|
|
|
- } else if (res.data.message) {
|
|
|
- console.log(res.data.message);
|
|
|
- message.error({ content: res.data.message, key: mkey, duration: 10 });
|
|
|
- } else if (!store.currentTask) {
|
|
|
- message.warn({ content: "暂无新任务", key: mkey, duration: 10 });
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const rejectQuestions = async (questions: Array<Question>) => {
|
|
|
- const mkey = "reject_task_key";
|
|
|
- message.loading({ content: "打回评卷任务...", key: mkey });
|
|
|
- const res = (await rejectInspectedTask(
|
|
|
- realStudentId.value,
|
|
|
- questions
|
|
|
- )) as any;
|
|
|
- if (res.data.success && store.currentTask) {
|
|
|
- store.currentTask = undefined;
|
|
|
- message.success({ content: "打回成功", key: mkey, duration: 2 });
|
|
|
- if (!store.historyOpen) {
|
|
|
- store.currentTask = undefined;
|
|
|
- if (!isSingleStudent) fetchTask();
|
|
|
- } else {
|
|
|
- shouldReloadHistory.value = Date.now();
|
|
|
- }
|
|
|
- } else if (res.data.message) {
|
|
|
- console.log(res.data.message);
|
|
|
- message.error({ content: res.data.message, key: mkey, duration: 10 });
|
|
|
- } else if (!store.currentTask) {
|
|
|
- message.warn({ content: "暂无新任务", key: mkey, duration: 10 });
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const renderError = () => {
|
|
|
+ } else if (res.data.message) {
|
|
|
+ console.log(res.data.message);
|
|
|
+ message.error({ content: res.data.message, key: mkey, duration: 10 });
|
|
|
+ } else if (!store.currentTask) {
|
|
|
+ message.warn({ content: "暂无新任务", key: mkey, duration: 10 });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const rejectQuestions = async (questions: Array<Question>) => {
|
|
|
+ const mkey = "reject_task_key";
|
|
|
+ message.loading({ content: "打回评卷任务...", key: mkey });
|
|
|
+ const res = (await rejectInspectedTask(
|
|
|
+ realStudentId.value,
|
|
|
+ questions
|
|
|
+ )) as any;
|
|
|
+ if (res.data.success && store.currentTask) {
|
|
|
+ store.currentTask = undefined;
|
|
|
+ message.success({ content: "打回成功", key: mkey, duration: 2 });
|
|
|
+ if (!store.historyOpen) {
|
|
|
store.currentTask = undefined;
|
|
|
- store.message = "加载失败,请重新加载。";
|
|
|
- };
|
|
|
-
|
|
|
- return {
|
|
|
- store,
|
|
|
- fetchTask,
|
|
|
- reloadAndfetchTask,
|
|
|
- saveTaskToServer,
|
|
|
- rejectQuestions,
|
|
|
- shouldReloadHistory,
|
|
|
- renderError,
|
|
|
- };
|
|
|
- },
|
|
|
-});
|
|
|
+ if (!isSingleStudent) fetchTask();
|
|
|
+ } else {
|
|
|
+ shouldReloadHistory.value = Date.now();
|
|
|
+ }
|
|
|
+ } else if (res.data.message) {
|
|
|
+ console.log(res.data.message);
|
|
|
+ message.error({ content: res.data.message, key: mkey, duration: 10 });
|
|
|
+ } else if (!store.currentTask) {
|
|
|
+ message.warn({ content: "暂无新任务", key: mkey, duration: 10 });
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const renderError = () => {
|
|
|
+ store.currentTask = undefined;
|
|
|
+ store.message = "加载失败,请重新加载。";
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -226,16 +203,4 @@ export default defineComponent({
|
|
|
a {
|
|
|
color: #42b983;
|
|
|
}
|
|
|
-
|
|
|
-label {
|
|
|
- margin: 0 0.5em;
|
|
|
- font-weight: bold;
|
|
|
-}
|
|
|
-
|
|
|
-code {
|
|
|
- background-color: #eee;
|
|
|
- padding: 2px 4px;
|
|
|
- border-radius: 4px;
|
|
|
- color: #304455;
|
|
|
-}
|
|
|
</style>
|