jichoi / lms_front star
이은진 이은진 2024-08-13
240813 이은진 대시보드 수정
@91ec3c1a7584f9026b5fc134794d95e69f79665f
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -7,21 +7,7 @@
             <div class="title-box">
                 <p class="title">{{ roadmapData[0].unit_nm }}</p>
                 <p class="subtitle">{{ roadmapData[0].book_nm }}</p>
-            </div>
-            <!--
-                    <div class="race-box">
-                        <div class="rabbit-start"><img src="../../../resources/img/img09_s.png" alt=""></div>
-                        <div class="rcon flex justify-between mb5">
-                            <div class="race-btn" v-for="roadmap in roadmapData" :key="roadmap.learning_id" @click="goToPage('Chapter7')">
-                                <button class="popTxt" v-for="(item, index) in items" :key="index" @click="toggleImage(index)" data-num="2">
-                                    <img :src="item.imgSrc1">
-                                    <img :src="item.imgSrc2" :style="{ display: item.isSecondImageVisible ? 'block' : 'none' }">
-                                </button>
-                                <p>{{getNonNullColumn(roadmap)}}</p>
-                            </div>
-                        </div>
-                    </div>
-                -->
+            </div> 
             <div class="race-box">
                 <div class="rabbit-start"><img src="../../../resources/img/img09_s.png" alt=""></div>
                 <div class="rcon flex justify-end mb5">
@@ -360,9 +346,6 @@
                 topLeft: { x: 0, y: 0 },
                 bottomRight: { x: 0, y: 0 }
             },
-
-
-            roadViewTF: false,
             roadmapData: [],
 
             schedules: [],
@@ -421,8 +404,7 @@
                 });
         },
 
