jichoi / lms_front star
dajeong 2024-08-14
240814 정다정 미니게임 로직 수정(배열, 열쇠, 도끼, 폭탄)
@71d6d88179346dd4c4c687e3be1b42958df9ff2c
client/views/pages/main/Chapter/Chapter2_10.vue
--- client/views/pages/main/Chapter/Chapter2_10.vue
+++ client/views/pages/main/Chapter/Chapter2_10.vue
@@ -1,6 +1,6 @@
 <template>
   <div id="Chapter1_1" class="content-wrap">
-    <div style="margin: 30px 0px 50px">
+    <div style="margin: 30px 0px 50px; width: 20%">
       <router-link to="/MyPlan.page">
         <div class="logo mb25">
           <img src="../../../../resources/img/logo2.png" alt="" />
@@ -16,7 +16,13 @@
         <img src="../../../../resources/img/left.png" alt="" />
       </div>
       <div class="content title-box">
-        <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p>
+        <div style="display: flex; justify-content: space-between">
+          <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p>
+          <button id="returnButton" @click="returnPage" style="margin: 4rem">
+            <img src="../../../../resources/img/btn_return_50x50.png" alt="" />
+            <p>되돌리기</p>
+          </button>
+        </div>
         <div class="flex align-center mb30">
           <p class="subtitle2 mr20">
             방문이 자물쇠로 잠겨져 있네? 세 개 중에 맞는 열쇠 하나를 찾아줘!
@@ -48,7 +54,7 @@
             <div class="pickChoice">
               <article class="flex justify-center mb50" style="gap: 60px">
                 <div class="flex" style="align-items: center">
-                  <button @click="handleClick(`${choice[0]}`, 1)">
+                  <button @click="handleClick(1)">
                     <img
                       src="../../../../resources/img/img136_71s.png"
                       alt=""
@@ -60,7 +66,7 @@
               </article>
               <article class="flex justify-center mb50" style="gap: 60px">
                 <div class="flex" style="align-items: center">
-                  <button @click="handleClick(`${choice[1]}`, 2)">
+                  <button @click="handleClick(2)">
                     <img
                       src="../../../../resources/img/img136_71s.png"
                       alt=""
@@ -72,7 +78,7 @@
               </article>
               <article class="flex justify-center" style="gap: 60px">
                 <div class="flex" style="align-items: center">
-                  <button @click="handleClick(`${choice[2]}`, 3)">
+                  <button @click="handleClick(3)">
                     <img
                       src="../../../../resources/img/img136_71s.png"
                       alt=""
@@ -84,6 +90,9 @@
               </article>
             </div>
           </div>
+        </div>
+        <div style="text-align: right">
+          <button class="answerButton" @click="confirmAnswer">정답 확인</button>
         </div>
       </div>
       <div class="next-btn" @click="goToPage('Chapter2_11')">
@@ -103,7 +112,7 @@
       beforeQuestion: "Tell me",
       afterQuestion: "Why",
       choice: ["You are so upset", "You is so upset", "You am so upset"],
-      answer: 0,
+      answer: 1,
     };
   },
   methods: {
@@ -119,14 +128,25 @@
       }
     },
 
-    handleClick(text, buttonNumber) {
-      this.selectedButton = buttonNumber; // 선택된 버튼 번호를 저장
+    handleClick(buttonNumber) {
+      this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장
+    },
 
-      if (text === this.choice[this.answer]) {
+    confirmAnswer() {
+      if (this.selectedButton === null) {
+        alert("정답을 선택해주세요.");
+        return;
+      }
+      if (this.selectedButton === this.answer) {
         alert("정답입니다!");
       } else {
         alert("오답입니다!");
       }
+      this.selectedButton = null;
+    },
+
+    returnPage() {
+      window.location.reload();
     },
   },
 
@@ -203,4 +223,14 @@
   flex-direction: column;
   align-items: flex-start;
 }
+
+.answerButton {
+  background-color: #ffc107;
+  border-radius: 30px;
+  padding: 20px 50px;
+  margin: 40px;
+  font-family: "ONEMobileOTF-Regular";
+  font-weight: bold;
+  font-size: 24px;
+}
 </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
