jichoi / lms_front star
박민혁 박민혁 2024-08-23
Merge branch 'master' of http://210.180.118.83/jichoi/lms_front
@44fac4ed3cf91ee213afd321d4cb17f4077d55eb
client/views/pages/main/Chapter/Chapter2.vue
--- client/views/pages/main/Chapter/Chapter2.vue
+++ client/views/pages/main/Chapter/Chapter2.vue
@@ -18,7 +18,8 @@
       <button class="completeBtn" @click="complete">학습 종료</button>
     </div>
     <div class="flex justify-between align-center">
-      <div class="pre-btn" @click="goToPage('Chapter1_3')">
+    
+      <div class="pre-btn" @click="goToPage('Chapter1_3')"> <!-- @click="goToPrevPage" -->
         <img src="../../../../resources/img/left.png" alt="" />
       </div>
       <div class="content title-box">
@@ -75,7 +76,7 @@
           </div>
         </div>
       </div>
-      <div class="next-btn" @click="goToPage('Chapter2_3')">
+      <div class="next-btn" @click="goToPage('Chapter2_3')"> <!-- @click="goToNextPage" -->
         <img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
@@ -90,11 +91,22 @@
     return {
       wdBookId: "WORD_BOOK_000000000000042",
       wordList: [],
-      wordContentList: [],
-      wdContentId: "",
+
+      wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트
+      currentWdBkIndex: 0, // 현재 단어장 인덱스
+      wdBookTypeIdState: "", // 이동할 페이지 타입 id
+      wordBookType: "", // 이동할 페이지
     };
   },
   methods: {
+    pageSetting() {
+      this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스
+      this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트
+      this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex] // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id
+
+      // this.fetchWordList();
+    },
+
     async fetchWordList() {
       try {
         const response = await axios.post("/word/getWordsByBookId.json", {
@@ -126,6 +138,88 @@
       }
     },
 
+    async goToPrevPage() {
+      if (this.currentWdBkIndex - 1 < 0) {
+        alert("단어장 첫번째 페이지 입니다");
+      } else {
+        this.currentWdBkIndex--;
+        this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex);
+
+        try {
+          const response = await axios.post("/wordbook/find.json", {
+            wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex]
+          });
+          this.wdBookTypeIdState = response.data.wdBookTypeId;
+          console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState);
+
+          switch (this.wdBookTypeIdState) {
+            case "1":
+                this.wordBookType = "Chapter2";
+                break;
+            case "2":
+                this.wordBookType = "Chapter2_3";
+                break;
+            case "3":
+                this.wordBookType = "Chapter2_2";
+                break;
+            case "4":
+                this.wordBookType = "Chapter2_9";
+                break;
+            case "5":
+                this.wordBookType = "Chapter2_4";
+                break;
+            default:
+                this.wordBookType = null;
+          }
+          
+          this.goToPage(this.wordBookType); 
+        } catch (error) {
+          console.error('단어장 정보 불러오는 중 오류 발생:', error);
+        }
+      }
+    },
+
+    async goToNextPage() {
+      if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) {
+        alert("단어장 마지막 페이지 입니다");
+      } else {
+        this.currentWdBkIndex++;
+        this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex);
+
+        try {
+          const response = await axios.post("/wordbook/find.json", {
+            wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex]
+          });
+          this.wdBookTypeIdState = response.data.wdBookTypeId;
+          console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState);
+
+          switch (this.wdBookTypeIdState) {
+            case "1":
+                this.wordBookType = "Chapter2";
+                break;
+            case "2":
+                this.wordBookType = "Chapter2_3";
+                break;
+            case "3":
+                this.wordBookType = "Chapter2_2";
+                break;
+            case "4":
+                this.wordBookType = "Chapter2_9";
+                break;
+            case "5":
+                this.wordBookType = "Chapter2_4";
+                break;
+            default:
+                this.wordBookType = null;
+          }
+          
+          this.goToPage(this.wordBookType); 
+        } catch (error) {
+          console.error('단어장 정보 불러오는 중 오류 발생:', error);
+        }
+      }
+    },
+
     goToPage(page) {
       this.$router.push({ name: page });
     },
