ソースを参照

修复分数显bug

shmily1213 3 週間 前
コミット
05c30c7e47

+ 3 - 0
src/composables/useExam.ts

@@ -124,6 +124,9 @@ export const useExam = () => {
   }
   const isCorrect = (qs: Study.ExamineeQuestion): boolean => {
     const { answers, answer1, answer2, typeId } = qs;
+    if (!answer1) {
+      return false;
+    }
     if ([EnumQuestionType.SINGLE_CHOICE, EnumQuestionType.JUDGMENT].includes(typeId)) {
       return answer1.includes(answers[0]);
     } else if ([EnumQuestionType.MULTIPLE_CHOICE].includes(typeId)) {

+ 7 - 1
src/pagesStudy/components/exam-record-item.vue

@@ -11,7 +11,7 @@
     <view
       class="mt-20 border border-solid border-[#FEF6DA] bg-[#FFFBEB] rounded-5 py-20 px-16 flex items-center justify-between">
       <view class="text-24 text-[#F59E0B]">考试科目:{{ data.subjectName }}</view>
-      <view class="text-24 text-[#F59E0B]">卷面得分:{{ data.score || '-' }}</view>
+      <view class="text-24 text-[#F59E0B]">卷面得分:{{ getScore }}</view>
     </view>
   </view>
 </template>
@@ -27,6 +27,12 @@ const props = defineProps<{
 const isFinished = computed(() => {
   return props.data.state === EnumSimulatedRecordStatus.SUBMIT;
 });
+const getScore = computed(() => {
+  if (props.data.score === undefined || props.data.score === null) {
+    return '-';
+  }
+  return props.data.score;
+})
 const handleDetail = () => {
   if (isFinished.value) {
     transferTo('/pagesStudy/pages/simulation-analysis/simulation-analysis', {

+ 3 - 4
src/pagesStudy/pages/exam-start/components/question-item.vue

@@ -28,7 +28,7 @@
           <view class="question-option-content text-fore-light">不会</view>
         </view>
       </view>
-      <view class="answer-wrap mt-40 rounded-8 pt-60 pb-40 flex items-center text-center relative">
+      <view v-if="readonly" class="answer-wrap mt-40 rounded-8 pt-60 pb-40 flex items-center text-center relative">
         <ie-image v-if="question.isCorrect" src="/pagesStudy/static/image/icon-answer-correct.png"
           class="absolute top-0 left-1/2 -translate-x-1/2 w-222 h-64" />
         <ie-image v-else src="/pagesStudy/static/image/icon-answer-incorrect.png"
@@ -150,7 +150,6 @@ const handleNotKnow = () => {
   }
 }
 const handleSelect = (option: Study.QuestionOption) => {
-  console.log(props.question)
   if (props.readonly) {
     return;
   }
@@ -310,7 +309,7 @@ const isSelected = (option: Study.QuestionOption) => {
       }
 
       .question-option-content {
-        @apply text-30 text-primary;
+        @apply text-primary;
       }
     }
 
@@ -318,7 +317,7 @@ const isSelected = (option: Study.QuestionOption) => {
       @apply bg-[#b5eaff8e];
 
       .question-option-content {
-        @apply text-30 text-primary;
+        @apply text-primary;
       }
     }
 

+ 2 - 2
src/pagesStudy/pages/exam-start/components/question-stats-popup.vue

@@ -100,13 +100,13 @@ defineExpose({
 
   &.stats-dot-correct {
     &::before {
-      @apply bg-[#19a237];
+      @apply bg-[#2CC6A0];
     }
   }
 
   &.stats-dot-incorrect {
     &::before {
-      @apply bg-error;
+      @apply bg-[#FF5B5C];
     }
   }
 }

+ 12 - 9
src/pagesStudy/pages/exam-start/exam-start.vue

@@ -2,8 +2,9 @@
   <ie-page :fix-height="true" :safe-area-inset-bottom="false">
     <ie-navbar :title="pageTitle" custom-back @left-click="handleLeftClick">
       <template v-if="isReady" #headerRight>
-        <view v-if="!isReadOnly" class="" :class="{ 'text-red-500': practiceDuration > totalExamTime }">{{
-          formatPracticeDuration }}</view>
+        <view v-if="!isReadOnly" class="" :class="{ 'text-red-500': practiceDuration > totalExamTime }">
+          {{ formatPracticeDuration }}
+        </view>
         <view v-else class="text-28">用时:{{ formatPracticeDuration }}</view>
       </template>
     </ie-navbar>
@@ -79,7 +80,7 @@
                     <text class="z-1 font-bold text-32">{{ qs.index + 1 }}</text>
                     <ie-image v-if="qs.question.isMark" src="/pagesStudy/static/image/icon-mark-active.png"
                       custom-class="absolute -top-12 left-14 w-28 h-28 z-1" mode="aspectFill" />
-                    <question-progress v-if="!isReadOnly" :progress="qs.question.progress || 0" />
+                    <question-progress v-if="!isReadOnly && !qs.question.isNotKnow" :progress="qs.question.progress || 0" />
                   </view>
                 </view>
               </view>
@@ -169,7 +170,7 @@ const pageTitle = computed(() => {
   if (isReadOnly.value) {
     return '考试解析';
   }
-  return isExam.value ? '练习' : '考试';
+  return isExam.value ? '考试' : '练习';
 });
 const isExam = computed(() => {
   return prevData.value.paperType === EnumPaperType.SIMULATED;
@@ -181,7 +182,7 @@ const isReadOnly = computed(() => {
   return prevData.value.readonly;
 });
 const handleLeftClick = () => {
-  if (isReady.value) {
+  if (!isReady.value || isReadOnly.value) {
     transferBack();
     return;
   }
@@ -192,7 +193,7 @@ const handleSwiperChange = (e: any) => {
 };
 const beforeQuit = () => {
   const { paperType } = prevData.value;
-  if (!isReady.value) {
+  if (!isReady.value || isReadOnly.value) {
     return;
   }
   stopTime();
@@ -341,7 +342,6 @@ const handleSubmit = (tempSave: boolean = false) => {
   const msg = tempSave ? '保存中...' : '提交中...';
   uni.$ie.showLoading(msg);
   setTimeout(() => {
-    uni.$ie.hideLoading();
     const params = {
       ...paperData.value,
       questions: questionList.value.map(item => {
@@ -356,9 +356,11 @@ const handleSubmit = (tempSave: boolean = false) => {
       duration: practiceDuration.value
     } as Study.ExamPaperSubmit;
     commitExamineePaper(params);
-    setTimeout(() => {
+    setTimeout(async () => {
+      uni.$ie.hideLoading();
+      await nextTick();
       uni.navigateBack();
-    }, isExam.value ? 2500 : 0);
+    }, isExam.value && !tempSave ? 2500 : 0);
   }, 1000);
 }
 
@@ -460,6 +462,7 @@ const combinePaperData = async (examinee: Study.Examinee, paperType: EnumPaperTy
         startTime();
       }
     }
+    console.log(isReadOnly.value)
   }
 }
 const handleSwiperTipNext = () => {