@@ -1,6 +1,6 @@
 <template>
   <div id="Chapter1_1" class="content-wrap">
-    <div style="margin: 30px 0px 50px">
+    <div style="margin: 30px 0px 50px; width: 20%">
       <router-link to="/MyPlan.page">
         <div class="logo mb25">
           <img src="../../../../resources/img/logo2.png" alt="" />
@@ -16,10 +16,17 @@
         <img src="../../../../resources/img/left.png" alt="" />
       </div>
       <div class="content title-box">
-        <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p>
+        <div style="display: flex; justify-content: space-between">
+          <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p>
+          <button id="returnButton" @click="returnPage" style="margin: 4rem">
+            <img src="../../../../resources/img/btn_return_50x50.png" alt="" />
+            <p>되돌리기</p>
+          </button>
+        </div>
+
         <div class="flex align-center mb30">
           <p class="subtitle2 mr20">
-            빈칸에 들어갈 알맞은 낱말을 골라 문장 완성시키기
+            앗! 도끼가 물에 빠졌어! 어느 것이 내 도끼일까?
           </p>
           <!-- <button><img src="../../../../resources/img/btn10_s.png" alt="">
           </button> -->
@@ -42,7 +49,7 @@
               <div class="flex">
                 <button @click="handleClick(1)">
                   <img src="../../../../resources/img/img136_71s.png" alt="" />
-                  <p>1</p>
+                  <p :class="{ active: selectedButton === 1 }">1</p>
                 </button>
                 <p>{{ choice[0] }}</p>
               </div>
@@ -54,11 +61,16 @@
               <div class="flex">
                 <button @click="handleClick(2)">
                   <img src="../../../../resources/img/img136_71s.png" alt="" />
-                  <p>2</p>
+                  <p :class="{ active: selectedButton === 2 }">2</p>
                 </button>
                 <p>{{ choice[1] }}</p>
               </div>
             </article>
+            <div class="answerBox">
+              <button class="answerButton" @click="confirmAnswer">
+                정답 확인
+              </button>
+            </div>
           </div>
         </div>
       </div>
