Răsfoiți Sursa

feat: 考试内容

huangziyang 2 săptămâni în urmă
părinte
comite
e32ef514a1
1 a modificat fișierele cu 8 adăugiri și 5 ștergeri
  1. 8 5
      pages/real/exam.vue

+ 8 - 5
pages/real/exam.vue

@@ -43,12 +43,13 @@ const getList = async (params) => {
     "api/question_bank/question_reception/topic/get_chapter_topic",
     {
       ...params,
-      id: getRoute().params.id,
+      // id: getRoute().params.id,
+      id: 66,
     }
   );
   total.value = res.data.total;
   data.value.push(
-    ...res.data.data.map((item) => {
+    ...res.data.data.map((item, ind) => {
       let questions = [];
       const ans = item.correct_answer.split(",");
       const ansList = [];
@@ -79,6 +80,7 @@ const getList = async (params) => {
         showResult: false, // 是否展示答案
         isRight: false, // 是否正确
         isImage: item.title.includes("<img"),
+        ind,
       };
     })
   );
@@ -100,7 +102,7 @@ const lookReport = (d, s) => {
     totalTime,
   };
   const r = data.value.filter((item) => item.isRight).length;
-  const n = data.value.filter((item) => !item.showResult).length;
+  const n = data.value.filter((item) => !item.selectAns.length).length;
   correct.value = {
     rate: (r / total.value) * 100,
     right: r,
@@ -125,6 +127,7 @@ onMounted(() => {
     :topics="data"
     @nextPage="nextPage"
     @lookReport="lookReport"
+    :empty="!data.length"
     border
     v-if="!showReport"
   />
@@ -155,7 +158,7 @@ onMounted(() => {
           class="item"
           :class="{
             right: it.isRight && it.showResult,
-            error: !it.isRight && it.showResult,
+            error: !it.isRight && it.showResult && it.selectAns.length,
           }"
           v-for="(it, index) in data"
           :key="it.id"
@@ -165,7 +168,7 @@ onMounted(() => {
     </view>
     <template #footer>
       <view class="footer">
-        <view class="button plain">答题解析</view>
+        <view class="button plain" @click="showReport = false">答题解析</view>
         <view class="button">炫耀一下</view>
       </view>
     </template>