jichoi / lms_front star
홍아랑 홍아랑 2024-08-23
240823 홍아랑 문제 2_13,11,10 api 연결
@db5b812a6702ec4e7149559e48061b3ad1113062
client/views/pages/main/Chapter/Chapter2_10.vue
--- client/views/pages/main/Chapter/Chapter2_10.vue
+++ client/views/pages/main/Chapter/Chapter2_10.vue
@@ -7,17 +7,18 @@
         </div>
       </router-link>
     </div>
-    <div class="title-box mb25 flex align-center mt40" style="
-    justify-content: space-between;
-">
+    <div
+      class="title-box mb25 flex align-center mt40"
+      style="justify-content: space-between"
+    >
       <div>
         <span class="title mr40">1. Hello WORLD</span>
         <span class="subtitle">my name is dd</span>
       </div>
-      <button class="completeBtn" @click="complete"> 학습 종료 </button>
+      <button class="completeBtn" @click="complete">학습 종료</button>
     </div>
     <div class="flex justify-between align-center">
-      <div class="pre-btn" @click="goToPage('Chapter2_6')">
+      <div class="pre-btn" @click="previousProblem()">
         <img src="../../../../resources/img/left.png" alt="" />
       </div>
       <div class="content title-box">
@@ -60,7 +61,10 @@
               <article class="flex justify-center mb50" style="gap: 60px">
                 <div class="flex" style="align-items: center">
                   <button @click="handleClick(1)">
-                    <img src="../../../../resources/img/img136_71s.png" alt="" />
+                    <img
+                      src="../../../../resources/img/img136_71s.png"
+                      alt=""
+                    />
                     <p :class="{ active: selectedButton === 1 }">1</p>
                   </button>
                   <p>{{ choice[0] }}</p>
@@ -69,7 +73,10 @@
               <article class="flex justify-center mb50" style="gap: 60px">
                 <div class="flex" style="align-items: center">
                   <button @click="handleClick(2)">
-                    <img src="../../../../resources/img/img136_71s.png" alt="" />
+                    <img
+                      src="../../../../resources/img/img136_71s.png"
+                      alt=""
+                    />
                     <p :class="{ active: selectedButton === 2 }">2</p>
                   </button>
                   <p>{{ choice[1] }}</p>
@@ -78,7 +85,10 @@
               <article class="flex justify-center" style="gap: 60px">
                 <div class="flex" style="align-items: center">
                   <button @click="handleClick(3)">
-                    <img src="../../../../resources/img/img136_71s.png" alt="" />
+                    <img
+                      src="../../../../resources/img/img136_71s.png"
+                      alt=""
+                    />
                     <p :class="{ active: selectedButton === 3 }">3</p>
                   </button>
                   <p>{{ choice[2] }}</p>
@@ -91,7 +101,7 @@
           <button class="answerButton" @click="confirmAnswer">정답 확인</button>
         </div>
       </div>
-      <div class="next-btn" @click="goToPage('Chapter2_11')">
+      <div class="next-btn" @click="nextProblem()">
         <img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
@@ -99,33 +109,35 @@
 </template>
 
 <script>
