CzRger 1 месяц назад
Родитель
Сommit
02dfc3ed57
2 измененных файлов с 29 добавлено и 8 удалено
  1. 5 0
      src/stores/modules/dictionary.ts
  2. 24 8
      src/views/study/subject/index.vue

+ 5 - 0
src/stores/modules/dictionary.ts

@@ -4,6 +4,11 @@ import { systemDictDataType } from '@/api/modules/global'
 export const useDictionaryStore = defineStore('dictionary', {
   state: () => ({
     ...dictionary,
+    difficultyLevelMap: new Map([
+      [1, 'A'],
+      [2, 'S'],
+      [3, 'T'],
+    ]),
   }),
   getters: {
     // shareConditionsMap() {

+ 24 - 8
src/views/study/subject/index.vue

@@ -159,9 +159,17 @@
                     </div>
                   </div>
                   <div class="mt-1 text-xs text-gray-500">
-                    {{ item.planDate }} | xxx题(<span class="text-red"
-                      >xxx</span
-                    >/<span class="text-green">xxx</span>) | 正确率xxx%
+                    {{ item.planDate }} | {{ item.questionCount }}题(<span
+                      class="text-red"
+                      >{{ item.wrongCount }}</span
+                    >/<span class="text-green">{{ item.correctCount }}</span
+                    >) | 正确率{{
+                      (
+                        (Number(item.correctCount) /
+                          Number(item.questionCount)) *
+                        100
+                      ).toFixed(1)
+                    }}%
                   </div>
                 </div>
               </template>
@@ -246,12 +254,18 @@
                         >
                           <div class="rounded bg-gray-50 p-2 text-center">
                             <div class="text-xs text-gray-500">试卷难度</div>
-                            <div class="font-medium text-gray-800">XXX</div>
+                            <div class="font-medium text-gray-800">
+                              {{
+                                DictionaryStore.difficultyLevelMap.get(
+                                  son.difficultyLevel,
+                                )
+                              }}
+                            </div>
                           </div>
                           <div class="rounded bg-gray-50 p-2 text-center">
                             <div class="text-xs text-gray-500">用时</div>
                             <div class="font-medium text-gray-800">
-                              {{ Math.floor(son.usedCardTime / 60) }}分钟
+                              {{ Math.floor(son.duration / 60) }}分钟
                             </div>
                           </div>
                           <div class="rounded bg-gray-50 p-2 text-center">
@@ -262,7 +276,9 @@
                           </div>
                           <div class="rounded bg-gray-50 p-2 text-center">
                             <div class="text-xs text-gray-500">错题</div>
-                            <div class="font-medium text-red-500">xxx题</div>
+                            <div class="font-medium text-red-500">
+                              {{ son.wrongCount }}题
+                            </div>
                           </div>
                         </div>
                         <div class="mt-3">
@@ -403,11 +419,12 @@ import chart3 from './chart-3.vue'
 import chart4 from './chart-4.vue'
 import { trainingCampLearningPlanList } from '@/api/modules/study'
 import { oneDayTime, YM, YMD } from '@/utils/czr-util'
-import { useAppStore } from '@/stores'
+import { useAppStore, useDictionaryStore } from '@/stores'
 import { useRoute } from 'vue-router'
 
 const route = useRoute()
 const AppStore = useAppStore()
+const DictionaryStore = useDictionaryStore()
 const state: any = reactive({
   makeQuestion: {
     loading: false,
@@ -496,7 +513,6 @@ const initTraining = () => {
         }
         return acc
       }, [])
-      console.log(state.training.groupData)
     })
     .finally(() => {
       state.training.loading = false