@@ -142,6 +236,7 @@
   },
   mounted() {
     console.log("챕터2 단어장 마운트 완료");
+    // this.pageSetting();
     this.fetchWordList();
   },
 };
client/views/pages/main/Chapter/Chapter2_2.vue
--- client/views/pages/main/Chapter/Chapter2_2.vue
+++ client/views/pages/main/Chapter/Chapter2_2.vue
@@ -45,7 +45,7 @@
             <button class="popTxt" v-for="(item, index) in items" :key="index">
               <div class="listenGroup">
                 <img :src="item.imgSrc1" />
-                <p class="textbox"><img :src="item.imgSrc" /></p>
+                <p class="textbox"><img :src="item.imgSrc" style="height: 150px;"/></p>
               </div>
               <div
                 class="listenGroup"
@@ -73,36 +73,37 @@
 export default {
   data() {
     return {
-      items: [
-        {
-          imgSrc1: "client/resources/img/img49_s.png",
-          imgSrc2: "client/resources/img/img50_s.png",
-          imgSrc: "client/resources/img/img77_41s.png",
-          isSecondImageVisible: false,
-          title: "america",
-        },
-        {
-          imgSrc1: "client/resources/img/img49_s.png",
-          imgSrc2: "client/resources/img/img50_s.png",
-          imgSrc: "client/resources/img/img47_s.png",
-          isSecondImageVisible: false,
-          title: "airplane",
-        },
-        {
-          imgSrc1: "client/resources/img/img49_s.png",
-          imgSrc2: "client/resources/img/img50_s.png",
-          imgSrc: "client/resources/img/img75_41s.png",
-          isSecondImageVisible: false,
-          title: "cat",
-        },
-        {
-          imgSrc1: "client/resources/img/img49_s.png",
-          imgSrc2: "client/resources/img/img50_s.png",
-          imgSrc: "client/resources/img/img74_41s.png",
-          isSecondImageVisible: false,
-          title: "mountain",
-        },
-      ],
+      // items: [
+      //   {
+      //     imgSrc1: "client/resources/img/img49_s.png",
+      //     imgSrc2: "client/resources/img/img50_s.png",
+      //     imgSrc: "client/resources/img/img77_41s.png",
+      //     isSecondImageVisible: false,
+      //     title: "america",
+      //   },
+      //   {
+      //     imgSrc1: "client/resources/img/img49_s.png",
+      //     imgSrc2: "client/resources/img/img50_s.png",
+      //     imgSrc: "client/resources/img/img47_s.png",
+      //     isSecondImageVisible: false,
+      //     title: "airplane",
+      //   },
+      //   {
+      //     imgSrc1: "client/resources/img/img49_s.png",
+      //     imgSrc2: "client/resources/img/img50_s.png",
+      //     imgSrc: "client/resources/img/img75_41s.png",
+      //     isSecondImageVisible: false,
+      //     title: "cat",
+      //   },
+      //   {
+      //     imgSrc1: "client/resources/img/img49_s.png",
+      //     imgSrc2: "client/resources/img/img50_s.png",
+      //     imgSrc: "client/resources/img/img74_41s.png",
+      //     isSecondImageVisible: false,
+      //     title: "mountain",
+      //   },
+      // ],
+      items: [],
       timer: 0,
       intervalId: null,
       currentIndex: 0,
@@ -118,14 +119,44 @@
       this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스
       this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트
       this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex] // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id
+      console.log(this.wdBookId);
 
-      // this.fetchWordList();
+      this.fetchWordList();
     },
 
     async fetchWordList() {
-      console.log("현재 단어장 콘텐츠 인덱스: ", this.$store.getters.getCurrentWdBkIndex);
-      this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex;
-      console.log("현재 단어장 콘텐츠 인덱스에 대한 단어장 id: ", this.$store.getters.getWdBookIdList[this.currentWdBkIndex]);
+      try {
+        const response = await axios.post('/word/getWordsByBookId.json', {
+          wdBookId: this.wdBookId,
+        });
+
+        const wordList = response.data;
+
+        // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리
+        const requests = wordList.map(async (word) => {
+          const fileResponse = await axios.post("/file/find.json", {
+            file_mng_id: word.fileMngId,
+          });
+
+          const fileRpath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileRpath : null;
+          console.log("각 단어의 fileRpath: ", fileRpath);
+
+          // items 배열에 새로운 항목 추가
+          this.items.push({
+            imgSrc1: "client/resources/img/img49_s.png",
+            imgSrc2: "client/resources/img/img50_s.png",
+            imgSrc: "http://165.229.169.113:9080/" + fileRpath, // 받아온 fileRpath로 이미지 설정
+            isSecondImageVisible: false, 
+            title: word.wdNm,
+          });
+        });
+
+        // 모든 요청이 완료될 때까지 대기
+        await Promise.all(requests);
+
+      } catch (error) {
+        console.error('단어 목록을 불러오는 중 오류 발생:', error);
+      }
     },
 
     async goToPrevPage() {
client/views/pages/main/Chapter/Chapter2_3.vue
--- client/views/pages/main/Chapter/Chapter2_3.vue
+++ client/views/pages/main/Chapter/Chapter2_3.vue
@@ -15,7 +15,7 @@
             <button class="completeBtn" @click="complete">학습 종료</button>
         </div>
         <div class="flex justify-between align-center">
-            <div class="pre-btn" @click="goToPage('Chapter2')">
+            <div class="pre-btn" @click="goToPage('Chapter2')"> <!-- @click="goToPrevPage" -->
                 <img src="../../../../resources/img/left.png" alt="" />
             </div>
             <div class="content title-box">
@@ -71,7 +71,7 @@
                     </div>
                 </div>
             </div>
-            <div class="next-btn" @click="goToPage('Chapter2_2')">
+            <div class="next-btn" @click="goToPage('Chapter2_2')"> <!-- @click="goToNextPage" -->
                 <img src="../../../../resources/img/right.png" alt="" />
             </div>
         </div>
@@ -106,9 +106,103 @@
             nowWord: 'cloud',
 
             wdBookId: "WORD_BOOK_000000000000043",
+            wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트
+            currentWdBkIndex: 0, // 현재 단어장 인덱스
+            wdBookTypeIdState: "", // 이동할 페이지 타입 id
+            wordBookType: "", // 이동할 페이지
         };
     },
     methods: {
+        pageSetting() {
+            this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스
+            this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트
+            this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex] // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id
+
+            // this.fetchWordList();
+        },
+
+        async goToPrevPage() {
+            if (this.currentWdBkIndex - 1 < 0) {
+                alert("단어장 첫번째 페이지 입니다");
+            } else {
+                this.currentWdBkIndex--;
+                this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex);
+
+                try {
+                    const response = await axios.post("/wordbook/find.json", {
+                        wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex]
+                    });
+                    this.wdBookTypeIdState = response.data.wdBookTypeId;
+                    console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState);
+
+                    switch (this.wdBookTypeIdState) {
+                        case "1":
+                            this.wordBookType = "Chapter2";
+                            break;
+                        case "2":
+                            this.wordBookType = "Chapter2_3";
+                            break;
+                        case "3":
+                            this.wordBookType = "Chapter2_2";
+                            break;
+                        case "4":
+                            this.wordBookType = "Chapter2_9";
+                            break;
+                        case "5":
+                            this.wordBookType = "Chapter2_4";
+                            break;
+                        default:
+                            this.wordBookType = null;
+                    }
+                    
+                    this.goToPage(this.wordBookType); 
+                } catch (error) {
+                    console.error('단어장 정보 불러오는 중 오류 발생:', error);
+                }
+            }
+        },
+
+        async goToNextPage() {
+            if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) {
+                alert("단어장 마지막 페이지 입니다");
+            } else {
+                this.currentWdBkIndex++;
+                this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex);
+
+                try {
+                    const response = await axios.post("/wordbook/find.json", {
+                        wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex]
+                    });
+                    this.wdBookTypeIdState = response.data.wdBookTypeId;
+                    console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState);
+
+                    switch (this.wdBookTypeIdState) {
+                        case "1":
+                            this.wordBookType = "Chapter2";
+                            break;
+                        case "2":
+                            this.wordBookType = "Chapter2_3";
+                            break;
+                        case "3":
+                            this.wordBookType = "Chapter2_2";
+                            break;
+                        case "4":
+                            this.wordBookType = "Chapter2_9";
+                            break;
+                        case "5":
+                            this.wordBookType = "Chapter2_4";
+                            break;
+                        default:
+                            this.wordBookType = null;
+                    }
+                    
+                    this.goToPage(this.wordBookType); 
+                } catch (error) {
+                    console.error('단어장 정보 불러오는 중 오류 발생:', error);
+                }
+            }
+        },
+
         complete() {
             const { unit_id, book_id } = this.$route.query;
             this.$router.push({ name: 'Dashboard', query: { value: 2, unit_id, book_id } });
@@ -264,6 +358,7 @@
         },
     },
     mounted() {
+        // this.pageSetting();
         this.fetchWordList();
     },
     beforeDestroy() {
client/views/pages/main/Chapter/Chapter3.vue
--- client/views/pages/main/Chapter/Chapter3.vue
+++ client/views/pages/main/Chapter/Chapter3.vue
@@ -53,24 +53,6 @@
                                 <p>{{ item.prblmDtlExpln }}</p>
                             </div>
                         </article>
-                        <!-- <article class="flex justify-center mb50" style="gap: 60px">
-                            <div class="flex" @click="handleClick(2)">
-                                <button>
-                                    <img src="../../../../resources/img/img136_71s.png" alt="" />
-                                    <p :class="{ active: selectedButton === 2 }">2</p>
-                                </button>
-                                <p>violin</p>
-                            </div>
-                        </article>
-                        <article class="flex justify-center" style="gap: 60px">
-                            <div class="flex" @click="handleClick(3)">
-                                <button>
-                                    <img src="../../../../resources/img/img136_71s.png" alt="" />
-                                    <p :class="{ active: selectedButton === 3 }">3</p>
-                                </button>
-                                <p>piano</p>
-                            </div>
-                        </article> -->
                     </div>
                 </div>
                 <button class="submit-button" @click="handleSubmit()">제출하기</button>
@@ -119,9 +101,7 @@
         },
         handleClick(answer) {
             console.log(answer)
-            this.$store.dispatch('updatePrblmAns', answer);
             this.selectedButton = answer;
-
         },
         // 제출하기 버튼
         handleSubmit() {
@@ -156,6 +136,7 @@
                 prblmAns: this.selectedButton
             }
             this.$store.dispatch('saveProblemData', problemData);