+import axios from "axios";
+
 export default {
   data() {
     return {
       selectedButton: null, // 선택된 버튼을 추적하기 위한 데이터
 
-      example: "Tell me/why/?",
-      beforeQuestion: "Tell me",
-      afterQuestion: "Why",
-      choice: ["You are so upset", "You is so upset", "You am so upset"],
-      answer: 1,
+      example: "",
+      beforeQuestion: "",
+      afterQuestion: "",
+      choice: [],
+      answer: "",
+
+      prblm_id: [],
+      problemData: [],
+      // problemArr: [],
+      answerArr: [],
     };
   },
   methods: {
     complete() {
       const { unit_id, book_id } = this.$route.query;
-      this.$router.push({ name: 'Dashboard', query: { value: 3, unit_id, book_id } });
+      this.$router.push({
+        name: "Dashboard",
+        query: { value: 3, unit_id, book_id },
+      });
     },
     goToPage(page) {
       this.$router.push({ name: page });
-    },
-
-    splitExample() {
-      const parts = this.example.split("/?/");
-      if (parts.length === 3) {
-        this.beforeQuestion = parts[0];
-        this.afterQuestion = parts[1];
-      }
     },
 
     handleClick(buttonNumber) {
@@ -148,10 +160,151 @@
     returnPage() {
       window.location.reload();
     },
-  },
+    nextProblem() {
+      if (
+        this.currentProblemIndex <
+        this.$store.state.currentLearningIds.length - 1
+      ) {
+        this.$store.dispatch("goToNextProblem");
+        this.handleProblemDetail(this.currentLearningId);
+        this.goToPage(this.problemType);
+      } else {
+        // 마지막 문제면 이동
+        this.goToPage("Chapter4");
+      }
+    },
+    previousProblem() {
+      if (this.currentProblemIndex > 0) {
+        this.$store.dispatch("goToPreviousProblem");
+        this.handleProblemDetail(this.currentLearningId);
+        this.goToPage(this.problemType);
+      }
+    },
 
+    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";
+      } 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";
+      }
+    },
+
+    fetchProblemData() {
+      axios({
+        url: "/problem/problemInfo.json",
+        method: "post",
+        headers: {
+          "Content-Type": "application/json; charset=UTF-8",
+        },
+        data: {
+          prblmId: this.prblm_id.prblm_id,
+        },
+      })
+        .then((response) => {
+          this.problemData = response.data;
+          console.log("problemData", this.problemData);
+
+          this.sortingProblem();
+        })
+        .catch((error) => {
+          this.state = "noProblem";
+          console.error("Error fetching problemData:", error);
+        });
+    },
+
+    sortingProblem() {
+      this.example = this.problemData.problem.prblmExpln;
+      const parts = this.example.split("/");
+      if (parts.length === 3) {
+        this.beforeQuestion = parts[0];
+        this.afterQuestion = parts[1];
+      }
+
+      for (let i = 0; i < this.problemData.problemDetail.length; i++) {
+        // this.answerArr[i].prblmDtlExpln =
+        //   this.problemData.problemDetail[i].prblmDtlExpln;
+        // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn;
+        this.answerArr[i] = this.problemData.problemDetail[i];
+        this.choice[i] = this.problemData.problemDetail[i].prblmDtlExpln;
+      }
+      console.log("answerArr", this.answerArr);
+
+      for (let i = 0; i < this.answerArr.length; i++) {
+        if (this.answerArr[i].prblmYn == "Y") {
+          this.answer = i + 1;
+          break;
+        }
+      }
+    },
+  },
+  computed: {
+    currentLearningId() {
+      return this.$store.getters.currentLearningId;
+    },
+    currentLabel() {
+      return this.$store.getters.currentLabel;
+    },
+    currentProblemIndex() {
+      return this.$store.getters.currentProblemIndex;
+    },
+    isPreviousButtonDisabled() {
+      return this.currentProblemIndex === 0;
+    },
+  },
+  created() {
+    console.log("Current Learning ID:", this.currentLearningId);
+    this.prblm_id = this.currentLearningId;
+    console.log("Current Label:", this.currentLabel);
+    console.log("Current Problem Index:", this.currentProblemIndex);
+
+    // Fetch or process the current problem based on `currentLearningId`
+  },
   mounted() {
-    this.splitExample();
+    this.fetchProblemData();
   },
 };
 </script>
@@ -206,7 +359,7 @@
   width: -webkit-fill-available;
 }
 
