Browse Source

修改显示逻辑

lex 1 year ago
parent
commit
1d4296be2f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/views/exercise-after-class/index.tsx

+ 6 - 1
src/views/exercise-after-class/index.tsx

@@ -119,7 +119,11 @@ export default defineComponent({
     }
     const setRecord = async (trainings: any[]) => {
       if (Array.isArray(trainings)) {
-        data.trainings = trainings.map((n: any) => {
+        const tempLessonTraining: any = []
+        trainings.forEach((item: any) => {
+          tempLessonTraining.push(...(item.studentLessonTrainingDetails || []))
+        })
+        data.trainings = tempLessonTraining.map((n: any) => {
           try {
             n.trainingContent = JSON.parse(n.trainingContent)
           } catch (error) {
@@ -142,6 +146,7 @@ export default defineComponent({
         handleExerciseCompleted()
       }
     }
+
     onMounted(async () => {
       const trainings = await getTrainingRecord()
       setRecord(trainings)