jichoi / lms_front star
PsHooN7979 2024-08-22
240822 박세훈 문제 타입 별 페이지 연결
@c4333249f0ae86a5f85079aa31dd79010dab7deb
client/views/pages/AppStore.js
--- client/views/pages/AppStore.js
+++ client/views/pages/AppStore.js
@@ -10,7 +10,8 @@
         bookId: null,
         unitId: null,
         LearningId: null,
-        currentLearningIds: [], // Stores multiple learning_ids (prblm_id)
+        currentLearningIds: [],
+        prblmTypeId: null,
         currentLabel: null,
         currentProblemIndex: 0,
     },
@@ -43,7 +44,8 @@
             return state.currentLearningIds[state.currentProblemIndex];
         },
         currentLabel: state => state.currentLabel,
-        currentProblemIndex: state => state.currentProblemIndex
+        currentProblemIndex: state => state.currentProblemIndex,
+        prblmTypeId: state => state.prblmTypeId,
     },
     mutations: {
         setToken(state, token) {
@@ -84,6 +86,7 @@
             state.currentLearningIds = payload.learning_id; // Array of IDs
             state.currentLabel = payload.label;
             state.currentProblemIndex = 0; // Reset to the first problem
+            state.prblmTypeId = payload.prblmTypeId;
         },
         incrementProblemIndex(state) {
             if (state.currentProblemIndex < state.currentLearningIds.length - 1) {
client/views/pages/main/Chapter/Chapter3_1.vue
--- client/views/pages/main/Chapter/Chapter3_1.vue
+++ client/views/pages/main/Chapter/Chapter3_1.vue
@@ -50,8 +50,7 @@
         </div>
         <button class="submit-button" @click="handleSubmit()">제출하기</button>
       </div>
-      <div class="next-btn" @click="[goToPage('Chapter3_2'), nextProblem()]"><img
-          src="../../../../resources/img/right.png" alt="" />
+      <div class="next-btn" @click="[nextProblem()]"><img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
   </div>
@@ -69,7 +68,7 @@
   },
   methods: {
     goToPage(page) {
-      // this.$router.push({ name: page });
+      this.$router.push({ name: page });
     },
     startTimer() {
       if (this.intervalId) {
@@ -93,11 +92,39 @@
     },
     nextProblem() {
       this.$store.dispatch('goToNextProblem')
-      console.log('Current Problem Index:', this.currentProblemIndex);
+      console.log('Current Learning ID:', this.currentLearningId);
+      this.handleProblemDetail(this.currentLearningId)
+      this.goToPage(this.problemType)
     },
     previousProblem() {
       this.$store.dispatch('goToPreviousProblem');
-    }
+    },
+
+    handleProblemDetail(item) {
+      if (item.prblm_type_id === "prblm_type_001") {
+        this.problemType = "Chapter3";
+      } else if (item.prblm_type_id === "prblm_type_002") {
+        this.problemType = "Chapter3_1";
+      } else if (item.prblm_type_id === "prblm_type_003") {
+        this.problemType = "Chapter3_2";
+      } else if (item.prblm_type_id === "prblm_type_004") {
+        this.problemType = "Chapter3_3";
+      } else if (item.prblm_type_id === "prblm_type_005") {
+        this.problemType = "Chapter3_3_1";
+      } else if (item.prblm_type_id === "prblm_type_006") {
+        this.problemType = "Chapter3_4";
+      } else if (item.prblm_type_id === "prblm_type_007") {
+        this.problemType = "Chapter3_5";
+      } else if (item.prblm_type_id === "prblm_type_008") {
+        this.problemType = "Chapter3_6";
+      } else if (item.prblm_type_id === "prblm_type_009") {
+        this.problemType = "Chapter3_7";
+      } else if (item.prblm_type_id === "prblm_type_010") {
+        this.problemType = "Chapter3_8";
+      } else if (item.prblm_type_id === "prblm_type_011") {
+        this.problemType = "Chapter3_9";
+      }
+    },
   },
   watch: {},
   computed: {
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -41,7 +41,7 @@
                     </div>
                 </div>
                 <div class="lcon flex justify-between mb5">
-                    <div class="race-btn" @click="[storeLearningId(labeledItems[6]), viewDetail(item)]">
+                    <div class="race-btn" @click="[storeLearningId(labeledItems[6])]">
                         <div class="rabbit-running"><img src="../../../resources/img/img09_s.png" alt=""
                                 :style="{ display: rabbitPos[7] ? 'block' : 'none' }"></div>
                         <button class="popTxt" v-for="(item, index) in items" :key="index" @click="toggleImage(index)"
@@ -592,46 +592,59 @@
         storeLearningId(labeledItems) {
             this.$store.dispatch('updateLearningData', labeledItems)
             if (labeledItems.label === "문제3") {
-                axios({
-                    url: "problem/problemInfo.json",
-                    method: "post",
-                    headers: {
-                        "Content-Type": "application/json; charset=UTF-8",
-                    },
-                    data: {
-                        prblmId: this.$store.getters.currentLearningId.prblm_id,
-                    },
-                })
-                    .then(response => {
-                        this.handleProblemDetail(response.data.problem);
-                        this.goToPage(this.problemType);
-                    })
+                this.handleProblemDetail(this.$store.getters.currentLearningId)
+                this.goToPage(this.problemType)
             }
         },
         handleProblemDetail(item) {
-            console.log(item);
-            if (item.prblmTypeId === "prblm_type_001") {
+            if (item.prblm_type_id === "prblm_type_001") {
                 this.problemType = "Chapter3";
-            } else if (item.prblmTypeId === "prblm_type_002") {
+            } else if (item.prblm_type_id === "prblm_type_002") {
                 this.problemType = "Chapter3_1";
-            } else if (item.prblmTypeId === "prblm_type_003") {
+            } else if (item.prblm_type_id === "prblm_type_003") {
                 this.problemType = "Chapter3_2";
-            } else if (item.prblmTypeId === "prblm_type_004") {
+            } else if (item.prblm_type_id === "prblm_type_004") {
                 this.problemType = "Chapter3_3";
-            } else if (item.prblmTypeId === "prblm_type_005") {
+            } else if (item.prblm_type_id === "prblm_type_005") {
                 this.problemType = "Chapter3_3_1";
-            } else if (item.prblmTypeId === "prblm_type_006") {
+            } else if (item.prblm_type_id === "prblm_type_006") {
                 this.problemType = "Chapter3_4";
-            } else if (item.prblmTypeId === "prblm_type_007") {
+            } else if (item.prblm_type_id === "prblm_type_007") {
                 this.problemType = "Chapter3_5";
-            } else if (item.prblmTypeId === "prblm_type_008") {
+            } else if (item.prblm_type_id === "prblm_type_008") {
                 this.problemType = "Chapter3_6";
-            } else if (item.prblmTypeId === "prblm_type_009") {
+            } else if (item.prblm_type_id === "prblm_type_009") {
                 this.problemType = "Chapter3_7";
-            } else if (item.prblmTypeId === "prblm_type_010") {
+            } else if (item.prblm_type_id === "prblm_type_010") {
                 this.problemType = "Chapter3_8";
-            } else if (item.prblmTypeId === "prblm_type_011") {
+            } else if (item.prblm_type_id === "prblm_type_011") {
                 this.problemType = "Chapter3_9";
+            } else if (item.prblm_type_id === "prblm_type_012") {
+                this.problemType = "Chapter3_10";
+            } else if (item.prblm_type_id === "prblm_type_013") {
+                this.problemType = "Chapter3_11";
+            } else if (item.prblm_type_id === "prblm_type_014") {
+                this.problemType = "Chapter3_12";
+            } else if (item.prblm_type_id === "prblm_type_015") {
+                this.problemType = "Chapter3_13";
+            } else if (item.prblm_type_id === "prblm_type_016") {
+                this.problemType = "Chapter3_14";
+            } else if (item.prblm_type_id === "prblm_type_017") {
+                this.problemType = "Chapter3_15";
+            } else if (item.prblm_type_id === "prblm_type_018") {
+                this.problemType = "Chapter2_8";
+            } else if (item.prblm_type_id === "prblm_type_019") {
+                this.problemType = "Chapter2_7";
+            } else if (item.prblm_type_id === "prblm_type_020") {
+                this.problemType = "Chapter2_5";
+            } else if (item.prblm_type_id === "prblm_type_021") {
+                this.problemType = "Chapter2_6";
+            } else if (item.prblm_type_id === "prblm_type_022") {
+                this.problemType = "Chapter2_10";
+            } else if (item.prblm_type_id === "prblm_type_023") {
+                this.problemType = "Chapter2_11";
+            } else if (item.prblm_type_id === "prblm_type_024") {
+                this.problemType = "Chapter2_13";
             }
         },
         openCameraModal() {
Add a comment
List