@@ -73,6 +85,8 @@
 export default {
   data() {
     return {
+      selectedButton: null,
+
       beforeQuestion: "I",
       afterQuestion: "very hungry.",
 
@@ -84,12 +98,26 @@
     goToPage(page) {
       this.$router.push({ name: page });
     },
+
     handleClick(buttonNumber) {
-      if (buttonNumber === this.answer) {
+      this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장
+    },
+
+    confirmAnswer() {
+      if (this.selectedButton === null) {
+        alert("정답을 선택해주세요.");
+        return;
+      }
+      if (this.selectedButton === this.answer) {
         alert("정답입니다!");
       } else {
         alert("오답입니다!");
       }
+      this.selectedButton = null;
+    },
+
+    returnPage() {
+      window.location.reload();
     },
   },
   watch: {},
@@ -127,6 +155,10 @@
   font-size: 64px;
 }
 
+.pickGroup button p.active {
+  color: #000; /* 선택된 버튼의 숫자 색을 더 진하게 */
+}
+
 .inputGroup {
   display: flex;
   align-items: center;
@@ -136,4 +168,19 @@
 .inputGroup p {
   font-size: 28px;
 }
+
+.answerBox {
+  margin-top: -87px;
+  margin-right: 10px;
+  text-align: right;
+}
+.answerButton {
+  background-color: #ffc107;
+  border-radius: 30px;
+  padding: 20px 50px;
+  margin: 40px;
+  font-family: "ONEMobileOTF-Regular";
+  font-weight: bold;
+  font-size: 24px;
+}
 </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
@@ -1,85 +1,121 @@
 <template>
   <div id="Chapter1_1" class="content-wrap">
-    <div style="margin: 30px 0px 50px">
-        <router-link to="/MyPlan.page">
-          <div class="logo mb25"><img src="../../../../resources/img/logo2.png" alt=""></div>
-        </router-link>
+    <div style="margin: 30px 0px 50px; width: 20%">
+      <router-link to="/MyPlan.page">
+        <div class="logo mb25">
+          <img src="../../../../resources/img/logo2.png" alt="" />
+        </div>
+      </router-link>
     </div>
     <div class="title-box mb25 flex align-center mt40">
       <span class="title mr40">1. Hello WORLD</span>
       <span class="subtitle">my name is dd</span>
     </div>
     <div class="flex justify-between align-center">
-      <div class="pre-btn" @click="goToPage('Chapter2_11')"><img src="../../../../resources/img/left.png" alt=""></div>
+      <div class="pre-btn" @click="goToPage('Chapter2_11')">
+        <img src="../../../../resources/img/left.png" alt="" />
+      </div>
       <div class="content title-box">
-        <p class="title mt25 title-bg">step2</p>
-          <div class="flex align-center mb30">
-          <p class="subtitle2 mr20">객관식 미니게임</p>
-          <!-- <button><img src="../../../../resources/img/btn10_s.png" alt="">
-          </button> -->
+        <div style="display: flex; justify-content: space-between">
+          <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p>
+          <button id="returnButton" @click="returnPage" style="margin: 4rem">
+            <img src="../../../../resources/img/btn_return_50x50.png" alt="" />
+            <p>되돌리기</p>
+          </button>
         </div>
 
-        <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%;">
-              <div class="time-bg">
-                  <div>
-                    <div class="time">
-                      <p class="second">{{ timer }}</p>
-                      <p class="text">sec</p>
-                    </div>
-                  </div>
-                </div>
-              <div class="textbox ">
-                <p class="title1 text-lf"> 문제</p>
-                <div class="pickGroup">
-                  <div>
-                <article  class="flex mb10" style="gap: 60px;">
-                  <div class="flex align-center">
-                    <button><img src="../../../../resources/img/img136_71s.png" alt="">
-                      <p>1</p>
-                    </button>
-                    <p class="red">a</p>
-                  </div>
-                </article>
-                <article  class="flex mb10" style="gap: 60px;">
-                  <div class="flex align-center">
-                    <button><img src="../../../../resources/img/img136_71s.png" alt="">
-                      <p>2</p>
-                    </button>
-                    <p class="orange">a</p>
-                  </div>
-                </article>
-                <article  class="flex mb10" style="gap: 60px;">
-                  <div class="flex align-center">
-                    <button><img src="../../../../resources/img/img136_71s.png" alt="">
-                      <p>3</p>
-                    </button>
-                    <p class="blue">a</p>
-                  </div>
-                </article>
-                <article  class="flex " style="gap: 60px;">
-                  <div class="flex align-center">
-                    <button><img src="../../../../resources/img/img136_71s.png" alt="">
-                      <p>4</p>
-                    </button>
-                    <p class="green">a</p>
-                  </div>
-                </article>
-              </div>
-                </div>
-                <!-- 오답일 경우 아래의 이미지가 보여야함 -->
-                <!-- <div class="flex justify-center wrong-anwser" style="gap: 20px;">
-                  <img src="../../../../resources/img/img165_46s.png" alt="">
-                </div> -->
-  
+        <div class="flex align-center mb30 questionBox">
+          <p class="subtitle2 mr20">문제를 맞춰 폭탄을 제거해줘!</p>
+          <div style="height: 130px">
+            <div>
+              <div>
+                <p class="second"></p>
+                <p class="text"></p>
               </div>
             </div>
           </div>
         </div>
+
+        <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%"
+              />
+
+              <div class="textbox">
+                <p class="little-title">{{ problem }}</p>
+                <div class="pickGroup">
+                  <article class="flex mb10" style="gap: 60px">
+                    <div class="flex align-center" @click="handleClick(1)">
+                      <button>
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
+                        <p :class="{ active: selectedButton === 1 }">1</p>
+                      </button>
+                      <p class="red">{{ choice[0] }}</p>
+                    </div>
+                  </article>
+                  <article class="flex mb10" style="gap: 60px">
+                    <div class="flex align-center" @click="handleClick(2)">
+                      <button>
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
+                        <p :class="{ active: selectedButton === 2 }">2</p>
+                      </button>
+                      <p class="orange">{{ choice[1] }}</p>
+                    </div>
+                  </article>
+                  <article class="flex mb10" style="gap: 60px">
+                    <div class="flex align-center" @click="handleClick(3)">
+                      <button>
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
+                        <p :class="{ active: selectedButton === 3 }">3</p>
+                      </button>
+                      <p class="blue">{{ choice[2] }}</p>
+                    </div>
+                  </article>
+                  <article class="flex" style="gap: 60px">
+                    <div class="flex align-center" @click="handleClick(4)">
+                      <button>
+                        <img
+                          src="../../../../resources/img/img136_71s.png"
+                          alt=""
+                        />
+                        <p :class="{ active: selectedButton === 4 }">4</p>
+                      </button>
+                      <p class="green">{{ choice[3] }}</p>
+                    </div>
+                  </article>
+                </div>
+              </div>
+              <!-- 오답일 경우 아래의 이미지가 보여야함 -->
+              <div
+                v-if="correct"
+                class="flex justify-center wrong-anwser"
+                style="gap: 20px"
+              >
+                <img src="../../../../resources/img/img165_46s.png" alt="" />
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="answerBox">
+          <button class="answerButton" @click="confirmAnswer">정답 확인</button>
+        </div>
       </div>
-      <div class="next-btn" @click="goToPage('Chapter3')"><img src="../../../../resources/img/right.png" alt=""></div>
+      <div class="next-btn" @click="goToPage('Chapter3')">
+        <img src="../../../../resources/img/right.png" alt="" />
+      </div>
     </div>
   </div>
 </template>
@@ -88,8 +124,20 @@
 export default {
   data() {
     return {
-      timer:'00'
-    }
+      timer: "00",
+      problem: "아래 보기 중 한국어 뜻과 영어 뜻이 다른 것은?",
+
+      choice: [
+        "apple - 사과",
+        "banana - 바나나",
+        "plum - 손바닥",
+        "watermelon - 수박",
+      ],
+      answer: 3,
+
+      selectedButton: null,
+      correct: false,
+    };
   },
   methods: {
     goToPage(page) {
@@ -107,35 +155,61 @@
           clearInterval(this.intervalId);
         }
       }, 1000);
-    }
-  },
-  watch: {
+    },
+    handleClick(buttonNumber) {
+      this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장
+    },
 
