jichoi / lms_front star
PsHooN7979 2024-08-23
240823 박세훈 Chapter3 문제들 수정
@33a2bd707a9411394ce6eb4446e4b6a8d239b65c
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