-.pickGroup article>div>p {
+.pickGroup article > div > p {
   font-size: 25px;
   white-space: nowrap;
   /* 텍스트가 줄 바꿈 없이 한 줄로 표시되도록 설정 */
@@ -245,6 +398,6 @@
   padding: 10px 30px;
   border-radius: 10px;
   font-size: 28px;
-  font-family: 'ONEMobilePOPOTF';
+  font-family: "ONEMobilePOPOTF";
 }
 </style>
client/views/pages/main/Chapter/Chapter2_11.vue
--- client/views/pages/main/Chapter/Chapter2_11.vue
+++ client/views/pages/main/Chapter/Chapter2_11.vue
@@ -7,14 +7,15 @@
         </div>
       </router-link>
     </div>
-    <div class="title-box mb25 flex align-center mt40" style="
-    justify-content: space-between;
-">
+    <div
+      class="title-box mb25 flex align-center mt40"
+      style="justify-content: space-between"
+    >
       <div>
         <span class="title mr40">1. Hello WORLD</span>
         <span class="subtitle">my name is dd</span>
       </div>
-      <button class="completeBtn" @click="complete"> 학습 종료 </button>
+      <button class="completeBtn" @click="complete">학습 종료</button>
     </div>
     <div class="flex justify-between align-center">
       <div class="pre-btn" @click="previousProblem()">
@@ -47,7 +48,10 @@
             </div>
           </div>
           <div class="pickGroup">
-            <article class="flex justify-center" style="gap: 60px; bottom: 159px; left: 242px">
+            <article
+              class="flex justify-center"
+              style="gap: 60px; bottom: 159px; left: 242px"
+            >
               <div class="flex">
                 <button @click="handleClick(1)">
                   <img src="../../../../resources/img/img136_71s.png" alt="" />
@@ -56,7 +60,10 @@
                 <p>{{ choice[0] }}</p>
               </div>
             </article>
-            <article class="flex justify-center" style="gap: 60px; bottom: 159px; right: 559px">
+            <article
+              class="flex justify-center"
+              style="gap: 60px; bottom: 159px; right: 559px"
+            >
               <div class="flex">
                 <button @click="handleClick(2)">
                   <img src="../../../../resources/img/img136_71s.png" alt="" />
@@ -87,8 +94,8 @@
     return {
       selectedButton: null,
 
-      beforeQuestion: "I",
-      afterQuestion: "very hungry.",
+      beforeQuestion: "",
+      afterQuestion: "",
 
       choice: [],
       answer: 1,
@@ -101,7 +108,10 @@
   methods: {
     complete() {
       const { unit_id, book_id } = this.$route.query;
-      this.$router.push({ name: 'Dashboard', query: { value: 3, unit_id, book_id } });
+      this.$router.push({
+        name: "Dashboard",
+        query: { value: 3, unit_id, book_id },
+      });
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -136,8 +146,9 @@
     },
     getProblem() {
       const vm = this;
-      // const prblmId = this.currentLearningId.prblm_id;
-      const prblmId = "PROBLEM_000000000000076"
+      const prblmId = this.prblm_id.prblm_id;
+      // const prblmId = "PROBLEM_000000000000076";
+
       axios({
         url: "problem/problemInfo.json",
         method: "post",
@@ -160,29 +171,31 @@
             }
           });
 
-          console.log(vm.example)
-          console.log(vm.choice)
-          console.log(vm.answer)
+          console.log(vm.example);
+          console.log(vm.choice);
+          console.log(vm.answer);
           vm.splitExample();
-
         })
         .catch(function (error) {
           console.log("problem - error : ", error);
         });
     },
     nextProblem() {
-      if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
-        this.$store.dispatch('goToNextProblem');
+      if (
+        this.currentProblemIndex <
+        this.$store.state.currentLearningIds.length - 1
+      ) {
+        this.$store.dispatch("goToNextProblem");
         this.handleProblemDetail(this.currentLearningId);
         this.goToPage(this.problemType);
       } else {
         // 마지막 문제면 이동
-        this.goToPage("Chapter4")
+        this.goToPage("Chapter4");
       }
     },
     previousProblem() {
       if (this.currentProblemIndex > 0) {
-        this.$store.dispatch('goToPreviousProblem');
+        this.$store.dispatch("goToPreviousProblem");
         this.handleProblemDetail(this.currentLearningId);
         this.goToPage(this.problemType);
       }
@@ -241,8 +254,7 @@
     },
   },
   watch: {},
-  computed: {},
-  components: {
+  computed: {
     currentLearningId() {
       return this.$store.getters.currentLearningId;
     },
@@ -254,17 +266,18 @@
     },
     isPreviousButtonDisabled() {
       return this.currentProblemIndex === 0;
-    }
+    },
   },
   created() {
-    console.log('Current Learning ID:', this.currentLearningId);
-    console.log('Current Label:', this.currentLabel);
-    console.log('Current Problem Index:', this.currentProblemIndex);
+    console.log("Current Learning ID:", this.currentLearningId);
+    this.prblm_id = this.currentLearningId;
+    console.log("Current Label:", this.currentLabel);
+    console.log("Current Problem Index:", this.currentProblemIndex);
 
     // Fetch or process the current problem based on `currentLearningId`
   },
   mounted() {
-    this.getProblem()
+    this.getProblem();
   },
 };
 </script>
@@ -297,7 +310,7 @@
   width: -webkit-fill-available;
 }
 
