Kaynağa Gözat

学习计划题目

taiji_caozhaorui 1 ay önce
ebeveyn
işleme
cddcbb741e

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

@@ -21,3 +21,13 @@ export const trainingCampQuestionTypeTree = (params) =>
 // 题库列表
 export const trainingCampQuestionList = (params) =>
   get(`/trainingCamp/question/list`, params, {})
+// 根据学习计划查询题目
+export const trainingCampPaperConfigGetPaperMarkInfoByPlanId = (
+  planId,
+  params,
+) =>
+  get(
+    `/trainingCamp/paperConfig/getPaperMarkInfoByPlanId/${planId}`,
+    params,
+    {},
+  )

+ 0 - 93
src/router/index.ts

@@ -31,99 +31,6 @@ const routes = [
       theme: 'main',
     },
   },
-  // {
-  //   name: 'chinese',
-  //   path: '/chinese',
-  //   component: () => import('@/views/study/chinese/index.vue'),
-  //   meta: {
-  //     isMenu: true,
-  //     title: '语文',
-  //     fa: 'fa-book',
-  //     theme: 'chinese',
-  //   },
-  // },
-  // {
-  //   name: 'chinese-question',
-  //   path: '/chinese-question',
-  //   component: () => import('@/views/study/chinese/question/index.vue'),
-  //   meta: {
-  //     root: 'chinese',
-  //     title: '语文题目',
-  //     theme: 'chinese',
-  //   },
-  // },
-  // {
-  //   name: 'chinese-question-only',
-  //   path: '/chinese-question-only',
-  //   component: () => import('@/views/study/chinese/question/only.vue'),
-  //   meta: {
-  //     root: 'chinese',
-  //     title: '语文题目',
-  //     theme: 'chinese',
-  //   },
-  // },
-  // {
-  //   name: 'math',
-  //   path: '/math',
-  //   component: () => import('@/views/study/math/index.vue'),
-  //   meta: {
-  //     isMenu: true,
-  //     title: '数学',
-  //     fa: 'fa-calculator',
-  //     theme: 'math',
-  //   },
-  // },
-  // {
-  //   name: 'math-question',
-  //   path: '/math-question',
-  //   component: () => import('@/views/study/math/question/index.vue'),
-  //   meta: {
-  //     root: 'math',
-  //     title: '语文题目',
-  //     theme: 'math',
-  //   },
-  // },
-  // {
-  //   name: 'math-question-only',
-  //   path: '/math-question-only',
-  //   component: () => import('@/views/study/math/question/only.vue'),
-  //   meta: {
-  //     root: 'math',
-  //     title: '语文题目',
-  //     theme: 'math',
-  //   },
-  // },
-  // {
-  //   name: 'english',
-  //   path: '/english',
-  //   component: () => import('@/views/study/english/index.vue'),
-  //   meta: {
-  //     isMenu: true,
-  //     title: '英语',
-  //     fa: 'fa-language',
-  //     theme: 'english',
-  //   },
-  // },
-  // {
-  //   name: 'english-question',
-  //   path: '/english-question',
-  //   component: () => import('@/views/study/english/question/index.vue'),
-  //   meta: {
-  //     root: 'english',
-  //     title: '语文题目',
-  //     theme: 'english',
-  //   },
-  // },
-  // {
-  //   name: 'english-question-only',
-  //   path: '/english-question-only',
-  //   component: () => import('@/views/study/english/question/only.vue'),
-  //   meta: {
-  //     root: 'english',
-  //     title: '语文题目',
-  //     theme: 'english',
-  //   },
-  // },
 ]
 
 const router = createRouter({

+ 3 - 3
src/stores/modules/app.ts

@@ -55,10 +55,10 @@ export const useAppStore = defineStore('app', {
                       },
                     }
                     const menu3 = {
-                      path: menu1.path + '/question-only',
-                      name: menu1.name + 'question-only',
+                      path: menu1.path + '/plan',
+                      name: menu1.name + 'plan',
                       component: () =>
-                        import('@/views/study/subject/question/only.vue'),
+                        import('@/views/study/subject/question/plan.vue'),
                       meta: {
                         subjectId: su.subjectId,
                         res: su,

+ 2 - 2
src/views/study/home/index.vue

@@ -32,8 +32,8 @@
                     class="text-subject-color ml-auto flex items-center text-xs hover:underline"
                     @click="
                       $router.push({
-                        name: item.subject + 'question-only',
-                        query: { isVideo: true },
+                        name: item.subject + 'plan',
+                        query: { isVideo: true, planId: item.planId },
                       })
                     "
                   >

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

@@ -146,7 +146,7 @@
                         class="text-subject-color flex items-center text-xs hover:underline"
                         @click="
                           $router.push({
-                            name: $route.meta.subjectId + 'question-only',
+                            name: $route.meta.subjectId + 'plan',
                             query: {
                               planId: item.planId,
                             },
@@ -285,7 +285,7 @@
                             class="text-subject-color flex items-center text-xs hover:underline"
                             @click="
                               $router.push({
-                                name: $route.meta.subjectId + 'question-only',
+                                name: $route.meta.subjectId + 'plan',
                                 query: {
                                   planId: son.planId,
                                 },
@@ -322,7 +322,7 @@
                 class="subject-questions-btn bg-subject-color ml-auto flex items-center rounded-full px-3 py-1 text-sm"
                 @click="
                   $router.push({
-                    name: $route.meta.subjectId + 'question-only',
+                    name: $route.meta.subjectId + 'plan',
                     query: {
                       onlyError: true,
                     },

+ 18 - 16
src/views/study/subject/question/only.vue

@@ -33,7 +33,7 @@
         >
           <template v-if="state.question.data?.length > 0">
             <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
-              <template v-for="(item, index) in state.question.data">
+              <template v-for="(item, index) in dataCpt">
                 <div
                   class="question-card overflow-hidden rounded-xl border border-[#e5e7eb] bg-white shadow-sm"
                 >
@@ -73,7 +73,7 @@
                       />
                     </div>
                     <!-- 视频解析列表 -->
-                    <div>
+                    <div v-if="item.questionVideo?.length > 0">
                       <div class="mb-2 text-sm font-medium text-gray-800">
                         视频解析:
                       </div>
@@ -102,10 +102,11 @@
               <div class="q-pa-lg flex-center flex">
                 <q-pagination
                   v-model="state.question.page"
-                  :max="Math.ceil(state.question.total / state.question.size)"
+                  :max="
+                    Math.ceil(state.question.data.length / state.question.size)
+                  "
                   :max-pages="6"
                   boundary-numbers
-                  @update:modelValue="initQuestion"
                 />
               </div>
             </div>
@@ -185,7 +186,10 @@
 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 { trainingCampQuestionList } from '@/api/modules/study'
+import {
+  trainingCampPaperConfigGetPaperMarkInfoByPlanId,
+  trainingCampQuestionList,
+} from '@/api/modules/study'
 import { useAppStore } from '@/stores'
 import { useRoute } from 'vue-router'
 
@@ -206,24 +210,22 @@ const state: any = reactive({
 const initQuestion = () => {
   state.question.loading = true
   state.question.data = []
-  trainingCampQuestionList({
-    pageNum: state.question.page,
-    pageSize: state.question.size,
-    category: AppStore.studentInfo?.grade,
-    subject: route.meta.subjectId,
-    planId: route.query.planId || '',
+  trainingCampPaperConfigGetPaperMarkInfoByPlanId(route.query.planId, {
     correct: state.question.type !== '错题',
-    studentId: AppStore.studentInfo?.studentId,
   })
-    .then(({ rows, total }: any) => {
-      state.question.data = rows
-      state.question.total = total
+    .then(({ data }: any) => {
+      state.question.data = data.questionList
     })
     .finally(() => {
       state.question.loading = false
     })
 }
-
+const dataCpt = computed(() => {
+  return state.question.data.slice(
+    (state.question.page - 1) * state.question.size,
+    state.question.page * state.question.size,
+  )
+})
 onMounted(() => {
   initQuestion()
 })