瀏覽代碼

修改显示逻辑

lex 2 年之前
父節點
當前提交
1d4296be2f
共有 1 個文件被更改,包括 6 次插入1 次删除
  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)