shmily1213 пре 1 месец
родитељ
комит
0c7ea29d37
3 измењених фајлова са 28 додато и 15 уклоњено
  1. 1 0
      package.json
  2. 8 0
      src/common/report.ts
  3. 19 15
      src/pagesStudy/pages/exam-start/exam-start.vue

+ 1 - 0
package.json

@@ -4,6 +4,7 @@
   "scripts": {
     "server": "uni -p",
     "dev": "uni -p h5-dev --host",
+    "pro": "uni -p h5-pro --host",
     "dev:h5": "uni -p h5-dev --host",
     "dev:mp": "uni -p mp-dev",
     "build": "uni build -p",

+ 8 - 0
src/common/report.ts

@@ -0,0 +1,8 @@
+export const events = {
+  examStartEnter: 'exam-start-enter',
+  examStartLoadSuccess: 'exam-start-load-success',
+  examStartLoadError: 'exam-start-load-error',
+  examStartSubmitSuccess: 'exam-start-submit-success',
+  examStartSubmitError: 'exam-start-submit-error',
+  examStartExit: 'exam-start-exit',
+} as const;

+ 19 - 15
src/pagesStudy/pages/exam-start/exam-start.vue

@@ -34,6 +34,7 @@ import {
 } from '@/types/injectionSymbols';
 import { useAppStore } from '@/store/appStore';
 import { useEnv } from '@/hooks/useEnv';
+import { events } from '@/common/report';
 
 const appStore = useAppStore();
 const { platform } = useEnv();
@@ -203,6 +204,7 @@ const handleSubmit = (tempSave: boolean = false) => {
     };
     console.log('提交试卷参数', params)
     await commitExamineePaper(params);
+    uni.report(events.examStartSubmitSuccess, getReportData(params));
     if (isSimulationExam.value || isTestExam.value) {
       if (!tempSave) {
         setTimeout(async () => {
@@ -407,9 +409,9 @@ const combinePaperData = async (examinee: Study.Examinee, paperType: EnumPaperTy
         startTime();
       }
     }
-    uni.report('exam-start-success', getReportData());
+    uni.report(events.examStartLoadSuccess, getReportData());
   } else {
-    uni.report('exam-start-error[no examinee.paperId]', getReportData());
+    uni.report(events.examStartLoadError, getReportData());
   }
 }
 const handleSwiperTipNext = () => {
@@ -425,28 +427,30 @@ const handleGuideClose = () => {
 const loadData = async () => {
   uni.$ie.showLoading();
   const { paperType } = prevData.value;
-  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();
-    // }
-    loadExamData();
+  try {
+    if (paperType === EnumPaperType.PRACTICE || paperType === EnumPaperType.COURSE) {
+      loadPracticeData();
+    } else if (paperType === EnumPaperType.SIMULATED || paperType === EnumPaperType.TEST) {
+      loadExamData();
+    }
+  } catch (error) {
+    uni.report(events.examStartLoadError, getReportData(error));
   }
 };
-const getReportData = () => {
+const getReportData = (extraData: any = {}) => {
   return {
     pageOptions: prevData.value,
-    userInfo: userStore.userInfo,
+    userInfo: {
+      userName: userStore.userInfo.userName,
+      phonenumber: userStore.userInfo.phonenumber,
+    },
     platform: platform.value,
-    envInfo: appStore.systemInfo,
+    extraData
   }
 }
 onLoad(() => {
   console.log(prevData.value)
-  uni.report('exam-start-enter', getReportData());
+  uni.report(events.examStartEnter, getReportData());
   loadData();
   uni.addInterceptor('navigateBack', {
     invoke: (e) => {