jichoi / lms_front star
홍아랑 홍아랑 08-14
240814 홍아랑 다리 문제 로직 수정 및 되돌리기 버튼 추가
@439262b48f1c840ea2f2bc8053aec467bf1322cb
 
client/resources/img/btn_return.png (Binary) (added)
+++ client/resources/img/btn_return.png
Binary file is not shown
 
client/resources/img/btn_return_30x30.png (Binary) (added)
+++ client/resources/img/btn_return_30x30.png
Binary file is not shown
 
client/resources/img/btn_return_50x50.png (Binary) (added)
+++ client/resources/img/btn_return_50x50.png
Binary file is not shown
client/views/pages/main/Chapter/Chapter2_7.vue
--- client/views/pages/main/Chapter/Chapter2_7.vue
+++ client/views/pages/main/Chapter/Chapter2_7.vue
@@ -10,9 +10,15 @@
       <span class="subtitle">my name is dd</span>
     </div>
     <div class="flex justify-between align-center">
-      <div class="pre-btn" @click="goToPage('Chapter2_12')"><img src="../../../../resources/img/left.png" alt=""></div>
+      <div class="pre-btn" @click="goToPage('Chapter2_8')"><img src="../../../../resources/img/left.png" alt=""></div>
       <div class="content title-box">
-        <p class="title mt25 title-bg">step2</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>
         </div>
@@ -63,6 +69,10 @@
     goToPage(page) {
       this.$router.push({ name: page });
     },
+    returnPage() {
+      // 페이지 새로 고침
+      window.location.reload();
+    },
     handleDragStart(event) {
       // 드래그한 요소의 ID를 저장
       this.draggedElementId = event.target.id;
@@ -71,50 +81,39 @@
       const dropZone = event.target;
       const draggedElement = document.getElementById(this.draggedElementId);
 
-      // 이미 드롭된 요소가 있는지 확인 -> 수정필요
-      const existingElement = dropZone.querySelector('button');
-
-      if (existingElement) {
-        // 이미 드롭된 요소가 있다면 원래 위치로 되돌림
-        const dragGroup = document.querySelector('.dragGroup > div');
-        existingElement.style.visibility = 'visible';
-        existingElement.style.position = '';
-        existingElement.style.top = '';
-        existingElement.style.left = '';
-        dragGroup.appendChild(existingElement);
+      if (draggedElement) {
+        // 새로운 버튼을 드롭 영역에 추가
+        const cloneElement = draggedElement.cloneNode(true);
+        cloneElement.style.position = 'absolute';
+        cloneElement.style.top = "-70px";
+        cloneElement.style.left = "-50px";
+        dropZone.innerHTML = ""; // 기존 ? 텍스트 제거
+        dropZone.appendChild(cloneElement);
+        
+        // 드래그한 버튼 숨기기
+        draggedElement.style.visibility = "hidden";
+        
+        // DOM 업데이트 후 알림을 비동기적으로 처리
+        setTimeout(() => {
+          if (this.draggedElementId === this.correctAnswer) {
+            alert("정답입니다!");
+            
+          } else {
+            alert("오답입니다!");
+            window.location.reload();
+          }
+          
+          // 드래그 상태 초기화
+          this.draggedElementId = null;
+        }, 0);
       }
-
-      // 새로운 다리 이미지와 텍스트를 드롭 영역에 추가
-      const cloneElement = draggedElement.cloneNode(true);
-      cloneElement.style.position = 'absolute';
-      cloneElement.style.top = "-70px";
-      cloneElement.style.left = "-50px";
-      dropZone.innerHTML = ""; // 기존 ? 텍스트 제거
-      dropZone.appendChild(cloneElement);
-
-      // 드래그한 요소 숨기기
-      draggedElement.style.visibility = "hidden";
-
-      // DOM 업데이트 후 알림을 비동기적으로 처리
-      setTimeout(() => {
-        if (this.draggedElementId === this.correctAnswer) {
-          alert("정답입니다!");
-        } else {
-          alert("오답입니다!");
-        }
-
-        // 드래그 상태 초기화
-        this.draggedElementId = null;
-      }, 0);
     }
-
-
-
   },
 };
 </script>
 
 