-.pickGroup article>div>p {
+.pickGroup article > div > p {
   font-size: 64px;
 }
 
@@ -338,6 +351,6 @@
   padding: 10px 30px;
   border-radius: 10px;
   font-size: 28px;
-  font-family: 'ONEMobilePOPOTF';
+  font-family: "ONEMobilePOPOTF";
 }
 </style>
client/views/pages/main/Chapter/Chapter2_13.vue
--- client/views/pages/main/Chapter/Chapter2_13.vue
+++ client/views/pages/main/Chapter/Chapter2_13.vue
@@ -7,17 +7,18 @@
         </div>
       </router-link>
     </div>
-    <div class="title-box mb25 flex align-center mt40" style="
-    justify-content: space-between;
-">
+    <div
+      class="title-box mb25 flex align-center mt40"
+      style="justify-content: space-between"
+    >
       <div>
         <span class="title mr40">1. Hello WORLD</span>
         <span class="subtitle">my name is dd</span>
       </div>
-      <button class="completeBtn" @click="complete"> 학습 종료 </button>
+      <button class="completeBtn" @click="complete">학습 종료</button>
     </div>
     <div class="flex justify-between align-center">
-      <div class="pre-btn" @click="goToPage('Chapter2_11')">
+      <div class="pre-btn" @click="previousProblem()">
         <img src="../../../../resources/img/left.png" alt="" />
       </div>
       <div class="content title-box">
@@ -44,7 +45,11 @@
         <div class="text-ct">
           <div class="imgGroup flex align-center justify-center">
             <div class="flex" style="gap: 20px; position: relative">
-              <img src="../../../../resources/img/img105_46s.png" alt="" style="width: 90%" />
+              <img
+                src="../../../../resources/img/img105_46s.png"
+                alt=""
+                style="width: 90%"
+              />
 
               <div class="textbox">
                 <p class="little-title">{{ problem }}</p>
@@ -52,7 +57,10 @@
                   <article class="flex mb10" style="gap: 60px">
                     <div class="flex align-center" @click="handleClick(1)">
                       <button>
-                        <img src="../../../../resources/img/img136_71s.png" alt="" />
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
                         <p :class="{ active: selectedButton === 1 }">1</p>
                       </button>
                       <p class="red">{{ choice[0] }}</p>
@@ -61,7 +69,10 @@
                   <article class="flex mb10" style="gap: 60px">
                     <div class="flex align-center" @click="handleClick(2)">
                       <button>
-                        <img src="../../../../resources/img/img136_71s.png" alt="" />
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
                         <p :class="{ active: selectedButton === 2 }">2</p>
                       </button>
                       <p class="orange">{{ choice[1] }}</p>
@@ -70,7 +81,10 @@
                   <article class="flex mb10" style="gap: 60px">
                     <div class="flex align-center" @click="handleClick(3)">
                       <button>
-                        <img src="../../../../resources/img/img136_71s.png" alt="" />
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
                         <p :class="{ active: selectedButton === 3 }">3</p>
                       </button>
                       <p class="blue">{{ choice[2] }}</p>
@@ -79,7 +93,10 @@
                   <article class="flex" style="gap: 60px">
                     <div class="flex align-center" @click="handleClick(4)">
                       <button>
-                        <img src="../../../../resources/img/img136_71s.png" alt="" />
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
                         <p :class="{ active: selectedButton === 4 }">4</p>
                       </button>
                       <p class="green">{{ choice[3] }}</p>
@@ -88,7 +105,11 @@
                 </div>
               </div>
               <!-- 오답일 경우 아래의 이미지가 보여야함 -->
-              <div v-if="correct" class="flex justify-center wrong-anwser" style="gap: 20px">
+              <div
+                v-if="correct"
+                class="flex justify-center wrong-anwser"
+                style="gap: 20px"
+              >
                 <img src="../../../../resources/img/img165_46s.png" alt="" />
               </div>
             </div>
@@ -98,7 +119,7 @@
           <button class="answerButton" @click="confirmAnswer">정답 확인</button>
         </div>
       </div>
-      <div class="next-btn" @click="goToPage('Chapter3')">
+      <div class="next-btn" @click="nextProblem()">
         <img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
@@ -106,28 +127,33 @@
 </template>
 
 <script>
