CzRger преди 2 седмици
родител
ревизия
a649ba437e
променени са 1 файла, в които са добавени 8 реда и са изтрити 2 реда
  1. 8 2
      src/views/study/subject/question/index.vue

+ 8 - 2
src/views/study/subject/question/index.vue

@@ -145,6 +145,7 @@ import {
 import { useAppStore } from '@/stores'
 import { useRoute } from 'vue-router'
 import listCom from './list.vue'
+import { v4 } from 'uuid'
 
 const AppStore = useAppStore()
 const route = useRoute()
@@ -156,6 +157,7 @@ const state: any = reactive({
     data: [],
   },
   question: {
+    uuid: '',
     loading: false,
     type: '错题',
     data: [],
@@ -215,6 +217,8 @@ const initQuestion = () => {
   }
   state.question.loading = true
   state.question.data = []
+  const uuid = v4()
+  state.question.uuid = uuid + ''
   trainingCampQuestionList({
     pageNum: state.question.page,
     pageSize: state.question.size,
@@ -225,8 +229,10 @@ const initQuestion = () => {
     studentId: AppStore.studentInfo?.studentId,
   })
     .then(({ rows, total }: any) => {
-      state.question.data = rows
-      state.question.total = total
+      if (uuid === state.question.uuid) {
+        state.question.data = rows
+        state.question.total = total
+      }
     })
     .finally(() => {
       state.question.loading = false