Bläddra i källkod

修改对口升学模拟考试接口流程

shmily1213 3 dagar sedan
förälder
incheckning
b85ed8e208

+ 2 - 2
index.html

@@ -16,10 +16,10 @@
   <!--preload-links-->
   <!--app-context-->
   
-  <script src="https://unpkg.com/vconsole@3.15.1/dist/vconsole.min.js"></script>
+  <!-- <script src="https://unpkg.com/vconsole@3.15.1/dist/vconsole.min.js"></script>
   <script>
     const vconsole = new VConsole();
-  </script>
+  </script> -->
 </head>
 
 <body>

+ 9 - 7
src/pagesStudy/components/paper-work-item.vue

@@ -92,14 +92,16 @@ const handleStart = () => {
     relateId: props.data.id,
     directed: props.data.directed
   }).then(res => {
+    const pageOptions: Transfer.ExamAnalysisPageOptions = {
+      paperType: EnumPaperType.TEST,
+      readonly: false,
+      simulationInfo: {
+        examineeId: res.data.examineeId,
+        name: batchName.value
+      },
+    }
     transferTo('/pagesStudy/pages/exam-start/exam-start', {
-      data: {
-        name: '组卷作业-' + batchName.value,
-        paperType: EnumPaperType.TEST,
-        simulationInfo: {
-          examineeId: res.data.examineeId
-        },
-      } as Transfer.ExamAnalysisPageOptions,
+      data: pageOptions,
     });
   }).catch(err => {
     console.error(err);

+ 30 - 9
src/pagesStudy/components/vhs-exam-item.vue

@@ -28,6 +28,7 @@ import { EnumPaperType, EnumSimulatedRecordStatus, EnumUserRole } from '@/common
 import { Study, Transfer } from '@/types';
 import { useTransferPage } from '@/hooks/useTransferPage';
 import { useAuth } from '@/hooks/useAuth';
+import { getOpenExaminee } from '@/api/modules/study';
 
 const { hasPermission } = useAuth();
 const { transferTo } = useTransferPage();
@@ -50,17 +51,37 @@ const handleStartExam = () => {
         }
       });
     } else {
-      const pageOptions: Transfer.ExamAnalysisPageOptions = {
+      console.log(props.data)
+      // return
+      // const pageOptions: Transfer.ExamAnalysisPageOptions = {
+      //   paperType: EnumPaperType.SIMULATED,
+      //   readonly: false,
+      //   simulationInfo: {
+      //     name: props.data.paperName,
+      //     // 难受
+      //     examineeId: props.data.id,
+      //   }
+      // }
+      // transferTo('/pagesStudy/pages/exam-start/exam-start', {
+      //   data: pageOptions,
+      // });
+      getOpenExaminee({
         paperType: EnumPaperType.SIMULATED,
-        readonly: false,
-        simulationInfo: {
-          name: props.data.paperName,
-          // 难受
-          examineeId: props.data.id,
+        relateId: props.data.id
+      }).then(res => {
+        const pageOptions: Transfer.ExamAnalysisPageOptions = {
+          paperType: EnumPaperType.SIMULATED,
+          readonly: false,
+          simulationInfo: {
+            examineeId: res.data.examineeId,
+            name: props.data.paperName,
+          },
         }
-      }
-      transferTo('/pagesStudy/pages/exam-start/exam-start', {
-        data: pageOptions,
+        transferTo('/pagesStudy/pages/exam-start/exam-start', {
+          data: pageOptions,
+        });
+      }).catch(err => {
+        console.error(err);
       });
     }
   }

+ 30 - 29
src/pagesStudy/pages/exam-start/exam-start.vue

@@ -336,30 +336,30 @@ const loadExamData = async () => {
   }
 }
 // 3、加载对口升学试卷数据
-const loadVHSPaperData = async () => {
-  const { paperType, readonly, simulationInfo } = prevData.value;
-  let data: Study.Examinee;
-  if (simulationInfo?.examineeId) {
-    if (readonly) {
-      const res = await getExamineeResult(simulationInfo.examineeId);
-      data = res.data;
-    } else {
-      const params = {
-        paperType: paperType,
-        relateId: simulationInfo?.examineeId,
-      } as Study.OpenExamineeRequestDTO;
-      const res = await getOpenExaminee(params);
-      data = res.data || {};
-    }
-    if (!data) {
-      uni.$ie.hideLoading();
-      transferBack();
-      return;
-    }
-    totalExamTime.value = data.paperInfo?.time || Number.MAX_SAFE_INTEGER;
-    combinePaperData(data, paperType);
-  }
-}
+// const loadVHSPaperData = async () => {
+//   const { paperType, readonly, simulationInfo } = prevData.value;
+//   let data: Study.Examinee;
+//   if (simulationInfo?.examineeId) {
+//     if (readonly) {
+//       const res = await getExamineeResult(simulationInfo.examineeId);
+//       data = res.data;
+//     } else {
+//       const params = {
+//         paperType: paperType,
+//         relateId: simulationInfo?.examineeId,
+//       } as Study.OpenExamineeRequestDTO;
+//       const res = await getOpenExaminee(params);
+//       data = res.data || {};
+//     }
+//     if (!data) {
+//       uni.$ie.hideLoading();
+//       transferBack();
+//       return;
+//     }
+//     totalExamTime.value = data.paperInfo?.time || Number.MAX_SAFE_INTEGER;
+//     combinePaperData(data, paperType);
+//   }
+// }
 const combinePaperData = async (examinee: Study.Examinee, paperType: EnumPaperType) => {
   examineeId.value = examinee.examineeId;
   if (examinee.paperId) {
@@ -419,11 +419,12 @@ const loadData = async () => {
   if (paperType === EnumPaperType.PRACTICE || paperType === EnumPaperType.COURSE) {
     loadPracticeData();
   } else if (paperType === EnumPaperType.SIMULATED || paperType === EnumPaperType.TEST) {
-    if (paperType === EnumPaperType.SIMULATED && userStore.isVHS) {
-      loadVHSPaperData();
-    } else {
-      loadExamData();
-    }
+    // if (paperType === EnumPaperType.SIMULATED && userStore.isVHS) {
+    //   loadVHSPaperData();
+    // } else {
+    //   loadExamData();
+    // }
+    loadExamData();
   }
 };
 onLoad(() => {

+ 1 - 1
src/pagesStudy/pages/index/compoentns/vhs-exam.vue

@@ -44,7 +44,7 @@ const loadData = async () => {
   });
   list.value = data;
 }
-onLoad(() => {
+onShow(() => {
   loadData();
 });
 </script>

+ 1 - 1
src/types/study.ts

@@ -312,7 +312,7 @@ export interface KnowledgeListRequestDTO {
 export interface OpenExamineeRequestDTO {
   paperType: string,
   relateId?: number,
-  directed: boolean,
+  directed?: boolean,
   subjectId?: number,
   testType?: string;
   questionType?: number;