+            console.log(this.$store.getters.getAllProblems)
             if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
                 this.$store.dispatch('goToNextProblem');
                 this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_1.vue
--- client/views/pages/main/Chapter/Chapter3_1.vue
+++ client/views/pages/main/Chapter/Chapter3_1.vue
@@ -32,16 +32,16 @@
           </div>
           <div class="pickGroup">
             <div class="flex" style="gap: 250px">
-              <article class="text-ct" @click="handleClick(1)">
+              <article class="text-ct" @click="handleClick('A')">
                 <div class="mb30"><img src="../../../../resources/img/img107_50s.png" alt="" /></div>
                 <button class="popTxt">
-                  <img :src="selectedButton === 1 ? selectedbuttonImg : buttonImg" alt="" />
+                  <img :src="selectedButton === 'A' ? selectedbuttonImg : buttonImg" alt="" />
                 </button>
               </article>
-              <article class="text-ct" @click="handleClick(2)">
+              <article class="text-ct" @click="handleClick('B')">
                 <div class="mb30"><img src="../../../../resources/img/img108_50s.png" alt="" /></div>
                 <button class="popTxt">
-                  <img :src="selectedButton === 2 ? selectedbuttonImg : buttonImg" alt="" />
+                  <img :src="selectedButton === 'B' ? selectedbuttonImg : buttonImg" alt="" />
                 </button>
               </article>
             </div>