-        fetchRoadmapData() {
-            const vm = this;
+        fetchRoadmapData() { 
             axios({
                 url: "/unitLearning/find.json",
                 method: "post",
@@ -430,14 +412,13 @@
                     "Content-Type": "application/json; charset=UTF-8",
                 },
                 data: {
-                    unit_id: this.schedules[0].unit_id,
-                    book_id: this.schedules[0].book_id
+                    unit_id: this.nowSchedule.unit_id,
+                    book_id: this.nowSchedule.book_id
                 }
             })
                 .then(response => { 
+                    console.log(response.data)
                     this.roadmapData = response.data;
-                    console.log(this.roadmapData)
-                    this.roadViewTF = vm.roadmapData.length > 0;
                 })
                 .catch(error => {
                     console.error("Error fetching roadmap data:", error);
client/views/pages/main/MyPlan.vue
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
@@ -5,9 +5,9 @@
             <div class="title-box flex justify-between mb40">
                 <p class="title">오늘 공부할 내용을 확인해봅시다.</p>
             </div>
-            <div class="wrap" style="border-radius: 0; min-height: 197px;"> 
+            <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>
@@ -17,14 +17,20 @@
                                     <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> 
+                                        <p class="title1">{{ schedule.schedule_time }}</p>
                                     </div>
                                     <div class="title-box mb10">
-                                        <span class="title">{{schedule.unit_nm}}</span> 
+                                        <span class="title">{{ schedule.unit_nm }}</span>
                                     </div>
                                     <p class="title2">{{ schedule.book_nm }}</p>
                                     <!-- <p class="title2">wirte a</p> -->
                                 </div>
+                                <button v-if="schedule.finish=='T'" type="button" title="바로가기" class="yellow-btn" @click="goToPage('Dashboard')">
+                                    학습완료
+                                </button>
+                                <button v-else type="button" title="바로가기" class="yellow-btn" @click="goToPage('Dashboard')">
+                                    바로가기
+                                </button>
                                 <div><img src="../../../resources/img/img214_19s.png" alt=""></div>
                             </div>
                         </div>
client/views/pages/main/MyPlan2.vue
--- client/views/pages/main/MyPlan2.vue
+++ client/views/pages/main/MyPlan2.vue
@@ -24,11 +24,11 @@
                             <td><input type="checkbox" class="ui-checkbox mr10" v-model="book.isSelected"></td>
                             <td><img src="../../../resources/img/img214_19s.png" alt=""></td>
                             <td class="text-lf">
-                                <p class="title1">{{ book.book_nm }}</p>
-                                <p class="title2">grade 3</p>
+                                <p class="title1">{{ book.bookName }}</p>
+                                <p class="title2">{{ book.unitName }}</p>
                             </td>
                             <td> <button type="button" title="확인" class="new-btn"
-                                    @click="buttonSearch(book.book_nm, book.book_id)">
+                                    @click="buttonSearch(book.bookName, book.bookId, book.unitId)">
                                     시간입력
                                 </button></td>
                         </tr>
@@ -54,7 +54,7 @@
                                         <p class="title1">{{ book.scheduleTime }}</p>
                                     </div>
                                     <div class="title-box  mb10"> <span class="title">{{ book.bookNm }}</span></div>
-                                    <p class="title2">wirte a</p>
+                                    <p class="title2">{{ book.unitNm }}</p>
                                 </div>
                                 <div class=""> <img src="../../../resources/img/img214_19s.png" alt=""></div>
                             </div>
@@ -159,9 +159,10 @@
         closeModal() {
             this.showModal = false;
         },
-        buttonSearch(book_nm, book_id) {
+        buttonSearch(book_nm, book_id, unit_id) {
             this.nowID = book_id
             this.nowName = book_nm
+            this.nowunitID = unit_id
             this.searchOpen = true;
         },
         closeBtn() {
@@ -179,6 +180,7 @@
                         this.addToNewDataArray(this.checkedItems[0]);
                         this.searchOpen = false;
                         this.nowID = ""
+                        this.nowunitID = ""
                         this.nowName = ""
                         this.unitList.push(this.checkedItems[0])
                         this.checkedItems = []
@@ -199,17 +201,18 @@
                 scheduleTime: selectedTime.time,
                 scheduleUnit: selectedTime.value,
                 bookId: this.nowID,
+                unitId: this.nowunitID,
                 stdId: "2"
             };
             this.newDataArray.push(newEntry);
         },
         async insertSchedule() {
-
             this.newDataArray = this.DataArray.map(item => ({
                 scheduleUnit: item.scheduleUnit,
                 bookId: item.bookId,
+                unitId: item.unitId,
                 stdId: item.stdId
-            }));
+            })); 
             try {
                 for (let data of this.newDataArray) {
                     await axios.post('/schedule/insertSchedule.json', data);
@@ -225,26 +228,7 @@
                 return a.scheduleUnit - b.scheduleUnit;
             });
 
-            this.DataArray = sortedArray;
-        },
-        fetchBooks() {
-            axios({
-                url: "/book/findAll.json",
-                method: "post",
-                headers: {
-                    "Content-Type": "application/json; charset=UTF-8",
-                },
-            })
-                .then(response => {
-                    this.books = response.data.map(book => ({
-                        ...book,
-                        isSelected: false
-                    }));
-                })
-                .catch(error => {
-                    console.error("fetchBooks - error: ", error);
-                    alert("교재 목록을 불러오는 중 오류가 발생했습니다.");
-                });
+            this.DataArray = sortedArray; 
         },
         searchBook() {
             this.books = ""
@@ -263,7 +247,24 @@
                     console.error("fetchUnits - error:", error);
                     alert("단원 목록을 불러오는 중 오류가 발생했습니다.");
                 });
-        }
+        },
+        fetchUnits() {
+            axios.post("unit/findAll.json", {
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                }
+            })
+                .then(response => {
+                    this.books = response.data.map(book => ({
+                        ...book,
+                        isSelected: false
+                    }));
+                })
+                .catch(error => {
+                    console.error("fetchBooks - error: ", error);
+                    alert("교재 목록을 불러오는 중 오류가 발생했습니다.");
+                });
+        },
     },
     watch: {
         // Watchers for reactivity (if needed)
@@ -276,7 +277,7 @@
     },
     mounted() {
         console.log('Main2 mounted');
-        this.fetchBooks();
+        this.fetchUnits();
     }
 }
 </script>
Add a comment
List