jichoi / lms_front star
구자현 구자현 2024-08-14
Merge branch 'master' of http://210.180.118.83/jichoi/lms_front
@210e95db554fe0e489e71601ee66ee6f5383edf8
client/views/layout/Side.vue
--- client/views/layout/Side.vue
+++ client/views/layout/Side.vue
@@ -26,7 +26,7 @@
             <p class="title1 mb15">선생님께 질문 있어요~</p>
 
             <div class="memo mb15"><textarea name="" id="" placeholder="궁금한 것을 적어보세요." v-model="studentInfo.studentQuestion"></textarea></div>
-            <div class="flex justify-end"><button>질문하기</button></div>
+            <div class="flex justify-end"><button @click="updateQuestion">질문하기</button></div>
         </div>
         <!-- <div class="btn-wrap flex justify-between">
             <button class="login-btn" @click="handleClick" >
@@ -73,6 +73,22 @@
             });
         },
 
+        // 질문 업데이트 메서드
+        updateQuestion() {
+            axios.post('/studentInfo/updateQuestion.json', {
+                userId: this.userId,
+                studentQuestion: this.studentInfo.studentQuestion
+            })
+            .then(response => {
+                console.log('질문이 성공적으로 업데이트되었습니다.');
+                alert('질문이 성공적으로 업데이트되었습니다.');
+            })
+            .catch(error => {
+                console.error('질문 업데이트 실패:', error);
+                alert('질문 업데이트에 실패했습니다.');
+            });
+        },
+
         handleClick() {
             this.toggleText();
             this.goToPage('PreviewNote');
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -1,27 +1,12 @@
 <template>
     <p class="title1" v-if="state === 'finish'">오늘 공부를 다했어요! 너무 고생했어요!</p>
     <p class="title1" v-else-if="state === 'notRegistered'">지금은 학습 루트가 등록이 안됐어요! 학습 일정에서 학습루트를 등록해볼까요?</p>
-    <!-- 1번 템플릿 -->
     <div v-else class="main">
         <div class="race-wrap">
             <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 class="race-box">
                 <div class="rabbit-start"><img src="../../../resources/img/img09_s.png" alt=""></div>
                 <div class="rcon flex justify-end mb5">
@@ -384,15 +369,13 @@
                 if (this.schedules.length == 0) {
                     this.state = 'notRegistered';
                 } else {
-                    // 모든 계획의 finish 값이 T인지 확인
                     const allFinished = this.schedules.every(schedule => schedule.finish === "T");
-
                     if (allFinished) {
                         this.state = 'finish';
                     } else {
                         this.nowSchedule = this.schedules.find(schedule => schedule.finish === null || schedule.finish === "F");
                         if (this.nowSchedule) {
-                            this.fetchRoadmapData(); // 진행 중인 스케줄이 있을 때 데이터를 가져오는 함수 호출
+                            this.fetchRoadmapData();
                             this.state = 'studying';
                         } else {
                             this.state = 'notRegistered';
@@ -421,14 +404,11 @@
             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();  // 전체 페이지 새로고침
+                window.location.reload();
                 alert("모든 학습을 완료했습니다!");
-                // 페이지를 새로고침하여 Dashboard.vue를 다시 로드
-                
             }
         })
             .catch(error => {
client/views/pages/main/MyPlan.vue
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
@@ -1,5 +1,4 @@
 <template>
-
     <div class="main">
         <div class="myplan">
             <div class="title-box flex justify-between mb40">
@@ -23,7 +22,6 @@
                                         <span class="title">{{schedule.unit_nm}}</span> 
                                     </div>
                                     <p class="title2">{{ schedule.book_nm }}</p>
-                                    <!-- <p class="title2">wirte a</p> -->
                                 </div>
                                 <div>
                                     <p class="title" @click="goToPage('Dashboard', schedule.schdl_id)">바로가기</p>
@@ -64,7 +62,6 @@
             </div>
         </div>
     </div>
-
 </template>
 
 <script>
@@ -95,46 +92,46 @@
     },
     methods: {
         goToPage(page, scheduleId) {
-        const startScheduleIndex = this.schedules.findIndex(schedule => schedule.schdl_id === scheduleId);
+            const startScheduleIndex = this.schedules.findIndex(schedule => schedule.schdl_id === scheduleId);
 
-        if (startScheduleIndex === -1) {
-            console.error("해당 스케줄을 찾을 수 없습니다.");
-            return;
-        }
+            if (startScheduleIndex === -1) {
+                console.error("해당 스케줄을 찾을 수 없습니다.");
+                return;
+            }
 
-        const updates = [];
-        const currentSchedule = this.schedules[startScheduleIndex];
-        if (currentSchedule.finish === null || currentSchedule.finish === "T") {
-            updates.push(
-                axios.post("/schedule/scheduleUpdate.json", { scheduleId: currentSchedule.schdl_id, finish: "F" }, {
-                    headers: {
-                        "Content-Type": "application/json; charset=UTF-8",
-                    }
-                })
-            );
-        }
-
-        for (let i = startScheduleIndex + 1; i < this.schedules.length; i++) {
-            const nextSchedule = this.schedules[i];
-            if (nextSchedule.finish === "T") {
+            const updates = [];
+            const currentSchedule = this.schedules[startScheduleIndex];
+            if (currentSchedule.finish === null || currentSchedule.finish === "T") {
                 updates.push(
-                    axios.post("/schedule/scheduleUpdate.json", { scheduleId: nextSchedule.schdl_id, finish: "F" }, {
+                    axios.post("/schedule/scheduleUpdate.json", { scheduleId: currentSchedule.schdl_id, finish: "F" }, {
                         headers: {
                             "Content-Type": "application/json; charset=UTF-8",
                         }
                     })
                 );
             }
-        }
 
-        Promise.all(updates)
-            .then(() => {
-                this.$router.push({ name: page });
-            })
-            .catch(error => {
-                console.error("Error updating schedules:", error);
-                alert("학습 계획을 업데이트하는 중 오류가 발생했습니다.");
-            });
+            for (let i = startScheduleIndex + 1; i < this.schedules.length; i++) {
+                const nextSchedule = this.schedules[i];
+                if (nextSchedule.finish === "T") {
+                    updates.push(
+                        axios.post("/schedule/scheduleUpdate.json", { scheduleId: nextSchedule.schdl_id, finish: "F" }, {
+                            headers: {
+                                "Content-Type": "application/json; charset=UTF-8",
+                            }
+                        })
+                    );
+                }
+            }
+
+            Promise.all(updates)
+                .then(() => {
+                    this.$router.push({ name: page });
+                })
+                .catch(error => {
+                    console.error("Error updating schedules:", error);
+                    alert("학습 계획을 업데이트하는 중 오류가 발생했습니다.");
+                });
         },
         showConfirm(type) {
             let message = '';
client/views/pages/main/PreviewNote.vue
--- client/views/pages/main/PreviewNote.vue
+++ client/views/pages/main/PreviewNote.vue
@@ -16,7 +16,7 @@
             <p class="title">오답노트</p>
         </div>
         <div class="wrap" style="border-radius: 0;">
-
+ㄴ
             <div class="table-wrap">
                 <table>
                     <colgroup>
@@ -56,7 +56,7 @@
             currentStdId: "1", // 임시 학생 아이디
             currentUnitId: "1", // 임시 유닛 아이디
             wrongAnswerNotes: [], // 오답 노트 목록 데이터
-            unitData: {},
+            unitData: {}, // 단원 정보 데이터
         }
     },
     methods: {
@@ -67,6 +67,7 @@
             console.log('링크될 문제 ID:', prblmId);
         },
 
+        // 단원 정보를 불러오는 API 호출
         fetchUnitDetail() {
             axios.post('/unit/unitDetail.json', {
                 unitId: this.currentUnitId
Add a comment
List