Răsfoiți Sursa

computed => $computed

Michael Wang 3 ani în urmă
părinte
comite
f6752390be

+ 4 - 5
src/features/library/inspect/LibraryInspect.vue

@@ -136,14 +136,14 @@ async function getOneOfStuTask() {
   return getOneOfInspectedTask(subjectCode, groupNumber);
 }
 
-const realLibraryId = computed(
+const realLibraryId = $computed(
   () => (isSingleStudent ? libraryId : store.currentTask?.libraryId) 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(realLibraryId.value)) as any;
+  const res = (await saveInspectedTask(realLibraryId)) as any;
   if (res.data.success && store.currentTask) {
     message.success({ content: "复核成功", key: mkey, duration: 2 });
     if (!store.historyOpen) {
@@ -164,11 +164,10 @@ const rejectQuestions = async (questions: Array<Question>) => {
   if (!store.currentTask) return;
   const mkey = "reject_task_key";
   message.loading({ content: "打回评卷任务...", key: mkey });
-  const res = (await rejectInspectedTask(
-    //realLibraryId.value,
+  const res = await rejectInspectedTask(
     store.currentTask.libraryId + "",
     questions
-  )) as any;
+  );
   if (res.data.success) {
     store.currentTask = undefined;
     message.success({ content: "打回成功", key: mkey, duration: 2 });

+ 5 - 5
src/features/library/inspect/MarkBoardInspect.vue

@@ -129,7 +129,7 @@ const groups = computed(() => {
   return [...new Set(gs)].sort((a, b) => a - b);
 });
 
-const questions = computed(() => {
+const questions = $computed(() => {
   const qs = store.currentTask?.questionList;
   return qs;
 });
@@ -146,7 +146,7 @@ function removeCheckedQuestion(question: Question) {
 function groupChecked(groupNumber: number) {
   return (
     checkedQuestions.filter((q) => q.groupNumber === groupNumber).length ===
-    questions.value?.filter((q) => q.groupNumber === groupNumber).length
+    questions?.filter((q) => q.groupNumber === groupNumber).length
   );
 }
 
@@ -172,7 +172,7 @@ function groupClicked(groupNumber: number) {
         checkedQuestions.splice(idx, 1);
       });
   } else {
-    questions.value
+    questions
       ?.filter((q) => q.groupNumber === groupNumber)
       .forEach((q) => {
         if (!questionChecked(q)) checkedQuestions.push(q);
@@ -188,7 +188,7 @@ function addFocusTrack(
   store.focusTracks.splice(0);
 
   if (groupNumber) {
-    questions.value
+    questions
       ?.filter((q) => q.groupNumber === groupNumber)
       ?.map((q) => q.trackList)
       .reduce((acc, ts) => acc.concat(ts))
@@ -196,7 +196,7 @@ function addFocusTrack(
         store.focusTracks.push(t);
       });
   } else {
-    questions.value
+    questions
       ?.map((q) => q.trackList)
       .reduce((acc, ts) => acc.concat(ts))
       .filter((t) => {

+ 2 - 2
src/features/mark/MinimapModal.vue

@@ -34,8 +34,8 @@ onBeforeUpdate(() => {
     document.querySelector(".mark-body-container div:first-of-type")
       ?.innerHTML ?? "请关闭或重新打开";
   // 没取到图片,提示
-  // if (imagesHtml.value.length <= 500) {
-  //   imagesHtml.value = "请关闭或重新打开";
+  // if (imagesHtml.length <= 500) {
+  //   imagesHtml = "请关闭或重新打开";
   // }
 
   // console.log(imagesHtml);

+ 5 - 5
src/features/student/importInspect/MarkBoardInspect.vue

@@ -111,7 +111,7 @@ const groups = computed(() => {
   return [...new Set(gs)].sort((a, b) => a - b);
 });
 
-const questions = computed(() => {
+const questions = $computed(() => {
   const qs = store.currentTask?.questionList;
   return qs;
 });
@@ -128,7 +128,7 @@ function removeCheckedQuestion(question: Question) {
 function groupChecked(groupNumber: number) {
   return (
     checkedQuestions.filter((q) => q.groupNumber === groupNumber).length ===
-    questions.value?.filter((q) => q.groupNumber === groupNumber).length
+    questions?.filter((q) => q.groupNumber === groupNumber).length
   );
 }
 
@@ -154,7 +154,7 @@ function groupClicked(groupNumber: number) {
         checkedQuestions.splice(idx, 1);
       });
   } else {
-    questions.value
+    questions
       ?.filter((q) => q.groupNumber === groupNumber)
       .forEach((q) => {
         if (!questionChecked(q)) checkedQuestions.push(q);
@@ -170,7 +170,7 @@ function addFocusTrack(
   store.focusTracks.splice(0);
 
   if (groupNumber) {
-    questions.value
+    questions
       ?.filter((q) => q.groupNumber === groupNumber)
       ?.map((q) => q.trackList)
       .reduce((acc, ts) => acc.concat(ts))
@@ -178,7 +178,7 @@ function addFocusTrack(
         store.focusTracks.push(t);
       });
   } else {
-    questions.value
+    questions
       ?.map((q) => q.trackList)
       .reduce((acc, ts) => acc.concat(ts))
       .filter((t) => {

+ 3 - 6
src/features/student/inspect/Inspect.vue

@@ -171,14 +171,14 @@ async function getOneOfStuTask() {
   });
 }
 
-const realStudentId = computed(
+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;
+  const res = (await saveInspectedTask(realStudentId)) as any;
   if (res.data.success && store.currentTask) {
     message.success({ content: "复核成功", key: mkey, duration: 2 });
     if (!store.historyOpen) {
@@ -198,10 +198,7 @@ const saveTaskToServer = async () => {
 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;
+  const res = (await rejectInspectedTask(realStudentId, questions)) as any;
   if (res.data.success && store.currentTask) {
     store.currentTask = undefined;
     message.success({ content: "打回成功", key: mkey, duration: 2 });

+ 5 - 5
src/features/student/inspect/MarkBoardInspect.vue

@@ -129,7 +129,7 @@ const groups = computed(() => {
   return [...new Set(gs)].sort((a, b) => a - b);
 });
 
-const questions = computed(() => {
+const questions = $computed(() => {
   const qs = store.currentTask?.questionList;
   return qs;
 });
@@ -146,7 +146,7 @@ function removeCheckedQuestion(question: Question) {
 function groupChecked(groupNumber: number) {
   return (
     checkedQuestions.filter((q) => q.groupNumber === groupNumber).length ===
-    questions.value?.filter((q) => q.groupNumber === groupNumber).length
+    questions?.filter((q) => q.groupNumber === groupNumber).length
   );
 }
 
@@ -172,7 +172,7 @@ function groupClicked(groupNumber: number) {
         checkedQuestions.splice(idx, 1);
       });
   } else {
-    questions.value
+    questions
       ?.filter((q) => q.groupNumber === groupNumber)
       .forEach((q) => {
         if (!questionChecked(q)) checkedQuestions.push(q);
@@ -188,7 +188,7 @@ function addFocusTrack(
   store.focusTracks.splice(0);
 
   if (groupNumber) {
-    questions.value
+    questions
       ?.filter((q) => q.groupNumber === groupNumber)
       ?.map((q) => q.trackList)
       .reduce((acc, ts) => acc.concat(ts))
@@ -196,7 +196,7 @@ function addFocusTrack(
         store.focusTracks.push(t);
       });
   } else {
-    questions.value
+    questions
       ?.map((q) => q.trackList)
       .reduce((acc, ts) => acc.concat(ts))
       .filter((t) => {