jichoi / lms_front star
woals 2024-08-13
240813 권민수 오답 노트 목록 조회 기능 구현
@93ffce81c0899b7d3ce2ebe231599bbdb32400a7
client/views/layout/Side.vue
--- client/views/layout/Side.vue
+++ client/views/layout/Side.vue
@@ -25,7 +25,7 @@
         <div class="ask mb30">
             <p class="title1 mb15">선생님께 질문 있어요~</p>
 
-            <div class="memo mb15"><textarea name="" id="" placeholder="궁금한 것을 적어보세요."></textarea></div>
+            <div class="memo mb15"><textarea name="" id="" placeholder="궁금한 것을 적어보세요." v-model="studentInfo.studentQuestion"></textarea></div>
             <div class="flex justify-end"><button>질문하기</button></div>
         </div>
         <!-- <div class="btn-wrap flex justify-between">
client/views/pages/main/PreviewNote.vue
--- client/views/pages/main/PreviewNote.vue
+++ client/views/pages/main/PreviewNote.vue
@@ -6,20 +6,14 @@
                     <p class="title">단원</p>
                     <div class="row-bd"></div>
                     <div>
-                        <p class="title mr40 mb10">1. Hello WORLD</p>
+                        <p class="title mr40 mb10">{{ unitData.unit_nm }}</p>
                         <p class="subtitle">my name is dd</p>
                     </div>
                 </div>
-                <!-- <button type="button" title="바로가기" class="yellow-btn" @click="goToPage('MyPlan2')">
-                            바로가기
-                        </button> -->
             </div>
         </div>
         <div class="title-box flex justify-between mb20 mt30">
             <p class="title">오답노트</p>
-            <!-- <select name="" id="">
-                <option value="">A반</option>
-            </select> -->
         </div>
         <div class="wrap" style="border-radius: 0;">
 
@@ -30,27 +24,17 @@
                         <col style="width: 70%;">
                         <col style="width: 15%;">
                     </colgroup>
-                    <tr>
-
+                    <tr v-for="note in wrongAnswerNotes" :key="note.prblmLogId">
                         <td><img src="../../../resources/img/img214_19s.png" alt=""></td>
                         <td class="text-lf">
-                            <p class="title1">중간평가</p>
-                            <p class="title2">wirte a</p>
+                            <p class="title1">{{ note.evalType }}</p>
+                            <p class="title2">{{ note.prblmExpln }}</p>
                         </td>
-                        <td> <button type="button" title="" class="new-btn" @click="buttonSearch">
+                        <td>
+                            <button type="button" title="" class="new-btn" @click="viewDetail(note.prblmId)">
                                 View Detail
-                            </button></td>
-                    </tr>
-                    <tr>
-
-                        <td><img src="../../../resources/img/img214_19s.png" alt=""></td>
-                        <td class="text-lf">
-                            <p class="title1">중간평가</p>
-                            <p class="title2">wirte a</p>
+                            </button>
                         </td>
-                        <td> <button type="button" title="" class="new-btn" @click="buttonSearch">
-                                View Detail
-                            </button></td>
                     </tr>
                 </table>
                 <div class="flex justify-end">
@@ -64,57 +48,55 @@
 </template>
 
 <script>
+import axios from 'axios';
+
 export default {
     data() {
         return {
-            timer: '00',
-            showButton1: false,
-            showButton2: false,
-            showButton3: false,
-            showButton4: false,
+            currentStdId: "1", // 임시 학생 아이디
+            currentUnitId: "1", // 임시 유닛 아이디
+            wrongAnswerNotes: [], // 오답 노트 목록 데이터
+            unitData: {},
         }
     },
     methods: {
-        goToPage(page) {
-            this.$router.push({ name: page });
+
+        // 오답노트 상세 보기 버튼 클릭
+        viewDetail(prblmId) {
+            // 상세 보기 페이지로 이동하는 로직을 추가 할 예정
+            console.log('링크될 문제 ID:', prblmId);
         },
-        handleDrag(dragNumber) {
-            // Drag 버튼 숨기기
-            // 여기서는 상태 관리를 통해 버튼을 제어합니다.
-            if (dragNumber === 1) {
-                this.showButton1 = false;
-            } else if (dragNumber === 2) {
-                this.showButton2 = false;
-            } else if (dragNumber === 3) {
-                this.showButton3 = false;
-            }
-        },
-        showButton(dropNumber) {
-            // Drop 영역의 이미지 클릭 이벤트 핸들러 설정
-            // 여기서는 상태 관리를 통해 버튼을 보이게 합니다.
-            if (dropNumber === 1) {
-                this.showButton1 = true;
-            } else if (dropNumber === 2) {
-                this.showButton2 = true;
-            } else if (dropNumber === 3) {
-                this.showButton3 = true;
-            } else if (dropNumber === 4) {
-                this.showButton4 = true;
-            }
-        },
-        startTimer() {
-            if (this.intervalId) {
-                clearInterval(this.intervalId);
-            }
-            this.timer = 5;
-            this.intervalId = setInterval(() => {
-                if (this.timer > 0) {
-                    this.timer--;
-                } else {
-                    clearInterval(this.intervalId);
+
+        fetchUnitDetail() {
+            axios.post('/unit/unitDetail.json', {
+                unitId: this.currentUnitId
+            })
+            .then(response => {
+                console.log(response.data[0]);
+                if (response.data.length > 0) {
+                    this.unitData = response.data[0];
                 }
-            }, 1000);
+            })
+            .catch(error => {
+                console.error('단원 정보를 불러오는 중 오류 발생:', error);
+            })
+        },
+
+        // 오답노트 목록을 가져오는 API 호출
+        fetchWrongAnswerNotes() {
+            axios.post('/problemLog/getPreviewNoteList.json', {
+                stdId: this.currentStdId,
+                unitId: this.currentUnitId
+            })
+            .then(response => {
+                console.log(response.data);
+                this.wrongAnswerNotes = response.data;
+            })
+            .catch(error => {
+                console.error('오답노트를 불러오는 중 오류 발생:', error);
+            });
         }
+
     },
     watch: {
 
@@ -125,7 +107,9 @@
     components: {
     },
     mounted() {
-
+        console.log('PreviewNote mounted');
+        this.fetchUnitDetail();
+        this.fetchWrongAnswerNotes();
     }
 }
 </script>
Add a comment
List