@@ -124,6 +124,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_10.vue
--- client/views/pages/main/Chapter/Chapter3_10.vue
+++ client/views/pages/main/Chapter/Chapter3_10.vue
@@ -116,6 +116,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_11.vue
--- client/views/pages/main/Chapter/Chapter3_11.vue
+++ client/views/pages/main/Chapter/Chapter3_11.vue
@@ -115,6 +115,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_12.vue
--- client/views/pages/main/Chapter/Chapter3_12.vue
+++ client/views/pages/main/Chapter/Chapter3_12.vue
@@ -149,6 +149,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_13.vue
--- client/views/pages/main/Chapter/Chapter3_13.vue
+++ client/views/pages/main/Chapter/Chapter3_13.vue
@@ -54,10 +54,10 @@
               </div>
 
               <div class="pickGroup right">
-                <article v-for="(word, index) in question" :key="index" class="flex align-center justify-start mb20"
-                  style="gap: 30px">
+                <article v-for="(word, index) in problemDetail" :key="index"
+                  class="flex align-center justify-start mb20" style="gap: 30px">
                   <button class="blue-c" @click="selectRight(index, $event)"></button>
-                  <p class="word">{{ word }}</p>
+                  <p class="word">{{ word.prblmDtlExpln }}</p>
                 </article>
               </div>
             </div>
