jichoi / lms_front star
이은진 이은진 2024-08-14
240814 이은진 대시보드 수정
@dd7466a347ee7ab31887a24ca17cd3719bb490a5
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -1,6 +1,7 @@
 <template>
     <p class="title1" v-if="state === 'finish'">오늘 공부를 다했어요! 너무 고생했어요!</p>
     <p class="title1" v-else-if="state === 'notRegistered'">지금은 학습 루트가 등록이 안됐어요! 학습 일정에서 학습루트를 등록해볼까요?</p>
+    <p class="title1" v-else-if="state === 'noProblem'">교재에 등록된 문제가 없습니다.</p>
     <div v-else class="main">
         <div class="race-wrap">
             <div class="title-box">
@@ -155,8 +156,8 @@
                     </div>
                 </div>
             </div>
-        <!-- 카메라 모달 -->
-        <article v-show="showCameraModal" class="popup-wrap">
+            <!-- 카메라 모달 -->
+            <article v-show="showCameraModal" class="popup-wrap">
                 <div class="popup-box" style="top: 500px; left:500px">
                     <div class="flex mb10 justify-between">
                         <p class="popup-title">사진 촬영</p>
@@ -341,9 +342,6 @@
                 topLeft: { x: 0, y: 0 },
                 bottomRight: { x: 0, y: 0 }
             },
-
-
-            roadViewTF: false,
             roadmapData: [],
 
             schedules: [],
@@ -384,9 +382,9 @@
                 }
                 console.log(this.state);
             })
-            .catch(error => {
-                console.error("Error fetching roadmap data:", error);
-            });
+                .catch(error => {
+                    console.error("Error fetching roadmap data:", error);
+                });
         },
         finishSchedule() {
             axios({
@@ -400,20 +398,20 @@
                     finish: "T"
                 }
             })
-            .then(response => {
-            const nextSchedule = this.schedules.find(schedule => schedule.schdl_id > this.nowSchedule.schdl_id);
-            alert("학습을 완료했습니다!");
-            if (nextSchedule) {
-                this.nowSchedule = nextSchedule;
-                this.$router.push({ name: 'Dashboard' });
-            } else {
-                window.location.reload();
-                alert("모든 학습을 완료했습니다!");
-            }
-        })
-            .catch(error => {
-                console.error("Error updating schedule:", error);
-            });
+                .then(response => {
+                    const nextSchedule = this.schedules.find(schedule => schedule.schdl_id > this.nowSchedule.schdl_id);
+                    alert("학습을 완료했습니다!");
+                    window.location.reload();
+                    if (nextSchedule) {
+                        this.nowSchedule = nextSchedule;
+                        this.$router.push({ name: 'Dashboard' });
+                    } else {
+                        alert("모든 학습을 완료했습니다!");
+                    }
+                })
+                .catch(error => {
+                    console.error("Error updating schedule:", error);
+                });
         },
 
         fetchRoadmapData() {
@@ -428,13 +426,17 @@
                     book_id: this.schedules[0].book_id
                 }
             })
-            .then(response => { 
-                this.roadmapData = response.data;
-                this.roadViewTF = this.roadmapData.length > 0;
-            })
-            .catch(error => {
-                console.error("Error fetching roadmap data:", error);
-            });
+                .then(response => {
+                    if (response.data.length != 0) {
+                        this.roadmapData = response.data;
+                    } else {
+                        this.state = "noProblem"
+                    }
+                })
+                .catch(error => {
+                    this.state = "noProblem"
+                    console.error("Error fetching roadmap data:", error);
+                });
         },
         toggleImage(index) {
             this.items[index].isSecondImageVisible = !this.items[index].isSecondImageVisible;
@@ -871,6 +873,7 @@
     align-items: center;
     z-index: 100;
 }
+
 video {
     width: 100%;
     height: auto;
@@ -885,6 +888,7 @@
     background-color: #FFF3D7;
     cursor: not-allowed;
 }
+
 .sticker {
     position: absolute;
     cursor: move;
Add a comment
List