jichoi / lms_front star
이은진 이은진 2024-08-13
240813 이은진 대시보드-학습일정계획
@73128689acece6e0aeb4455ec8a448a32fb8879c
client/views/pages/main/MyPlan.vue
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
@@ -5,9 +5,33 @@
             <div class="title-box flex justify-between mb40">
                 <p class="title">오늘 공부할 내용을 확인해봅시다.</p>
             </div>
-            <div class="wrap" style="border-radius: 0; min-height: 197px;">
-                <p class="title1"> 오늘 학습할 내용이 없습니다.</p>
+            <div class="wrap" style="border-radius: 0; min-height: 197px;"> 
+                <p class="title1" v-if="!schedules || schedules.length === 0"> 오늘 학습할 내용이 없습니다.</p>
+ 
+                <div class="flex-column" style="gap: 20px;" v-else 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 class="wrap cs-pt" :class="{ 'cs-pt-clicked': isClicked }" style="width: 100%;">
+                            <div class="text-lf flex justify-between align-center">
+                                <div>
+                                    <p class="title2">grade 3</p>
+                                    <div class="flex align-center mb10" style="gap: 10px;">
+                                        <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">{{schedule.unit_nm}}</span> 
+                                    </div>
+                                    <p class="title2">{{ schedule.book_nm }}</p>
+                                    <!-- <p class="title2">wirte a</p> -->
+                                </div>
+                                <div><img src="../../../resources/img/img214_19s.png" alt=""></div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
             </div>
+
             <div class="yellow-box mt30">
                 <div class="title-box flex justify-between align-center">
                     <div>
@@ -42,6 +66,7 @@
 </template>
 
 <script>
+import axios from "axios";
 import SvgIcon from '@jamescoyle/vue-icon';
 import { mdiMagnify, mdiWindowClose } from '@mdi/js';
 
@@ -53,6 +78,16 @@
             mdiWindowClose: mdiWindowClose,
             showModal: false,
             searchOpen: false,
+            schedules: [],
+            stdId: "2",
+            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" },
+            ],
         }
     },
     methods: {
@@ -82,8 +117,27 @@
         closeBtn() {
             this.searchOpen = false;
 
-        },
-
+        }, fetchSchedules() {
+            axios.post("/schedule/selectSchedule.json", { stdId: this.stdId }, {
+                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: {
 
@@ -96,6 +150,7 @@
     },
     mounted() {
         console.log('Main2 mounted');
+        this.fetchSchedules();
     }
 }
 </script>
(No newline at end of file)
Add a comment
List