+    confirmAnswer() {
+      if (this.selectedButton === null) {
+        alert("정답을 선택해주세요.");
+        return;
+      }
+      if (this.selectedButton === this.answer) {
+        alert("정답입니다!");
+      } else {
+        this.correct = true;
+      }
+      this.selectedButton = null;
+    },
+    returnPage() {
+      window.location.reload();
+    },
   },
-  computed: {
-
-  },
-  components: {
-  },
-  mounted() {
-
-  }
-}
+  watch: {},
+  computed: {},
+  components: {},
+  mounted() {},
+};
 </script>
 <style scoped>
-.wrong-anwser{position: absolute; top: 51%;
-  left: 102%;
-  transform: translate(-50%, -50%);}
-.textbox{position: absolute;     top: 140px;
-  left: 45px;}
-  .time-bg{     top: 136px;
-    right: 124px;}
-  .pickGroup{margin: 45px 0 0 180px;}
+.wrong-anwser {
+  position: absolute;
+  top: 51%;
+  left: 45%;
+  transform: translate(-50%, -50%);
+}
+.textbox {
+  position: absolute;
+  top: 140px;
+  left: 45px;
+}
+.time-bg {
+  margin-right: 40px;
+  top: 136px;
+  right: 124px;
+}
+.pickGroup {
+  margin: 40px 0 0 180px;
+}
 .pickGroup button {
   position: relative;
   margin-right: 30px;
 }
-.pickGroup button img{width: 33px; height: 33px;}
+.pickGroup button img {
+  width: 33px;
+  height: 33px;
+}
 .pickGroup button p {
   font-size: 20px;
   color: #c6c6c6;
@@ -144,7 +218,46 @@
   left: 50%;
   transform: translate(-50%, -50%);
 }
