Ver código fonte

优化获取任务提示

Michael Wang 3 anos atrás
pai
commit
0b9b65604e

+ 6 - 4
src/features/arbitrate/Arbitrate.vue

@@ -108,15 +108,18 @@ async function updateStatus() {
   if (res.data.valid) store.status = res.data;
 }
 async function updateTask() {
-  // const mkey = "fetch_task_key";
-  message.info({ content: "获取任务中...", duration: 1.5 });
+  const mkey = "fetch_task_key";
+  message.info({ content: "获取任务中...", duration: 1.5, key: mkey });
   let res;
   if (isSingleStudent) {
     res = await getSingleStuTask();
   } else {
     res = await getOneOfStuTask();
   }
-  // message.success({ content: "获取成功", key: mkey });
+  message.success({
+    content: res.data.libraryId ? "获取成功" : "无任务",
+    key: mkey,
+  });
 
   if (res.data.libraryId) {
     let rawTask = res.data as Task;
@@ -140,7 +143,6 @@ watch(
   async () => {
     if (!store.historyOpen) {
       await updateClearTask();
-      // await updateSetting();
       await fetchTask();
     }
   }

+ 6 - 3
src/features/library/inspect/LibraryInspect.vue

@@ -73,15 +73,18 @@ async function updateStatus() {
   if (res.data.valid) store.status = res.data;
 }
 async function updateTask() {
-  // const mkey = "fetch_task_key";
-  message.info({ content: "获取任务中...", duration: 1.5 });
+  const mkey = "fetch_task_key";
+  message.info({ content: "获取任务中...", duration: 1.5, key: mkey });
   let res;
   // if (isSingleStudent) {
   //   res = await getSingleStuTask();
   // } else {
   res = await getOneOfStuTask();
   // }
-  // message.success({ content: "获取成功", key: mkey });
+  message.success({
+    content: res.data.libraryId ? "获取成功" : "无任务",
+    key: mkey,
+  });
 
   if (res.data.libraryId) {
     let rawTask = res.data as Task;

+ 6 - 3
src/features/library/libraryTrack/LibraryTrack.vue

@@ -48,10 +48,13 @@ async function updateSetting() {
 }
 
 async function updateTask() {
-  // const mkey = "fetch_task_key";
-  message.info({ content: "获取任务中...", duration: 1.5 });
+  const mkey = "fetch_task_key";
+  message.info({ content: "获取任务中...", duration: 1.5, key: mkey });
   let res = await getSingleStuTask();
-  // message.success({ content: "获取成功", key: mkey });
+  message.success({
+    content: res.data.libraryId ? "获取成功" : "无任务",
+    key: mkey,
+  });
 
   if (res.data.task) {
     store.setting.fileServer = res.data.fileServer;

+ 8 - 6
src/features/student/importInspect/ImportInspect.vue

@@ -60,14 +60,16 @@ async function updateSetting() {
 }
 // 要通过fetchTask调用
 async function updateTask() {
-  // const mkey = "fetch_task_key";
-  message.info({ content: "获取任务中...", duration: 1.5 });
-  let res;
-  if (currentStudentId) {
-    res = await getSingleInspectedTask("" + currentStudentId);
-  } else {
+  if (!currentStudentId) {
     return;
   }
+  const mkey = "fetch_task_key";
+  message.info({ content: "获取任务中...", duration: 1.5, key: mkey });
+  let res = await getSingleInspectedTask("" + currentStudentId);
+  message.success({
+    content: res.data.libraryId ? "获取成功" : "无任务",
+    key: mkey,
+  });
 
   if (res.data.studentId) {
     let rawTask = res.data as Task;

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

@@ -100,15 +100,18 @@ async function updateStatus() {
   if (res.data.valid) store.status = res.data;
 }
 async function updateTask() {
-  // const mkey = "fetch_task_key";
-  message.info({ content: "获取任务中...", duration: 1.5 });
+  const mkey = "fetch_task_key";
+  message.info({ content: "获取任务中...", duration: 1.5, key: mkey });
   let res;
   if (isSingleStudent) {
     res = await getSingleStuTask();
   } else {
     res = await getOneOfStuTask();
   }
-  // message.success({ content: "获取成功", key: mkey });
+  message.success({
+    content: res.data.libraryId ? "获取成功" : "无任务",
+    key: mkey,
+  });
 
   if (res.data.studentId) {
     let rawTask = res.data as Task;

+ 6 - 3
src/features/student/studentTrack/StudentTrack.vue

@@ -61,10 +61,13 @@ async function updateSetting() {
 }
 
 async function updateTask() {
-  // const mkey = "fetch_task_key";
-  message.info({ content: "获取任务中...", duration: 1.5 });
+  const mkey = "fetch_task_key";
+  message.info({ content: "获取任务中...", duration: 1.5, key: mkey });
   let res = await getSingleStuTask();
-  // message.success({ content: "获取成功", key: mkey });
+  message.success({
+    content: res.data.libraryId ? "获取成功" : "无任务",
+    key: mkey,
+  });
 
   // if (res.data.sliceUrls) {
   //   store.setting.fileServer = res.data.fileServer;