+import axios from "axios";
+
 export default {
   data() {
     return {
       timer: "00",
-      problem: "아래 보기 중 한국어 뜻과 영어 뜻이 다른 것은?",
+      problem: "",
 
-      choice: [
-        "apple - 사과",
-        "banana - 바나나",
-        "plum - 손바닥",
-        "watermelon - 수박",
-      ],
-      answer: 3,
+      choice: [],
+      answer: "",
 
       selectedButton: null,
       correct: false,
+
+      prblm_id: [],
+      problemData: [],
+      // problemArr: [],
+      answerArr: [],
     };
   },
   methods: {
     complete() {
       const { unit_id, book_id } = this.$route.query;
-      this.$router.push({ name: 'Dashboard', query: { value: 3, unit_id, book_id } });
+      this.$router.push({
+        name: "Dashboard",
+        query: { value: 3, unit_id, book_id },
+      });
     },
     goToPage(page) {
       this.$router.push({ name: page });
@@ -164,11 +190,147 @@
     returnPage() {
       window.location.reload();
     },
+    nextProblem() {
+      if (
+        this.currentProblemIndex <
+        this.$store.state.currentLearningIds.length - 1
+      ) {
+        this.$store.dispatch("goToNextProblem");
+        this.handleProblemDetail(this.currentLearningId);
+        this.goToPage(this.problemType);
+      } else {
+        // 마지막 문제면 이동
+        this.goToPage("Chapter4");
+      }
+    },
+    previousProblem() {
+      if (this.currentProblemIndex > 0) {
+        this.$store.dispatch("goToPreviousProblem");
+        this.handleProblemDetail(this.currentLearningId);
+        this.goToPage(this.problemType);
+      }
+    },
+
+    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";
+      } 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";
+      }
+    },
+
+    fetchProblemData() {
+      axios({
+        url: "/problem/problemInfo.json",
+        method: "post",
+        headers: {
+          "Content-Type": "application/json; charset=UTF-8",
+        },
+        data: {
+          prblmId: this.prblm_id.prblm_id,
+        },
+      })
+        .then((response) => {
+          this.problemData = response.data;
+          console.log("problemData", this.problemData);
+
+          this.sortingProblem();
+        })
+        .catch((error) => {
+          this.state = "noProblem";
+          console.error("Error fetching problemData:", error);
+        });
+    },
+
+    sortingProblem() {
+      this.problem = this.problemData.problem.prblmExpln;
+
+      for (let i = 0; i < this.problemData.problemDetail.length; i++) {
+        // this.answerArr[i].prblmDtlExpln =
+        //   this.problemData.problemDetail[i].prblmDtlExpln;
+        // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn;
+        this.answerArr[i] = this.problemData.problemDetail[i];
+        this.choice[i] = this.problemData.problemDetail[i].prblmDtlExpln;
+      }
+      console.log("answerArr", this.answerArr);
+
+      for (let i = 0; i < this.answerArr.length; i++) {
+        if (this.answerArr[i].prblmYn == "Y") {
+          this.answer = i + 1;
+          break;
+        }
+      }
+    },
   },
-  watch: {},
-  computed: {},
-  components: {},
-  mounted() { },
+  computed: {
+    currentLearningId() {
+      return this.$store.getters.currentLearningId;
+    },
+    currentLabel() {
+      return this.$store.getters.currentLabel;
+    },
+    currentProblemIndex() {
+      return this.$store.getters.currentProblemIndex;
+    },
+    isPreviousButtonDisabled() {
+      return this.currentProblemIndex === 0;
+    },
+  },
+  created() {
+    console.log("Current Learning ID:", this.currentLearningId);
+    this.prblm_id = this.currentLearningId;
+    console.log("Current Label:", this.currentLabel);
+    console.log("Current Problem Index:", this.currentProblemIndex);
+
+    // Fetch or process the current problem based on `currentLearningId`
+  },
+  mounted() {
+    this.fetchProblemData();
+  },
 };
 </script>
 <style scoped>
@@ -218,7 +380,7 @@
   cursor: pointer;
 }
 
-.pickGroup article>div>p {
+.pickGroup article > div > p {
   font-size: 24px;
 }
 
@@ -266,6 +428,6 @@
   padding: 10px 30px;
   border-radius: 10px;
   font-size: 28px;
-  font-family: 'ONEMobilePOPOTF';
+  font-family: "ONEMobilePOPOTF";
 }
 </style>
Add a comment
List