jichoi / lms_front star
woals 2024-08-14
240814 권민수 오답노트 목록의 각 문제에 대한 링크 설정
@d02c5b5afb5f8dba9c97ed970165c55fd870d8f4
client/views/pages/main/PreviewNote.vue
--- client/views/pages/main/PreviewNote.vue
+++ client/views/pages/main/PreviewNote.vue
@@ -33,7 +33,7 @@
                             <p class="title2">{{ note.prblmExpln }}</p>
                         </td>
                         <td>
-                            <button type="button" title="" class="new-btn" @click="viewDetail(note.prblmId)">
+                            <button type="button" title="" class="new-btn" @click="viewDetail(note)">
                                 View Detail
                             </button>
                         </td>
@@ -59,14 +59,16 @@
             currentUnitId: "1", // 임시 유닛 아이디
             wrongAnswerNotes: [], // 오답 노트 목록 데이터
             unitData: {}, // 단원 정보 데이터
+            problemType: null, // 링크될 문제 유형 페이지 이름
         }
     },
     methods: {
 
         // 오답노트 상세 보기 버튼 클릭
-        viewDetail(prblmId) {
-            // 상세 보기 페이지로 이동하는 로직을 추가 할 예정
-            console.log('링크될 문제 ID:', prblmId);
+        viewDetail(prblm) {
+            console.log('링크될 문제 ID와 문제 타입 ID:', prblm.prblmId, prblm.prblmTypeId);
+            this.handleProblemDetail(prblm);
+            this.goToPage(this.problemType);
         },
 
         // 단원 정보를 불러오는 API 호출
@@ -98,6 +100,29 @@
             .catch(error => {
                 console.error('오답노트를 불러오는 중 오류 발생:', error);
             });
+        },
+
+        // 문제 유형에 따른 라우팅 메서드
+        handleProblemDetail(item) {
+            // sessionStorage.setItem("prblmId", JSON.stringify(item.prblmId));
+            // console.log(item.prblmTypeId);
+            if (item.prblmTypeId === "11") {
+                this.problemType = "Chapter3_9";
+            } else if (item.prblmTypeId === "12") {
+                this.problemType = "Chapter3_4";
+            } else if (item.prblmTypeId === "4") {
+                this.problemType = "Chapter3_3";
+            } else if (item.prblmTypeId === "3") {
+                this.problemType = "Chapter3_7";
+            } else if (item.prblmTypeId === "10") {
+                this.problemType = "Chapter3_2";
+            } else if (item.prblmTypeId === "14") {
+                this.problemType = "Chapter3_12";
+            }
+        },
+
+        goToPage(page) {
+            this.$router.push({ name: page });
         }
 
     },
Add a comment
List