+
 <style scoped>
 .textbox p {
   position: absolute;
client/views/pages/main/Chapter/Chapter2_8.vue
--- client/views/pages/main/Chapter/Chapter2_8.vue
+++ client/views/pages/main/Chapter/Chapter2_8.vue
@@ -10,9 +10,15 @@
       <span class="subtitle">my name is dd</span>
     </div>
     <div class="flex justify-between align-center">
-      <div class="pre-btn" @click="goToPage('Chapter2_9')"><img src="../../../../resources/img/left.png" alt=""></div>
+      <div class="pre-btn" @click="goToPage('Chapter2_4')"><img src="../../../../resources/img/left.png" alt=""></div>
       <div class="content title-box">
-        <p class="title mt25 title-bg">step2</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>
         </div>
@@ -21,43 +27,43 @@
           <div class="dropGroup flex align-center justify-center mt30">
             <div style="position: relative;">
               <img src="../../../../resources/img/img28_s.png" alt="">
-              <button class="dropzone" data-answer="This" style="left: 30px; top: 167px;">
+              <button class="dropzone" data-answer="umbrella" style="left: 30px; top: 167px;">
                 <img src="../../../../resources/img/img29_s_01.png" alt="">
-                <p style="font-size: 35px;">?</p>
+                <p style="font-size: 35px;">우산</p>
               </button>
-              <button class="dropzone" data-answer="is" style="right: 409px; top: 133px;">
+              <button class="dropzone" data-answer="line" style="right: 409px; top: 133px;">
                 <img src="../../../../resources/img/img30_s_01.png" alt="">
-                <p style="font-size: 35px;">?</p>
+                <p style="font-size: 35px;">선</p>
               </button>
-              <button class="dropzone" data-answer="a pen" style="right: 46px; top: 128px;">
+              <button class="dropzone" data-answer="lion" style="right: 46px; top: 128px;">
                 <img src="../../../../resources/img/img31_s_01.png" alt="">
-                <p style="font-size: 35px;">?</p>
+                <p style="font-size: 35px;">사자</p>
               </button>
             </div>
           </div>
           <div class="dragGroup flex justify-center" style="gap: 20px;">
             <article style="right: 0; top: 36%;">
-              <button class="draggable" data-text="This" draggable="true">
+              <button class="draggable" data-text="umbrella" draggable="true">
                 <img src="../../../../resources/img/img29_s.png" alt="">
-                <p style="font-size: 35px;">This</p>
+                <p style="font-size: 35px;">umbrella</p>
               </button>
             </article>
             <article style="left: 0; top: 36%;">
-              <button class="draggable" data-text="is" draggable="true">
+              <button class="draggable" data-text="line" draggable="true">
                 <img src="../../../../resources/img/img30_s.png" alt="">
-                <p style="font-size: 35px;">is</p>
+                <p style="font-size: 35px;">line</p>
               </button>
             </article>
             <article style="left: 50%; top: 10%;">
-              <button class="draggable" data-text="a pen" draggable="true">
+              <button class="draggable" data-text="lion" draggable="true">
                 <img src="../../../../resources/img/img31_s.png" alt="">
-                <p style="font-size: 35px;">a pen</p>
+                <p style="font-size: 35px;">lion</p>
               </button>
             </article>
           </div>
         </div>
       </div>
-      <div class="next-btn" @click="goToPage('Chapter2_12')"><img src="../../../../resources/img/right.png" alt=""></div>
+      <div class="next-btn" @click="goToPage('Chapter2_7')"><img src="../../../../resources/img/right.png" alt=""></div>
     </div>
   </div>
 </template>
@@ -73,6 +79,9 @@
   methods: {
     goToPage(page) {
       this.$router.push({ name: page });
+    },
+    returnPage() {
+      window.location.reload();
     },
     handleDragStart(event) {
       this.draggedElement = event.target; // 드래그한 요소 저장
@@ -148,7 +157,7 @@
 
 
 .dropzone img {
-  display: block; /* 이미지가 항상 보이도록 설정 */
+  display: block;
+  /* 이미지가 항상 보이도록 설정 */
 }
-
 </style>
(파일 끝에 줄바꿈 문자 없음)
Add a comment
List