CzRger пре 1 недеља
родитељ
комит
6ebfee8e9b

+ 8 - 0
src/api/modules/study/index.ts

@@ -78,3 +78,11 @@ export const trainingCampPaperQuestionRelIpadHistoryRecords = (questionId) =>
     {},
     {},
   )
+
+// 错题题目列表
+export const trainingCampCampWrongQuestionApiListAll = (category, subject) =>
+  get(
+    `/trainingCamp/campWrongQuestion/api/listAll/${category}/${subject}`,
+    {},
+    {},
+  )

+ 3 - 3
src/views/study/subject/chart-3.vue

@@ -55,7 +55,7 @@ const initChart = () => {
     },
     xAxis: {
       type: 'category',
-      data: ['基础知识', '文言文', '现代文', '诗歌', '作文', '语言运用'],
+      data: props.data.map((v) => v.typeName),
     },
     yAxis: {
       type: 'value',
@@ -66,7 +66,7 @@ const initChart = () => {
         stack: 'total',
         name: '已完成',
         type: 'bar',
-        data: [28, 15, 22, 10, 8, 25],
+        data: props.data.map((v) => v.solvingCount || 0),
         itemStyle: {
           color: 'rgba(211, 73, 71, 1)',
         },
@@ -75,7 +75,7 @@ const initChart = () => {
         stack: 'total',
         name: '未完成',
         type: 'bar',
-        data: [5, 8, 3, 5, 7, 3],
+        data: props.data.map((v) => Math.abs(v.unSolvingCount) || 0),
         itemStyle: {
           color: 'rgba(2, 50, 112, 1)',
         },

+ 33 - 26
src/views/study/subject/index.vue

@@ -300,19 +300,21 @@
                             </div>
                           </div>
                         </div>
-                        <div class="mt-3">
+                        <div
+                          class="mt-3"
+                          v-if="son.wrongQuestionTypes?.length > 0"
+                        >
                           <div class="mb-1 text-xs text-gray-500">
                             错题类型:
                           </div>
                           <div class="flex flex-wrap gap-2">
-                            <span
-                              class="mistake-tag rounded-full bg-red-100 px-2 py-0.5 text-xs text-red-800"
-                              >xxx(xxx)</span
-                            >
-                            <span
-                              class="mistake-tag rounded-full bg-red-100 px-2 py-0.5 text-xs text-red-800"
-                              >xxx(xxx)</span
-                            >
+                            <template v-for="w in son.wrongQuestionTypes">
+                              <span
+                                class="mistake-tag rounded-full bg-red-100 px-2 py-0.5 text-xs text-red-800"
+                              >
+                                {{ w.typeName }}({{ w.count }}题)
+                              </span>
+                            </template>
                           </div>
                         </div>
                         <div class="mt-3 flex justify-end">
@@ -376,7 +378,7 @@
                 </div>
                 <div>
                   <div class="text-sm text-gray-500">本学科总做题数</div>
-                  <div class="text-lg font-bold">246题</div>
+                  <div class="text-lg font-bold">{{ state.error.total }}题</div>
                 </div>
               </div>
               <div class="flex flex-1 items-center rounded-lg bg-gray-50 p-3">
@@ -387,7 +389,9 @@
                 </div>
                 <div>
                   <div class="text-sm text-gray-500">错题数</div>
-                  <div class="text-lg font-bold">59题</div>
+                  <div class="text-lg font-bold">
+                    {{ state.error.errorCount }}题
+                  </div>
                 </div>
               </div>
               <div class="flex flex-1 items-center rounded-lg bg-gray-50 p-3">
@@ -398,25 +402,25 @@
                 </div>
                 <div>
                   <div class="text-sm text-gray-500">错误率</div>
-                  <div class="text-lg font-bold">23%</div>
+                  <div class="text-lg font-bold">
+                    {{ state.error.errorPercent }}
+                  </div>
                 </div>
               </div>
             </div>
-            <div class="mt-4 border-t border-gray-100 pt-4">
+            <div
+              class="mt-4 border-t border-gray-100 pt-4"
+              v-if="state.error.errorList.length > 0"
+            >
               <div class="mb-3 text-sm font-medium">错题最多的知识点</div>
               <div class="flex flex-wrap gap-2">
-                <span
-                  class="mistake-tag rounded-full bg-red-100 px-2 py-1 text-xs text-red-800"
-                  >文言文虚词 (12题)</span
-                >
-                <span
-                  class="mistake-tag rounded-full bg-red-100 px-2 py-1 text-xs text-red-800"
-                  >现代文阅读理解 (9题)</span
-                >
-                <span
-                  class="mistake-tag rounded-full bg-red-100 px-2 py-1 text-xs text-red-800"
-                  >诗歌鉴赏 (7题)</span
-                >
+                <template v-for="item in state.error.errorList">
+                  <span
+                    class="mistake-tag rounded-full bg-red-100 px-2 py-1 text-xs text-red-800"
+                  >
+                    {{ item.typeName }}({{ item.count }}题)
+                  </span>
+                </template>
               </div>
             </div>
           </div>
@@ -619,7 +623,10 @@ const initError = () => {
     route.meta.subjectId,
   )
     .then(({ data }: any) => {
-      // state.error.total =
+      state.error.total = data.totalQuestions
+      state.error.errorCount = data.wrongQuestions
+      state.error.errorPercent = data.errorRatePercent
+      state.error.errorList = data.wrongQuestionTypes || []
     })
     .finally(() => {
       state.error.loading = false

+ 14 - 15
src/views/study/subject/question/error.vue

@@ -8,7 +8,9 @@
           <div class="relative flex items-center text-xl font-bold">
             <i class="fas fa-book mr-2"></i>
             题目列表
-            <span class="text-base"> (共{{ state.question.total }}题) </span>
+            <span class="text-base">
+              (共{{ state.question.data.length }}题)
+            </span>
           </div>
         </div>
         <div
@@ -48,14 +50,10 @@
 <script setup lang="ts">
 import { computed, onBeforeMount, onMounted, reactive, ref } from 'vue'
 import StudyLayout from '@/views/study/components/study-layout.vue'
-import { Plus } from '@element-plus/icons-vue'
-import {
-  trainingCampPaperConfigGetPaperMarkInfoByPlanId,
-  trainingCampQuestionList,
-} from '@/api/modules/study'
 import { useAppStore } from '@/stores'
 import { useRoute } from 'vue-router'
 import listCom from './list.vue'
+import { trainingCampCampWrongQuestionApiListAll } from '@/api/modules/study'
 
 const AppStore = useAppStore()
 const route = useRoute()
@@ -73,15 +71,16 @@ const state: any = reactive({
 const initQuestion = () => {
   state.question.loading = true
   state.question.data = []
-  // trainingCampPaperConfigGetPaperMarkInfoByPlanId(route.query.planId, {
-  //   correct: state.question.type !== '错题',
-  // })
-  //   .then(({ data }: any) => {
-  //     state.question.data = data.questionList
-  //   })
-  //   .finally(() => {
-  //     state.question.loading = false
-  //   })
+  trainingCampCampWrongQuestionApiListAll(
+    AppStore.studentInfo?.grade,
+    route.meta.subjectId,
+  )
+    .then(({ data }: any) => {
+      state.question.data = data
+    })
+    .finally(() => {
+      state.question.loading = false
+    })
 }
 const dataCpt = computed(() => {
   return state.question.data.slice(

+ 0 - 2
src/views/study/subject/question/list.vue

@@ -25,9 +25,7 @@
               <img :src="pic.imageUrl" alt="题目图片" />
             </div>
           </template>
-
           <!-- 答案的图片 -->
-
           <template v-for="pic in item.answerImages">
             <div>
               <img :src="pic.imageUrl" alt="题目图片" />

+ 3 - 2
src/views/study/subject/question/plan.vue

@@ -8,7 +8,9 @@
           <div class="relative flex items-center text-xl font-bold">
             <i class="fas fa-book mr-2"></i>
             题目列表
-            <span class="text-base"> (共{{ state.question.total }}题) </span>
+            <span class="text-base">
+              (共{{ state.question.data.length }}题)
+            </span>
             <div class="absolute right-2 ml-auto flex">
               <q-select
                 class="select ml-4 w-[100px]"
@@ -76,7 +78,6 @@ const state: any = reactive({
     loading: false,
     type: '错题',
     data: [],
-    total: 0,
     page: 1,
     size: 10,
   },