jichoi / lms_front star
정다정 2024-10-25
241025 정다정 학부모페이지 학습 일정 API 연결
@a405da636f80d4244dc6b36aaf9eb6b14dd4e23f
client/views/pages/parents/Main_p.vue
--- client/views/pages/parents/Main_p.vue
+++ client/views/pages/parents/Main_p.vue
@@ -156,7 +156,12 @@
                     <div class="flex">
                         <div class="wrap" style="flex: 1">
                             <p class="name">오늘의 학습 일정</p>
-                            <div class="flex-column mt20" style="gap: 20px">
+                            <div
+                                class="scheduleBox mt20"
+                                style="gap: 20px"
+                                v-for="(schedule, index) in schedules"
+                                :key="index"
+                            >
                                 <div class="flex justify-between align-center" style="gap: 70px">
                                     <div><img src="../../../resources/img/img217_22s.png" alt="" /></div>
                                     <div
@@ -168,13 +173,15 @@
                                         <div class="text-lf flex justify-between align-center">
                                             <div>
                                                 <div class="flex align-center mb10" style="gap: 10px">
-                                                    <p class="title2"><em class="gray-bd">1교시</em></p>
-                                                    <p class="title1">9:00</p>
-                                                    <p class="title1">~</p>
-                                                    <p class="title1">10:00</p>
+                                                    <p class="title2">
+                                                        <em class="gray-bd">{{ schedule.schdl_unit }}교시</em>
+                                                    </p>
+                                                    <p class="title1">{{ schedule.schedule_time }}</p>
                                                 </div>
-                                                <div class="title-box mb10"><span class="title">the best</span></div>
-                                                <p class="title2">wirte a</p>
+                                                <div class="title-box mb10">
+                                                    <span class="title">{{ schedule.unit_nm }}</span>
+                                                </div>
+                                                <p class="title2">{{ schedule.book_nm }}</p>
                                             </div>
                                             <div class="">
                                                 <img src="../../../resources/img/img214_19s.png" alt="" />
@@ -229,7 +236,7 @@
             time_rank: 0,
             progress: 20,
             donutChartData: {},
-            currentDate: '2024-08-14',
+            currentDate: '2024-10-25',
             studentInfo: {
                 studentName: '',
                 institutionName: '',
@@ -238,7 +245,16 @@
                 studentQuestion: '',
                 history: [],
             },
-            currentStdId: '1',
+            currentStdId: 'USID_000000000000002',
+            schedules: [],
+            timeList: [
+                { label: '1교시', time: '08:00 ~ 09:00', value: '1' },
+                { label: '2교시', time: '09:00 ~ 10:00', value: '2' },
+                { label: '3교시', time: '10:00 ~ 11:00', value: '3' },
+                { label: '4교시', time: '11:00 ~ 12:00', value: '4' },
+                { label: '5교시', time: '13:00 ~ 14:00', value: '5' },
+                { label: '6교시', time: '14:00 ~ 15:00', value: '6' },
+            ],
         };
     },
 
@@ -385,6 +401,34 @@
                     console.error('오늘의 학생 학습 현황 데이터를 가져오는 중 오류 발생:', error);
                 });
         },
+
+        // 현재학생의 학습 스케줄 가져오기
+        fetchSchedules() {
+            axios
+                .post(
+                    '/schedule/selectSchedule.json',
+                    { stdId: '2' },
+                    {
+                        headers: {
+                            'Content-Type': 'application/json; charset=UTF-8',
+                        },
+                    }
+                )
+                .then((response) => {
+                    this.schedules = response.data.map((schedule) => {
+                        const matchingTime = this.timeList.find((time) => time.value === schedule.schdl_unit);
+                        return {
+                            ...schedule,
+                            schedule_time: matchingTime ? matchingTime.time : '시간 정보 없음',
+                        };
+                    });
+                    console.log(this.schedules);
+                })
+                .catch((error) => {
+                    console.error('fetchUnits - error:', error);
+                    alert('단원 목록을 불러오는 중 오류가 발생했습니다.');
+                });
+        },
     },
 
     watch: {},
@@ -413,6 +457,7 @@
         this.getUserRankByScore();
         this.problemRankByProblemData();
         this.getUserRankByStudyTime();
+        this.fetchSchedules();
     },
 };
 </script>
@@ -450,4 +495,9 @@
     border-radius: 8px;
     padding: 10px 10px;
 }
+
+.scheduleBox {
+    display: flex;
+    flex-direction: column;
+}
 </style>
Add a comment
List