-.pickGroup article >div >p {
+.pickGroup article {
+  cursor: pointer;
+}
+.pickGroup article > div > p {
   font-size: 24px;
 }
-</style>
(No newline at end of file)
+
+.pickGroup button p.active {
+  color: #000; /* 선택된 버튼의 숫자 색을 더 진하게 */
+}
+
+.little-title {
+  text-align: start;
+  font-size: 24px;
+  font-weight: bold;
+}
+
+.questionBox {
+  justify-content: space-between;
+  align-items: flex-start;
+}
+
+.imgGroup {
+  position: absolute;
+  top: 150px;
+  left: 30%;
+  width: fit-content;
+}
+
+.answerBox {
+  margin-top: 295px;
+  text-align: right;
+}
+.answerButton {
+  background-color: #ffc107;
+  border-radius: 30px;
+  padding: 20px 50px;
+  margin: 40px;
+  font-family: "ONEMobileOTF-Regular";
+  font-weight: bold;
+  font-size: 24px;
+}
+</style>
client/views/pages/main/Chapter/Chapter2_5.vue
--- client/views/pages/main/Chapter/Chapter2_5.vue
+++ client/views/pages/main/Chapter/Chapter2_5.vue
@@ -1,7 +1,7 @@
 <template>
   <div id="Chapter1_1" class="content-wrap">
-    <div style="margin: 30px 0px 50px">
-      <router-link router-link to="/MyPlan.page">
+    <div style="margin: 30px 0px 50px; width: 20%">
+      <router-link to="/MyPlan.page">
         <div class="logo mb25">
           <img src="../../../../resources/img/logo2.png" alt="" />
         </div>
@@ -16,9 +16,15 @@
         <img src="../../../../resources/img/left.png" alt="" />
       </div>
       <div class="content title-box">
-        <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p>
+        <div style="display: flex; justify-content: space-between">
+          <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p>
+          <button id="returnButton" @click="returnPage" style="margin: 4rem">
+            <img src="../../../../resources/img/btn_return_50x50.png" alt="" />
+            <p>되돌리기</p>
+          </button>
+        </div>
         <div class="flex align-center mb30">
-          <p class="subtitle2 mr20">아래 지문을 보고 빈칸을 채워주세요.</p>
+          <p class="subtitle2 mr20">그림을 보고 문장을 완성시켜줘!</p>
           <!-- <button><img src="../../../../resources/img/btn10_s.png" alt="">
               </button> -->
         </div>
@@ -124,7 +130,7 @@
     // 드롭 시 호출
     onDrop(event, index) {
       if (this.userAnswer[index] === "") {
-        this.userAnswer.splice(index, 1, this.draggedChar); // Vue 3에서는 $set 대신 splice 사용
+        this.userAnswer.splice(index, 1, this.draggedChar);
         const charIndex = this.choiceCharacters.indexOf(this.draggedChar);
         if (charIndex > -1) {
           this.choiceCharacters.splice(charIndex, 1); // 드래그한 문자를 choice에서 제거
@@ -136,17 +142,22 @@
     checkAnswer() {
       // userAnswer 배열이 모두 채워졌는지 확인
       if (!this.userAnswer.includes("")) {
-        if (this.userAnswer.join("") === this.answer) {
-          alert("정답입니다!");
-        } else {
-          alert("틀렸습니다. 다시 시도해보세요.");
-        }
+        setTimeout(() => {
+          if (this.userAnswer.join("") === this.answer) {
+            alert("정답입니다!");
+          } else {
+            alert("오답입니다!");
+          }
+        }, 0);
       }
     },
     initializeUserAnswer() {
       this.answerLength = this.answer.length; // answer의 길이를 answerLength에 설정
       this.userAnswer = Array(this.answerLength).fill(""); // answerLength만큼 빈 배열 생성
     },
+    returnPage() {
+      window.location.reload();
+    },
   },
   mounted() {
     this.splitExample();
Add a comment
List