@@ -185,6 +185,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_14.vue
--- client/views/pages/main/Chapter/Chapter3_14.vue
+++ client/views/pages/main/Chapter/Chapter3_14.vue
@@ -42,7 +42,7 @@
         </div>
         <button class="submit-button" @click="handleSubmit()">제출하기</button>
       </div>
-      <div class="next-btn" @click="nextProblem()"><img src="../../../../resources/img/right.png" alt="" />
+      <div class="next-btn" @click="nextProblem(answer)"><img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
   </div>
@@ -76,9 +76,6 @@
         }
       }, 1000);
     },
-    handleSubmit() {
-      console.log("정답 : ", this.answer);
-    },
     getProblem() {
       const vm = this;
       const prblmId = this.currentLearningId.prblm_id;
@@ -101,13 +98,14 @@
           console.log("problem - error : ", error);
         });
     },
-    nextProblem() {
+    nextProblem(answer) {
       const problemData = {
         prblmImfo: this.currentLearningId,
         prblmNumber: this.currentProblemIndex,
-        prblmAns: this.selectedButton
+        prblmAns: answer
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_15.vue
--- client/views/pages/main/Chapter/Chapter3_15.vue
+++ client/views/pages/main/Chapter/Chapter3_15.vue
@@ -101,6 +101,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_2.vue
--- client/views/pages/main/Chapter/Chapter3_2.vue
+++ client/views/pages/main/Chapter/Chapter3_2.vue
@@ -131,6 +131,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_3.vue
--- client/views/pages/main/Chapter/Chapter3_3.vue
+++ client/views/pages/main/Chapter/Chapter3_3.vue
@@ -31,14 +31,14 @@
           </div>
           <div class="pickGroup mt60 flex align-center justify-center"
             style="flex-wrap: wrap; gap: 100px; margin-top: 7%; margin-left: 5%">
-            <article v-for="(detail, index) in problemDetail" :key="index"
+            <article v-for="(item, index) in problemDetail" :key="index"
               style="flex: 1 0 calc(50% - 100px); bottom: 159px; left: 242px">
-              <div class="flex align-center" @click="handleClick(item)">
+              <div class="flex align-center" @click="handleClick(item.prblmDtlExpln)">
                 <button>
                   <img src="../../../../resources/img/img136_71s.png" alt="" />
-                  <p :class="{ active: selectedButton === item }">{{ index + 1 }}</p>
+                  <p :class="{ active: selectedButton === item.prblmDtlExpln }">{{ index + 1 }}</p>
                 </button>
-                <p>{{ detail.prblmDtlExpln }}</p>
+                <p>{{ item.prblmDtlExpln }}</p>
               </div>
             </article>
           </div>
@@ -120,6 +120,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_3_1.vue
--- client/views/pages/main/Chapter/Chapter3_3_1.vue
+++ client/views/pages/main/Chapter/Chapter3_3_1.vue
@@ -137,6 +137,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_4.vue
--- client/views/pages/main/Chapter/Chapter3_4.vue
+++ client/views/pages/main/Chapter/Chapter3_4.vue
@@ -42,10 +42,10 @@
             <article v-for="(item, index) in problemDetail" :key="index"
               style="flex: 1 0 calc(50% - 100px); bottom: 159px; left: 242px">
               <div class="flex align-center">
-                <button @click="submitAnswer(item)">
+                <button @click="handleClick(item.prblmDtlExpln)">
                   <img src="../../../../resources/img/img136_71s.png" alt="" />
                   <p :class="{
-                    active: answer === item.prblmDtlExpln,
+                    active: selectedButton === item.prblmDtlExpln,
                   }">
                     {{ index + 1 }}
                   </p>
@@ -53,37 +53,11 @@
                 <p>{{ item.prblmDtlExpln }}</p>
               </div>
             </article>
-            <!-- <article style="gap: 60px; bottom: 159px; right: 559px">
-                            <div class="flex align-center">
-                                <button>
-                                    <img
-                                        src="../../../../resources/img/img136_71s.png"
-                                        alt=""
-                                    />
-                                    <p>2</p>
-                                </button>
-                                <p>b</p>
-                            </div>
-                        </article>
-                        <article style="gap: 60px; bottom: 159px; right: 559px">
-                            <div class="flex align-center">
-                                <button>
-                                    <img
-                                        src="../../../../resources/img/img136_71s.png"
-                                        alt=""
-                                    />
-                                    <p>3</p>
-                                </button>
-                                <p>c</p>
-                            </div>
-                        </article> -->
           </div>
         </div>
         <button class="submit-button" @click="handleSubmit()">제출하기</button>
       </div>
-      <div class="next-btn" @click="
-        nextProblem()
-        ">
+      <div class="next-btn" @click="nextProblem()">
         <img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
@@ -101,7 +75,7 @@
       dataList: [],
       prblmExpln: null,
       accessTime: null,
-      answer: null,
+      selectedButton: null,
     };
   },
   methods: {
@@ -125,6 +99,9 @@
       const audio = document.getElementById("audio-player");
       audio.play();
       console.log("playing");
+    },
+    handleClick(number) {
+      this.selectedButton = number;
     },
     handleSubmit() {
       console.log("정답 : ", this.answer);
@@ -158,6 +135,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_5.vue
--- client/views/pages/main/Chapter/Chapter3_5.vue
+++ client/views/pages/main/Chapter/Chapter3_5.vue
@@ -136,6 +136,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_6.vue
--- client/views/pages/main/Chapter/Chapter3_6.vue
+++ client/views/pages/main/Chapter/Chapter3_6.vue
@@ -34,13 +34,24 @@
           <img src="../../../../resources/img/img114_57s.png" alt="" />
         </div> -->
 
-        <div class="flex justify-center">
-          <div class="btnGroup mt50 flex justify-between">
-            <button class="popTxt" v-for="(item, index) in items" :key="index" @click="updateContent(index)"
-              :class="{ active: selectedIndex === index }">
-              <img :src="item.imgSrc1" />
-              <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block" />
-            </button>
+        <div class="pickGroup flex align-center justify-center"
+          style="flex-wrap: wrap; gap: 100px; margin-top: 7%; margin-left: 5%">
+          <div class="pickGroup flex align-center justify-center"
+            style="flex-wrap: wrap; gap: 100px; margin-top: 7%; margin-left: 5%">
+            <article v-for="(item, index) in problemDetail" :key="index"
+              style="flex: 1 0 calc(50% - 100px); bottom: 159px; left: 242px">
+              <div class="flex align-center">
+                <button @click="handleClick(item.prblmDtlExpln)">
+                  <img src="../../../../resources/img/img136_71s.png" alt="" />
+                  <p :class="{
+                    active: selectedButton === item.prblmDtlExpln,
+                  }">
+                    {{ index + 1 }}
+                  </p>
+                </button>
+                <p>{{ item.prblmDtlExpln }}</p>
+              </div>
+            </article>
           </div>
         </div>
         <button class="submit-button" @click="handleSubmit()">제출하기</button>
@@ -69,6 +80,7 @@
       intervalId: null,
       dataList: [],
       problemDetail: [],
+      selectedButton: null,
     };
   },
   beforeDestroy() {
@@ -96,6 +108,9 @@
           clearInterval(this.intervalId);
         }
       }, 1000);
+    },
+    handleClick(number) {
+      this.selectedButton = number;
     },
     handleSubmit() {
       console.log("정답 : ", this.selectedIndex + 1);
@@ -134,6 +149,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
@@ -239,6 +255,29 @@
   left: 0;
 }
 
+.pickGroup p {
+  font-size: 34px;
+  font-weight: bold;
+}
+
+.pickGroup button {
+  position: relative;
+  margin-right: 30px;
+}
+
+.pickGroup button p {
+  font-size: 34px;
+  color: #c6c6c6;
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+}
+
+.pickGroup button p.active {
+  color: #000000;
+}
+
 .submit-button {
   position: absolute;
   background-color: #ffba08;
client/views/pages/main/Chapter/Chapter3_7.vue
--- client/views/pages/main/Chapter/Chapter3_7.vue
+++ client/views/pages/main/Chapter/Chapter3_7.vue
@@ -44,7 +44,7 @@
                 <div class="flex align-center">
                   <button @click="handleCheck('O')" name="O">
                     <img src="../../../../resources/img/img136_71s.png" alt="" />
-                    <p :class="{ active: answer === 'O' }">1</p>
+                    <p :class="{ active: selectedButton === 'O' }">1</p>
                   </button>
                   <img src="../../../../resources/img/img111_56s.png" alt="" />
                 </div>
@@ -53,7 +53,7 @@
                 <div class="flex align-center">
                   <button @click="handleCheck('X')" name="X">
                     <img src="../../../../resources/img/img136_71s.png" alt="" />
-                    <p :class="{ active: answer === 'X' }">2</p>
+                    <p :class="{ active: selectedButton === 'X' }">2</p>
                   </button>
                   <img src="../../../../resources/img/img112_56s.png" alt="" />
                 </div>
@@ -63,9 +63,7 @@
         </div>
         <button class="submit-button" @click="handleSubmit()">제출하기</button>
       </div>
-      <div class="next-btn" @click="
-        nextProblem()
-        ">
+      <div class="next-btn" @click="nextProblem()">
         <img src="../../../../resources/img/right.png" alt="" />
       </div>
     </div>
@@ -84,7 +82,7 @@
       dataList: [],
       prblmExpln: null,
       accessTime: null,
-      answer: null,
+      selectedButton: null,
       prblmLogAnsCnt: 0,
     };
   },
@@ -107,11 +105,11 @@
     },
 
     handleCheck(value) {
-      this.answer = value;
-      console.log(this.answer);
+      this.selectedButton = value;
+      console.log(this.selectedButton);
     },
     handleSubmit() {
-      console.log("정답 : ", this.answer);
+      console.log("정답 : ", this.selectedButton);
     },
     getProblem() {
       const vm = this;
@@ -142,6 +140,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_8.vue
--- client/views/pages/main/Chapter/Chapter3_8.vue
+++ client/views/pages/main/Chapter/Chapter3_8.vue
@@ -146,6 +146,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
client/views/pages/main/Chapter/Chapter3_9.vue
--- client/views/pages/main/Chapter/Chapter3_9.vue
+++ client/views/pages/main/Chapter/Chapter3_9.vue
@@ -149,6 +149,7 @@
         prblmAns: this.selectedButton
       }
       this.$store.dispatch('saveProblemData', problemData);
+      console.log(this.$store.getters.getAllProblems)
       if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) {
         this.$store.dispatch('goToNextProblem');
         this.handleProblemDetail(this.currentLearningId);
Add a comment
List