

241021 정다정 단원명, 책명 페이지에 반영
@1533a48b2a83a7b7982e9072a858fa214a2c1bb2
--- client/views/pages/main/Chapter/Chapter1.vue
+++ client/views/pages/main/Chapter/Chapter1.vue
... | ... | @@ -1,124 +1,120 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div class="pre-btn"> |
|
22 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
23 |
- </div> |
|
24 |
- <div class="content title-box"> |
|
25 |
- <p class="title mt25 title-bg">step1. Hello WORLD</p> |
|
26 |
- <div class="videoCon"> |
|
27 |
- <div ref="youtubePlayer" class="youtube-player"></div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
28 | 13 |
</div> |
29 |
- </div> |
|
30 |
- <div class="next-btn" @click="goToPage('Chapter1_2')"> |
|
31 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
32 |
- </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <p class="title mt25 title-bg">step1. Hello WORLD</p> |
|
20 |
+ <div class="videoCon"> |
|
21 |
+ <div ref="youtubePlayer" class="youtube-player"></div> |
|
22 |
+ </div> |
|
23 |
+ </div> |
|
24 |
+ <div class="next-btn" @click="goToPage('Chapter1_2')"> |
|
25 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
26 |
+ </div> |
|
27 |
+ </div> |
|
28 |
+ <TextToImage /> |
|
33 | 29 |
</div> |
34 |
- <TextToImage /> |
|
35 |
- </div> |
|
36 | 30 |
</template> |
37 | 31 |
|
38 | 32 |
<script> |
39 |
-import TextToImage from "../../../component/TextToImage.vue"; |
|
40 |
- |
|
33 |
+import TextToImage from '../../../component/TextToImage.vue'; |
|
34 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
41 | 35 |
export default { |
42 |
- components: { |
|
43 |
- TextToImage, |
|
44 |
- }, |
|
45 |
- methods: { |
|
46 |
- complete() { |
|
47 |
- const { unit_id, book_id } = this.$route.query; |
|
48 |
- this.$router.push({ |
|
49 |
- name: "Dashboard", |
|
50 |
- query: { value: 1, unit_id, book_id }, |
|
51 |
- }); |
|
36 |
+ components: { |
|
37 |
+ TextToImage, |
|
52 | 38 |
}, |
53 |
- goToPage(page) { |
|
54 |
- this.$router.push({ name: page }); |
|
55 |
- }, |
|
56 |
- loadYouTubeAPI() { |
|
57 |
- return new Promise((resolve, reject) => { |
|
58 |
- if (window.YT && window.YT.Player) { |
|
59 |
- resolve(); // API가 이미 로드된 경우 |
|
60 |
- } else { |
|
61 |
- const script = document.createElement("script"); |
|
62 |
- script.src = "https://www.youtube.com/iframe_api"; |
|
63 |
- script.onload = () => { |
|
64 |
- // 스크립트가 로드되면, `YT` 객체가 준비될 때까지 기다립니다. |
|
65 |
- const checkYTReady = setInterval(() => { |
|
66 |
- if (window.YT && window.YT.Player) { |
|
67 |
- clearInterval(checkYTReady); |
|
68 |
- resolve(); |
|
69 |
- } |
|
70 |
- }, 100); // 100ms마다 `YT` 객체가 준비되었는지 확인 |
|
71 |
- }; |
|
72 |
- script.onerror = () => |
|
73 |
- reject(new Error("Failed to load the YouTube API script")); |
|
74 |
- document.body.appendChild(script); |
|
75 |
- } |
|
76 |
- }); |
|
77 |
- }, |
|
78 |
- initializePlayer() { |
|
79 |
- if (!window.YT || !window.YT.Player) { |
|
80 |
- console.error("YouTube Player is not available"); |
|
81 |
- return; |
|
82 |
- } |
|
83 |
- new window.YT.Player(this.$refs.youtubePlayer, { |
|
84 |
- height: "550", |
|
85 |
- width: "950", |
|
86 |
- videoId: "VloEiK4Ihj8", // 비디오 ID |
|
87 |
- events: { |
|
88 |
- onReady: this.onPlayerReady, |
|
39 |
+ methods: { |
|
40 |
+ complete() { |
|
41 |
+ const { unit_id, book_id } = this.$route.query; |
|
42 |
+ this.$router.push({ |
|
43 |
+ name: 'Dashboard', |
|
44 |
+ query: { value: 1, unit_id, book_id }, |
|
45 |
+ }); |
|
89 | 46 |
}, |
90 |
- }); |
|
47 |
+ goToPage(page) { |
|
48 |
+ this.$router.push({ name: page }); |
|
49 |
+ }, |
|
50 |
+ loadYouTubeAPI() { |
|
51 |
+ return new Promise((resolve, reject) => { |
|
52 |
+ if (window.YT && window.YT.Player) { |
|
53 |
+ resolve(); // API가 이미 로드된 경우 |
|
54 |
+ } else { |
|
55 |
+ const script = document.createElement('script'); |
|
56 |
+ script.src = 'https://www.youtube.com/iframe_api'; |
|
57 |
+ script.onload = () => { |
|
58 |
+ // 스크립트가 로드되면, `YT` 객체가 준비될 때까지 기다립니다. |
|
59 |
+ const checkYTReady = setInterval(() => { |
|
60 |
+ if (window.YT && window.YT.Player) { |
|
61 |
+ clearInterval(checkYTReady); |
|
62 |
+ resolve(); |
|
63 |
+ } |
|
64 |
+ }, 100); // 100ms마다 `YT` 객체가 준비되었는지 확인 |
|
65 |
+ }; |
|
66 |
+ script.onerror = () => reject(new Error('Failed to load the YouTube API script')); |
|
67 |
+ document.body.appendChild(script); |
|
68 |
+ } |
|
69 |
+ }); |
|
70 |
+ }, |
|
71 |
+ initializePlayer() { |
|
72 |
+ if (!window.YT || !window.YT.Player) { |
|
73 |
+ console.error('YouTube Player is not available'); |
|
74 |
+ return; |
|
75 |
+ } |
|
76 |
+ new window.YT.Player(this.$refs.youtubePlayer, { |
|
77 |
+ height: '550', |
|
78 |
+ width: '950', |
|
79 |
+ videoId: 'VloEiK4Ihj8', // 비디오 ID |
|
80 |
+ events: { |
|
81 |
+ onReady: this.onPlayerReady, |
|
82 |
+ }, |
|
83 |
+ }); |
|
84 |
+ }, |
|
85 |
+ onPlayerReady(event) { |
|
86 |
+ event.target.playVideo(); // 비디오가 준비되면 자동 재생 |
|
87 |
+ }, |
|
91 | 88 |
}, |
92 |
- onPlayerReady(event) { |
|
93 |
- event.target.playVideo(); // 비디오가 준비되면 자동 재생 |
|
89 |
+ mounted() { |
|
90 |
+ this.loadYouTubeAPI() |
|
91 |
+ .then(() => { |
|
92 |
+ this.initializePlayer(); |
|
93 |
+ }) |
|
94 |
+ .catch((error) => { |
|
95 |
+ console.error('Error loading YouTube API:', error); |
|
96 |
+ }); |
|
94 | 97 |
}, |
95 |
- }, |
|
96 |
- mounted() { |
|
97 |
- this.loadYouTubeAPI() |
|
98 |
- .then(() => { |
|
99 |
- this.initializePlayer(); |
|
100 |
- }) |
|
101 |
- .catch((error) => { |
|
102 |
- console.error("Error loading YouTube API:", error); |
|
103 |
- }); |
|
104 |
- }, |
|
98 |
+ components: { |
|
99 |
+ BookInfo: BookInfo, |
|
100 |
+ }, |
|
105 | 101 |
}; |
106 | 102 |
</script> |
107 | 103 |
|
108 | 104 |
<style scoped> |
109 | 105 |
.youtube-player { |
110 |
- width: 950px; |
|
111 |
- /* 플레이어의 가로 크기 */ |
|
112 |
- height: 550px; |
|
113 |
- /* 플레이어의 세로 크기 */ |
|
106 |
+ width: 950px; |
|
107 |
+ /* 플레이어의 가로 크기 */ |
|
108 |
+ height: 550px; |
|
109 |
+ /* 플레이어의 세로 크기 */ |
|
114 | 110 |
} |
115 | 111 |
|
116 | 112 |
.completeBtn { |
117 |
- margin-right: 100px; |
|
118 |
- background-color: #ffba08; |
|
119 |
- padding: 10px 30px; |
|
120 |
- border-radius: 10px; |
|
121 |
- font-size: 28px; |
|
122 |
- font-family: "ONEMobilePOPOTF"; |
|
113 |
+ margin-right: 100px; |
|
114 |
+ background-color: #ffba08; |
|
115 |
+ padding: 10px 30px; |
|
116 |
+ border-radius: 10px; |
|
117 |
+ font-size: 28px; |
|
118 |
+ font-family: 'ONEMobilePOPOTF'; |
|
123 | 119 |
} |
124 | 120 |
</style> |
--- client/views/pages/main/Chapter/Chapter1_1.vue
+++ client/views/pages/main/Chapter/Chapter1_1.vue
... | ... | @@ -8,10 +8,7 @@ |
8 | 8 |
</router-link> |
9 | 9 |
</div> |
10 | 10 |
<div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
11 |
- <div> |
|
12 |
- <span class="title mr40">1. Hello WORLD</span> |
|
13 |
- <span class="subtitle">my name is dd</span> |
|
14 |
- </div> |
|
11 |
+ <BookInfo /> |
|
15 | 12 |
<div class="flex"> |
16 | 13 |
<TextToImage /> |
17 | 14 |
<button class="completeBtn" @click="complete">학습 종료</button> |
... | ... | @@ -103,6 +100,7 @@ |
103 | 100 |
|
104 | 101 |
<script> |
105 | 102 |
import TextToImage from '../../../component/TextToImage.vue'; |
103 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
106 | 104 |
import axios from 'axios'; |
107 | 105 |
export default { |
108 | 106 |
data() { |
... | ... | @@ -303,6 +301,7 @@ |
303 | 301 |
}, |
304 | 302 |
components: { |
305 | 303 |
TextToImage: TextToImage, |
304 |
+ BookInfo: BookInfo, |
|
306 | 305 |
}, |
307 | 306 |
mounted() { |
308 | 307 |
this.fetchText(); |
--- client/views/pages/main/Chapter/Chapter1_3.vue
+++ client/views/pages/main/Chapter/Chapter1_3.vue
... | ... | @@ -8,10 +8,7 @@ |
8 | 8 |
</router-link> |
9 | 9 |
</div> |
10 | 10 |
<div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
11 |
- <div> |
|
12 |
- <span class="title mr40">1. Hello WORLD</span> |
|
13 |
- <span class="subtitle">my name is dd</span> |
|
14 |
- </div> |
|
11 |
+ <BookInfo /> |
|
15 | 12 |
<div class="flex"> |
16 | 13 |
<TextToImage /> |
17 | 14 |
<button class="completeBtn" @click="complete">학습 종료</button> |
... | ... | @@ -48,6 +45,7 @@ |
48 | 45 |
|
49 | 46 |
<script> |
50 | 47 |
import TextToImage from '../../../component/TextToImage.vue'; |
48 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
51 | 49 |
import axios from 'axios'; |
52 | 50 |
export default { |
53 | 51 |
data() { |
... | ... | @@ -141,6 +139,7 @@ |
141 | 139 |
}, |
142 | 140 |
components: { |
143 | 141 |
TextToImage: TextToImage, |
142 |
+ BookInfo: BookInfo, |
|
144 | 143 |
}, |
145 | 144 |
mounted() { |
146 | 145 |
this.fetchText(); |
--- client/views/pages/main/Chapter/Chapter2.vue
+++ client/views/pages/main/Chapter/Chapter2.vue
... | ... | @@ -1,289 +1,263 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <!-- <div class="pre-btn" @click="goToPage('Chapter1_3')"> @click="goToPrevPage" --> |
|
22 |
- <div |
|
23 |
- class="pre-btn" |
|
24 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
25 |
- @click="goToPrevPage" |
|
26 |
- > |
|
27 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
28 |
- </div> |
|
29 |
- <div class="content title-box"> |
|
30 |
- <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
31 |
- <div class="flex align-center mb30"> |
|
32 |
- <p class="subtitle2 mr20"></p> |
|
33 |
- </div> |
|
34 |
- |
|
35 |
- <div class="flex justify-center"> |
|
36 |
- <div class="vocaGroup"> |
|
37 |
- <div |
|
38 |
- v-for="word in wordList" |
|
39 |
- :key="word.wdId" |
|
40 |
- class="flex justify-between mb80 word-item" |
|
41 |
- > |
|
42 |
- <article class="flex align-center"> |
|
43 |
- <div class="imgGroup mr30"> |
|
44 |
- <img |
|
45 |
- :src="word.fileRpath" |
|
46 |
- data-num="1" |
|
47 |
- style="width: 200px" |
|
48 |
- /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
49 | 7 |
</div> |
50 |
- <div class="flex align-start"> |
|
51 |
- <button |
|
52 |
- class="listen-btn mr30" |
|
53 |
- data-video="1" |
|
54 |
- tabindex="0" |
|
55 |
- aria-label="음성 재생" |
|
56 |
- > |
|
57 |
- <img |
|
58 |
- src="../../../../resources/img/btn10_s.png" |
|
59 |
- data-num="1" |
|
60 |
- @click="playAudio('audio-family')" |
|
61 |
- /> |
|
62 |
- </button> |
|
63 |
- <audio |
|
64 |
- id="audio-family" |
|
65 |
- src="client/resources/audio/family.wav" |
|
66 |
- preload="auto" |
|
67 |
- ></audio> |
|
68 |
- <div> |
|
69 |
- <h3>{{ word.wdNm }}</h3> |
|
70 |
- <div class="flex align-center mt10"> |
|
71 |
- <p class="yellow-box">명</p> |
|
72 |
- <span class="title1">{{ word.wdMnng }}</span> |
|
73 |
- </div> |
|
74 |
- </div> |
|
75 |
- </div> |
|
76 |
- </article> |
|
8 |
+ </router-link> |
|
9 |
+ </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <!-- <div class="pre-btn" @click="goToPage('Chapter1_3')"> @click="goToPrevPage" --> |
|
16 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="goToPrevPage"> |
|
17 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
77 | 18 |
</div> |
78 |
- </div> |
|
19 |
+ <div class="content title-box"> |
|
20 |
+ <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
21 |
+ <div class="flex align-center mb30"> |
|
22 |
+ <p class="subtitle2 mr20"></p> |
|
23 |
+ </div> |
|
24 |
+ |
|
25 |
+ <div class="flex justify-center"> |
|
26 |
+ <div class="vocaGroup"> |
|
27 |
+ <div v-for="word in wordList" :key="word.wdId" class="flex justify-between mb80 word-item"> |
|
28 |
+ <article class="flex align-center"> |
|
29 |
+ <div class="imgGroup mr30"> |
|
30 |
+ <img :src="word.fileRpath" data-num="1" style="width: 200px" /> |
|
31 |
+ </div> |
|
32 |
+ <div class="flex align-start"> |
|
33 |
+ <button class="listen-btn mr30" data-video="1" tabindex="0" aria-label="음성 재생"> |
|
34 |
+ <img |
|
35 |
+ src="../../../../resources/img/btn10_s.png" |
|
36 |
+ data-num="1" |
|
37 |
+ @click="playAudio('audio-family')" |
|
38 |
+ /> |
|
39 |
+ </button> |
|
40 |
+ <audio |
|
41 |
+ id="audio-family" |
|
42 |
+ src="client/resources/audio/family.wav" |
|
43 |
+ preload="auto" |
|
44 |
+ ></audio> |
|
45 |
+ <div> |
|
46 |
+ <h3>{{ word.wdNm }}</h3> |
|
47 |
+ <div class="flex align-center mt10"> |
|
48 |
+ <p class="yellow-box">명</p> |
|
49 |
+ <span class="title1">{{ word.wdMnng }}</span> |
|
50 |
+ </div> |
|
51 |
+ </div> |
|
52 |
+ </div> |
|
53 |
+ </article> |
|
54 |
+ </div> |
|
55 |
+ </div> |
|
56 |
+ </div> |
|
57 |
+ </div> |
|
58 |
+ <div class="next-btn" @click="goToNextPage"> |
|
59 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
60 |
+ </div> |
|
79 | 61 |
</div> |
80 |
- </div> |
|
81 |
- <div class="next-btn" @click="goToNextPage"> |
|
82 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
83 |
- </div> |
|
84 | 62 |
</div> |
85 |
- </div> |
|
86 | 63 |
</template> |
87 | 64 |
|
88 | 65 |
<script> |
89 |
-import axios from "axios"; |
|
90 |
- |
|
66 |
+import axios from 'axios'; |
|
67 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
91 | 68 |
export default { |
92 |
- data() { |
|
93 |
- return { |
|
94 |
- wdBookId: "", |
|
95 |
- wordList: [], |
|
69 |
+ data() { |
|
70 |
+ return { |
|
71 |
+ wdBookId: '', |
|
72 |
+ wordList: [], |
|
96 | 73 |
|
97 |
- wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
98 |
- currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
99 |
- wdBookTypeIdState: "", // 이동할 페이지 타입 id |
|
100 |
- wordBookType: "", // 이동할 페이지 |
|
74 |
+ wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
75 |
+ currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
76 |
+ wdBookTypeIdState: '', // 이동할 페이지 타입 id |
|
77 |
+ wordBookType: '', // 이동할 페이지 |
|
101 | 78 |
|
102 |
- hiddenState: false, |
|
103 |
- seq: this.$store.getters.seqNum, |
|
104 |
- }; |
|
105 |
- }, |
|
106 |
- methods: { |
|
107 |
- pageSetting() { |
|
108 |
- this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
109 |
- this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
110 |
- this.wdBookId = |
|
111 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
112 |
- |
|
113 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
114 |
- this.hiddenState = true; |
|
115 |
- } |
|
116 |
- this.fetchWordList(); |
|
79 |
+ hiddenState: false, |
|
80 |
+ seq: this.$store.getters.seqNum, |
|
81 |
+ }; |
|
117 | 82 |
}, |
83 |
+ methods: { |
|
84 |
+ pageSetting() { |
|
85 |
+ this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
86 |
+ this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
87 |
+ this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
118 | 88 |
|
119 |
- async fetchWordList() { |
|
120 |
- try { |
|
121 |
- const response = await axios.post("/word/getWordsByBookId.json", { |
|
122 |
- wdBookId: this.wdBookId, |
|
123 |
- }); |
|
89 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
90 |
+ this.hiddenState = true; |
|
91 |
+ } |
|
92 |
+ this.fetchWordList(); |
|
93 |
+ }, |
|
124 | 94 |
|
125 |
- const wordList = response.data; |
|
95 |
+ async fetchWordList() { |
|
96 |
+ try { |
|
97 |
+ const response = await axios.post('/word/getWordsByBookId.json', { |
|
98 |
+ wdBookId: this.wdBookId, |
|
99 |
+ }); |
|
126 | 100 |
|
127 |
- // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
128 |
- const requests = wordList.map(async (word) => { |
|
129 |
- const fileResponse = await axios.post("/file/find.json", { |
|
130 |
- file_mng_id: word.fileMngId, |
|
131 |
- }); |
|
101 |
+ const wordList = response.data; |
|
132 | 102 |
|
133 |
- const fileRpath = |
|
134 |
- fileResponse.data.list.length > 0 |
|
135 |
- ? fileResponse.data.list[0].fileRpath |
|
136 |
- : null; |
|
137 |
- console.log("각 단어의 fileRpath: ", fileRpath); |
|
103 |
+ // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
104 |
+ const requests = wordList.map(async (word) => { |
|
105 |
+ const fileResponse = await axios.post('/file/find.json', { |
|
106 |
+ file_mng_id: word.fileMngId, |
|
107 |
+ }); |
|
138 | 108 |
|
139 |
- word.fileRpath = "http://165.229.169.113:9080/" + fileRpath; // fileRpath 값을 해당 객체에 추가 |
|
140 |
- }); |
|
109 |
+ const fileRpath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileRpath : null; |
|
110 |
+ console.log('각 단어의 fileRpath: ', fileRpath); |
|
141 | 111 |
|
142 |
- // 모든 요청이 완료될 때까지 대기 |
|
143 |
- await Promise.all(requests); |
|
112 |
+ word.fileRpath = 'http://165.229.169.113:9080/' + fileRpath; // fileRpath 값을 해당 객체에 추가 |
|
113 |
+ }); |
|
144 | 114 |
|
145 |
- // 최종적으로 wordList를 설정 |
|
146 |
- this.wordList = wordList; |
|
147 |
- console.log("단어 리스트 -> ", this.wordList); |
|
148 |
- } catch (error) { |
|
149 |
- console.error("단어 목록을 불러오는 중 오류 발생:", error); |
|
150 |
- } |
|
115 |
+ // 모든 요청이 완료될 때까지 대기 |
|
116 |
+ await Promise.all(requests); |
|
117 |
+ |
|
118 |
+ // 최종적으로 wordList를 설정 |
|
119 |
+ this.wordList = wordList; |
|
120 |
+ console.log('단어 리스트 -> ', this.wordList); |
|
121 |
+ } catch (error) { |
|
122 |
+ console.error('단어 목록을 불러오는 중 오류 발생:', error); |
|
123 |
+ } |
|
124 |
+ }, |
|
125 |
+ |
|
126 |
+ async goToPrevPage() { |
|
127 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
128 |
+ alert('단어장 첫번째 페이지 입니다'); |
|
129 |
+ } else { |
|
130 |
+ this.currentWdBkIndex--; |
|
131 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
132 |
+ |
|
133 |
+ try { |
|
134 |
+ const response = await axios.post('/wordbook/find.json', { |
|
135 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
136 |
+ }); |
|
137 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
138 |
+ console.log('이전 단어장 타입 id: ', this.wdBookTypeIdState); |
|
139 |
+ |
|
140 |
+ switch (this.wdBookTypeIdState) { |
|
141 |
+ case '1': |
|
142 |
+ this.wordBookType = 'Chapter2'; |
|
143 |
+ break; |
|
144 |
+ case '2': |
|
145 |
+ this.wordBookType = 'Chapter2_3'; |
|
146 |
+ break; |
|
147 |
+ case '3': |
|
148 |
+ this.wordBookType = 'Chapter2_2'; |
|
149 |
+ break; |
|
150 |
+ case '4': |
|
151 |
+ this.wordBookType = 'Chapter2_9'; |
|
152 |
+ break; |
|
153 |
+ case '5': |
|
154 |
+ this.wordBookType = 'Chapter2_4'; |
|
155 |
+ break; |
|
156 |
+ default: |
|
157 |
+ this.wordBookType = null; |
|
158 |
+ } |
|
159 |
+ |
|
160 |
+ this.goToPage(this.wordBookType); |
|
161 |
+ } catch (error) { |
|
162 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
163 |
+ } |
|
164 |
+ } |
|
165 |
+ }, |
|
166 |
+ |
|
167 |
+ async goToNextPage() { |
|
168 |
+ if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
169 |
+ alert('단어장 마지막 페이지 입니다'); |
|
170 |
+ this.complete(); |
|
171 |
+ } else { |
|
172 |
+ this.currentWdBkIndex++; |
|
173 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
174 |
+ |
|
175 |
+ try { |
|
176 |
+ const response = await axios.post('/wordbook/find.json', { |
|
177 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
178 |
+ }); |
|
179 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
180 |
+ console.log('다음 단어장 타입 id: ', this.wdBookTypeIdState); |
|
181 |
+ |
|
182 |
+ switch (this.wdBookTypeIdState) { |
|
183 |
+ case '1': |
|
184 |
+ this.wordBookType = 'Chapter2'; |
|
185 |
+ break; |
|
186 |
+ case '2': |
|
187 |
+ this.wordBookType = 'Chapter2_3'; |
|
188 |
+ break; |
|
189 |
+ case '3': |
|
190 |
+ this.wordBookType = 'Chapter2_2'; |
|
191 |
+ break; |
|
192 |
+ case '4': |
|
193 |
+ this.wordBookType = 'Chapter2_9'; |
|
194 |
+ break; |
|
195 |
+ case '5': |
|
196 |
+ this.wordBookType = 'Chapter2_4'; |
|
197 |
+ break; |
|
198 |
+ default: |
|
199 |
+ this.wordBookType = null; |
|
200 |
+ } |
|
201 |
+ |
|
202 |
+ this.goToPage(this.wordBookType); |
|
203 |
+ } catch (error) { |
|
204 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
205 |
+ } |
|
206 |
+ } |
|
207 |
+ }, |
|
208 |
+ |
|
209 |
+ goToPage(page) { |
|
210 |
+ this.$router.push({ name: page }); |
|
211 |
+ }, |
|
212 |
+ |
|
213 |
+ playAudio(audioId) { |
|
214 |
+ const audio = document.getElementById(audioId); |
|
215 |
+ if (audio) { |
|
216 |
+ audio.play(); |
|
217 |
+ } else { |
|
218 |
+ console.error(`Audio element with ID ${audioId} not found.`); |
|
219 |
+ } |
|
220 |
+ }, |
|
221 |
+ |
|
222 |
+ complete() { |
|
223 |
+ const { unit_id, book_id } = this.$route.query; |
|
224 |
+ this.$router.push({ |
|
225 |
+ name: 'Dashboard', |
|
226 |
+ query: { value: this.seq, unit_id, book_id }, |
|
227 |
+ }); |
|
228 |
+ }, |
|
151 | 229 |
}, |
152 |
- |
|
153 |
- async goToPrevPage() { |
|
154 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
155 |
- alert("단어장 첫번째 페이지 입니다"); |
|
156 |
- } else { |
|
157 |
- this.currentWdBkIndex--; |
|
158 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
159 |
- |
|
160 |
- try { |
|
161 |
- const response = await axios.post("/wordbook/find.json", { |
|
162 |
- wdBookId: |
|
163 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
164 |
- }); |
|
165 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
166 |
- console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState); |
|
167 |
- |
|
168 |
- switch (this.wdBookTypeIdState) { |
|
169 |
- case "1": |
|
170 |
- this.wordBookType = "Chapter2"; |
|
171 |
- break; |
|
172 |
- case "2": |
|
173 |
- this.wordBookType = "Chapter2_3"; |
|
174 |
- break; |
|
175 |
- case "3": |
|
176 |
- this.wordBookType = "Chapter2_2"; |
|
177 |
- break; |
|
178 |
- case "4": |
|
179 |
- this.wordBookType = "Chapter2_9"; |
|
180 |
- break; |
|
181 |
- case "5": |
|
182 |
- this.wordBookType = "Chapter2_4"; |
|
183 |
- break; |
|
184 |
- default: |
|
185 |
- this.wordBookType = null; |
|
186 |
- } |
|
187 |
- |
|
188 |
- this.goToPage(this.wordBookType); |
|
189 |
- } catch (error) { |
|
190 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
191 |
- } |
|
192 |
- } |
|
230 |
+ mounted() { |
|
231 |
+ console.log('챕터2 단어장 마운트 완료'); |
|
232 |
+ this.pageSetting(); |
|
193 | 233 |
}, |
194 |
- |
|
195 |
- async goToNextPage() { |
|
196 |
- if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
197 |
- alert("단어장 마지막 페이지 입니다"); |
|
198 |
- this.complete(); |
|
199 |
- } else { |
|
200 |
- this.currentWdBkIndex++; |
|
201 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
202 |
- |
|
203 |
- try { |
|
204 |
- const response = await axios.post("/wordbook/find.json", { |
|
205 |
- wdBookId: |
|
206 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
207 |
- }); |
|
208 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
209 |
- console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState); |
|
210 |
- |
|
211 |
- switch (this.wdBookTypeIdState) { |
|
212 |
- case "1": |
|
213 |
- this.wordBookType = "Chapter2"; |
|
214 |
- break; |
|
215 |
- case "2": |
|
216 |
- this.wordBookType = "Chapter2_3"; |
|
217 |
- break; |
|
218 |
- case "3": |
|
219 |
- this.wordBookType = "Chapter2_2"; |
|
220 |
- break; |
|
221 |
- case "4": |
|
222 |
- this.wordBookType = "Chapter2_9"; |
|
223 |
- break; |
|
224 |
- case "5": |
|
225 |
- this.wordBookType = "Chapter2_4"; |
|
226 |
- break; |
|
227 |
- default: |
|
228 |
- this.wordBookType = null; |
|
229 |
- } |
|
230 |
- |
|
231 |
- this.goToPage(this.wordBookType); |
|
232 |
- } catch (error) { |
|
233 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
234 |
- } |
|
235 |
- } |
|
234 |
+ components: { |
|
235 |
+ BookInfo: BookInfo, |
|
236 | 236 |
}, |
237 |
- |
|
238 |
- goToPage(page) { |
|
239 |
- this.$router.push({ name: page }); |
|
240 |
- }, |
|
241 |
- |
|
242 |
- playAudio(audioId) { |
|
243 |
- const audio = document.getElementById(audioId); |
|
244 |
- if (audio) { |
|
245 |
- audio.play(); |
|
246 |
- } else { |
|
247 |
- console.error(`Audio element with ID ${audioId} not found.`); |
|
248 |
- } |
|
249 |
- }, |
|
250 |
- |
|
251 |
- complete() { |
|
252 |
- const { unit_id, book_id } = this.$route.query; |
|
253 |
- this.$router.push({ |
|
254 |
- name: "Dashboard", |
|
255 |
- query: { value: this.seq, unit_id, book_id }, |
|
256 |
- }); |
|
257 |
- }, |
|
258 |
- }, |
|
259 |
- mounted() { |
|
260 |
- console.log("챕터2 단어장 마운트 완료"); |
|
261 |
- this.pageSetting(); |
|
262 |
- }, |
|
263 | 237 |
}; |
264 | 238 |
</script> |
265 | 239 |
|
266 | 240 |
<style scoped> |
267 | 241 |
.vocaGroup { |
268 |
- display: flex; |
|
269 |
- flex-wrap: wrap; |
|
242 |
+ display: flex; |
|
243 |
+ flex-wrap: wrap; |
|
270 | 244 |
} |
271 | 245 |
|
272 | 246 |
.word-item { |
273 |
- width: 49%; |
|
247 |
+ width: 49%; |
|
274 | 248 |
} |
275 | 249 |
|
276 | 250 |
.grid-container { |
277 |
- display: grid; |
|
278 |
- grid-template-columns: repeat(2, 1fr); |
|
279 |
- gap: 20px; |
|
251 |
+ display: grid; |
|
252 |
+ grid-template-columns: repeat(2, 1fr); |
|
253 |
+ gap: 20px; |
|
280 | 254 |
} |
281 | 255 |
.completeBtn { |
282 |
- margin-right: 100px; |
|
283 |
- background-color: #ffba08; |
|
284 |
- padding: 10px 30px; |
|
285 |
- border-radius: 10px; |
|
286 |
- font-size: 28px; |
|
287 |
- font-family: "ONEMobilePOPOTF"; |
|
256 |
+ margin-right: 100px; |
|
257 |
+ background-color: #ffba08; |
|
258 |
+ padding: 10px 30px; |
|
259 |
+ border-radius: 10px; |
|
260 |
+ font-size: 28px; |
|
261 |
+ font-family: 'ONEMobilePOPOTF'; |
|
288 | 262 |
} |
289 | 263 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_1.vue
+++ client/views/pages/main/Chapter/Chapter2_1.vue
... | ... | @@ -1,190 +1,177 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="goToPage('Chapter2_2')"> |
|
16 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
- </div> |
|
18 |
- <div class="content title-box"> |
|
19 |
- <p class="title mt25 title-bg">step2</p> |
|
20 |
- <div class="flex align-center mb30"> |
|
21 |
- <p class="subtitle2 mr20"> |
|
22 |
- 오늘 배웠던 단어를 말하고 생성된 예문을 따라 읽어보세요 |
|
23 |
- </p> |
|
24 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
25 |
- </button> --> |
|
26 |
- </div> |
|
27 |
- <div> |
|
28 |
- <img |
|
29 |
- src="http://localhost:8081/client/build/dad67b1726cb2d2b215965b433149ca3.png" |
|
30 |
- data-num="1" |
|
31 |
- /> |
|
32 |
- <p>{{ word }}</p> |
|
33 |
- <p>{{ mean }}</p> |
|
34 |
- </div> |
|
35 |
- <div class="flex justify-center"> |
|
36 |
- <div class="readGroup"> |
|
37 |
- <section> |
|
38 |
- <div class="imgGroup flex justify-center"> |
|
39 |
- <!-- 녹음 버튼 --> |
|
40 |
- <div |
|
41 |
- :class="['mic-btn', { notRecording: !isRecording }]" |
|
42 |
- @click="toggleRecording" |
|
43 |
- > |
|
44 |
- <img src="../../../../resources/img/btn11_s.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
45 | 7 |
</div> |
46 |
- </div> |
|
47 |
- <article> |
|
48 |
- <p class="speakText mb25"> |
|
49 |
- <span v-if="transcription === null" |
|
50 |
- >위의 버튼을 누른 후 오늘 배운 단어를 말해보세요!</span |
|
51 |
- > |
|
52 |
- <span |
|
53 |
- v-else-if="!transcription || transcription.trim() === ''" |
|
54 |
- >다시 말해보세요!</span |
|
55 |
- > |
|
56 |
- <span v-else>{{ transcription }}</span> |
|
57 |
- </p> |
|
58 |
- <p class="read-ai"> |
|
59 |
- <img |
|
60 |
- style="margin-top: -5px" |
|
61 |
- src="../../../../resources/img/img43_s.png" |
|
62 |
- alt="" |
|
63 |
- /> |
|
64 |
- </p> |
|
65 |
- </article> |
|
66 |
- </section> |
|
67 |
- </div> |
|
8 |
+ </router-link> |
|
68 | 9 |
</div> |
69 |
- </div> |
|
70 |
- <div class="next-btn" @click="goToPage('Chapter2_4')"> |
|
71 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
72 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="goToPage('Chapter2_2')"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step2</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">오늘 배웠던 단어를 말하고 생성된 예문을 따라 읽어보세요</p> |
|
21 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
22 |
+ </button> --> |
|
23 |
+ </div> |
|
24 |
+ <div> |
|
25 |
+ <img src="http://localhost:8081/client/build/dad67b1726cb2d2b215965b433149ca3.png" data-num="1" /> |
|
26 |
+ <p>{{ word }}</p> |
|
27 |
+ <p>{{ mean }}</p> |
|
28 |
+ </div> |
|
29 |
+ <div class="flex justify-center"> |
|
30 |
+ <div class="readGroup"> |
|
31 |
+ <section> |
|
32 |
+ <div class="imgGroup flex justify-center"> |
|
33 |
+ <!-- 녹음 버튼 --> |
|
34 |
+ <div :class="['mic-btn', { notRecording: !isRecording }]" @click="toggleRecording"> |
|
35 |
+ <img src="../../../../resources/img/btn11_s.png" alt="" /> |
|
36 |
+ </div> |
|
37 |
+ </div> |
|
38 |
+ <article> |
|
39 |
+ <p class="speakText mb25"> |
|
40 |
+ <span v-if="transcription === null" |
|
41 |
+ >위의 버튼을 누른 후 오늘 배운 단어를 말해보세요!</span |
|
42 |
+ > |
|
43 |
+ <span v-else-if="!transcription || transcription.trim() === ''" |
|
44 |
+ >다시 말해보세요!</span |
|
45 |
+ > |
|
46 |
+ <span v-else>{{ transcription }}</span> |
|
47 |
+ </p> |
|
48 |
+ <p class="read-ai"> |
|
49 |
+ <img style="margin-top: -5px" src="../../../../resources/img/img43_s.png" alt="" /> |
|
50 |
+ </p> |
|
51 |
+ </article> |
|
52 |
+ </section> |
|
53 |
+ </div> |
|
54 |
+ </div> |
|
55 |
+ </div> |
|
56 |
+ <div class="next-btn" @click="goToPage('Chapter2_4')"> |
|
57 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
58 |
+ </div> |
|
59 |
+ </div> |
|
73 | 60 |
</div> |
74 |
- </div> |
|
75 | 61 |
</template> |
76 | 62 |
|
77 | 63 |
<script> |
78 |
-import axios from "axios"; |
|
79 |
-import SvgIcon from "@jamescoyle/vue-icon"; |
|
80 |
-import { mdiStop } from "@mdi/js"; |
|
64 |
+import axios from 'axios'; |
|
65 |
+import SvgIcon from '@jamescoyle/vue-icon'; |
|
66 |
+import { mdiStop } from '@mdi/js'; |
|
67 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
81 | 68 |
export default { |
82 |
- data() { |
|
83 |
- return { |
|
84 |
- isRecording: false, // 녹음 중 여부 |
|
85 |
- mediaRecorder: null, |
|
86 |
- audioChunks: [], // 녹음된 오디오 데이터 |
|
87 |
- audioBlob: null, // 오디오 Blob 객체 |
|
88 |
- transcription: null, // 서버에서 받아온 텍스트 결과 |
|
89 |
- stream: null, // MediaStream 객체 |
|
69 |
+ data() { |
|
70 |
+ return { |
|
71 |
+ isRecording: false, // 녹음 중 여부 |
|
72 |
+ mediaRecorder: null, |
|
73 |
+ audioChunks: [], // 녹음된 오디오 데이터 |
|
74 |
+ audioBlob: null, // 오디오 Blob 객체 |
|
75 |
+ transcription: null, // 서버에서 받아온 텍스트 결과 |
|
76 |
+ stream: null, // MediaStream 객체 |
|
90 | 77 |
|
91 |
- path: mdiStop, |
|
78 |
+ path: mdiStop, |
|
92 | 79 |
|
93 |
- /* audioURL : null // 오디오 URL 객체 */ |
|
80 |
+ /* audioURL : null // 오디오 URL 객체 */ |
|
94 | 81 |
|
95 |
- word: "apple", |
|
96 |
- mean: "사과", |
|
97 |
- imageSrc: |
|
98 |
- "http://localhost:8081/client/build/dad67b1726cb2d2b215965b433149ca3.png", |
|
99 |
- }; |
|
100 |
- }, |
|
101 |
- methods: { |
|
102 |
- goToPage(page) { |
|
103 |
- this.$router.push({ name: page }); |
|
82 |
+ word: 'apple', |
|
83 |
+ mean: '사과', |
|
84 |
+ imageSrc: 'http://localhost:8081/client/build/dad67b1726cb2d2b215965b433149ca3.png', |
|
85 |
+ }; |
|
104 | 86 |
}, |
105 |
- // 녹음 시작/중지 토글 |
|
106 |
- async toggleRecording() { |
|
107 |
- if (this.isRecording) { |
|
108 |
- console.log("녹음 그만!"); |
|
109 |
- this.stopRecording(); // 녹음 중이면 중지 |
|
110 |
- } else { |
|
111 |
- console.log("녹음 시작!"); |
|
112 |
- await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
113 |
- } |
|
87 |
+ methods: { |
|
88 |
+ goToPage(page) { |
|
89 |
+ this.$router.push({ name: page }); |
|
90 |
+ }, |
|
91 |
+ // 녹음 시작/중지 토글 |
|
92 |
+ async toggleRecording() { |
|
93 |
+ if (this.isRecording) { |
|
94 |
+ console.log('녹음 그만!'); |
|
95 |
+ this.stopRecording(); // 녹음 중이면 중지 |
|
96 |
+ } else { |
|
97 |
+ console.log('녹음 시작!'); |
|
98 |
+ await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
99 |
+ } |
|
100 |
+ }, |
|
101 |
+ |
|
102 |
+ // 녹음 시작 |
|
103 |
+ async startRecording() { |
|
104 |
+ this.audioChunks = []; // 오디오 초기화 |
|
105 |
+ this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
106 |
+ this.mediaRecorder = new MediaRecorder(this.stream); |
|
107 |
+ this.mediaRecorder.ondataavailable = (event) => { |
|
108 |
+ this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
109 |
+ }; |
|
110 |
+ this.mediaRecorder.onstop = () => { |
|
111 |
+ this.audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' }); |
|
112 |
+ |
|
113 |
+ /******************************/ |
|
114 |
+ // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
115 |
+ // console.log('Audio URL:', this.audioURL); |
|
116 |
+ /******************************/ |
|
117 |
+ |
|
118 |
+ console.log('Recorded Audio Blob:', this.audioBlob); // 콘솔에 Blob 확인 |
|
119 |
+ this.sendAudioToServer(); // 서버로 오디오 전송 |
|
120 |
+ }; |
|
121 |
+ this.mediaRecorder.start(); // 녹음 시작 |
|
122 |
+ this.isRecording = true; // 녹음 상태 변경 |
|
123 |
+ }, |
|
124 |
+ |
|
125 |
+ // 녹음 중지 |
|
126 |
+ stopRecording() { |
|
127 |
+ this.mediaRecorder.stop(); // 녹음 중단 |
|
128 |
+ |
|
129 |
+ if (this.stream) { |
|
130 |
+ this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
131 |
+ } |
|
132 |
+ |
|
133 |
+ this.isRecording = false; // 녹음 상태 변경 |
|
134 |
+ }, |
|
135 |
+ |
|
136 |
+ // 오디오 전송 |
|
137 |
+ async sendAudioToServer() { |
|
138 |
+ const formData = new FormData(); |
|
139 |
+ formData.append('file', this.audioBlob, 'recording.wav'); |
|
140 |
+ try { |
|
141 |
+ const resposne = await axios.post('/api/speechToText.json', formData, { |
|
142 |
+ headers: { |
|
143 |
+ 'Content-Type': 'multipart/form-data', |
|
144 |
+ }, |
|
145 |
+ }); |
|
146 |
+ this.transcription = resposne.data; |
|
147 |
+ console.log(`받은 데이터 : ${this.transcription}`); |
|
148 |
+ } catch (error) { |
|
149 |
+ console.log('파일 전송 실패 : ', error); |
|
150 |
+ } |
|
151 |
+ }, |
|
114 | 152 |
}, |
115 |
- |
|
116 |
- // 녹음 시작 |
|
117 |
- async startRecording() { |
|
118 |
- this.audioChunks = []; // 오디오 초기화 |
|
119 |
- this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
120 |
- this.mediaRecorder = new MediaRecorder(this.stream); |
|
121 |
- this.mediaRecorder.ondataavailable = (event) => { |
|
122 |
- this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
123 |
- }; |
|
124 |
- this.mediaRecorder.onstop = () => { |
|
125 |
- this.audioBlob = new Blob(this.audioChunks, { type: "audio/wav" }); |
|
126 |
- |
|
127 |
- /******************************/ |
|
128 |
- // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
129 |
- // console.log('Audio URL:', this.audioURL); |
|
130 |
- /******************************/ |
|
131 |
- |
|
132 |
- console.log("Recorded Audio Blob:", this.audioBlob); // 콘솔에 Blob 확인 |
|
133 |
- this.sendAudioToServer(); // 서버로 오디오 전송 |
|
134 |
- }; |
|
135 |
- this.mediaRecorder.start(); // 녹음 시작 |
|
136 |
- this.isRecording = true; // 녹음 상태 변경 |
|
153 |
+ watch: {}, |
|
154 |
+ computed: {}, |
|
155 |
+ components: { |
|
156 |
+ SvgIcon, |
|
157 |
+ BookInfo: BookInfo, |
|
137 | 158 |
}, |
138 |
- |
|
139 |
- // 녹음 중지 |
|
140 |
- stopRecording() { |
|
141 |
- this.mediaRecorder.stop(); // 녹음 중단 |
|
142 |
- |
|
143 |
- if (this.stream) { |
|
144 |
- this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
145 |
- } |
|
146 |
- |
|
147 |
- this.isRecording = false; // 녹음 상태 변경 |
|
148 |
- }, |
|
149 |
- |
|
150 |
- // 오디오 전송 |
|
151 |
- async sendAudioToServer() { |
|
152 |
- const formData = new FormData(); |
|
153 |
- formData.append("file", this.audioBlob, "recording.wav"); |
|
154 |
- try { |
|
155 |
- const resposne = await axios.post("/api/speechToText.json", formData, { |
|
156 |
- headers: { |
|
157 |
- "Content-Type": "multipart/form-data", |
|
158 |
- }, |
|
159 |
- }); |
|
160 |
- this.transcription = resposne.data; |
|
161 |
- console.log(`받은 데이터 : ${this.transcription}`); |
|
162 |
- } catch (error) { |
|
163 |
- console.log("파일 전송 실패 : ", error); |
|
164 |
- } |
|
165 |
- }, |
|
166 |
- }, |
|
167 |
- watch: {}, |
|
168 |
- computed: {}, |
|
169 |
- components: { |
|
170 |
- SvgIcon, |
|
171 |
- }, |
|
172 |
- mounted() {}, |
|
159 |
+ mounted() {}, |
|
173 | 160 |
}; |
174 | 161 |
</script> |
175 | 162 |
<style scoped> |
176 | 163 |
.mic-btn { |
177 |
- cursor: pointer; |
|
164 |
+ cursor: pointer; |
|
178 | 165 |
} |
179 | 166 |
.mic-btn.notRecording { |
180 |
- background-image: none; |
|
181 |
- cursor: pointer; |
|
167 |
+ background-image: none; |
|
168 |
+ cursor: pointer; |
|
182 | 169 |
} |
183 | 170 |
.speakText { |
184 |
- background-color: #fff8e9; |
|
185 |
- border: 0; |
|
171 |
+ background-color: #fff8e9; |
|
172 |
+ border: 0; |
|
186 | 173 |
} |
187 | 174 |
.speakText span { |
188 |
- font-size: 28px; |
|
175 |
+ font-size: 28px; |
|
189 | 176 |
} |
190 | 177 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_10.vue
+++ client/views/pages/main/Chapter/Chapter2_10.vue
... | ... | @@ -1,497 +1,475 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
35 | 13 |
</div> |
36 |
- <div class="flex align-center mb30"> |
|
37 |
- <p class="subtitle2 mr20"> |
|
38 |
- 방문이 자물쇠로 잠겨져 있네? 세 개 중에 맞는 열쇠 하나를 찾아줘! |
|
39 |
- </p> |
|
40 |
- </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ <div class="flex align-center mb30"> |
|
27 |
+ <p class="subtitle2 mr20">방문이 자물쇠로 잠겨져 있네? 세 개 중에 맞는 열쇠 하나를 찾아줘!</p> |
|
28 |
+ </div> |
|
41 | 29 |
|
42 |
- <div class="flex align-center justify-center" style="gap: 113px"> |
|
43 |
- <div class="imgGroup"> |
|
44 |
- <div class="flex" style="gap: 60px"> |
|
45 |
- <button> |
|
46 |
- <img src="../../../../resources/img/img82_42s.png" alt="" /> |
|
47 |
- <p>{{ beforeQuestion }}</p> |
|
48 |
- </button> |
|
49 |
- <button> |
|
50 |
- <img src="../../../../resources/img/img159_42s.png" alt="" /> |
|
51 |
- </button> |
|
52 |
- <button> |
|
53 |
- <img src="../../../../resources/img/img83_42s.png" alt="" /> |
|
54 |
- <p>{{ afterQuestion }}</p> |
|
55 |
- </button> |
|
56 |
- </div> |
|
57 |
- </div> |
|
58 |
- <div class="pickGroup"> |
|
59 |
- <div class="pickImg"> |
|
60 |
- <img src="../../../../resources/img/img84_42s.png" alt="" /> |
|
61 |
- <img src="../../../../resources/img/img85_42s.png" alt="" /> |
|
62 |
- <img src="../../../../resources/img/img86_42s.png" alt="" /> |
|
63 |
- </div> |
|
64 |
- <div class="pickChoice"> |
|
65 |
- <article class="flex justify-center mb50" style="gap: 60px"> |
|
66 |
- <div class="flex" style="align-items: center"> |
|
67 |
- <button @click="handleClick(1)"> |
|
68 |
- <img |
|
69 |
- src="../../../../resources/img/img136_71s.png" |
|
70 |
- alt="" |
|
71 |
- /> |
|
72 |
- <p :class="{ active: selectedButton === 1 }">1</p> |
|
73 |
- </button> |
|
74 |
- <p>{{ choice[0] }}</p> |
|
30 |
+ <div class="flex align-center justify-center" style="gap: 113px"> |
|
31 |
+ <div class="imgGroup"> |
|
32 |
+ <div class="flex" style="gap: 60px"> |
|
33 |
+ <button> |
|
34 |
+ <img src="../../../../resources/img/img82_42s.png" alt="" /> |
|
35 |
+ <p>{{ beforeQuestion }}</p> |
|
36 |
+ </button> |
|
37 |
+ <button> |
|
38 |
+ <img src="../../../../resources/img/img159_42s.png" alt="" /> |
|
39 |
+ </button> |
|
40 |
+ <button> |
|
41 |
+ <img src="../../../../resources/img/img83_42s.png" alt="" /> |
|
42 |
+ <p>{{ afterQuestion }}</p> |
|
43 |
+ </button> |
|
44 |
+ </div> |
|
45 |
+ </div> |
|
46 |
+ <div class="pickGroup"> |
|
47 |
+ <div class="pickImg"> |
|
48 |
+ <img src="../../../../resources/img/img84_42s.png" alt="" /> |
|
49 |
+ <img src="../../../../resources/img/img85_42s.png" alt="" /> |
|
50 |
+ <img src="../../../../resources/img/img86_42s.png" alt="" /> |
|
51 |
+ </div> |
|
52 |
+ <div class="pickChoice"> |
|
53 |
+ <article class="flex justify-center mb50" style="gap: 60px"> |
|
54 |
+ <div class="flex" style="align-items: center"> |
|
55 |
+ <button @click="handleClick(1)"> |
|
56 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
57 |
+ <p :class="{ active: selectedButton === 1 }">1</p> |
|
58 |
+ </button> |
|
59 |
+ <p>{{ choice[0] }}</p> |
|
60 |
+ </div> |
|
61 |
+ </article> |
|
62 |
+ <article class="flex justify-center mb50" style="gap: 60px"> |
|
63 |
+ <div class="flex" style="align-items: center"> |
|
64 |
+ <button @click="handleClick(2)"> |
|
65 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
66 |
+ <p :class="{ active: selectedButton === 2 }">2</p> |
|
67 |
+ </button> |
|
68 |
+ <p>{{ choice[1] }}</p> |
|
69 |
+ </div> |
|
70 |
+ </article> |
|
71 |
+ <article class="flex justify-center" style="gap: 60px"> |
|
72 |
+ <div class="flex" style="align-items: center"> |
|
73 |
+ <button @click="handleClick(3)"> |
|
74 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
75 |
+ <p :class="{ active: selectedButton === 3 }">3</p> |
|
76 |
+ </button> |
|
77 |
+ <p>{{ choice[2] }}</p> |
|
78 |
+ </div> |
|
79 |
+ </article> |
|
80 |
+ </div> |
|
81 |
+ </div> |
|
75 | 82 |
</div> |
76 |
- </article> |
|
77 |
- <article class="flex justify-center mb50" style="gap: 60px"> |
|
78 |
- <div class="flex" style="align-items: center"> |
|
79 |
- <button @click="handleClick(2)"> |
|
80 |
- <img |
|
81 |
- src="../../../../resources/img/img136_71s.png" |
|
82 |
- alt="" |
|
83 |
- /> |
|
84 |
- <p :class="{ active: selectedButton === 2 }">2</p> |
|
85 |
- </button> |
|
86 |
- <p>{{ choice[1] }}</p> |
|
83 |
+ <div style="text-align: right"> |
|
84 |
+ <button class="answerButton" @click="confirmAnswer">정답 확인</button> |
|
87 | 85 |
</div> |
88 |
- </article> |
|
89 |
- <article class="flex justify-center" style="gap: 60px"> |
|
90 |
- <div class="flex" style="align-items: center"> |
|
91 |
- <button @click="handleClick(3)"> |
|
92 |
- <img |
|
93 |
- src="../../../../resources/img/img136_71s.png" |
|
94 |
- alt="" |
|
95 |
- /> |
|
96 |
- <p :class="{ active: selectedButton === 3 }">3</p> |
|
97 |
- </button> |
|
98 |
- <p>{{ choice[2] }}</p> |
|
99 |
- </div> |
|
100 |
- </article> |
|
101 | 86 |
</div> |
102 |
- </div> |
|
87 |
+ <div class="next-btn" @click="nextProblem()"> |
|
88 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
89 |
+ </div> |
|
103 | 90 |
</div> |
104 |
- <div style="text-align: right"> |
|
105 |
- <button class="answerButton" @click="confirmAnswer">정답 확인</button> |
|
106 |
- </div> |
|
107 |
- </div> |
|
108 |
- <div class="next-btn" @click="nextProblem()"> |
|
109 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
110 |
- </div> |
|
111 | 91 |
</div> |
112 |
- </div> |
|
113 | 92 |
</template> |
114 | 93 |
|
115 | 94 |
<script> |
116 |
-import axios from "axios"; |
|
117 |
- |
|
95 |
+import axios from 'axios'; |
|
96 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
118 | 97 |
export default { |
119 |
- data() { |
|
120 |
- return { |
|
121 |
- selectedButton: null, // 선택된 버튼을 추적하기 위한 데이터 |
|
98 |
+ data() { |
|
99 |
+ return { |
|
100 |
+ selectedButton: null, // 선택된 버튼을 추적하기 위한 데이터 |
|
122 | 101 |
|
123 |
- example: "", |
|
124 |
- beforeQuestion: "", |
|
125 |
- afterQuestion: "", |
|
126 |
- choice: [], |
|
127 |
- answer: "", |
|
102 |
+ example: '', |
|
103 |
+ beforeQuestion: '', |
|
104 |
+ afterQuestion: '', |
|
105 |
+ choice: [], |
|
106 |
+ answer: '', |
|
128 | 107 |
|
129 |
- prblm_id: [], |
|
130 |
- problemData: [], |
|
131 |
- // problemArr: [], |
|
132 |
- answerArr: [], |
|
108 |
+ prblm_id: [], |
|
109 |
+ problemData: [], |
|
110 |
+ // problemArr: [], |
|
111 |
+ answerArr: [], |
|
133 | 112 |
|
134 |
- seq: this.$store.getters.seqNum, |
|
113 |
+ seq: this.$store.getters.seqNum, |
|
135 | 114 |
|
136 |
- hiddenState: false, |
|
137 |
- }; |
|
138 |
- }, |
|
139 |
- methods: { |
|
140 |
- complete() { |
|
141 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
142 |
- const savedState = localStorage.getItem("vuexState"); |
|
143 |
- if (savedState) { |
|
144 |
- const parsedState = JSON.parse(savedState); |
|
145 |
- const currentDashboard = parsedState.currentDashboard; |
|
115 |
+ hiddenState: false, |
|
116 |
+ }; |
|
117 |
+ }, |
|
118 |
+ methods: { |
|
119 |
+ complete() { |
|
120 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
121 |
+ const savedState = localStorage.getItem('vuexState'); |
|
122 |
+ if (savedState) { |
|
123 |
+ const parsedState = JSON.parse(savedState); |
|
124 |
+ const currentDashboard = parsedState.currentDashboard; |
|
146 | 125 |
|
147 |
- const { unit_id, book_id } = this.$route.query; |
|
148 |
- if (currentDashboard === "Learning") { |
|
149 |
- // Learning 모드일 때 Dashboard로 이동 |
|
150 |
- this.$router.push({ |
|
151 |
- name: "Dashboard", |
|
152 |
- query: { value: this.seq, unit_id, book_id }, |
|
153 |
- }); |
|
154 |
- } else if (currentDashboard === "AI") { |
|
155 |
- // AI 모드일 때 AIDashboard로 이동 |
|
156 |
- this.$router.push({ |
|
157 |
- name: "AIDashboard", |
|
158 |
- query: { value: this.seq, unit_id, book_id }, |
|
159 |
- }); |
|
126 |
+ const { unit_id, book_id } = this.$route.query; |
|
127 |
+ if (currentDashboard === 'Learning') { |
|
128 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
129 |
+ this.$router.push({ |
|
130 |
+ name: 'Dashboard', |
|
131 |
+ query: { value: this.seq, unit_id, book_id }, |
|
132 |
+ }); |
|
133 |
+ } else if (currentDashboard === 'AI') { |
|
134 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
135 |
+ this.$router.push({ |
|
136 |
+ name: 'AIDashboard', |
|
137 |
+ query: { value: this.seq, unit_id, book_id }, |
|
138 |
+ }); |
|
139 |
+ } |
|
140 |
+ } else { |
|
141 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
142 |
+ } |
|
143 |
+ }, |
|
144 |
+ goToPage(page) { |
|
145 |
+ this.$router.push({ name: page }); |
|
146 |
+ }, |
|
147 |
+ |
|
148 |
+ handleClick(buttonNumber) { |
|
149 |
+ this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장 |
|
150 |
+ }, |
|
151 |
+ |
|
152 |
+ confirmAnswer() { |
|
153 |
+ if (this.selectedButton === null) { |
|
154 |
+ alert('정답을 선택해주세요.'); |
|
155 |
+ return; |
|
156 |
+ } |
|
157 |
+ if (this.selectedButton === this.answer) { |
|
158 |
+ alert('정답입니다!'); |
|
159 |
+ this.nextProblem(); |
|
160 |
+ } else { |
|
161 |
+ alert('오답입니다!'); |
|
162 |
+ } |
|
163 |
+ this.selectedButton = null; |
|
164 |
+ }, |
|
165 |
+ |
|
166 |
+ returnPage() { |
|
167 |
+ window.location.reload(); |
|
168 |
+ }, |
|
169 |
+ nextProblem() { |
|
170 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
171 |
+ this.$store.dispatch('goToNextProblem'); |
|
172 |
+ this.handleProblemDetail(this.currentLearningId); |
|
173 |
+ this.goToPage(this.problemType); |
|
174 |
+ } else { |
|
175 |
+ // 마지막 문제면 이동 |
|
176 |
+ // this.goToPage("Chapter4"); |
|
177 |
+ alert('문제 학습 완료'); |
|
178 |
+ this.complete(); |
|
179 |
+ } |
|
180 |
+ }, |
|
181 |
+ previousProblem() { |
|
182 |
+ if (this.currentProblemIndex > 0) { |
|
183 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
184 |
+ this.handleProblemDetail(this.currentLearningId); |
|
185 |
+ this.goToPage(this.problemType); |
|
186 |
+ } |
|
187 |
+ }, |
|
188 |
+ |
|
189 |
+ handleProblemDetail(item) { |
|
190 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
191 |
+ this.problemType = 'Chapter3'; |
|
192 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
193 |
+ this.problemType = 'Chapter3_1'; |
|
194 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
195 |
+ this.problemType = 'Chapter3_2'; |
|
196 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
197 |
+ this.problemType = 'Chapter3_3'; |
|
198 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
199 |
+ this.problemType = 'Chapter3_3_1'; |
|
200 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
201 |
+ this.problemType = 'Chapter3_4'; |
|
202 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
203 |
+ this.problemType = 'Chapter3_5'; |
|
204 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
205 |
+ this.problemType = 'Chapter3_6'; |
|
206 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
207 |
+ this.problemType = 'Chapter3_7'; |
|
208 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
209 |
+ this.problemType = 'Chapter3_8'; |
|
210 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
211 |
+ this.problemType = 'Chapter3_9'; |
|
212 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
213 |
+ this.problemType = 'Chapter3_10'; |
|
214 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
215 |
+ this.problemType = 'Chapter3_11'; |
|
216 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
217 |
+ this.problemType = 'Chapter3_12'; |
|
218 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
219 |
+ this.problemType = 'Chapter3_13'; |
|
220 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
221 |
+ this.problemType = 'Chapter3_14'; |
|
222 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
223 |
+ this.problemType = 'Chapter3_15'; |
|
224 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
225 |
+ this.problemType = 'Chapter2_8'; |
|
226 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
227 |
+ this.problemType = 'Chapter2_7'; |
|
228 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
229 |
+ this.problemType = 'Chapter2_5'; |
|
230 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
231 |
+ this.problemType = 'Chapter2_6'; |
|
232 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
233 |
+ this.problemType = 'Chapter2_10'; |
|
234 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
235 |
+ this.problemType = 'Chapter2_11'; |
|
236 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
237 |
+ this.problemType = 'Chapter2_13'; |
|
238 |
+ } |
|
239 |
+ }, |
|
240 |
+ |
|
241 |
+ // fetchProblemData() { |
|
242 |
+ // axios({ |
|
243 |
+ // url: "/problem/problemInfo.json", |
|
244 |
+ // method: "post", |
|
245 |
+ // headers: { |
|
246 |
+ // "Content-Type": "application/json; charset=UTF-8", |
|
247 |
+ // }, |
|
248 |
+ // data: { |
|
249 |
+ // prblmId: this.prblm_id.prblm_id, |
|
250 |
+ // }, |
|
251 |
+ // }) |
|
252 |
+ // .then((response) => { |
|
253 |
+ // this.problemData = response.data; |
|
254 |
+ // console.log("problemData", this.problemData); |
|
255 |
+ |
|
256 |
+ // this.sortingProblem(); |
|
257 |
+ // }) |
|
258 |
+ // .catch((error) => { |
|
259 |
+ // this.state = "noProblem"; |
|
260 |
+ // console.error("Error fetching problemData:", error); |
|
261 |
+ // }); |
|
262 |
+ // }, |
|
263 |
+ |
|
264 |
+ fetchProblemData() { |
|
265 |
+ // 로컬 스토리지에서 currentDashboard를 확인 |
|
266 |
+ const savedState = localStorage.getItem('vuexState'); |
|
267 |
+ if (savedState) { |
|
268 |
+ const parsedState = JSON.parse(savedState); |
|
269 |
+ const currentDashboard = parsedState.currentDashboard; |
|
270 |
+ |
|
271 |
+ if (currentDashboard === 'AI') { |
|
272 |
+ // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
273 |
+ const currentLearningId = parsedState.currentLearningIds; |
|
274 |
+ console.log('AI 모드에서 currentLearningId 사용:', currentLearningId); |
|
275 |
+ |
|
276 |
+ // currentLearningId로 문제 데이터 가져오기 |
|
277 |
+ axios({ |
|
278 |
+ url: '/problem/problemInfo.json', |
|
279 |
+ method: 'post', |
|
280 |
+ headers: { |
|
281 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
282 |
+ }, |
|
283 |
+ data: { |
|
284 |
+ prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
285 |
+ }, |
|
286 |
+ }) |
|
287 |
+ .then((response) => { |
|
288 |
+ this.problemData = response.data; |
|
289 |
+ console.log('AI 모드 problemData', this.problemData); |
|
290 |
+ this.sortingProblem(); |
|
291 |
+ }) |
|
292 |
+ .catch((error) => { |
|
293 |
+ this.state = 'noProblem'; |
|
294 |
+ console.error('Error fetching AI problemData:', error); |
|
295 |
+ }); |
|
296 |
+ } else { |
|
297 |
+ // Learning 모드일 경우 기존 로직 사용 |
|
298 |
+ console.log('Learning 모드에서 prblm_id 사용:', this.prblm_id); |
|
299 |
+ |
|
300 |
+ axios({ |
|
301 |
+ url: '/problem/problemInfo.json', |
|
302 |
+ method: 'post', |
|
303 |
+ headers: { |
|
304 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
305 |
+ }, |
|
306 |
+ data: { |
|
307 |
+ prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
308 |
+ }, |
|
309 |
+ }) |
|
310 |
+ .then((response) => { |
|
311 |
+ this.problemData = response.data; |
|
312 |
+ console.log('Learning 모드 problemData', this.problemData); |
|
313 |
+ this.sortingProblem(); |
|
314 |
+ }) |
|
315 |
+ .catch((error) => { |
|
316 |
+ this.state = 'noProblem'; |
|
317 |
+ console.error('Error fetching problemData:', error); |
|
318 |
+ }); |
|
319 |
+ } |
|
320 |
+ } else { |
|
321 |
+ console.error('vuexState가 로컬스토리지에 없습니다.'); |
|
322 |
+ } |
|
323 |
+ }, |
|
324 |
+ |
|
325 |
+ sortingProblem() { |
|
326 |
+ this.example = this.problemData.problem.prblmExpln; |
|
327 |
+ const parts = this.example.split('/'); |
|
328 |
+ if (parts.length === 3) { |
|
329 |
+ this.beforeQuestion = parts[0]; |
|
330 |
+ this.afterQuestion = parts[1]; |
|
331 |
+ } |
|
332 |
+ |
|
333 |
+ for (let i = 0; i < this.problemData.problemDetail.length; i++) { |
|
334 |
+ // this.answerArr[i].prblmDtlExpln = |
|
335 |
+ // this.problemData.problemDetail[i].prblmDtlExpln; |
|
336 |
+ // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn; |
|
337 |
+ this.answerArr[i] = this.problemData.problemDetail[i]; |
|
338 |
+ this.choice[i] = this.problemData.problemDetail[i].prblmDtlExpln; |
|
339 |
+ } |
|
340 |
+ console.log('answerArr', this.answerArr); |
|
341 |
+ |
|
342 |
+ for (let i = 0; i < this.answerArr.length; i++) { |
|
343 |
+ if (this.answerArr[i].prblmYn == 'Y') { |
|
344 |
+ this.answer = i + 1; |
|
345 |
+ break; |
|
346 |
+ } |
|
347 |
+ } |
|
348 |
+ }, |
|
349 |
+ }, |
|
350 |
+ computed: { |
|
351 |
+ currentLearningId() { |
|
352 |
+ return this.$store.getters.currentLearningId; |
|
353 |
+ }, |
|
354 |
+ currentLabel() { |
|
355 |
+ return this.$store.getters.currentLabel; |
|
356 |
+ }, |
|
357 |
+ currentProblemIndex() { |
|
358 |
+ return this.$store.getters.currentProblemIndex; |
|
359 |
+ }, |
|
360 |
+ isPreviousButtonDisabled() { |
|
361 |
+ return this.currentProblemIndex === 0; |
|
362 |
+ }, |
|
363 |
+ }, |
|
364 |
+ created() { |
|
365 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
366 |
+ this.prblm_id = this.currentLearningId; |
|
367 |
+ console.log('Current Label:', this.currentLabel); |
|
368 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
369 |
+ |
|
370 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
371 |
+ }, |
|
372 |
+ mounted() { |
|
373 |
+ this.fetchProblemData(); |
|
374 |
+ if (this.currentProblemIndex == 0) { |
|
375 |
+ this.hiddenState = true; |
|
160 | 376 |
} |
161 |
- } else { |
|
162 |
- console.error("currentDashboard 값이 없습니다."); |
|
163 |
- } |
|
164 | 377 |
}, |
165 |
- goToPage(page) { |
|
166 |
- this.$router.push({ name: page }); |
|
378 |
+ components: { |
|
379 |
+ BookInfo: BookInfo, |
|
167 | 380 |
}, |
168 |
- |
|
169 |
- handleClick(buttonNumber) { |
|
170 |
- this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장 |
|
171 |
- }, |
|
172 |
- |
|
173 |
- confirmAnswer() { |
|
174 |
- if (this.selectedButton === null) { |
|
175 |
- alert("정답을 선택해주세요."); |
|
176 |
- return; |
|
177 |
- } |
|
178 |
- if (this.selectedButton === this.answer) { |
|
179 |
- alert("정답입니다!"); |
|
180 |
- this.nextProblem(); |
|
181 |
- } else { |
|
182 |
- alert("오답입니다!"); |
|
183 |
- } |
|
184 |
- this.selectedButton = null; |
|
185 |
- }, |
|
186 |
- |
|
187 |
- returnPage() { |
|
188 |
- window.location.reload(); |
|
189 |
- }, |
|
190 |
- nextProblem() { |
|
191 |
- if ( |
|
192 |
- this.currentProblemIndex < |
|
193 |
- this.$store.state.currentLearningIds.length - 1 |
|
194 |
- ) { |
|
195 |
- this.$store.dispatch("goToNextProblem"); |
|
196 |
- this.handleProblemDetail(this.currentLearningId); |
|
197 |
- this.goToPage(this.problemType); |
|
198 |
- } else { |
|
199 |
- // 마지막 문제면 이동 |
|
200 |
- // this.goToPage("Chapter4"); |
|
201 |
- alert("문제 학습 완료"); |
|
202 |
- this.complete(); |
|
203 |
- } |
|
204 |
- }, |
|
205 |
- previousProblem() { |
|
206 |
- if (this.currentProblemIndex > 0) { |
|
207 |
- this.$store.dispatch("goToPreviousProblem"); |
|
208 |
- this.handleProblemDetail(this.currentLearningId); |
|
209 |
- this.goToPage(this.problemType); |
|
210 |
- } |
|
211 |
- }, |
|
212 |
- |
|
213 |
- handleProblemDetail(item) { |
|
214 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
215 |
- this.problemType = "Chapter3"; |
|
216 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
217 |
- this.problemType = "Chapter3_1"; |
|
218 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
219 |
- this.problemType = "Chapter3_2"; |
|
220 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
221 |
- this.problemType = "Chapter3_3"; |
|
222 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
223 |
- this.problemType = "Chapter3_3_1"; |
|
224 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
225 |
- this.problemType = "Chapter3_4"; |
|
226 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
227 |
- this.problemType = "Chapter3_5"; |
|
228 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
229 |
- this.problemType = "Chapter3_6"; |
|
230 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
231 |
- this.problemType = "Chapter3_7"; |
|
232 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
233 |
- this.problemType = "Chapter3_8"; |
|
234 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
235 |
- this.problemType = "Chapter3_9"; |
|
236 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
237 |
- this.problemType = "Chapter3_10"; |
|
238 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
239 |
- this.problemType = "Chapter3_11"; |
|
240 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
241 |
- this.problemType = "Chapter3_12"; |
|
242 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
243 |
- this.problemType = "Chapter3_13"; |
|
244 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
245 |
- this.problemType = "Chapter3_14"; |
|
246 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
247 |
- this.problemType = "Chapter3_15"; |
|
248 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
249 |
- this.problemType = "Chapter2_8"; |
|
250 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
251 |
- this.problemType = "Chapter2_7"; |
|
252 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
253 |
- this.problemType = "Chapter2_5"; |
|
254 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
255 |
- this.problemType = "Chapter2_6"; |
|
256 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
257 |
- this.problemType = "Chapter2_10"; |
|
258 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
259 |
- this.problemType = "Chapter2_11"; |
|
260 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
261 |
- this.problemType = "Chapter2_13"; |
|
262 |
- } |
|
263 |
- }, |
|
264 |
- |
|
265 |
- // fetchProblemData() { |
|
266 |
- // axios({ |
|
267 |
- // url: "/problem/problemInfo.json", |
|
268 |
- // method: "post", |
|
269 |
- // headers: { |
|
270 |
- // "Content-Type": "application/json; charset=UTF-8", |
|
271 |
- // }, |
|
272 |
- // data: { |
|
273 |
- // prblmId: this.prblm_id.prblm_id, |
|
274 |
- // }, |
|
275 |
- // }) |
|
276 |
- // .then((response) => { |
|
277 |
- // this.problemData = response.data; |
|
278 |
- // console.log("problemData", this.problemData); |
|
279 |
- |
|
280 |
- // this.sortingProblem(); |
|
281 |
- // }) |
|
282 |
- // .catch((error) => { |
|
283 |
- // this.state = "noProblem"; |
|
284 |
- // console.error("Error fetching problemData:", error); |
|
285 |
- // }); |
|
286 |
- // }, |
|
287 |
- |
|
288 |
- fetchProblemData() { |
|
289 |
- // 로컬 스토리지에서 currentDashboard를 확인 |
|
290 |
- const savedState = localStorage.getItem("vuexState"); |
|
291 |
- if (savedState) { |
|
292 |
- const parsedState = JSON.parse(savedState); |
|
293 |
- const currentDashboard = parsedState.currentDashboard; |
|
294 |
- |
|
295 |
- if (currentDashboard === "AI") { |
|
296 |
- // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
297 |
- const currentLearningId = parsedState.currentLearningIds; |
|
298 |
- console.log("AI 모드에서 currentLearningId 사용:", currentLearningId); |
|
299 |
- |
|
300 |
- // currentLearningId로 문제 데이터 가져오기 |
|
301 |
- axios({ |
|
302 |
- url: "/problem/problemInfo.json", |
|
303 |
- method: "post", |
|
304 |
- headers: { |
|
305 |
- "Content-Type": "application/json; charset=UTF-8", |
|
306 |
- }, |
|
307 |
- data: { |
|
308 |
- prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
309 |
- }, |
|
310 |
- }) |
|
311 |
- .then((response) => { |
|
312 |
- this.problemData = response.data; |
|
313 |
- console.log("AI 모드 problemData", this.problemData); |
|
314 |
- this.sortingProblem(); |
|
315 |
- }) |
|
316 |
- .catch((error) => { |
|
317 |
- this.state = "noProblem"; |
|
318 |
- console.error("Error fetching AI problemData:", error); |
|
319 |
- }); |
|
320 |
- |
|
321 |
- } else { |
|
322 |
- // Learning 모드일 경우 기존 로직 사용 |
|
323 |
- console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id); |
|
324 |
- |
|
325 |
- axios({ |
|
326 |
- url: "/problem/problemInfo.json", |
|
327 |
- method: "post", |
|
328 |
- headers: { |
|
329 |
- "Content-Type": "application/json; charset=UTF-8", |
|
330 |
- }, |
|
331 |
- data: { |
|
332 |
- prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
333 |
- }, |
|
334 |
- }) |
|
335 |
- .then((response) => { |
|
336 |
- this.problemData = response.data; |
|
337 |
- console.log("Learning 모드 problemData", this.problemData); |
|
338 |
- this.sortingProblem(); |
|
339 |
- }) |
|
340 |
- .catch((error) => { |
|
341 |
- this.state = "noProblem"; |
|
342 |
- console.error("Error fetching problemData:", error); |
|
343 |
- }); |
|
344 |
- } |
|
345 |
- } else { |
|
346 |
- console.error("vuexState가 로컬스토리지에 없습니다."); |
|
347 |
- } |
|
348 |
- }, |
|
349 |
- |
|
350 |
- sortingProblem() { |
|
351 |
- this.example = this.problemData.problem.prblmExpln; |
|
352 |
- const parts = this.example.split("/"); |
|
353 |
- if (parts.length === 3) { |
|
354 |
- this.beforeQuestion = parts[0]; |
|
355 |
- this.afterQuestion = parts[1]; |
|
356 |
- } |
|
357 |
- |
|
358 |
- for (let i = 0; i < this.problemData.problemDetail.length; i++) { |
|
359 |
- // this.answerArr[i].prblmDtlExpln = |
|
360 |
- // this.problemData.problemDetail[i].prblmDtlExpln; |
|
361 |
- // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn; |
|
362 |
- this.answerArr[i] = this.problemData.problemDetail[i]; |
|
363 |
- this.choice[i] = this.problemData.problemDetail[i].prblmDtlExpln; |
|
364 |
- } |
|
365 |
- console.log("answerArr", this.answerArr); |
|
366 |
- |
|
367 |
- for (let i = 0; i < this.answerArr.length; i++) { |
|
368 |
- if (this.answerArr[i].prblmYn == "Y") { |
|
369 |
- this.answer = i + 1; |
|
370 |
- break; |
|
371 |
- } |
|
372 |
- } |
|
373 |
- }, |
|
374 |
- }, |
|
375 |
- computed: { |
|
376 |
- currentLearningId() { |
|
377 |
- return this.$store.getters.currentLearningId; |
|
378 |
- }, |
|
379 |
- currentLabel() { |
|
380 |
- return this.$store.getters.currentLabel; |
|
381 |
- }, |
|
382 |
- currentProblemIndex() { |
|
383 |
- return this.$store.getters.currentProblemIndex; |
|
384 |
- }, |
|
385 |
- isPreviousButtonDisabled() { |
|
386 |
- return this.currentProblemIndex === 0; |
|
387 |
- }, |
|
388 |
- }, |
|
389 |
- created() { |
|
390 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
391 |
- this.prblm_id = this.currentLearningId; |
|
392 |
- console.log("Current Label:", this.currentLabel); |
|
393 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
394 |
- |
|
395 |
- // Fetch or process the current problem based on `currentLearningId` |
|
396 |
- }, |
|
397 |
- mounted() { |
|
398 |
- this.fetchProblemData(); |
|
399 |
- if (this.currentProblemIndex == 0) { |
|
400 |
- this.hiddenState = true; |
|
401 |
- } |
|
402 |
- }, |
|
403 | 381 |
}; |
404 | 382 |
</script> |
405 | 383 |
|
406 | 384 |
<style scoped> |
407 | 385 |
.imgGroup { |
408 |
- width: fit-content; |
|
386 |
+ width: fit-content; |
|
409 | 387 |
} |
410 | 388 |
|
411 | 389 |
.imgGroup button { |
412 |
- position: relative; |
|
390 |
+ position: relative; |
|
413 | 391 |
} |
414 | 392 |
|
415 | 393 |
.imgGroup button p, |
416 | 394 |
.textbox p { |
417 |
- position: absolute; |
|
418 |
- top: 50%; |
|
419 |
- left: 50%; |
|
420 |
- transform: translate(-50%, -50%); |
|
421 |
- width: fit-content; |
|
422 |
- height: fit-content; |
|
423 |
- background: #ffffffb8; |
|
424 |
- border-radius: 5px; |
|
425 |
- padding: 10px; |
|
426 |
- font-size: 23px; |
|
427 |
- font-family: "ONEMobilePOP"; |
|
395 |
+ position: absolute; |
|
396 |
+ top: 50%; |
|
397 |
+ left: 50%; |
|
398 |
+ transform: translate(-50%, -50%); |
|
399 |
+ width: fit-content; |
|
400 |
+ height: fit-content; |
|
401 |
+ background: #ffffffb8; |
|
402 |
+ border-radius: 5px; |
|
403 |
+ padding: 10px; |
|
404 |
+ font-size: 23px; |
|
405 |
+ font-family: 'ONEMobilePOP'; |
|
428 | 406 |
} |
429 | 407 |
|
430 | 408 |
.pickGroup { |
431 |
- display: flex; |
|
432 |
- flex-direction: row; |
|
433 |
- align-items: center; |
|
434 |
- gap: 40px; |
|
409 |
+ display: flex; |
|
410 |
+ flex-direction: row; |
|
411 |
+ align-items: center; |
|
412 |
+ gap: 40px; |
|
435 | 413 |
} |
436 | 414 |
|
437 | 415 |
.pickGroup button { |
438 |
- position: relative; |
|
439 |
- margin-right: 30px; |
|
416 |
+ position: relative; |
|
417 |
+ margin-right: 30px; |
|
440 | 418 |
} |
441 | 419 |
|
442 | 420 |
.pickGroup button p { |
443 |
- font-size: 34px; |
|
444 |
- color: #c6c6c6; |
|
445 |
- position: absolute; |
|
446 |
- top: 50%; |
|
447 |
- left: 50%; |
|
448 |
- transform: translate(-50%, -50%); |
|
421 |
+ font-size: 34px; |
|
422 |
+ color: #c6c6c6; |
|
423 |
+ position: absolute; |
|
424 |
+ top: 50%; |
|
425 |
+ left: 50%; |
|
426 |
+ transform: translate(-50%, -50%); |
|
449 | 427 |
} |
450 | 428 |
|
451 | 429 |
.pickGroup article img { |
452 |
- object-fit: contain; |
|
453 |
- width: -webkit-fill-available; |
|
430 |
+ object-fit: contain; |
|
431 |
+ width: -webkit-fill-available; |
|
454 | 432 |
} |
455 | 433 |
|
456 | 434 |
.pickGroup article > div > p { |
457 |
- font-size: 25px; |
|
458 |
- white-space: nowrap; |
|
459 |
- /* 텍스트가 줄 바꿈 없이 한 줄로 표시되도록 설정 */ |
|
435 |
+ font-size: 25px; |
|
436 |
+ white-space: nowrap; |
|
437 |
+ /* 텍스트가 줄 바꿈 없이 한 줄로 표시되도록 설정 */ |
|
460 | 438 |
} |
461 | 439 |
|
462 | 440 |
.pickGroup button p.active { |
463 |
- color: #000; |
|
464 |
- /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
441 |
+ color: #000; |
|
442 |
+ /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
465 | 443 |
} |
466 | 444 |
|
467 | 445 |
.pickImg { |
468 |
- display: flex; |
|
469 |
- flex-direction: column; |
|
470 |
- gap: 70px; |
|
446 |
+ display: flex; |
|
447 |
+ flex-direction: column; |
|
448 |
+ gap: 70px; |
|
471 | 449 |
} |
472 | 450 |
|
473 | 451 |
.pickChoice { |
474 |
- display: flex; |
|
475 |
- flex-direction: column; |
|
476 |
- align-items: flex-start; |
|
452 |
+ display: flex; |
|
453 |
+ flex-direction: column; |
|
454 |
+ align-items: flex-start; |
|
477 | 455 |
} |
478 | 456 |
|
479 | 457 |
.answerButton { |
480 |
- background-color: #ffc107; |
|
481 |
- border-radius: 30px; |
|
482 |
- padding: 20px 50px; |
|
483 |
- margin: 40px; |
|
484 |
- font-family: "ONEMobileOTF-Regular"; |
|
485 |
- font-weight: bold; |
|
486 |
- font-size: 24px; |
|
458 |
+ background-color: #ffc107; |
|
459 |
+ border-radius: 30px; |
|
460 |
+ padding: 20px 50px; |
|
461 |
+ margin: 40px; |
|
462 |
+ font-family: 'ONEMobileOTF-Regular'; |
|
463 |
+ font-weight: bold; |
|
464 |
+ font-size: 24px; |
|
487 | 465 |
} |
488 | 466 |
|
489 | 467 |
.completeBtn { |
490 |
- margin-right: 100px; |
|
491 |
- background-color: #ffba08; |
|
492 |
- padding: 10px 30px; |
|
493 |
- border-radius: 10px; |
|
494 |
- font-size: 28px; |
|
495 |
- font-family: "ONEMobilePOPOTF"; |
|
468 |
+ margin-right: 100px; |
|
469 |
+ background-color: #ffba08; |
|
470 |
+ padding: 10px 30px; |
|
471 |
+ border-radius: 10px; |
|
472 |
+ font-size: 28px; |
|
473 |
+ font-family: 'ONEMobilePOPOTF'; |
|
496 | 474 |
} |
497 | 475 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_11.vue
+++ client/views/pages/main/Chapter/Chapter2_11.vue
... | ... | @@ -1,442 +1,423 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
35 | 13 |
</div> |
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
36 | 26 |
|
37 |
- <div class="flex align-center mb30"> |
|
38 |
- <p class="subtitle2 mr20"> |
|
39 |
- 앗! 도끼가 물에 빠졌어! 어느 것이 내 도끼일까? |
|
40 |
- </p> |
|
41 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
27 |
+ <div class="flex align-center mb30"> |
|
28 |
+ <p class="subtitle2 mr20">앗! 도끼가 물에 빠졌어! 어느 것이 내 도끼일까?</p> |
|
29 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
42 | 30 |
</button> --> |
43 |
- </div> |
|
31 |
+ </div> |
|
44 | 32 |
|
45 |
- <div class="text-ct"> |
|
46 |
- <div class="imgGroup flex align-start justify-center mt30"> |
|
47 |
- <img src="../../../../resources/img/img87_43s.png" alt="" /> |
|
48 |
- <div class="inputGroup"> |
|
49 |
- <p>{{ beforeQuestion }}</p> |
|
50 |
- <p>__________</p> |
|
51 |
- <p>{{ afterQuestion }}</p> |
|
33 |
+ <div class="text-ct"> |
|
34 |
+ <div class="imgGroup flex align-start justify-center mt30"> |
|
35 |
+ <img src="../../../../resources/img/img87_43s.png" alt="" /> |
|
36 |
+ <div class="inputGroup"> |
|
37 |
+ <p>{{ beforeQuestion }}</p> |
|
38 |
+ <p>__________</p> |
|
39 |
+ <p>{{ afterQuestion }}</p> |
|
40 |
+ </div> |
|
41 |
+ </div> |
|
42 |
+ <div class="pickGroup"> |
|
43 |
+ <article class="flex justify-center" style="gap: 60px; bottom: 159px; left: 242px"> |
|
44 |
+ <div class="flex"> |
|
45 |
+ <button @click="handleClick(1)"> |
|
46 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
47 |
+ <p :class="{ active: selectedButton === 1 }">1</p> |
|
48 |
+ </button> |
|
49 |
+ <p>{{ choice[0] }}</p> |
|
50 |
+ </div> |
|
51 |
+ </article> |
|
52 |
+ <article class="flex justify-center" style="gap: 60px; bottom: 159px; right: 559px"> |
|
53 |
+ <div class="flex"> |
|
54 |
+ <button @click="handleClick(2)"> |
|
55 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
56 |
+ <p :class="{ active: selectedButton === 2 }">2</p> |
|
57 |
+ </button> |
|
58 |
+ <p>{{ choice[1] }}</p> |
|
59 |
+ </div> |
|
60 |
+ </article> |
|
61 |
+ <div class="answerBox"> |
|
62 |
+ <button class="answerButton" @click="confirmAnswer">정답 확인</button> |
|
63 |
+ </div> |
|
64 |
+ </div> |
|
65 |
+ </div> |
|
52 | 66 |
</div> |
53 |
- </div> |
|
54 |
- <div class="pickGroup"> |
|
55 |
- <article |
|
56 |
- class="flex justify-center" |
|
57 |
- style="gap: 60px; bottom: 159px; left: 242px" |
|
58 |
- > |
|
59 |
- <div class="flex"> |
|
60 |
- <button @click="handleClick(1)"> |
|
61 |
- <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
62 |
- <p :class="{ active: selectedButton === 1 }">1</p> |
|
63 |
- </button> |
|
64 |
- <p>{{ choice[0] }}</p> |
|
65 |
- </div> |
|
66 |
- </article> |
|
67 |
- <article |
|
68 |
- class="flex justify-center" |
|
69 |
- style="gap: 60px; bottom: 159px; right: 559px" |
|
70 |
- > |
|
71 |
- <div class="flex"> |
|
72 |
- <button @click="handleClick(2)"> |
|
73 |
- <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
74 |
- <p :class="{ active: selectedButton === 2 }">2</p> |
|
75 |
- </button> |
|
76 |
- <p>{{ choice[1] }}</p> |
|
77 |
- </div> |
|
78 |
- </article> |
|
79 |
- <div class="answerBox"> |
|
80 |
- <button class="answerButton" @click="confirmAnswer"> |
|
81 |
- 정답 확인 |
|
82 |
- </button> |
|
67 |
+ <div class="next-btn" @click="nextProblem()"> |
|
68 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
83 | 69 |
</div> |
84 |
- </div> |
|
85 | 70 |
</div> |
86 |
- </div> |
|
87 |
- <div class="next-btn" @click="nextProblem()"> |
|
88 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
89 |
- </div> |
|
90 | 71 |
</div> |
91 |
- </div> |
|
92 | 72 |
</template> |
93 | 73 |
|
94 | 74 |
<script> |
95 |
-import axios from "axios"; |
|
75 |
+import axios from 'axios'; |
|
76 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
96 | 77 |
export default { |
97 |
- data() { |
|
98 |
- return { |
|
99 |
- selectedButton: null, |
|
78 |
+ data() { |
|
79 |
+ return { |
|
80 |
+ selectedButton: null, |
|
100 | 81 |
|
101 |
- beforeQuestion: "", |
|
102 |
- afterQuestion: "", |
|
82 |
+ beforeQuestion: '', |
|
83 |
+ afterQuestion: '', |
|
103 | 84 |
|
104 |
- choice: [], |
|
105 |
- answer: 1, |
|
85 |
+ choice: [], |
|
86 |
+ answer: 1, |
|
106 | 87 |
|
107 |
- prblm_id: [], |
|
108 |
- unit_id: null, |
|
109 |
- dataList: [], |
|
88 |
+ prblm_id: [], |
|
89 |
+ unit_id: null, |
|
90 |
+ dataList: [], |
|
110 | 91 |
|
111 |
- seq: this.$store.getters.seqNum, |
|
112 |
- hiddenState: false, |
|
113 |
- }; |
|
114 |
- }, |
|
115 |
- methods: { |
|
116 |
- complete() { |
|
117 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
118 |
- const savedState = localStorage.getItem("vuexState"); |
|
119 |
- if (savedState) { |
|
120 |
- const parsedState = JSON.parse(savedState); |
|
121 |
- const currentDashboard = parsedState.currentDashboard; |
|
122 |
- |
|
123 |
- const { unit_id, book_id } = this.$route.query; |
|
124 |
- if (currentDashboard === "Learning") { |
|
125 |
- // Learning 모드일 때 Dashboard로 이동 |
|
126 |
- this.$router.push({ |
|
127 |
- name: "Dashboard", |
|
128 |
- query: { value: this.seq, unit_id, book_id }, |
|
129 |
- }); |
|
130 |
- } else if (currentDashboard === "AI") { |
|
131 |
- // AI 모드일 때 AIDashboard로 이동 |
|
132 |
- this.$router.push({ |
|
133 |
- name: "AIDashboard", |
|
134 |
- query: { value: this.seq, unit_id, book_id }, |
|
135 |
- }); |
|
136 |
- } |
|
137 |
- } else { |
|
138 |
- console.error("currentDashboard 값이 없습니다."); |
|
139 |
- } |
|
92 |
+ seq: this.$store.getters.seqNum, |
|
93 |
+ hiddenState: false, |
|
94 |
+ }; |
|
140 | 95 |
}, |
141 |
- goToPage(page) { |
|
142 |
- this.$router.push({ name: page }); |
|
143 |
- }, |
|
96 |
+ methods: { |
|
97 |
+ complete() { |
|
98 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
99 |
+ const savedState = localStorage.getItem('vuexState'); |
|
100 |
+ if (savedState) { |
|
101 |
+ const parsedState = JSON.parse(savedState); |
|
102 |
+ const currentDashboard = parsedState.currentDashboard; |
|
144 | 103 |
|
145 |
- handleClick(buttonNumber) { |
|
146 |
- this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장 |
|
147 |
- }, |
|
148 |
- |
|
149 |
- confirmAnswer() { |
|
150 |
- if (this.selectedButton === null) { |
|
151 |
- alert("정답을 선택해주세요."); |
|
152 |
- return; |
|
153 |
- } |
|
154 |
- if (this.selectedButton === this.answer) { |
|
155 |
- alert("정답입니다!"); |
|
156 |
- this.nextProblem(); |
|
157 |
- } else { |
|
158 |
- alert("오답입니다!"); |
|
159 |
- } |
|
160 |
- this.selectedButton = null; |
|
161 |
- }, |
|
162 |
- |
|
163 |
- returnPage() { |
|
164 |
- window.location.reload(); |
|
165 |
- }, |
|
166 |
- splitExample() { |
|
167 |
- const parts = this.example.split("/?/"); |
|
168 |
- if (parts.length === 2) { |
|
169 |
- this.beforeQuestion = parts[0]; |
|
170 |
- this.afterQuestion = parts[1]; |
|
171 |
- } |
|
172 |
- }, |
|
173 |
- // getProblem() { |
|
174 |
- // const vm = this; |
|
175 |
- // const prblmId = this.prblm_id.prblm_id; |
|
176 |
- // // const prblmId = "PROBLEM_000000000000076"; |
|
177 |
- |
|
178 |
- // axios({ |
|
179 |
- // url: "problem/problemInfo.json", |
|
180 |
- // method: "post", |
|
181 |
- // headers: { |
|
182 |
- // "Content-Type": "application/json; charset=UTF-8", |
|
183 |
- // }, |
|
184 |
- // data: { |
|
185 |
- // prblmId: prblmId, |
|
186 |
- // }, |
|
187 |
- // }) |
|
188 |
- // .then(function (res) { |
|
189 |
- // console.log("problem - response : ", res.data); |
|
190 |
- // vm.dataList = res.data.problem; |
|
191 |
- // vm.problemDetail = res.data.problemDetail; |
|
192 |
- // vm.example = vm.dataList.prblmExpln; |
|
193 |
- // vm.problemDetail.forEach((detail, index) => { |
|
194 |
- // vm.choice.push(detail.prblmDtlExpln); |
|
195 |
- // if (detail.prblmYn === "Y") { |
|
196 |
- // vm.answer = index + 1; |
|
197 |
- // } |
|
198 |
- // }); |
|
199 |
- |
|
200 |
- // console.log(vm.example); |
|
201 |
- // console.log(vm.choice); |
|
202 |
- // console.log(vm.answer); |
|
203 |
- // vm.splitExample(); |
|
204 |
- // }) |
|
205 |
- // .catch(function (error) { |
|
206 |
- // console.log("problem - error : ", error); |
|
207 |
- // }); |
|
208 |
- // }, |
|
209 |
- |
|
210 |
- getProblem() { |
|
211 |
- const vm = this; |
|
212 |
- let prblmId = null; |
|
213 |
- |
|
214 |
- // 로컬 스토리지에서 currentDashboard를 확인 |
|
215 |
- const savedState = localStorage.getItem("vuexState"); |
|
216 |
- if (savedState) { |
|
217 |
- const parsedState = JSON.parse(savedState); |
|
218 |
- const currentDashboard = parsedState.currentDashboard; |
|
219 |
- |
|
220 |
- if (currentDashboard === "AI") { |
|
221 |
- // AI 모드일 때 로컬스토리지에서 currentLearningIds를 사용 |
|
222 |
- prblmId = parsedState.currentLearningIds; // currentLearningIds를 사용 |
|
223 |
- console.log("AI 모드에서 currentLearningIds 사용:", prblmId); |
|
224 |
- } else { |
|
225 |
- // Learning 모드일 때 기존 방식 사용 |
|
226 |
- prblmId = this.prblm_id.prblm_id; // 기존 방식 |
|
227 |
- console.log("Learning 모드에서 currentLearningId 사용:", prblmId); |
|
228 |
- } |
|
229 |
- } |
|
230 |
- |
|
231 |
- axios({ |
|
232 |
- url: "problem/problemInfo.json", |
|
233 |
- method: "post", |
|
234 |
- headers: { |
|
235 |
- "Content-Type": "application/json; charset=UTF-8", |
|
236 |
- }, |
|
237 |
- data: { |
|
238 |
- prblmId: prblmId, |
|
239 |
- }, |
|
240 |
- }) |
|
241 |
- .then(function (res) { |
|
242 |
- console.log("problem - response : ", res.data); |
|
243 |
- vm.dataList = res.data.problem; |
|
244 |
- vm.problemDetail = res.data.problemDetail; |
|
245 |
- vm.example = vm.dataList.prblmExpln; |
|
246 |
- vm.problemDetail.forEach((detail, index) => { |
|
247 |
- vm.choice.push(detail.prblmDtlExpln); |
|
248 |
- if (detail.prblmYn === "Y") { |
|
249 |
- vm.answer = index + 1; |
|
104 |
+ const { unit_id, book_id } = this.$route.query; |
|
105 |
+ if (currentDashboard === 'Learning') { |
|
106 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
107 |
+ this.$router.push({ |
|
108 |
+ name: 'Dashboard', |
|
109 |
+ query: { value: this.seq, unit_id, book_id }, |
|
110 |
+ }); |
|
111 |
+ } else if (currentDashboard === 'AI') { |
|
112 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
113 |
+ this.$router.push({ |
|
114 |
+ name: 'AIDashboard', |
|
115 |
+ query: { value: this.seq, unit_id, book_id }, |
|
116 |
+ }); |
|
117 |
+ } |
|
118 |
+ } else { |
|
119 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
250 | 120 |
} |
251 |
- }); |
|
121 |
+ }, |
|
122 |
+ goToPage(page) { |
|
123 |
+ this.$router.push({ name: page }); |
|
124 |
+ }, |
|
252 | 125 |
|
253 |
- console.log(vm.example); |
|
254 |
- console.log(vm.choice); |
|
255 |
- console.log(vm.answer); |
|
256 |
- vm.splitExample(); |
|
257 |
- }) |
|
258 |
- .catch(function (error) { |
|
259 |
- console.log("problem - error : ", error); |
|
260 |
- }); |
|
261 |
- }, |
|
126 |
+ handleClick(buttonNumber) { |
|
127 |
+ this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장 |
|
128 |
+ }, |
|
262 | 129 |
|
263 |
- nextProblem() { |
|
264 |
- if ( |
|
265 |
- this.currentProblemIndex < |
|
266 |
- this.$store.state.currentLearningIds.length - 1 |
|
267 |
- ) { |
|
268 |
- this.$store.dispatch("goToNextProblem"); |
|
269 |
- this.handleProblemDetail(this.currentLearningId); |
|
270 |
- this.goToPage(this.problemType); |
|
271 |
- } else { |
|
272 |
- // 마지막 문제면 이동 |
|
273 |
- // this.goToPage("Chapter4"); |
|
274 |
- alert("문제 학습 완료"); |
|
275 |
- this.complete(); |
|
276 |
- } |
|
277 |
- }, |
|
278 |
- previousProblem() { |
|
279 |
- if (this.currentProblemIndex > 0) { |
|
280 |
- this.$store.dispatch("goToPreviousProblem"); |
|
281 |
- this.handleProblemDetail(this.currentLearningId); |
|
282 |
- this.goToPage(this.problemType); |
|
283 |
- } |
|
284 |
- }, |
|
130 |
+ confirmAnswer() { |
|
131 |
+ if (this.selectedButton === null) { |
|
132 |
+ alert('정답을 선택해주세요.'); |
|
133 |
+ return; |
|
134 |
+ } |
|
135 |
+ if (this.selectedButton === this.answer) { |
|
136 |
+ alert('정답입니다!'); |
|
137 |
+ this.nextProblem(); |
|
138 |
+ } else { |
|
139 |
+ alert('오답입니다!'); |
|
140 |
+ } |
|
141 |
+ this.selectedButton = null; |
|
142 |
+ }, |
|
285 | 143 |
|
286 |
- handleProblemDetail(item) { |
|
287 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
288 |
- this.problemType = "Chapter3"; |
|
289 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
290 |
- this.problemType = "Chapter3_1"; |
|
291 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
292 |
- this.problemType = "Chapter3_2"; |
|
293 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
294 |
- this.problemType = "Chapter3_3"; |
|
295 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
296 |
- this.problemType = "Chapter3_3_1"; |
|
297 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
298 |
- this.problemType = "Chapter3_4"; |
|
299 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
300 |
- this.problemType = "Chapter3_5"; |
|
301 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
302 |
- this.problemType = "Chapter3_6"; |
|
303 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
304 |
- this.problemType = "Chapter3_7"; |
|
305 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
306 |
- this.problemType = "Chapter3_8"; |
|
307 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
308 |
- this.problemType = "Chapter3_9"; |
|
309 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
310 |
- this.problemType = "Chapter3_10"; |
|
311 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
312 |
- this.problemType = "Chapter3_11"; |
|
313 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
314 |
- this.problemType = "Chapter3_12"; |
|
315 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
316 |
- this.problemType = "Chapter3_13"; |
|
317 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
318 |
- this.problemType = "Chapter3_14"; |
|
319 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
320 |
- this.problemType = "Chapter3_15"; |
|
321 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
322 |
- this.problemType = "Chapter2_8"; |
|
323 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
324 |
- this.problemType = "Chapter2_7"; |
|
325 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
326 |
- this.problemType = "Chapter2_5"; |
|
327 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
328 |
- this.problemType = "Chapter2_6"; |
|
329 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
330 |
- this.problemType = "Chapter2_10"; |
|
331 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
332 |
- this.problemType = "Chapter2_11"; |
|
333 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
334 |
- this.problemType = "Chapter2_13"; |
|
335 |
- } |
|
336 |
- }, |
|
337 |
- }, |
|
338 |
- watch: {}, |
|
339 |
- computed: { |
|
340 |
- currentLearningId() { |
|
341 |
- return this.$store.getters.currentLearningId; |
|
342 |
- }, |
|
343 |
- currentLabel() { |
|
344 |
- return this.$store.getters.currentLabel; |
|
345 |
- }, |
|
346 |
- currentProblemIndex() { |
|
347 |
- return this.$store.getters.currentProblemIndex; |
|
348 |
- }, |
|
349 |
- isPreviousButtonDisabled() { |
|
350 |
- return this.currentProblemIndex === 0; |
|
351 |
- }, |
|
352 |
- }, |
|
353 |
- created() { |
|
354 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
355 |
- this.prblm_id = this.currentLearningId; |
|
356 |
- console.log("Current Label:", this.currentLabel); |
|
357 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
144 |
+ returnPage() { |
|
145 |
+ window.location.reload(); |
|
146 |
+ }, |
|
147 |
+ splitExample() { |
|
148 |
+ const parts = this.example.split('/?/'); |
|
149 |
+ if (parts.length === 2) { |
|
150 |
+ this.beforeQuestion = parts[0]; |
|
151 |
+ this.afterQuestion = parts[1]; |
|
152 |
+ } |
|
153 |
+ }, |
|
154 |
+ // getProblem() { |
|
155 |
+ // const vm = this; |
|
156 |
+ // const prblmId = this.prblm_id.prblm_id; |
|
157 |
+ // // const prblmId = "PROBLEM_000000000000076"; |
|
358 | 158 |
|
359 |
- // Fetch or process the current problem based on `currentLearningId` |
|
360 |
- }, |
|
361 |
- mounted() { |
|
362 |
- this.getProblem(); |
|
159 |
+ // axios({ |
|
160 |
+ // url: "problem/problemInfo.json", |
|
161 |
+ // method: "post", |
|
162 |
+ // headers: { |
|
163 |
+ // "Content-Type": "application/json; charset=UTF-8", |
|
164 |
+ // }, |
|
165 |
+ // data: { |
|
166 |
+ // prblmId: prblmId, |
|
167 |
+ // }, |
|
168 |
+ // }) |
|
169 |
+ // .then(function (res) { |
|
170 |
+ // console.log("problem - response : ", res.data); |
|
171 |
+ // vm.dataList = res.data.problem; |
|
172 |
+ // vm.problemDetail = res.data.problemDetail; |
|
173 |
+ // vm.example = vm.dataList.prblmExpln; |
|
174 |
+ // vm.problemDetail.forEach((detail, index) => { |
|
175 |
+ // vm.choice.push(detail.prblmDtlExpln); |
|
176 |
+ // if (detail.prblmYn === "Y") { |
|
177 |
+ // vm.answer = index + 1; |
|
178 |
+ // } |
|
179 |
+ // }); |
|
363 | 180 |
|
364 |
- if (this.currentProblemIndex == 0) { |
|
365 |
- this.hiddenState = true; |
|
366 |
- } |
|
367 |
- }, |
|
181 |
+ // console.log(vm.example); |
|
182 |
+ // console.log(vm.choice); |
|
183 |
+ // console.log(vm.answer); |
|
184 |
+ // vm.splitExample(); |
|
185 |
+ // }) |
|
186 |
+ // .catch(function (error) { |
|
187 |
+ // console.log("problem - error : ", error); |
|
188 |
+ // }); |
|
189 |
+ // }, |
|
190 |
+ |
|
191 |
+ getProblem() { |
|
192 |
+ const vm = this; |
|
193 |
+ let prblmId = null; |
|
194 |
+ |
|
195 |
+ // 로컬 스토리지에서 currentDashboard를 확인 |
|
196 |
+ const savedState = localStorage.getItem('vuexState'); |
|
197 |
+ if (savedState) { |
|
198 |
+ const parsedState = JSON.parse(savedState); |
|
199 |
+ const currentDashboard = parsedState.currentDashboard; |
|
200 |
+ |
|
201 |
+ if (currentDashboard === 'AI') { |
|
202 |
+ // AI 모드일 때 로컬스토리지에서 currentLearningIds를 사용 |
|
203 |
+ prblmId = parsedState.currentLearningIds; // currentLearningIds를 사용 |
|
204 |
+ console.log('AI 모드에서 currentLearningIds 사용:', prblmId); |
|
205 |
+ } else { |
|
206 |
+ // Learning 모드일 때 기존 방식 사용 |
|
207 |
+ prblmId = this.prblm_id.prblm_id; // 기존 방식 |
|
208 |
+ console.log('Learning 모드에서 currentLearningId 사용:', prblmId); |
|
209 |
+ } |
|
210 |
+ } |
|
211 |
+ |
|
212 |
+ axios({ |
|
213 |
+ url: 'problem/problemInfo.json', |
|
214 |
+ method: 'post', |
|
215 |
+ headers: { |
|
216 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
217 |
+ }, |
|
218 |
+ data: { |
|
219 |
+ prblmId: prblmId, |
|
220 |
+ }, |
|
221 |
+ }) |
|
222 |
+ .then(function (res) { |
|
223 |
+ console.log('problem - response : ', res.data); |
|
224 |
+ vm.dataList = res.data.problem; |
|
225 |
+ vm.problemDetail = res.data.problemDetail; |
|
226 |
+ vm.example = vm.dataList.prblmExpln; |
|
227 |
+ vm.problemDetail.forEach((detail, index) => { |
|
228 |
+ vm.choice.push(detail.prblmDtlExpln); |
|
229 |
+ if (detail.prblmYn === 'Y') { |
|
230 |
+ vm.answer = index + 1; |
|
231 |
+ } |
|
232 |
+ }); |
|
233 |
+ |
|
234 |
+ console.log(vm.example); |
|
235 |
+ console.log(vm.choice); |
|
236 |
+ console.log(vm.answer); |
|
237 |
+ vm.splitExample(); |
|
238 |
+ }) |
|
239 |
+ .catch(function (error) { |
|
240 |
+ console.log('problem - error : ', error); |
|
241 |
+ }); |
|
242 |
+ }, |
|
243 |
+ |
|
244 |
+ nextProblem() { |
|
245 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
246 |
+ this.$store.dispatch('goToNextProblem'); |
|
247 |
+ this.handleProblemDetail(this.currentLearningId); |
|
248 |
+ this.goToPage(this.problemType); |
|
249 |
+ } else { |
|
250 |
+ // 마지막 문제면 이동 |
|
251 |
+ // this.goToPage("Chapter4"); |
|
252 |
+ alert('문제 학습 완료'); |
|
253 |
+ this.complete(); |
|
254 |
+ } |
|
255 |
+ }, |
|
256 |
+ previousProblem() { |
|
257 |
+ if (this.currentProblemIndex > 0) { |
|
258 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
259 |
+ this.handleProblemDetail(this.currentLearningId); |
|
260 |
+ this.goToPage(this.problemType); |
|
261 |
+ } |
|
262 |
+ }, |
|
263 |
+ |
|
264 |
+ handleProblemDetail(item) { |
|
265 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
266 |
+ this.problemType = 'Chapter3'; |
|
267 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
268 |
+ this.problemType = 'Chapter3_1'; |
|
269 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
270 |
+ this.problemType = 'Chapter3_2'; |
|
271 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
272 |
+ this.problemType = 'Chapter3_3'; |
|
273 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
274 |
+ this.problemType = 'Chapter3_3_1'; |
|
275 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
276 |
+ this.problemType = 'Chapter3_4'; |
|
277 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
278 |
+ this.problemType = 'Chapter3_5'; |
|
279 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
280 |
+ this.problemType = 'Chapter3_6'; |
|
281 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
282 |
+ this.problemType = 'Chapter3_7'; |
|
283 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
284 |
+ this.problemType = 'Chapter3_8'; |
|
285 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
286 |
+ this.problemType = 'Chapter3_9'; |
|
287 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
288 |
+ this.problemType = 'Chapter3_10'; |
|
289 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
290 |
+ this.problemType = 'Chapter3_11'; |
|
291 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
292 |
+ this.problemType = 'Chapter3_12'; |
|
293 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
294 |
+ this.problemType = 'Chapter3_13'; |
|
295 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
296 |
+ this.problemType = 'Chapter3_14'; |
|
297 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
298 |
+ this.problemType = 'Chapter3_15'; |
|
299 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
300 |
+ this.problemType = 'Chapter2_8'; |
|
301 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
302 |
+ this.problemType = 'Chapter2_7'; |
|
303 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
304 |
+ this.problemType = 'Chapter2_5'; |
|
305 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
306 |
+ this.problemType = 'Chapter2_6'; |
|
307 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
308 |
+ this.problemType = 'Chapter2_10'; |
|
309 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
310 |
+ this.problemType = 'Chapter2_11'; |
|
311 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
312 |
+ this.problemType = 'Chapter2_13'; |
|
313 |
+ } |
|
314 |
+ }, |
|
315 |
+ }, |
|
316 |
+ watch: {}, |
|
317 |
+ computed: { |
|
318 |
+ currentLearningId() { |
|
319 |
+ return this.$store.getters.currentLearningId; |
|
320 |
+ }, |
|
321 |
+ currentLabel() { |
|
322 |
+ return this.$store.getters.currentLabel; |
|
323 |
+ }, |
|
324 |
+ currentProblemIndex() { |
|
325 |
+ return this.$store.getters.currentProblemIndex; |
|
326 |
+ }, |
|
327 |
+ isPreviousButtonDisabled() { |
|
328 |
+ return this.currentProblemIndex === 0; |
|
329 |
+ }, |
|
330 |
+ }, |
|
331 |
+ created() { |
|
332 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
333 |
+ this.prblm_id = this.currentLearningId; |
|
334 |
+ console.log('Current Label:', this.currentLabel); |
|
335 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
336 |
+ |
|
337 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
338 |
+ }, |
|
339 |
+ mounted() { |
|
340 |
+ this.getProblem(); |
|
341 |
+ |
|
342 |
+ if (this.currentProblemIndex == 0) { |
|
343 |
+ this.hiddenState = true; |
|
344 |
+ } |
|
345 |
+ }, |
|
346 |
+ components: { |
|
347 |
+ BookInfo: BookInfo, |
|
348 |
+ }, |
|
368 | 349 |
}; |
369 | 350 |
</script> |
370 | 351 |
<style scoped> |
371 | 352 |
.imgGroup { |
372 |
- margin-left: 183px; |
|
373 |
- width: auto; |
|
353 |
+ margin-left: 183px; |
|
354 |
+ width: auto; |
|
374 | 355 |
} |
375 | 356 |
|
376 | 357 |
.pickGroup button { |
377 |
- position: relative; |
|
378 |
- margin-right: 30px; |
|
358 |
+ position: relative; |
|
359 |
+ margin-right: 30px; |
|
379 | 360 |
} |
380 | 361 |
|
381 | 362 |
.pickGroup button p { |
382 |
- font-size: 34px; |
|
383 |
- color: #c6c6c6; |
|
384 |
- position: absolute; |
|
385 |
- top: 50%; |
|
386 |
- left: 50%; |
|
387 |
- transform: translate(-50%, -50%); |
|
363 |
+ font-size: 34px; |
|
364 |
+ color: #c6c6c6; |
|
365 |
+ position: absolute; |
|
366 |
+ top: 50%; |
|
367 |
+ left: 50%; |
|
368 |
+ transform: translate(-50%, -50%); |
|
388 | 369 |
} |
389 | 370 |
|
390 | 371 |
.pickGroup article { |
391 |
- position: absolute; |
|
372 |
+ position: absolute; |
|
392 | 373 |
} |
393 | 374 |
|
394 | 375 |
.pickGroup article img { |
395 |
- object-fit: contain; |
|
396 |
- width: -webkit-fill-available; |
|
376 |
+ object-fit: contain; |
|
377 |
+ width: -webkit-fill-available; |
|
397 | 378 |
} |
398 | 379 |
|
399 | 380 |
.pickGroup article > div > p { |
400 |
- font-size: 64px; |
|
381 |
+ font-size: 64px; |
|
401 | 382 |
} |
402 | 383 |
|
403 | 384 |
.pickGroup button p.active { |
404 |
- color: #000; |
|
405 |
- /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
385 |
+ color: #000; |
|
386 |
+ /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
406 | 387 |
} |
407 | 388 |
|
408 | 389 |
.inputGroup { |
409 |
- display: flex; |
|
410 |
- align-items: center; |
|
411 |
- gap: 30px; |
|
390 |
+ display: flex; |
|
391 |
+ align-items: center; |
|
392 |
+ gap: 30px; |
|
412 | 393 |
} |
413 | 394 |
|
414 | 395 |
.inputGroup p { |
415 |
- font-size: 28px; |
|
396 |
+ font-size: 28px; |
|
416 | 397 |
} |
417 | 398 |
|
418 | 399 |
.answerBox { |
419 |
- margin-top: -87px; |
|
420 |
- margin-right: 10px; |
|
421 |
- text-align: right; |
|
400 |
+ margin-top: -87px; |
|
401 |
+ margin-right: 10px; |
|
402 |
+ text-align: right; |
|
422 | 403 |
} |
423 | 404 |
|
424 | 405 |
.answerButton { |
425 |
- background-color: #ffc107; |
|
426 |
- border-radius: 30px; |
|
427 |
- padding: 20px 50px; |
|
428 |
- margin: 40px; |
|
429 |
- font-family: "ONEMobileOTF-Regular"; |
|
430 |
- font-weight: bold; |
|
431 |
- font-size: 24px; |
|
406 |
+ background-color: #ffc107; |
|
407 |
+ border-radius: 30px; |
|
408 |
+ padding: 20px 50px; |
|
409 |
+ margin: 40px; |
|
410 |
+ font-family: 'ONEMobileOTF-Regular'; |
|
411 |
+ font-weight: bold; |
|
412 |
+ font-size: 24px; |
|
432 | 413 |
} |
433 | 414 |
|
434 | 415 |
.completeBtn { |
435 |
- margin-right: 100px; |
|
436 |
- background-color: #ffba08; |
|
437 |
- padding: 10px 30px; |
|
438 |
- border-radius: 10px; |
|
439 |
- font-size: 28px; |
|
440 |
- font-family: "ONEMobilePOPOTF"; |
|
416 |
+ margin-right: 100px; |
|
417 |
+ background-color: #ffba08; |
|
418 |
+ padding: 10px 30px; |
|
419 |
+ border-radius: 10px; |
|
420 |
+ font-size: 28px; |
|
421 |
+ font-family: 'ONEMobilePOPOTF'; |
|
441 | 422 |
} |
442 | 423 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_12.vue
+++ client/views/pages/main/Chapter/Chapter2_12.vue
... | ... | @@ -1,164 +1,147 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="goToPage('Chapter2_8')"> |
|
16 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
- </div> |
|
18 |
- <div class="content title-box"> |
|
19 |
- <p class="title mt25 title-bg">step2</p> |
|
20 |
- <div class="flex align-center mb30"> |
|
21 |
- <p class="subtitle2 mr20">단어 짝 맞추기 게임</p> |
|
22 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="goToPage('Chapter2_8')"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step2</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">단어 짝 맞추기 게임</p> |
|
21 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
23 | 22 |
</button> --> |
24 |
- </div> |
|
23 |
+ </div> |
|
25 | 24 |
|
26 |
- <div class="text-ct"> |
|
27 |
- <div |
|
28 |
- class="pickGroup flex align-center justify-center mt50" |
|
29 |
- style="gap: 100px" |
|
30 |
- > |
|
31 |
- <div> |
|
32 |
- <div class="mb20"> |
|
33 |
- <button> |
|
34 |
- <img src="../../../../resources/img/img100_45s.png" alt="" /> |
|
35 |
- <p>1</p> |
|
36 |
- </button> |
|
37 |
- <button> |
|
38 |
- <img src="../../../../resources/img/img101_45s.png" alt="" /> |
|
39 |
- <p>1</p> |
|
40 |
- </button> |
|
41 |
- <button> |
|
42 |
- <img src="../../../../resources/img/img102_45s.png" alt="" /> |
|
43 |
- <p>1</p> |
|
44 |
- </button> |
|
45 |
- <button> |
|
46 |
- <img src="../../../../resources/img/img103_45s.png" alt="" /> |
|
47 |
- <p>1</p> |
|
48 |
- </button> |
|
49 |
- </div> |
|
50 |
- <div> |
|
51 |
- <button> |
|
52 |
- <img src="../../../../resources/img/img100_45s.png" alt="" /> |
|
53 |
- <p>1</p> |
|
54 |
- </button> |
|
55 |
- <button> |
|
56 |
- <img src="../../../../resources/img/img101_45s.png" alt="" /> |
|
57 |
- <p>1</p> |
|
58 |
- </button> |
|
59 |
- <button> |
|
60 |
- <img src="../../../../resources/img/img102_45s.png" alt="" /> |
|
61 |
- <p>1</p> |
|
62 |
- </button> |
|
63 |
- <button> |
|
64 |
- <img src="../../../../resources/img/img103_45s.png" alt="" /> |
|
65 |
- <p>1</p> |
|
66 |
- </button> |
|
67 |
- </div> |
|
68 |
- </div> |
|
69 |
- <div class="dropGroup" style="gap: 20px"> |
|
70 |
- <img src="../../../../resources/img/img160_43s.png" alt="" /> |
|
71 |
- <div class="dropimg"> |
|
72 |
- <img |
|
73 |
- style="top: 21px" |
|
74 |
- src="../../../../resources/img/img161_44s.png" |
|
75 |
- alt="" |
|
76 |
- /> |
|
77 |
- <img |
|
78 |
- style="top: 119px" |
|
79 |
- src="../../../../resources/img/img162_43s.png" |
|
80 |
- alt="" |
|
81 |
- /> |
|
82 |
- <img |
|
83 |
- style="top: 215px" |
|
84 |
- src="../../../../resources/img/img163_43s.png" |
|
85 |
- alt="" |
|
86 |
- /> |
|
87 |
- <img |
|
88 |
- style="bottom: 36px" |
|
89 |
- src="../../../../resources/img/img164_43s.png" |
|
90 |
- alt="" |
|
91 |
- /> |
|
92 |
- </div> |
|
93 |
- </div> |
|
94 |
- </div> |
|
25 |
+ <div class="text-ct"> |
|
26 |
+ <div class="pickGroup flex align-center justify-center mt50" style="gap: 100px"> |
|
27 |
+ <div> |
|
28 |
+ <div class="mb20"> |
|
29 |
+ <button> |
|
30 |
+ <img src="../../../../resources/img/img100_45s.png" alt="" /> |
|
31 |
+ <p>1</p> |
|
32 |
+ </button> |
|
33 |
+ <button> |
|
34 |
+ <img src="../../../../resources/img/img101_45s.png" alt="" /> |
|
35 |
+ <p>1</p> |
|
36 |
+ </button> |
|
37 |
+ <button> |
|
38 |
+ <img src="../../../../resources/img/img102_45s.png" alt="" /> |
|
39 |
+ <p>1</p> |
|
40 |
+ </button> |
|
41 |
+ <button> |
|
42 |
+ <img src="../../../../resources/img/img103_45s.png" alt="" /> |
|
43 |
+ <p>1</p> |
|
44 |
+ </button> |
|
45 |
+ </div> |
|
46 |
+ <div> |
|
47 |
+ <button> |
|
48 |
+ <img src="../../../../resources/img/img100_45s.png" alt="" /> |
|
49 |
+ <p>1</p> |
|
50 |
+ </button> |
|
51 |
+ <button> |
|
52 |
+ <img src="../../../../resources/img/img101_45s.png" alt="" /> |
|
53 |
+ <p>1</p> |
|
54 |
+ </button> |
|
55 |
+ <button> |
|
56 |
+ <img src="../../../../resources/img/img102_45s.png" alt="" /> |
|
57 |
+ <p>1</p> |
|
58 |
+ </button> |
|
59 |
+ <button> |
|
60 |
+ <img src="../../../../resources/img/img103_45s.png" alt="" /> |
|
61 |
+ <p>1</p> |
|
62 |
+ </button> |
|
63 |
+ </div> |
|
64 |
+ </div> |
|
65 |
+ <div class="dropGroup" style="gap: 20px"> |
|
66 |
+ <img src="../../../../resources/img/img160_43s.png" alt="" /> |
|
67 |
+ <div class="dropimg"> |
|
68 |
+ <img style="top: 21px" src="../../../../resources/img/img161_44s.png" alt="" /> |
|
69 |
+ <img style="top: 119px" src="../../../../resources/img/img162_43s.png" alt="" /> |
|
70 |
+ <img style="top: 215px" src="../../../../resources/img/img163_43s.png" alt="" /> |
|
71 |
+ <img style="bottom: 36px" src="../../../../resources/img/img164_43s.png" alt="" /> |
|
72 |
+ </div> |
|
73 |
+ </div> |
|
74 |
+ </div> |
|
95 | 75 |
|
96 |
- <div class="time-bg"> |
|
97 |
- <div> |
|
98 |
- <div class="time"> |
|
99 |
- <p class="second">{{ timer }}</p> |
|
100 |
- <p class="text">sec</p> |
|
101 |
- </div> |
|
76 |
+ <div class="time-bg"> |
|
77 |
+ <div> |
|
78 |
+ <div class="time"> |
|
79 |
+ <p class="second">{{ timer }}</p> |
|
80 |
+ <p class="text">sec</p> |
|
81 |
+ </div> |
|
82 |
+ </div> |
|
83 |
+ </div> |
|
84 |
+ </div> |
|
102 | 85 |
</div> |
103 |
- </div> |
|
86 |
+ <div class="next-btn" @click="goToPage('Chapter2_7')"> |
|
87 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
88 |
+ </div> |
|
104 | 89 |
</div> |
105 |
- </div> |
|
106 |
- <div class="next-btn" @click="goToPage('Chapter2_7')"> |
|
107 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
108 |
- </div> |
|
109 | 90 |
</div> |
110 |
- </div> |
|
111 | 91 |
</template> |
112 | 92 |
|
113 | 93 |
<script> |
94 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
114 | 95 |
export default { |
115 |
- data() { |
|
116 |
- return { |
|
117 |
- timer: "00", |
|
118 |
- }; |
|
119 |
- }, |
|
120 |
- methods: { |
|
121 |
- goToPage(page) { |
|
122 |
- this.$router.push({ name: page }); |
|
96 |
+ data() { |
|
97 |
+ return { |
|
98 |
+ timer: '00', |
|
99 |
+ }; |
|
123 | 100 |
}, |
124 |
- startTimer() { |
|
125 |
- if (this.intervalId) { |
|
126 |
- clearInterval(this.intervalId); |
|
127 |
- } |
|
128 |
- this.timer = 5; |
|
129 |
- this.intervalId = setInterval(() => { |
|
130 |
- if (this.timer > 0) { |
|
131 |
- this.timer--; |
|
132 |
- } else { |
|
133 |
- clearInterval(this.intervalId); |
|
134 |
- } |
|
135 |
- }, 1000); |
|
101 |
+ methods: { |
|
102 |
+ goToPage(page) { |
|
103 |
+ this.$router.push({ name: page }); |
|
104 |
+ }, |
|
105 |
+ startTimer() { |
|
106 |
+ if (this.intervalId) { |
|
107 |
+ clearInterval(this.intervalId); |
|
108 |
+ } |
|
109 |
+ this.timer = 5; |
|
110 |
+ this.intervalId = setInterval(() => { |
|
111 |
+ if (this.timer > 0) { |
|
112 |
+ this.timer--; |
|
113 |
+ } else { |
|
114 |
+ clearInterval(this.intervalId); |
|
115 |
+ } |
|
116 |
+ }, 1000); |
|
117 |
+ }, |
|
136 | 118 |
}, |
137 |
- }, |
|
138 |
- watch: {}, |
|
139 |
- computed: {}, |
|
140 |
- components: {}, |
|
141 |
- mounted() {}, |
|
119 |
+ watch: {}, |
|
120 |
+ computed: {}, |
|
121 |
+ components: { |
|
122 |
+ BookInfo: BookInfo, |
|
123 |
+ }, |
|
124 |
+ mounted() {}, |
|
142 | 125 |
}; |
143 | 126 |
</script> |
144 | 127 |
<style scoped> |
145 | 128 |
.dropGroup { |
146 |
- position: relative; |
|
129 |
+ position: relative; |
|
147 | 130 |
} |
148 | 131 |
.dropimg img { |
149 |
- position: absolute; |
|
150 |
- left: 27px; |
|
132 |
+ position: absolute; |
|
133 |
+ left: 27px; |
|
151 | 134 |
} |
152 | 135 |
.pickGroup button { |
153 |
- position: relative; |
|
154 |
- margin: 10px 40px; |
|
136 |
+ position: relative; |
|
137 |
+ margin: 10px 40px; |
|
155 | 138 |
} |
156 | 139 |
|
157 | 140 |
.pickGroup button p { |
158 |
- font-size: 34px; |
|
159 |
- position: absolute; |
|
160 |
- top: 50%; |
|
161 |
- left: 50%; |
|
162 |
- transform: translate(-50%, -50%); |
|
141 |
+ font-size: 34px; |
|
142 |
+ position: absolute; |
|
143 |
+ top: 50%; |
|
144 |
+ left: 50%; |
|
145 |
+ transform: translate(-50%, -50%); |
|
163 | 146 |
} |
164 | 147 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_13.vue
+++ client/views/pages/main/Chapter/Chapter2_13.vue
... | ... | @@ -1,526 +1,495 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
35 |
- </div> |
|
36 |
- |
|
37 |
- <div class="flex align-center mb30 questionBox"> |
|
38 |
- <p class="subtitle2 mr20">문제를 맞춰 폭탄을 제거해줘!</p> |
|
39 |
- <div style="height: 130px"> |
|
40 |
- <div> |
|
41 |
- <div> |
|
42 |
- <p class="second"></p> |
|
43 |
- <p class="text"></p> |
|
44 |
- </div> |
|
45 |
- </div> |
|
46 |
- </div> |
|
47 |
- </div> |
|
48 |
- |
|
49 |
- <div class="text-ct"> |
|
50 |
- <div class="imgGroup flex align-center justify-center"> |
|
51 |
- <div class="flex" style="gap: 20px; position: relative"> |
|
52 |
- <img |
|
53 |
- src="../../../../resources/img/img105_46s.png" |
|
54 |
- alt="" |
|
55 |
- style="width: 90%" |
|
56 |
- /> |
|
57 |
- |
|
58 |
- <div class="textbox"> |
|
59 |
- <p class="little-title">{{ problem }}</p> |
|
60 |
- <div class="pickGroup"> |
|
61 |
- <article class="flex mb10" style="gap: 60px"> |
|
62 |
- <div class="flex align-center" @click="handleClick(1)"> |
|
63 |
- <button> |
|
64 |
- <img |
|
65 |
- src="../../../../resources/img/img136_71s.png" |
|
66 |
- alt="" |
|
67 |
- /> |
|
68 |
- <p :class="{ active: selectedButton === 1 }">1</p> |
|
69 |
- </button> |
|
70 |
- <p class="red">{{ choice[0] }}</p> |
|
71 |
- </div> |
|
72 |
- </article> |
|
73 |
- <article class="flex mb10" style="gap: 60px"> |
|
74 |
- <div class="flex align-center" @click="handleClick(2)"> |
|
75 |
- <button> |
|
76 |
- <img |
|
77 |
- src="../../../../resources/img/img136_71s.png" |
|
78 |
- alt="" |
|
79 |
- /> |
|
80 |
- <p :class="{ active: selectedButton === 2 }">2</p> |
|
81 |
- </button> |
|
82 |
- <p class="orange">{{ choice[1] }}</p> |
|
83 |
- </div> |
|
84 |
- </article> |
|
85 |
- <article class="flex mb10" style="gap: 60px"> |
|
86 |
- <div class="flex align-center" @click="handleClick(3)"> |
|
87 |
- <button> |
|
88 |
- <img |
|
89 |
- src="../../../../resources/img/img136_71s.png" |
|
90 |
- alt="" |
|
91 |
- /> |
|
92 |
- <p :class="{ active: selectedButton === 3 }">3</p> |
|
93 |
- </button> |
|
94 |
- <p class="blue">{{ choice[2] }}</p> |
|
95 |
- </div> |
|
96 |
- </article> |
|
97 |
- <article class="flex" style="gap: 60px"> |
|
98 |
- <div class="flex align-center" @click="handleClick(4)"> |
|
99 |
- <button> |
|
100 |
- <img |
|
101 |
- src="../../../../resources/img/img136_71s.png" |
|
102 |
- alt="" |
|
103 |
- /> |
|
104 |
- <p :class="{ active: selectedButton === 4 }">4</p> |
|
105 |
- </button> |
|
106 |
- <p class="green">{{ choice[3] }}</p> |
|
107 |
- </div> |
|
108 |
- </article> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
109 | 7 |
</div> |
110 |
- </div> |
|
111 |
- <!-- 오답일 경우 아래의 이미지가 보여야함 --> |
|
112 |
- <div |
|
113 |
- v-if="correct" |
|
114 |
- class="flex justify-center wrong-anwser" |
|
115 |
- style="gap: 20px" |
|
116 |
- > |
|
117 |
- <img src="../../../../resources/img/img165_46s.png" alt="" /> |
|
118 |
- </div> |
|
8 |
+ </router-link> |
|
9 |
+ </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
119 | 17 |
</div> |
120 |
- </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3-놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ |
|
27 |
+ <div class="flex align-center mb30 questionBox"> |
|
28 |
+ <p class="subtitle2 mr20">문제를 맞춰 폭탄을 제거해줘!</p> |
|
29 |
+ <div style="height: 130px"> |
|
30 |
+ <div> |
|
31 |
+ <div> |
|
32 |
+ <p class="second"></p> |
|
33 |
+ <p class="text"></p> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ </div> |
|
38 |
+ |
|
39 |
+ <div class="text-ct"> |
|
40 |
+ <div class="imgGroup flex align-center justify-center"> |
|
41 |
+ <div class="flex" style="gap: 20px; position: relative"> |
|
42 |
+ <img src="../../../../resources/img/img105_46s.png" alt="" style="width: 90%" /> |
|
43 |
+ |
|
44 |
+ <div class="textbox"> |
|
45 |
+ <p class="little-title">{{ problem }}</p> |
|
46 |
+ <div class="pickGroup"> |
|
47 |
+ <article class="flex mb10" style="gap: 60px"> |
|
48 |
+ <div class="flex align-center" @click="handleClick(1)"> |
|
49 |
+ <button> |
|
50 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
51 |
+ <p :class="{ active: selectedButton === 1 }">1</p> |
|
52 |
+ </button> |
|
53 |
+ <p class="red">{{ choice[0] }}</p> |
|
54 |
+ </div> |
|
55 |
+ </article> |
|
56 |
+ <article class="flex mb10" style="gap: 60px"> |
|
57 |
+ <div class="flex align-center" @click="handleClick(2)"> |
|
58 |
+ <button> |
|
59 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
60 |
+ <p :class="{ active: selectedButton === 2 }">2</p> |
|
61 |
+ </button> |
|
62 |
+ <p class="orange">{{ choice[1] }}</p> |
|
63 |
+ </div> |
|
64 |
+ </article> |
|
65 |
+ <article class="flex mb10" style="gap: 60px"> |
|
66 |
+ <div class="flex align-center" @click="handleClick(3)"> |
|
67 |
+ <button> |
|
68 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
69 |
+ <p :class="{ active: selectedButton === 3 }">3</p> |
|
70 |
+ </button> |
|
71 |
+ <p class="blue">{{ choice[2] }}</p> |
|
72 |
+ </div> |
|
73 |
+ </article> |
|
74 |
+ <article class="flex" style="gap: 60px"> |
|
75 |
+ <div class="flex align-center" @click="handleClick(4)"> |
|
76 |
+ <button> |
|
77 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
78 |
+ <p :class="{ active: selectedButton === 4 }">4</p> |
|
79 |
+ </button> |
|
80 |
+ <p class="green">{{ choice[3] }}</p> |
|
81 |
+ </div> |
|
82 |
+ </article> |
|
83 |
+ </div> |
|
84 |
+ </div> |
|
85 |
+ <!-- 오답일 경우 아래의 이미지가 보여야함 --> |
|
86 |
+ <div v-if="correct" class="flex justify-center wrong-anwser" style="gap: 20px"> |
|
87 |
+ <img src="../../../../resources/img/img165_46s.png" alt="" /> |
|
88 |
+ </div> |
|
89 |
+ </div> |
|
90 |
+ </div> |
|
91 |
+ </div> |
|
92 |
+ <div class="answerBox"> |
|
93 |
+ <button class="answerButton" @click="confirmAnswer">정답 확인</button> |
|
94 |
+ </div> |
|
95 |
+ </div> |
|
96 |
+ <div class="next-btn" @click="nextProblem()"> |
|
97 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
98 |
+ </div> |
|
121 | 99 |
</div> |
122 |
- <div class="answerBox"> |
|
123 |
- <button class="answerButton" @click="confirmAnswer">정답 확인</button> |
|
124 |
- </div> |
|
125 |
- </div> |
|
126 |
- <div class="next-btn" @click="nextProblem()"> |
|
127 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
128 |
- </div> |
|
129 | 100 |
</div> |
130 |
- </div> |
|
131 | 101 |
</template> |
132 | 102 |
|
133 | 103 |
<script> |
134 |
-import axios from "axios"; |
|
135 |
- |
|
104 |
+import axios from 'axios'; |
|
105 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
136 | 106 |
export default { |
137 |
- data() { |
|
138 |
- return { |
|
139 |
- timer: "00", |
|
140 |
- problem: "", |
|
107 |
+ data() { |
|
108 |
+ return { |
|
109 |
+ timer: '00', |
|
110 |
+ problem: '', |
|
141 | 111 |
|
142 |
- choice: [], |
|
143 |
- answer: "", |
|
112 |
+ choice: [], |
|
113 |
+ answer: '', |
|
144 | 114 |
|
145 |
- selectedButton: null, |
|
146 |
- correct: false, |
|
115 |
+ selectedButton: null, |
|
116 |
+ correct: false, |
|
147 | 117 |
|
148 |
- prblm_id: [], |
|
149 |
- problemData: [], |
|
150 |
- // problemArr: [], |
|
151 |
- answerArr: [], |
|
118 |
+ prblm_id: [], |
|
119 |
+ problemData: [], |
|
120 |
+ // problemArr: [], |
|
121 |
+ answerArr: [], |
|
152 | 122 |
|
153 |
- seq: this.$store.getters.seqNum, |
|
154 |
- hiddenState: false, |
|
155 |
- }; |
|
156 |
- }, |
|
157 |
- methods: { |
|
158 |
- complete() { |
|
159 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
160 |
- const savedState = localStorage.getItem("vuexState"); |
|
161 |
- if (savedState) { |
|
162 |
- const parsedState = JSON.parse(savedState); |
|
163 |
- const currentDashboard = parsedState.currentDashboard; |
|
123 |
+ seq: this.$store.getters.seqNum, |
|
124 |
+ hiddenState: false, |
|
125 |
+ }; |
|
126 |
+ }, |
|
127 |
+ methods: { |
|
128 |
+ complete() { |
|
129 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
130 |
+ const savedState = localStorage.getItem('vuexState'); |
|
131 |
+ if (savedState) { |
|
132 |
+ const parsedState = JSON.parse(savedState); |
|
133 |
+ const currentDashboard = parsedState.currentDashboard; |
|
164 | 134 |
|
165 |
- const { unit_id, book_id } = this.$route.query; |
|
166 |
- if (currentDashboard === "Learning") { |
|
167 |
- // Learning 모드일 때 Dashboard로 이동 |
|
168 |
- this.$router.push({ |
|
169 |
- name: "Dashboard", |
|
170 |
- query: { value: this.seq, unit_id, book_id }, |
|
171 |
- }); |
|
172 |
- } else if (currentDashboard === "AI") { |
|
173 |
- // AI 모드일 때 AIDashboard로 이동 |
|
174 |
- this.$router.push({ |
|
175 |
- name: "AIDashboard", |
|
176 |
- query: { value: this.seq, unit_id, book_id }, |
|
177 |
- }); |
|
135 |
+ const { unit_id, book_id } = this.$route.query; |
|
136 |
+ if (currentDashboard === 'Learning') { |
|
137 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
138 |
+ this.$router.push({ |
|
139 |
+ name: 'Dashboard', |
|
140 |
+ query: { value: this.seq, unit_id, book_id }, |
|
141 |
+ }); |
|
142 |
+ } else if (currentDashboard === 'AI') { |
|
143 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
144 |
+ this.$router.push({ |
|
145 |
+ name: 'AIDashboard', |
|
146 |
+ query: { value: this.seq, unit_id, book_id }, |
|
147 |
+ }); |
|
148 |
+ } |
|
149 |
+ } else { |
|
150 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
151 |
+ } |
|
152 |
+ }, |
|
153 |
+ goToPage(page) { |
|
154 |
+ this.$router.push({ name: page }); |
|
155 |
+ }, |
|
156 |
+ startTimer() { |
|
157 |
+ if (this.intervalId) { |
|
158 |
+ clearInterval(this.intervalId); |
|
159 |
+ } |
|
160 |
+ this.timer = 5; |
|
161 |
+ this.intervalId = setInterval(() => { |
|
162 |
+ if (this.timer > 0) { |
|
163 |
+ this.timer--; |
|
164 |
+ } else { |
|
165 |
+ clearInterval(this.intervalId); |
|
166 |
+ } |
|
167 |
+ }, 1000); |
|
168 |
+ }, |
|
169 |
+ handleClick(buttonNumber) { |
|
170 |
+ this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장 |
|
171 |
+ }, |
|
172 |
+ |
|
173 |
+ confirmAnswer() { |
|
174 |
+ if (this.selectedButton === null) { |
|
175 |
+ alert('정답을 선택해주세요.'); |
|
176 |
+ return; |
|
177 |
+ } |
|
178 |
+ if (this.selectedButton === this.answer) { |
|
179 |
+ alert('정답입니다!'); |
|
180 |
+ this.nextProblem(); |
|
181 |
+ } else { |
|
182 |
+ this.correct = true; |
|
183 |
+ } |
|
184 |
+ this.selectedButton = null; |
|
185 |
+ }, |
|
186 |
+ returnPage() { |
|
187 |
+ window.location.reload(); |
|
188 |
+ }, |
|
189 |
+ nextProblem() { |
|
190 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
191 |
+ this.$store.dispatch('goToNextProblem'); |
|
192 |
+ this.handleProblemDetail(this.currentLearningId); |
|
193 |
+ this.goToPage(this.problemType); |
|
194 |
+ } else { |
|
195 |
+ // 마지막 문제면 이동 |
|
196 |
+ // this.goToPage("Chapter4"); |
|
197 |
+ alert('문제 학습 완료'); |
|
198 |
+ this.complete(); |
|
199 |
+ } |
|
200 |
+ }, |
|
201 |
+ previousProblem() { |
|
202 |
+ if (this.currentProblemIndex > 0) { |
|
203 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
204 |
+ this.handleProblemDetail(this.currentLearningId); |
|
205 |
+ this.goToPage(this.problemType); |
|
206 |
+ } |
|
207 |
+ }, |
|
208 |
+ |
|
209 |
+ handleProblemDetail(item) { |
|
210 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
211 |
+ this.problemType = 'Chapter3'; |
|
212 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
213 |
+ this.problemType = 'Chapter3_1'; |
|
214 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
215 |
+ this.problemType = 'Chapter3_2'; |
|
216 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
217 |
+ this.problemType = 'Chapter3_3'; |
|
218 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
219 |
+ this.problemType = 'Chapter3_3_1'; |
|
220 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
221 |
+ this.problemType = 'Chapter3_4'; |
|
222 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
223 |
+ this.problemType = 'Chapter3_5'; |
|
224 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
225 |
+ this.problemType = 'Chapter3_6'; |
|
226 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
227 |
+ this.problemType = 'Chapter3_7'; |
|
228 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
229 |
+ this.problemType = 'Chapter3_8'; |
|
230 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
231 |
+ this.problemType = 'Chapter3_9'; |
|
232 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
233 |
+ this.problemType = 'Chapter3_10'; |
|
234 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
235 |
+ this.problemType = 'Chapter3_11'; |
|
236 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
237 |
+ this.problemType = 'Chapter3_12'; |
|
238 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
239 |
+ this.problemType = 'Chapter3_13'; |
|
240 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
241 |
+ this.problemType = 'Chapter3_14'; |
|
242 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
243 |
+ this.problemType = 'Chapter3_15'; |
|
244 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
245 |
+ this.problemType = 'Chapter2_8'; |
|
246 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
247 |
+ this.problemType = 'Chapter2_7'; |
|
248 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
249 |
+ this.problemType = 'Chapter2_5'; |
|
250 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
251 |
+ this.problemType = 'Chapter2_6'; |
|
252 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
253 |
+ this.problemType = 'Chapter2_10'; |
|
254 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
255 |
+ this.problemType = 'Chapter2_11'; |
|
256 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
257 |
+ this.problemType = 'Chapter2_13'; |
|
258 |
+ } |
|
259 |
+ }, |
|
260 |
+ |
|
261 |
+ // fetchProblemData() { |
|
262 |
+ // axios({ |
|
263 |
+ // url: "/problem/problemInfo.json", |
|
264 |
+ // method: "post", |
|
265 |
+ // headers: { |
|
266 |
+ // "Content-Type": "application/json; charset=UTF-8", |
|
267 |
+ // }, |
|
268 |
+ // data: { |
|
269 |
+ // prblmId: this.prblm_id.prblm_id, |
|
270 |
+ // }, |
|
271 |
+ // }) |
|
272 |
+ // .then((response) => { |
|
273 |
+ // this.problemData = response.data; |
|
274 |
+ // console.log("problemData", this.problemData); |
|
275 |
+ |
|
276 |
+ // this.sortingProblem(); |
|
277 |
+ // }) |
|
278 |
+ // .catch((error) => { |
|
279 |
+ // this.state = "noProblem"; |
|
280 |
+ // console.error("Error fetching problemData:", error); |
|
281 |
+ // }); |
|
282 |
+ // }, |
|
283 |
+ |
|
284 |
+ fetchProblemData() { |
|
285 |
+ // 로컬 스토리지에서 currentDashboard를 확인 |
|
286 |
+ const savedState = localStorage.getItem('vuexState'); |
|
287 |
+ if (savedState) { |
|
288 |
+ const parsedState = JSON.parse(savedState); |
|
289 |
+ const currentDashboard = parsedState.currentDashboard; |
|
290 |
+ |
|
291 |
+ if (currentDashboard === 'AI') { |
|
292 |
+ // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
293 |
+ const currentLearningId = parsedState.currentLearningIds; |
|
294 |
+ console.log('AI 모드에서 currentLearningId 사용:', currentLearningId); |
|
295 |
+ |
|
296 |
+ // currentLearningId로 문제 데이터 가져오기 |
|
297 |
+ axios({ |
|
298 |
+ url: '/problem/problemInfo.json', |
|
299 |
+ method: 'post', |
|
300 |
+ headers: { |
|
301 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
302 |
+ }, |
|
303 |
+ data: { |
|
304 |
+ prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
305 |
+ }, |
|
306 |
+ }) |
|
307 |
+ .then((response) => { |
|
308 |
+ this.problemData = response.data; |
|
309 |
+ console.log('AI 모드 problemData', this.problemData); |
|
310 |
+ this.sortingProblem(); |
|
311 |
+ }) |
|
312 |
+ .catch((error) => { |
|
313 |
+ this.state = 'noProblem'; |
|
314 |
+ console.error('Error fetching AI problemData:', error); |
|
315 |
+ }); |
|
316 |
+ } else { |
|
317 |
+ // Learning 모드일 경우 기존 로직 사용 |
|
318 |
+ console.log('Learning 모드에서 prblm_id 사용:', this.prblm_id); |
|
319 |
+ |
|
320 |
+ axios({ |
|
321 |
+ url: '/problem/problemInfo.json', |
|
322 |
+ method: 'post', |
|
323 |
+ headers: { |
|
324 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
325 |
+ }, |
|
326 |
+ data: { |
|
327 |
+ prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
328 |
+ }, |
|
329 |
+ }) |
|
330 |
+ .then((response) => { |
|
331 |
+ this.problemData = response.data; |
|
332 |
+ console.log('Learning 모드 problemData', this.problemData); |
|
333 |
+ this.sortingProblem(); |
|
334 |
+ }) |
|
335 |
+ .catch((error) => { |
|
336 |
+ this.state = 'noProblem'; |
|
337 |
+ console.error('Error fetching problemData:', error); |
|
338 |
+ }); |
|
339 |
+ } |
|
340 |
+ } else { |
|
341 |
+ console.error('vuexState가 로컬스토리지에 없습니다.'); |
|
342 |
+ } |
|
343 |
+ }, |
|
344 |
+ |
|
345 |
+ sortingProblem() { |
|
346 |
+ this.problem = this.problemData.problem.prblmExpln; |
|
347 |
+ |
|
348 |
+ for (let i = 0; i < this.problemData.problemDetail.length; i++) { |
|
349 |
+ // this.answerArr[i].prblmDtlExpln = |
|
350 |
+ // this.problemData.problemDetail[i].prblmDtlExpln; |
|
351 |
+ // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn; |
|
352 |
+ this.answerArr[i] = this.problemData.problemDetail[i]; |
|
353 |
+ this.choice[i] = this.problemData.problemDetail[i].prblmDtlExpln; |
|
354 |
+ } |
|
355 |
+ console.log('answerArr', this.answerArr); |
|
356 |
+ |
|
357 |
+ for (let i = 0; i < this.answerArr.length; i++) { |
|
358 |
+ if (this.answerArr[i].prblmYn == 'Y') { |
|
359 |
+ this.answer = i + 1; |
|
360 |
+ break; |
|
361 |
+ } |
|
362 |
+ } |
|
363 |
+ }, |
|
364 |
+ }, |
|
365 |
+ computed: { |
|
366 |
+ currentLearningId() { |
|
367 |
+ return this.$store.getters.currentLearningId; |
|
368 |
+ }, |
|
369 |
+ currentLabel() { |
|
370 |
+ return this.$store.getters.currentLabel; |
|
371 |
+ }, |
|
372 |
+ currentProblemIndex() { |
|
373 |
+ return this.$store.getters.currentProblemIndex; |
|
374 |
+ }, |
|
375 |
+ isPreviousButtonDisabled() { |
|
376 |
+ return this.currentProblemIndex === 0; |
|
377 |
+ }, |
|
378 |
+ }, |
|
379 |
+ created() { |
|
380 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
381 |
+ this.prblm_id = this.currentLearningId; |
|
382 |
+ console.log('Current Label:', this.currentLabel); |
|
383 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
384 |
+ |
|
385 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
386 |
+ }, |
|
387 |
+ mounted() { |
|
388 |
+ this.fetchProblemData(); |
|
389 |
+ if (this.currentProblemIndex == 0) { |
|
390 |
+ this.hiddenState = true; |
|
178 | 391 |
} |
179 |
- } else { |
|
180 |
- console.error("currentDashboard 값이 없습니다."); |
|
181 |
- } |
|
182 | 392 |
}, |
183 |
- goToPage(page) { |
|
184 |
- this.$router.push({ name: page }); |
|
393 |
+ components: { |
|
394 |
+ BookInfo: BookInfo, |
|
185 | 395 |
}, |
186 |
- startTimer() { |
|
187 |
- if (this.intervalId) { |
|
188 |
- clearInterval(this.intervalId); |
|
189 |
- } |
|
190 |
- this.timer = 5; |
|
191 |
- this.intervalId = setInterval(() => { |
|
192 |
- if (this.timer > 0) { |
|
193 |
- this.timer--; |
|
194 |
- } else { |
|
195 |
- clearInterval(this.intervalId); |
|
196 |
- } |
|
197 |
- }, 1000); |
|
198 |
- }, |
|
199 |
- handleClick(buttonNumber) { |
|
200 |
- this.selectedButton = buttonNumber; // 선택된 버튼 번호 저장 |
|
201 |
- }, |
|
202 |
- |
|
203 |
- confirmAnswer() { |
|
204 |
- if (this.selectedButton === null) { |
|
205 |
- alert("정답을 선택해주세요."); |
|
206 |
- return; |
|
207 |
- } |
|
208 |
- if (this.selectedButton === this.answer) { |
|
209 |
- alert("정답입니다!"); |
|
210 |
- this.nextProblem(); |
|
211 |
- } else { |
|
212 |
- this.correct = true; |
|
213 |
- } |
|
214 |
- this.selectedButton = null; |
|
215 |
- }, |
|
216 |
- returnPage() { |
|
217 |
- window.location.reload(); |
|
218 |
- }, |
|
219 |
- nextProblem() { |
|
220 |
- if ( |
|
221 |
- this.currentProblemIndex < |
|
222 |
- this.$store.state.currentLearningIds.length - 1 |
|
223 |
- ) { |
|
224 |
- this.$store.dispatch("goToNextProblem"); |
|
225 |
- this.handleProblemDetail(this.currentLearningId); |
|
226 |
- this.goToPage(this.problemType); |
|
227 |
- } else { |
|
228 |
- // 마지막 문제면 이동 |
|
229 |
- // this.goToPage("Chapter4"); |
|
230 |
- alert("문제 학습 완료"); |
|
231 |
- this.complete(); |
|
232 |
- } |
|
233 |
- }, |
|
234 |
- previousProblem() { |
|
235 |
- if (this.currentProblemIndex > 0) { |
|
236 |
- this.$store.dispatch("goToPreviousProblem"); |
|
237 |
- this.handleProblemDetail(this.currentLearningId); |
|
238 |
- this.goToPage(this.problemType); |
|
239 |
- } |
|
240 |
- }, |
|
241 |
- |
|
242 |
- handleProblemDetail(item) { |
|
243 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
244 |
- this.problemType = "Chapter3"; |
|
245 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
246 |
- this.problemType = "Chapter3_1"; |
|
247 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
248 |
- this.problemType = "Chapter3_2"; |
|
249 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
250 |
- this.problemType = "Chapter3_3"; |
|
251 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
252 |
- this.problemType = "Chapter3_3_1"; |
|
253 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
254 |
- this.problemType = "Chapter3_4"; |
|
255 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
256 |
- this.problemType = "Chapter3_5"; |
|
257 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
258 |
- this.problemType = "Chapter3_6"; |
|
259 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
260 |
- this.problemType = "Chapter3_7"; |
|
261 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
262 |
- this.problemType = "Chapter3_8"; |
|
263 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
264 |
- this.problemType = "Chapter3_9"; |
|
265 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
266 |
- this.problemType = "Chapter3_10"; |
|
267 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
268 |
- this.problemType = "Chapter3_11"; |
|
269 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
270 |
- this.problemType = "Chapter3_12"; |
|
271 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
272 |
- this.problemType = "Chapter3_13"; |
|
273 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
274 |
- this.problemType = "Chapter3_14"; |
|
275 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
276 |
- this.problemType = "Chapter3_15"; |
|
277 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
278 |
- this.problemType = "Chapter2_8"; |
|
279 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
280 |
- this.problemType = "Chapter2_7"; |
|
281 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
282 |
- this.problemType = "Chapter2_5"; |
|
283 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
284 |
- this.problemType = "Chapter2_6"; |
|
285 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
286 |
- this.problemType = "Chapter2_10"; |
|
287 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
288 |
- this.problemType = "Chapter2_11"; |
|
289 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
290 |
- this.problemType = "Chapter2_13"; |
|
291 |
- } |
|
292 |
- }, |
|
293 |
- |
|
294 |
- // fetchProblemData() { |
|
295 |
- // axios({ |
|
296 |
- // url: "/problem/problemInfo.json", |
|
297 |
- // method: "post", |
|
298 |
- // headers: { |
|
299 |
- // "Content-Type": "application/json; charset=UTF-8", |
|
300 |
- // }, |
|
301 |
- // data: { |
|
302 |
- // prblmId: this.prblm_id.prblm_id, |
|
303 |
- // }, |
|
304 |
- // }) |
|
305 |
- // .then((response) => { |
|
306 |
- // this.problemData = response.data; |
|
307 |
- // console.log("problemData", this.problemData); |
|
308 |
- |
|
309 |
- // this.sortingProblem(); |
|
310 |
- // }) |
|
311 |
- // .catch((error) => { |
|
312 |
- // this.state = "noProblem"; |
|
313 |
- // console.error("Error fetching problemData:", error); |
|
314 |
- // }); |
|
315 |
- // }, |
|
316 |
- |
|
317 |
- fetchProblemData() { |
|
318 |
- // 로컬 스토리지에서 currentDashboard를 확인 |
|
319 |
- const savedState = localStorage.getItem("vuexState"); |
|
320 |
- if (savedState) { |
|
321 |
- const parsedState = JSON.parse(savedState); |
|
322 |
- const currentDashboard = parsedState.currentDashboard; |
|
323 |
- |
|
324 |
- if (currentDashboard === "AI") { |
|
325 |
- // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
326 |
- const currentLearningId = parsedState.currentLearningIds; |
|
327 |
- console.log("AI 모드에서 currentLearningId 사용:", currentLearningId); |
|
328 |
- |
|
329 |
- // currentLearningId로 문제 데이터 가져오기 |
|
330 |
- axios({ |
|
331 |
- url: "/problem/problemInfo.json", |
|
332 |
- method: "post", |
|
333 |
- headers: { |
|
334 |
- "Content-Type": "application/json; charset=UTF-8", |
|
335 |
- }, |
|
336 |
- data: { |
|
337 |
- prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
338 |
- }, |
|
339 |
- }) |
|
340 |
- .then((response) => { |
|
341 |
- this.problemData = response.data; |
|
342 |
- console.log("AI 모드 problemData", this.problemData); |
|
343 |
- this.sortingProblem(); |
|
344 |
- }) |
|
345 |
- .catch((error) => { |
|
346 |
- this.state = "noProblem"; |
|
347 |
- console.error("Error fetching AI problemData:", error); |
|
348 |
- }); |
|
349 |
- |
|
350 |
- } else { |
|
351 |
- // Learning 모드일 경우 기존 로직 사용 |
|
352 |
- console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id); |
|
353 |
- |
|
354 |
- axios({ |
|
355 |
- url: "/problem/problemInfo.json", |
|
356 |
- method: "post", |
|
357 |
- headers: { |
|
358 |
- "Content-Type": "application/json; charset=UTF-8", |
|
359 |
- }, |
|
360 |
- data: { |
|
361 |
- prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
362 |
- }, |
|
363 |
- }) |
|
364 |
- .then((response) => { |
|
365 |
- this.problemData = response.data; |
|
366 |
- console.log("Learning 모드 problemData", this.problemData); |
|
367 |
- this.sortingProblem(); |
|
368 |
- }) |
|
369 |
- .catch((error) => { |
|
370 |
- this.state = "noProblem"; |
|
371 |
- console.error("Error fetching problemData:", error); |
|
372 |
- }); |
|
373 |
- } |
|
374 |
- } else { |
|
375 |
- console.error("vuexState가 로컬스토리지에 없습니다."); |
|
376 |
- } |
|
377 |
- }, |
|
378 |
- |
|
379 |
- sortingProblem() { |
|
380 |
- this.problem = this.problemData.problem.prblmExpln; |
|
381 |
- |
|
382 |
- for (let i = 0; i < this.problemData.problemDetail.length; i++) { |
|
383 |
- // this.answerArr[i].prblmDtlExpln = |
|
384 |
- // this.problemData.problemDetail[i].prblmDtlExpln; |
|
385 |
- // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn; |
|
386 |
- this.answerArr[i] = this.problemData.problemDetail[i]; |
|
387 |
- this.choice[i] = this.problemData.problemDetail[i].prblmDtlExpln; |
|
388 |
- } |
|
389 |
- console.log("answerArr", this.answerArr); |
|
390 |
- |
|
391 |
- for (let i = 0; i < this.answerArr.length; i++) { |
|
392 |
- if (this.answerArr[i].prblmYn == "Y") { |
|
393 |
- this.answer = i + 1; |
|
394 |
- break; |
|
395 |
- } |
|
396 |
- } |
|
397 |
- }, |
|
398 |
- }, |
|
399 |
- computed: { |
|
400 |
- currentLearningId() { |
|
401 |
- return this.$store.getters.currentLearningId; |
|
402 |
- }, |
|
403 |
- currentLabel() { |
|
404 |
- return this.$store.getters.currentLabel; |
|
405 |
- }, |
|
406 |
- currentProblemIndex() { |
|
407 |
- return this.$store.getters.currentProblemIndex; |
|
408 |
- }, |
|
409 |
- isPreviousButtonDisabled() { |
|
410 |
- return this.currentProblemIndex === 0; |
|
411 |
- }, |
|
412 |
- }, |
|
413 |
- created() { |
|
414 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
415 |
- this.prblm_id = this.currentLearningId; |
|
416 |
- console.log("Current Label:", this.currentLabel); |
|
417 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
418 |
- |
|
419 |
- // Fetch or process the current problem based on `currentLearningId` |
|
420 |
- }, |
|
421 |
- mounted() { |
|
422 |
- this.fetchProblemData(); |
|
423 |
- if (this.currentProblemIndex == 0) { |
|
424 |
- this.hiddenState = true; |
|
425 |
- } |
|
426 |
- }, |
|
427 | 396 |
}; |
428 | 397 |
</script> |
429 | 398 |
<style scoped> |
430 | 399 |
.wrong-anwser { |
431 |
- position: absolute; |
|
432 |
- top: 51%; |
|
433 |
- left: 45%; |
|
434 |
- transform: translate(-50%, -50%); |
|
400 |
+ position: absolute; |
|
401 |
+ top: 51%; |
|
402 |
+ left: 45%; |
|
403 |
+ transform: translate(-50%, -50%); |
|
435 | 404 |
} |
436 | 405 |
|
437 | 406 |
.textbox { |
438 |
- position: absolute; |
|
439 |
- top: 140px; |
|
440 |
- left: 45px; |
|
407 |
+ position: absolute; |
|
408 |
+ top: 140px; |
|
409 |
+ left: 45px; |
|
441 | 410 |
} |
442 | 411 |
|
443 | 412 |
.time-bg { |
444 |
- margin-right: 40px; |
|
445 |
- top: 136px; |
|
446 |
- right: 124px; |
|
413 |
+ margin-right: 40px; |
|
414 |
+ top: 136px; |
|
415 |
+ right: 124px; |
|
447 | 416 |
} |
448 | 417 |
|
449 | 418 |
.pickGroup { |
450 |
- margin: 40px 0 0 180px; |
|
419 |
+ margin: 40px 0 0 180px; |
|
451 | 420 |
} |
452 | 421 |
|
453 | 422 |
.pickGroup button { |
454 |
- position: relative; |
|
455 |
- margin-right: 30px; |
|
423 |
+ position: relative; |
|
424 |
+ margin-right: 30px; |
|
456 | 425 |
} |
457 | 426 |
|
458 | 427 |
.pickGroup button img { |
459 |
- width: 33px; |
|
460 |
- height: 33px; |
|
428 |
+ width: 33px; |
|
429 |
+ height: 33px; |
|
461 | 430 |
} |
462 | 431 |
|
463 | 432 |
.pickGroup button p { |
464 |
- font-size: 20px; |
|
465 |
- color: #c6c6c6; |
|
466 |
- position: absolute; |
|
467 |
- top: 50%; |
|
468 |
- left: 50%; |
|
469 |
- transform: translate(-50%, -50%); |
|
433 |
+ font-size: 20px; |
|
434 |
+ color: #c6c6c6; |
|
435 |
+ position: absolute; |
|
436 |
+ top: 50%; |
|
437 |
+ left: 50%; |
|
438 |
+ transform: translate(-50%, -50%); |
|
470 | 439 |
} |
471 | 440 |
|
472 | 441 |
.pickGroup article { |
473 |
- cursor: pointer; |
|
442 |
+ cursor: pointer; |
|
474 | 443 |
} |
475 | 444 |
|
476 | 445 |
.pickGroup article > div > p { |
477 |
- font-size: 24px; |
|
446 |
+ font-size: 24px; |
|
478 | 447 |
} |
479 | 448 |
|
480 | 449 |
.pickGroup button p.active { |
481 |
- color: #000; |
|
482 |
- /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
450 |
+ color: #000; |
|
451 |
+ /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
483 | 452 |
} |
484 | 453 |
|
485 | 454 |
.little-title { |
486 |
- text-align: start; |
|
487 |
- font-size: 24px; |
|
488 |
- font-weight: bold; |
|
455 |
+ text-align: start; |
|
456 |
+ font-size: 24px; |
|
457 |
+ font-weight: bold; |
|
489 | 458 |
} |
490 | 459 |
|
491 | 460 |
.questionBox { |
492 |
- justify-content: space-between; |
|
493 |
- align-items: flex-start; |
|
461 |
+ justify-content: space-between; |
|
462 |
+ align-items: flex-start; |
|
494 | 463 |
} |
495 | 464 |
|
496 | 465 |
.imgGroup { |
497 |
- position: absolute; |
|
498 |
- top: 150px; |
|
499 |
- left: 30%; |
|
500 |
- width: fit-content; |
|
466 |
+ position: absolute; |
|
467 |
+ top: 150px; |
|
468 |
+ left: 30%; |
|
469 |
+ width: fit-content; |
|
501 | 470 |
} |
502 | 471 |
|
503 | 472 |
.answerBox { |
504 |
- margin-top: 295px; |
|
505 |
- text-align: right; |
|
473 |
+ margin-top: 295px; |
|
474 |
+ text-align: right; |
|
506 | 475 |
} |
507 | 476 |
|
508 | 477 |
.answerButton { |
509 |
- background-color: #ffc107; |
|
510 |
- border-radius: 30px; |
|
511 |
- padding: 20px 50px; |
|
512 |
- margin: 40px; |
|
513 |
- font-family: "ONEMobileOTF-Regular"; |
|
514 |
- font-weight: bold; |
|
515 |
- font-size: 24px; |
|
478 |
+ background-color: #ffc107; |
|
479 |
+ border-radius: 30px; |
|
480 |
+ padding: 20px 50px; |
|
481 |
+ margin: 40px; |
|
482 |
+ font-family: 'ONEMobileOTF-Regular'; |
|
483 |
+ font-weight: bold; |
|
484 |
+ font-size: 24px; |
|
516 | 485 |
} |
517 | 486 |
|
518 | 487 |
.completeBtn { |
519 |
- margin-right: 100px; |
|
520 |
- background-color: #ffba08; |
|
521 |
- padding: 10px 30px; |
|
522 |
- border-radius: 10px; |
|
523 |
- font-size: 28px; |
|
524 |
- font-family: "ONEMobilePOPOTF"; |
|
488 |
+ margin-right: 100px; |
|
489 |
+ background-color: #ffba08; |
|
490 |
+ padding: 10px 30px; |
|
491 |
+ border-radius: 10px; |
|
492 |
+ font-size: 28px; |
|
493 |
+ font-family: 'ONEMobilePOPOTF'; |
|
525 | 494 |
} |
526 | 495 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_2.vue
+++ client/views/pages/main/Chapter/Chapter2_2.vue
... | ... | @@ -1,324 +1,305 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter2_2" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter2_2" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="goToPrevPage" |
|
25 |
- > |
|
26 |
- > |
|
27 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
28 |
- </div> |
|
29 |
- <div class="content title-box"> |
|
30 |
- <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
31 |
- <div |
|
32 |
- class="flex align-center mb30" |
|
33 |
- style="justify-content: space-between; margin-right: 9em" |
|
34 |
- > |
|
35 |
- <p class="subtitle2 mr20"> |
|
36 |
- 3초마다 뒤집어지는 카드의 단어를 외어보세요! |
|
37 |
- </p> |
|
38 |
- <div class="time-bg"> |
|
39 |
- <div> |
|
40 |
- <div class="time"> |
|
41 |
- <p class="second">{{ timer }}</p> |
|
42 |
- <p class="text">sec</p> |
|
43 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="goToPrevPage"> |
|
16 |
+ > |
|
17 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
44 | 18 |
</div> |
45 |
- </div> |
|
46 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
19 |
+ <div class="content title-box"> |
|
20 |
+ <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
21 |
+ <div class="flex align-center mb30" style="justify-content: space-between; margin-right: 9em"> |
|
22 |
+ <p class="subtitle2 mr20">3초마다 뒤집어지는 카드의 단어를 외어보세요!</p> |
|
23 |
+ <div class="time-bg"> |
|
24 |
+ <div> |
|
25 |
+ <div class="time"> |
|
26 |
+ <p class="second">{{ timer }}</p> |
|
27 |
+ <p class="text">sec</p> |
|
28 |
+ </div> |
|
29 |
+ </div> |
|
30 |
+ </div> |
|
31 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
47 | 32 |
</button> --> |
48 |
- </div> |
|
33 |
+ </div> |
|
49 | 34 |
|
50 |
- <div class="imgGroup"> |
|
51 |
- <div class="flex justify-center" style="gap: 90px"> |
|
52 |
- <button class="popTxt" v-for="(item, index) in items" :key="index"> |
|
53 |
- <div class="listenGroup"> |
|
54 |
- <img :src="item.imgSrc1" /> |
|
55 |
- <p class="textbox"> |
|
56 |
- <img :src="item.imgSrc" style="height: 150px" /> |
|
57 |
- </p> |
|
58 |
- </div> |
|
59 |
- <div |
|
60 |
- class="listenGroup" |
|
61 |
- :style="{ |
|
62 |
- display: item.isSecondImageVisible ? 'block' : 'none', |
|
63 |
- }" |
|
64 |
- > |
|
65 |
- <img :src="item.imgSrc2" /> |
|
66 |
- <p class="title4 textbox">{{ item.title }}</p> |
|
67 |
- </div> |
|
68 |
- </button> |
|
69 |
- </div> |
|
35 |
+ <div class="imgGroup"> |
|
36 |
+ <div class="flex justify-center" style="gap: 90px"> |
|
37 |
+ <button class="popTxt" v-for="(item, index) in items" :key="index"> |
|
38 |
+ <div class="listenGroup"> |
|
39 |
+ <img :src="item.imgSrc1" /> |
|
40 |
+ <p class="textbox"> |
|
41 |
+ <img :src="item.imgSrc" style="height: 150px" /> |
|
42 |
+ </p> |
|
43 |
+ </div> |
|
44 |
+ <div |
|
45 |
+ class="listenGroup" |
|
46 |
+ :style="{ |
|
47 |
+ display: item.isSecondImageVisible ? 'block' : 'none', |
|
48 |
+ }" |
|
49 |
+ > |
|
50 |
+ <img :src="item.imgSrc2" /> |
|
51 |
+ <p class="title4 textbox">{{ item.title }}</p> |
|
52 |
+ </div> |
|
53 |
+ </button> |
|
54 |
+ </div> |
|
55 |
+ </div> |
|
56 |
+ </div> |
|
57 |
+ <div class="next-btn" @click="goToNextPage"> |
|
58 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
59 |
+ </div> |
|
70 | 60 |
</div> |
71 |
- </div> |
|
72 |
- <div class="next-btn" @click="goToNextPage"> |
|
73 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
74 |
- </div> |
|
75 | 61 |
</div> |
76 |
- </div> |
|
77 | 62 |
</template> |
78 | 63 |
|
79 | 64 |
<script> |
80 |
-import axios from "axios"; |
|
81 |
- |
|
65 |
+import axios from 'axios'; |
|
66 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
82 | 67 |
export default { |
83 |
- data() { |
|
84 |
- return { |
|
85 |
- items: [], |
|
86 |
- timer: 0, |
|
87 |
- intervalId: null, |
|
88 |
- currentIndex: 0, |
|
89 |
- wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
90 |
- wdBookId: "", // 현재 단어장 id |
|
91 |
- currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
92 |
- wdBookTypeIdState: "", // 이동할 페이지 타입 id |
|
93 |
- wordBookType: "", // 이동할 페이지 |
|
68 |
+ data() { |
|
69 |
+ return { |
|
70 |
+ items: [], |
|
71 |
+ timer: 0, |
|
72 |
+ intervalId: null, |
|
73 |
+ currentIndex: 0, |
|
74 |
+ wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
75 |
+ wdBookId: '', // 현재 단어장 id |
|
76 |
+ currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
77 |
+ wdBookTypeIdState: '', // 이동할 페이지 타입 id |
|
78 |
+ wordBookType: '', // 이동할 페이지 |
|
94 | 79 |
|
95 |
- seq: this.$store.getters.seqNum, |
|
96 |
- hiddenState: false, |
|
97 |
- }; |
|
98 |
- }, |
|
99 |
- methods: { |
|
100 |
- pageSetting() { |
|
101 |
- this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
102 |
- this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
103 |
- this.wdBookId = |
|
104 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
105 |
- console.log(this.wdBookId); |
|
106 |
- |
|
107 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
108 |
- this.hiddenState = true; |
|
109 |
- } |
|
110 |
- |
|
111 |
- this.fetchWordList(); |
|
80 |
+ seq: this.$store.getters.seqNum, |
|
81 |
+ hiddenState: false, |
|
82 |
+ }; |
|
112 | 83 |
}, |
84 |
+ methods: { |
|
85 |
+ pageSetting() { |
|
86 |
+ this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
87 |
+ this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
88 |
+ this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
89 |
+ console.log(this.wdBookId); |
|
113 | 90 |
|
114 |
- async fetchWordList() { |
|
115 |
- try { |
|
116 |
- const response = await axios.post("/word/getWordsByBookId.json", { |
|
117 |
- wdBookId: this.wdBookId, |
|
118 |
- }); |
|
91 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
92 |
+ this.hiddenState = true; |
|
93 |
+ } |
|
119 | 94 |
|
120 |
- const wordList = response.data; |
|
95 |
+ this.fetchWordList(); |
|
96 |
+ }, |
|
121 | 97 |
|
122 |
- // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
123 |
- const requests = wordList.map(async (word) => { |
|
124 |
- const fileResponse = await axios.post("/file/find.json", { |
|
125 |
- file_mng_id: word.fileMngId, |
|
126 |
- }); |
|
98 |
+ async fetchWordList() { |
|
99 |
+ try { |
|
100 |
+ const response = await axios.post('/word/getWordsByBookId.json', { |
|
101 |
+ wdBookId: this.wdBookId, |
|
102 |
+ }); |
|
127 | 103 |
|
128 |
- const fileRpath = |
|
129 |
- fileResponse.data.list.length > 0 |
|
130 |
- ? fileResponse.data.list[0].fileRpath |
|
131 |
- : null; |
|
132 |
- console.log("각 단어의 fileRpath: ", fileRpath); |
|
104 |
+ const wordList = response.data; |
|
133 | 105 |
|
134 |
- // items 배열에 새로운 항목 추가 |
|
135 |
- this.items.push({ |
|
136 |
- imgSrc1: "client/resources/img/img49_s.png", |
|
137 |
- imgSrc2: "client/resources/img/img50_s.png", |
|
138 |
- imgSrc: "http://165.229.169.113:9080/" + fileRpath, // 받아온 fileRpath로 이미지 설정 |
|
139 |
- isSecondImageVisible: false, |
|
140 |
- title: word.wdNm, |
|
141 |
- }); |
|
142 |
- }); |
|
106 |
+ // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
107 |
+ const requests = wordList.map(async (word) => { |
|
108 |
+ const fileResponse = await axios.post('/file/find.json', { |
|
109 |
+ file_mng_id: word.fileMngId, |
|
110 |
+ }); |
|
143 | 111 |
|
144 |
- // 모든 요청이 완료될 때까지 대기 |
|
145 |
- await Promise.all(requests); |
|
146 |
- } catch (error) { |
|
147 |
- console.error("단어 목록을 불러오는 중 오류 발생:", error); |
|
148 |
- } |
|
112 |
+ const fileRpath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileRpath : null; |
|
113 |
+ console.log('각 단어의 fileRpath: ', fileRpath); |
|
114 |
+ |
|
115 |
+ // items 배열에 새로운 항목 추가 |
|
116 |
+ this.items.push({ |
|
117 |
+ imgSrc1: 'client/resources/img/img49_s.png', |
|
118 |
+ imgSrc2: 'client/resources/img/img50_s.png', |
|
119 |
+ imgSrc: 'http://165.229.169.113:9080/' + fileRpath, // 받아온 fileRpath로 이미지 설정 |
|
120 |
+ isSecondImageVisible: false, |
|
121 |
+ title: word.wdNm, |
|
122 |
+ }); |
|
123 |
+ }); |
|
124 |
+ |
|
125 |
+ // 모든 요청이 완료될 때까지 대기 |
|
126 |
+ await Promise.all(requests); |
|
127 |
+ } catch (error) { |
|
128 |
+ console.error('단어 목록을 불러오는 중 오류 발생:', error); |
|
129 |
+ } |
|
130 |
+ }, |
|
131 |
+ |
|
132 |
+ async goToPrevPage() { |
|
133 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
134 |
+ alert('단어장 첫번째 페이지 입니다'); |
|
135 |
+ } else { |
|
136 |
+ this.currentWdBkIndex--; |
|
137 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
138 |
+ |
|
139 |
+ try { |
|
140 |
+ const response = await axios.post('/wordbook/find.json', { |
|
141 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
142 |
+ }); |
|
143 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
144 |
+ console.log('이전 단어장 타입 id: ', this.wdBookTypeIdState); |
|
145 |
+ |
|
146 |
+ switch (this.wdBookTypeIdState) { |
|
147 |
+ case '1': |
|
148 |
+ this.wordBookType = 'Chapter2'; |
|
149 |
+ break; |
|
150 |
+ case '2': |
|
151 |
+ this.wordBookType = 'Chapter2_3'; |
|
152 |
+ break; |
|
153 |
+ case '3': |
|
154 |
+ this.wordBookType = 'Chapter2_2'; |
|
155 |
+ break; |
|
156 |
+ case '4': |
|
157 |
+ this.wordBookType = 'Chapter2_9'; |
|
158 |
+ break; |
|
159 |
+ case '5': |
|
160 |
+ this.wordBookType = 'Chapter2_4'; |
|
161 |
+ break; |
|
162 |
+ default: |
|
163 |
+ this.wordBookType = null; |
|
164 |
+ } |
|
165 |
+ |
|
166 |
+ this.goToPage(this.wordBookType); |
|
167 |
+ } catch (error) { |
|
168 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
169 |
+ } |
|
170 |
+ } |
|
171 |
+ }, |
|
172 |
+ |
|
173 |
+ async goToNextPage() { |
|
174 |
+ if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
175 |
+ alert('단어 학습 완료!'); |
|
176 |
+ this.complete(); |
|
177 |
+ } else { |
|
178 |
+ this.currentWdBkIndex++; |
|
179 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
180 |
+ |
|
181 |
+ try { |
|
182 |
+ const response = await axios.post('/wordbook/find.json', { |
|
183 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
184 |
+ }); |
|
185 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
186 |
+ console.log('다음 단어장 타입 id: ', this.wdBookTypeIdState); |
|
187 |
+ |
|
188 |
+ switch (this.wdBookTypeIdState) { |
|
189 |
+ case '1': |
|
190 |
+ this.wordBookType = 'Chapter2'; |
|
191 |
+ break; |
|
192 |
+ case '2': |
|
193 |
+ this.wordBookType = 'Chapter2_3'; |
|
194 |
+ break; |
|
195 |
+ case '3': |
|
196 |
+ this.wordBookType = 'Chapter2_2'; |
|
197 |
+ break; |
|
198 |
+ case '4': |
|
199 |
+ this.wordBookType = 'Chapter2_9'; |
|
200 |
+ break; |
|
201 |
+ case '5': |
|
202 |
+ this.wordBookType = 'Chapter2_4'; |
|
203 |
+ break; |
|
204 |
+ default: |
|
205 |
+ this.wordBookType = null; |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ this.goToPage(this.wordBookType); |
|
209 |
+ } catch (error) { |
|
210 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
211 |
+ } |
|
212 |
+ } |
|
213 |
+ }, |
|
214 |
+ |
|
215 |
+ complete() { |
|
216 |
+ const { unit_id, book_id } = this.$route.query; |
|
217 |
+ this.$router.push({ |
|
218 |
+ name: 'Dashboard', |
|
219 |
+ query: { value: this.seq, unit_id, book_id }, |
|
220 |
+ }); |
|
221 |
+ }, |
|
222 |
+ |
|
223 |
+ goToPage(page) { |
|
224 |
+ this.$router.push({ name: page }); |
|
225 |
+ }, |
|
226 |
+ toggleImage(index) { |
|
227 |
+ this.items[index].isSecondImageVisible = !this.items[index].isSecondImageVisible; |
|
228 |
+ }, |
|
229 |
+ startTimer() { |
|
230 |
+ // 현재 실행 중인 타이머가 있다면 정리 |
|
231 |
+ if (this.intervalId) { |
|
232 |
+ clearInterval(this.intervalId); |
|
233 |
+ } |
|
234 |
+ |
|
235 |
+ // 타이머 및 이미지 토글 상태 초기화 |
|
236 |
+ this.timer = 0; |
|
237 |
+ this.currentIndex = 0; // 현재 타이머 인덱스를 추적 |
|
238 |
+ |
|
239 |
+ // 시작 타이머 설정 |
|
240 |
+ this.runTimer(); |
|
241 |
+ }, |
|
242 |
+ |
|
243 |
+ runTimer() { |
|
244 |
+ // 반복 타이머 설정 |
|
245 |
+ this.intervalId = setInterval(() => { |
|
246 |
+ if (this.currentIndex == this.items.length) return; |
|
247 |
+ if (this.timer < 3) { |
|
248 |
+ this.timer++; |
|
249 |
+ } else { |
|
250 |
+ // 타이머가 끝났을 때, 다음 타이머 설정 |
|
251 |
+ this.timer = 0; |
|
252 |
+ |
|
253 |
+ if (this.currentIndex < this.items.length) { |
|
254 |
+ // 현재 인덱스에 해당하는 아이템으로 이미지 토글 |
|
255 |
+ this.toggleImage(this.currentIndex); |
|
256 |
+ this.currentIndex++; |
|
257 |
+ } else { |
|
258 |
+ // 모든 타이머가 완료되었으면 타이머 정리 |
|
259 |
+ clearInterval(this.intervalId); |
|
260 |
+ this.intervalId = null; |
|
261 |
+ console.log('모든 타이머가 완료되었습니다.'); |
|
262 |
+ } |
|
263 |
+ } |
|
264 |
+ }, 1000); |
|
265 |
+ }, |
|
149 | 266 |
}, |
150 |
- |
|
151 |
- async goToPrevPage() { |
|
152 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
153 |
- alert("단어장 첫번째 페이지 입니다"); |
|
154 |
- } else { |
|
155 |
- this.currentWdBkIndex--; |
|
156 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
157 |
- |
|
158 |
- try { |
|
159 |
- const response = await axios.post("/wordbook/find.json", { |
|
160 |
- wdBookId: |
|
161 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
162 |
- }); |
|
163 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
164 |
- console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState); |
|
165 |
- |
|
166 |
- switch (this.wdBookTypeIdState) { |
|
167 |
- case "1": |
|
168 |
- this.wordBookType = "Chapter2"; |
|
169 |
- break; |
|
170 |
- case "2": |
|
171 |
- this.wordBookType = "Chapter2_3"; |
|
172 |
- break; |
|
173 |
- case "3": |
|
174 |
- this.wordBookType = "Chapter2_2"; |
|
175 |
- break; |
|
176 |
- case "4": |
|
177 |
- this.wordBookType = "Chapter2_9"; |
|
178 |
- break; |
|
179 |
- case "5": |
|
180 |
- this.wordBookType = "Chapter2_4"; |
|
181 |
- break; |
|
182 |
- default: |
|
183 |
- this.wordBookType = null; |
|
184 |
- } |
|
185 |
- |
|
186 |
- this.goToPage(this.wordBookType); |
|
187 |
- } catch (error) { |
|
188 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
189 |
- } |
|
190 |
- } |
|
267 |
+ mounted() { |
|
268 |
+ this.pageSetting(); |
|
269 |
+ this.startTimer(); |
|
191 | 270 |
}, |
192 |
- |
|
193 |
- async goToNextPage() { |
|
194 |
- if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
195 |
- alert("단어 학습 완료!"); |
|
196 |
- this.complete(); |
|
197 |
- } else { |
|
198 |
- this.currentWdBkIndex++; |
|
199 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
200 |
- |
|
201 |
- try { |
|
202 |
- const response = await axios.post("/wordbook/find.json", { |
|
203 |
- wdBookId: |
|
204 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
205 |
- }); |
|
206 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
207 |
- console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState); |
|
208 |
- |
|
209 |
- switch (this.wdBookTypeIdState) { |
|
210 |
- case "1": |
|
211 |
- this.wordBookType = "Chapter2"; |
|
212 |
- break; |
|
213 |
- case "2": |
|
214 |
- this.wordBookType = "Chapter2_3"; |
|
215 |
- break; |
|
216 |
- case "3": |
|
217 |
- this.wordBookType = "Chapter2_2"; |
|
218 |
- break; |
|
219 |
- case "4": |
|
220 |
- this.wordBookType = "Chapter2_9"; |
|
221 |
- break; |
|
222 |
- case "5": |
|
223 |
- this.wordBookType = "Chapter2_4"; |
|
224 |
- break; |
|
225 |
- default: |
|
226 |
- this.wordBookType = null; |
|
227 |
- } |
|
228 |
- |
|
229 |
- this.goToPage(this.wordBookType); |
|
230 |
- } catch (error) { |
|
231 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
232 |
- } |
|
233 |
- } |
|
271 |
+ components: { |
|
272 |
+ BookInfo: BookInfo, |
|
234 | 273 |
}, |
235 |
- |
|
236 |
- complete() { |
|
237 |
- const { unit_id, book_id } = this.$route.query; |
|
238 |
- this.$router.push({ |
|
239 |
- name: "Dashboard", |
|
240 |
- query: { value: this.seq, unit_id, book_id }, |
|
241 |
- }); |
|
242 |
- }, |
|
243 |
- |
|
244 |
- goToPage(page) { |
|
245 |
- this.$router.push({ name: page }); |
|
246 |
- }, |
|
247 |
- toggleImage(index) { |
|
248 |
- this.items[index].isSecondImageVisible = |
|
249 |
- !this.items[index].isSecondImageVisible; |
|
250 |
- }, |
|
251 |
- startTimer() { |
|
252 |
- // 현재 실행 중인 타이머가 있다면 정리 |
|
253 |
- if (this.intervalId) { |
|
254 |
- clearInterval(this.intervalId); |
|
255 |
- } |
|
256 |
- |
|
257 |
- // 타이머 및 이미지 토글 상태 초기화 |
|
258 |
- this.timer = 0; |
|
259 |
- this.currentIndex = 0; // 현재 타이머 인덱스를 추적 |
|
260 |
- |
|
261 |
- // 시작 타이머 설정 |
|
262 |
- this.runTimer(); |
|
263 |
- }, |
|
264 |
- |
|
265 |
- runTimer() { |
|
266 |
- // 반복 타이머 설정 |
|
267 |
- this.intervalId = setInterval(() => { |
|
268 |
- if (this.currentIndex == this.items.length) return; |
|
269 |
- if (this.timer < 3) { |
|
270 |
- this.timer++; |
|
271 |
- } else { |
|
272 |
- // 타이머가 끝났을 때, 다음 타이머 설정 |
|
273 |
- this.timer = 0; |
|
274 |
- |
|
275 |
- if (this.currentIndex < this.items.length) { |
|
276 |
- // 현재 인덱스에 해당하는 아이템으로 이미지 토글 |
|
277 |
- this.toggleImage(this.currentIndex); |
|
278 |
- this.currentIndex++; |
|
279 |
- } else { |
|
280 |
- // 모든 타이머가 완료되었으면 타이머 정리 |
|
281 |
- clearInterval(this.intervalId); |
|
282 |
- this.intervalId = null; |
|
283 |
- console.log("모든 타이머가 완료되었습니다."); |
|
284 |
- } |
|
285 |
- } |
|
286 |
- }, 1000); |
|
287 |
- }, |
|
288 |
- }, |
|
289 |
- mounted() { |
|
290 |
- this.pageSetting(); |
|
291 |
- this.startTimer(); |
|
292 |
- }, |
|
293 | 274 |
}; |
294 | 275 |
</script> |
295 | 276 |
<style scoped> |
296 | 277 |
.popTxt { |
297 |
- width: 295px; |
|
298 |
- height: 406px; |
|
278 |
+ width: 295px; |
|
279 |
+ height: 406px; |
|
299 | 280 |
} |
300 | 281 |
|
301 | 282 |
.popTxt div:last-child img { |
302 |
- position: absolute; |
|
303 |
- top: 0; |
|
304 |
- left: 0; |
|
283 |
+ position: absolute; |
|
284 |
+ top: 0; |
|
285 |
+ left: 0; |
|
305 | 286 |
} |
306 | 287 |
|
307 | 288 |
.listenGroup .textbox { |
308 |
- top: 50%; |
|
309 |
- left: 50%; |
|
289 |
+ top: 50%; |
|
290 |
+ left: 50%; |
|
310 | 291 |
} |
311 | 292 |
|
312 | 293 |
.questionBox { |
313 |
- justify-content: space-between; |
|
314 |
- align-items: flex-start; |
|
294 |
+ justify-content: space-between; |
|
295 |
+ align-items: flex-start; |
|
315 | 296 |
} |
316 | 297 |
.completeBtn { |
317 |
- margin-right: 100px; |
|
318 |
- background-color: #ffba08; |
|
319 |
- padding: 10px 30px; |
|
320 |
- border-radius: 10px; |
|
321 |
- font-size: 28px; |
|
322 |
- font-family: "ONEMobilePOPOTF"; |
|
298 |
+ margin-right: 100px; |
|
299 |
+ background-color: #ffba08; |
|
300 |
+ padding: 10px 30px; |
|
301 |
+ border-radius: 10px; |
|
302 |
+ font-size: 28px; |
|
303 |
+ font-family: 'ONEMobilePOPOTF'; |
|
323 | 304 |
} |
324 | 305 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_3.vue
+++ client/views/pages/main/Chapter/Chapter2_3.vue
... | ... | @@ -1,450 +1,427 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter2_2" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="goToPrevPage" |
|
25 |
- > |
|
26 |
- <!-- @click="goToPrevPage" --> |
|
27 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
28 |
- </div> |
|
29 |
- <div class="content title-box"> |
|
30 |
- <p class="subtitle2"></p> |
|
31 |
- <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
32 |
- <div class="flex align-center mb30"> |
|
33 |
- <p class="subtitle2 mr20">다음을 듣고 따라 말하세요.</p> |
|
34 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
35 |
- </button> --> |
|
36 |
- </div> |
|
37 |
- |
|
38 |
- <div class="imgGroup box23"> |
|
39 |
- <div class="con"> |
|
40 |
- <img :src="currentCon.imgSrc" alt="" style="height: 150px" /> |
|
41 |
- <p class="title3"> |
|
42 |
- <em class="yellow">{{ currentCon.titleEm }}</em |
|
43 |
- >{{ currentCon.title }} |
|
44 |
- </p> |
|
45 |
- <div class="flex align-center justify-center mt10"> |
|
46 |
- <p class="yellow-box-big">{{ currentCon.boxText }}</p> |
|
47 |
- <span class="subtitle3">{{ currentCon.subtitle }}</span> |
|
48 |
- </div> |
|
49 |
- <div class="flex justify-center"> |
|
50 |
- <div class="btnGroup mt50 flex justify-between"> |
|
51 |
- <button |
|
52 |
- class="popTxt" |
|
53 |
- v-for="(item, index) in items" |
|
54 |
- :key="index" |
|
55 |
- @click="updateContent(index)" |
|
56 |
- :class="{ active: selectedIndex === index }" |
|
57 |
- > |
|
58 |
- <img :src="item.imgSrc1" /> |
|
59 |
- <img |
|
60 |
- :src="item.imgSrc2" |
|
61 |
- v-if="selectedIndex === index" |
|
62 |
- style="display: block" |
|
63 |
- /> |
|
64 |
- </button> |
|
65 |
- </div> |
|
66 |
- </div> |
|
67 |
- </div> |
|
68 |
- |
|
69 |
- <div class="flex justify-center"> |
|
70 |
- <div class="readGroup"> |
|
71 |
- <section> |
|
72 |
- <div class="imgGroup flex justify-center"> |
|
73 |
- <!-- 녹음 버튼 --> |
|
74 |
- <div |
|
75 |
- :class="['mic-btn', { notRecording: !isRecording }]" |
|
76 |
- @click="toggleRecording" |
|
77 |
- > |
|
78 |
- <img src="../../../../resources/img/btn11_s.png" alt="" /> |
|
79 |
- </div> |
|
2 |
+ <div id="Chapter2_2" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
80 | 7 |
</div> |
81 |
- <article> |
|
82 |
- <p ref="speakText" class="speakText mb25"> |
|
83 |
- 위의 버튼을 누른 후 단어를 말해보세요! |
|
84 |
- </p> |
|
85 |
- </article> |
|
86 |
- </section> |
|
87 |
- </div> |
|
88 |
- </div> |
|
8 |
+ </router-link> |
|
89 | 9 |
</div> |
90 |
- </div> |
|
91 |
- <div class="next-btn" @click="goToNextPage"> |
|
92 |
- <!-- @click="goToNextPage" --> |
|
93 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
94 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="goToPrevPage"> |
|
16 |
+ <!-- @click="goToPrevPage" --> |
|
17 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
18 |
+ </div> |
|
19 |
+ <div class="content title-box"> |
|
20 |
+ <p class="subtitle2"></p> |
|
21 |
+ <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
22 |
+ <div class="flex align-center mb30"> |
|
23 |
+ <p class="subtitle2 mr20">다음을 듣고 따라 말하세요.</p> |
|
24 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
25 |
+ </button> --> |
|
26 |
+ </div> |
|
27 |
+ |
|
28 |
+ <div class="imgGroup box23"> |
|
29 |
+ <div class="con"> |
|
30 |
+ <img :src="currentCon.imgSrc" alt="" style="height: 150px" /> |
|
31 |
+ <p class="title3"> |
|
32 |
+ <em class="yellow">{{ currentCon.titleEm }}</em |
|
33 |
+ >{{ currentCon.title }} |
|
34 |
+ </p> |
|
35 |
+ <div class="flex align-center justify-center mt10"> |
|
36 |
+ <p class="yellow-box-big">{{ currentCon.boxText }}</p> |
|
37 |
+ <span class="subtitle3">{{ currentCon.subtitle }}</span> |
|
38 |
+ </div> |
|
39 |
+ <div class="flex justify-center"> |
|
40 |
+ <div class="btnGroup mt50 flex justify-between"> |
|
41 |
+ <button |
|
42 |
+ class="popTxt" |
|
43 |
+ v-for="(item, index) in items" |
|
44 |
+ :key="index" |
|
45 |
+ @click="updateContent(index)" |
|
46 |
+ :class="{ active: selectedIndex === index }" |
|
47 |
+ > |
|
48 |
+ <img :src="item.imgSrc1" /> |
|
49 |
+ <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block" /> |
|
50 |
+ </button> |
|
51 |
+ </div> |
|
52 |
+ </div> |
|
53 |
+ </div> |
|
54 |
+ |
|
55 |
+ <div class="flex justify-center"> |
|
56 |
+ <div class="readGroup"> |
|
57 |
+ <section> |
|
58 |
+ <div class="imgGroup flex justify-center"> |
|
59 |
+ <!-- 녹음 버튼 --> |
|
60 |
+ <div :class="['mic-btn', { notRecording: !isRecording }]" @click="toggleRecording"> |
|
61 |
+ <img src="../../../../resources/img/btn11_s.png" alt="" /> |
|
62 |
+ </div> |
|
63 |
+ </div> |
|
64 |
+ <article> |
|
65 |
+ <p ref="speakText" class="speakText mb25">위의 버튼을 누른 후 단어를 말해보세요!</p> |
|
66 |
+ </article> |
|
67 |
+ </section> |
|
68 |
+ </div> |
|
69 |
+ </div> |
|
70 |
+ </div> |
|
71 |
+ </div> |
|
72 |
+ <div class="next-btn" @click="goToNextPage"> |
|
73 |
+ <!-- @click="goToNextPage" --> |
|
74 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
75 |
+ </div> |
|
76 |
+ </div> |
|
95 | 77 |
</div> |
96 |
- </div> |
|
97 | 78 |
</template> |
98 | 79 |
|
99 | 80 |
<script> |
100 |
-import axios from "axios"; |
|
101 |
-import { mdiStop } from "@mdi/js"; |
|
81 |
+import axios from 'axios'; |
|
82 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
83 |
+import { mdiStop } from '@mdi/js'; |
|
102 | 84 |
export default { |
103 |
- data() { |
|
104 |
- return { |
|
105 |
- items: [], |
|
106 |
- currentCon: { |
|
107 |
- imgSrc: "", |
|
108 |
- titleEm: "", |
|
109 |
- title: "", |
|
110 |
- boxText: "명", |
|
111 |
- subtitle: "", |
|
112 |
- }, |
|
113 |
- selectedIndex: 0, |
|
114 |
- timer: "00", |
|
115 |
- intervalId: null, |
|
116 |
- |
|
117 |
- isRecording: false, // 녹음 중 여부 |
|
118 |
- mediaRecorder: null, |
|
119 |
- audioChunks: [], // 녹음된 오디오 데이터 |
|
120 |
- audioBlob: null, // 오디오 Blob 객체 |
|
121 |
- stream: null, // MediaStream 객체 |
|
122 |
- |
|
123 |
- path: mdiStop, |
|
124 |
- nowWord: "cloud", |
|
125 |
- |
|
126 |
- wdBookId: "WORD_BOOK_000000000000043", |
|
127 |
- wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
128 |
- currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
129 |
- wdBookTypeIdState: "", // 이동할 페이지 타입 id |
|
130 |
- wordBookType: "", // 이동할 페이지 |
|
131 |
- |
|
132 |
- seq: this.$store.getters.seqNum, |
|
133 |
- hiddenState: false, |
|
134 |
- }; |
|
135 |
- }, |
|
136 |
- methods: { |
|
137 |
- pageSetting() { |
|
138 |
- this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
139 |
- this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
140 |
- this.wdBookId = |
|
141 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
142 |
- |
|
143 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
144 |
- this.hiddenState = true; |
|
145 |
- } |
|
146 |
- this.fetchWordList(); |
|
147 |
- }, |
|
148 |
- |
|
149 |
- async goToPrevPage() { |
|
150 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
151 |
- alert("단어장 첫번째 페이지 입니다"); |
|
152 |
- } else { |
|
153 |
- this.currentWdBkIndex--; |
|
154 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
155 |
- |
|
156 |
- try { |
|
157 |
- const response = await axios.post("/wordbook/find.json", { |
|
158 |
- wdBookId: |
|
159 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
160 |
- }); |
|
161 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
162 |
- console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState); |
|
163 |
- |
|
164 |
- switch (this.wdBookTypeIdState) { |
|
165 |
- case "1": |
|
166 |
- this.wordBookType = "Chapter2"; |
|
167 |
- break; |
|
168 |
- case "2": |
|
169 |
- this.wordBookType = "Chapter2_3"; |
|
170 |
- break; |
|
171 |
- case "3": |
|
172 |
- this.wordBookType = "Chapter2_2"; |
|
173 |
- break; |
|
174 |
- case "4": |
|
175 |
- this.wordBookType = "Chapter2_9"; |
|
176 |
- break; |
|
177 |
- case "5": |
|
178 |
- this.wordBookType = "Chapter2_4"; |
|
179 |
- break; |
|
180 |
- default: |
|
181 |
- this.wordBookType = null; |
|
182 |
- } |
|
183 |
- |
|
184 |
- this.goToPage(this.wordBookType); |
|
185 |
- } catch (error) { |
|
186 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
187 |
- } |
|
188 |
- } |
|
189 |
- }, |
|
190 |
- |
|
191 |
- async goToNextPage() { |
|
192 |
- if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
193 |
- alert("단어장 학습 완료!"); |
|
194 |
- this.complete(); |
|
195 |
- } else { |
|
196 |
- this.currentWdBkIndex++; |
|
197 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
198 |
- |
|
199 |
- try { |
|
200 |
- const response = await axios.post("/wordbook/find.json", { |
|
201 |
- wdBookId: |
|
202 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
203 |
- }); |
|
204 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
205 |
- console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState); |
|
206 |
- |
|
207 |
- switch (this.wdBookTypeIdState) { |
|
208 |
- case "1": |
|
209 |
- this.wordBookType = "Chapter2"; |
|
210 |
- break; |
|
211 |
- case "2": |
|
212 |
- this.wordBookType = "Chapter2_3"; |
|
213 |
- break; |
|
214 |
- case "3": |
|
215 |
- this.wordBookType = "Chapter2_2"; |
|
216 |
- break; |
|
217 |
- case "4": |
|
218 |
- this.wordBookType = "Chapter2_9"; |
|
219 |
- break; |
|
220 |
- case "5": |
|
221 |
- this.wordBookType = "Chapter2_4"; |
|
222 |
- break; |
|
223 |
- default: |
|
224 |
- this.wordBookType = null; |
|
225 |
- } |
|
226 |
- |
|
227 |
- this.goToPage(this.wordBookType); |
|
228 |
- } catch (error) { |
|
229 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
230 |
- } |
|
231 |
- } |
|
232 |
- }, |
|
233 |
- |
|
234 |
- complete() { |
|
235 |
- const { unit_id, book_id } = this.$route.query; |
|
236 |
- this.$router.push({ |
|
237 |
- name: "Dashboard", |
|
238 |
- query: { value: this.seq, unit_id, book_id }, |
|
239 |
- }); |
|
240 |
- }, |
|
241 |
- |
|
242 |
- goToPage(page) { |
|
243 |
- this.$router.push({ name: page }); |
|
244 |
- }, |
|
245 |
- |
|
246 |
- updateContent(index) { |
|
247 |
- this.selectedIndex = index; |
|
248 |
- this.currentCon = this.items[index].con; |
|
249 |
- console.log(this.currentCon.imgSrc); |
|
250 |
- this.startTimer(); |
|
251 |
- }, |
|
252 |
- |
|
253 |
- startTimer() { |
|
254 |
- if (this.intervalId) { |
|
255 |
- clearInterval(this.intervalId); |
|
256 |
- } |
|
257 |
- this.timer = 5; |
|
258 |
- this.intervalId = setInterval(() => { |
|
259 |
- if (this.timer > 0) { |
|
260 |
- this.timer--; |
|
261 |
- } else { |
|
262 |
- clearInterval(this.intervalId); |
|
263 |
- } |
|
264 |
- }, 1000); |
|
265 |
- }, |
|
266 |
- |
|
267 |
- // 녹음 시작/중지 토글 |
|
268 |
- async toggleRecording() { |
|
269 |
- if (this.isRecording) { |
|
270 |
- console.log("녹음 그만!"); |
|
271 |
- this.stopRecording(); // 녹음 중이면 중지 |
|
272 |
- } else { |
|
273 |
- console.log("녹음 시작!"); |
|
274 |
- await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
275 |
- } |
|
276 |
- }, |
|
277 |
- |
|
278 |
- // 녹음 시작 |
|
279 |
- async startRecording() { |
|
280 |
- this.audioChunks = []; // 오디오 초기화 |
|
281 |
- this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
282 |
- this.mediaRecorder = new MediaRecorder(this.stream); |
|
283 |
- this.mediaRecorder.ondataavailable = (event) => { |
|
284 |
- this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
285 |
- }; |
|
286 |
- this.mediaRecorder.onstop = () => { |
|
287 |
- this.audioBlob = new Blob(this.audioChunks, { type: "audio/wav" }); |
|
288 |
- |
|
289 |
- /******************************/ |
|
290 |
- // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
291 |
- // console.log('Audio URL:', this.audioURL); |
|
292 |
- /******************************/ |
|
293 |
- |
|
294 |
- console.log("Recorded Audio Blob:", this.audioBlob); // 콘솔에 Blob 확인 |
|
295 |
- this.sendAudioToServer(); // 서버로 오디오 전송 |
|
296 |
- }; |
|
297 |
- this.mediaRecorder.start(); // 녹음 시작 |
|
298 |
- this.isRecording = true; // 녹음 상태 변경 |
|
299 |
- }, |
|
300 |
- |
|
301 |
- // 녹음 중지 |
|
302 |
- stopRecording() { |
|
303 |
- this.mediaRecorder.stop(); // 녹음 중단 |
|
304 |
- |
|
305 |
- if (this.stream) { |
|
306 |
- this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
307 |
- } |
|
308 |
- |
|
309 |
- this.isRecording = false; // 녹음 상태 변경 |
|
310 |
- }, |
|
311 |
- |
|
312 |
- // 오디오 전송 |
|
313 |
- async sendAudioToServer() { |
|
314 |
- const formData = new FormData(); |
|
315 |
- formData.append("file", this.audioBlob, "recording.wav"); |
|
316 |
- try { |
|
317 |
- const response = await axios.post("/api/speechToText.json", formData, { |
|
318 |
- headers: { |
|
319 |
- "Content-Type": "multipart/form-data", |
|
320 |
- }, |
|
321 |
- }); |
|
322 |
- |
|
323 |
- this.transcription = response.data.trim().toLowerCase(); |
|
324 |
- this.nowWord = this.nowWord.toLowerCase(); |
|
325 |
- |
|
326 |
- console.log("지금 단어: ", this.nowWord); |
|
327 |
- console.log("녹음 결과: ", this.transcription); |
|
328 |
- |
|
329 |
- if (this.transcription === this.nowWord) { |
|
330 |
- this.$refs.speakText.innerText = "정답입니다! 잘했어요"; |
|
331 |
- } else { |
|
332 |
- this.$refs.speakText.innerText = "다시 말해보세요!"; |
|
333 |
- } |
|
334 |
- } catch (error) { |
|
335 |
- console.log("파일 전송 실패: ", error); |
|
336 |
- } |
|
337 |
- }, |
|
338 |
- |
|
339 |
- // 단어 리스트를 서버에서 받아와 items에 적용하는 메서드 |
|
340 |
- async fetchWordList() { |
|
341 |
- try { |
|
342 |
- const response = await axios.post("/word/getWordsByBookId.json", { |
|
343 |
- wdBookId: this.wdBookId, |
|
344 |
- }); |
|
345 |
- |
|
346 |
- this.wordList = response.data; |
|
347 |
- |
|
348 |
- const requests = this.wordList.map(async (word, index) => { |
|
349 |
- // fileRpath를 받아오기 위한 요청 |
|
350 |
- const fileResponse = await axios.post("/file/find.json", { |
|
351 |
- file_mng_id: word.fileMngId, |
|
352 |
- }); |
|
353 |
- |
|
354 |
- // fileResponse.data.list에서 fileRpath 값을 추출하여 imgSrc에 설정 |
|
355 |
- const fileRpath = |
|
356 |
- fileResponse.data.list.length > 0 |
|
357 |
- ? fileResponse.data.list[0].fileRpath |
|
358 |
- : null; |
|
359 |
- const imgSrc = fileRpath |
|
360 |
- ? `http://165.229.169.113:9080/${fileRpath}` |
|
361 |
- : ""; |
|
362 |
- |
|
363 |
- return { |
|
364 |
- imgSrc1: `client/resources/img/img53_${6 + index}_35s.png`, |
|
365 |
- imgSrc2: `client/resources/img/img53_${1 + index}_35s.png`, |
|
366 |
- con: { |
|
367 |
- imgSrc, // fileRpath를 imgSrc에 설정 |
|
368 |
- titleEm: word.wdNm.charAt(0), // 단어의 첫 글자 |
|
369 |
- title: word.wdNm.slice(1), // 단어의 나머지 부분 |
|
370 |
- boxText: "명", |
|
371 |
- subtitle: word.wdMnng, // 단어의 의미 |
|
85 |
+ data() { |
|
86 |
+ return { |
|
87 |
+ items: [], |
|
88 |
+ currentCon: { |
|
89 |
+ imgSrc: '', |
|
90 |
+ titleEm: '', |
|
91 |
+ title: '', |
|
92 |
+ boxText: '명', |
|
93 |
+ subtitle: '', |
|
372 | 94 |
}, |
373 |
- }; |
|
374 |
- }); |
|
95 |
+ selectedIndex: 0, |
|
96 |
+ timer: '00', |
|
97 |
+ intervalId: null, |
|
375 | 98 |
|
376 |
- // 모든 요청이 완료될 때까지 대기 |
|
377 |
- this.items = await Promise.all(requests); |
|
99 |
+ isRecording: false, // 녹음 중 여부 |
|
100 |
+ mediaRecorder: null, |
|
101 |
+ audioChunks: [], // 녹음된 오디오 데이터 |
|
102 |
+ audioBlob: null, // 오디오 Blob 객체 |
|
103 |
+ stream: null, // MediaStream 객체 |
|
378 | 104 |
|
379 |
- // items 리스트의 첫 번째 항목을 currentCon에 설정 |
|
380 |
- if (this.items.length > 0) { |
|
381 |
- this.currentCon = this.items[0].con; |
|
382 |
- this.nowWord = this.currentCon.titleEm + this.currentCon.title; |
|
105 |
+ path: mdiStop, |
|
106 |
+ nowWord: 'cloud', |
|
107 |
+ |
|
108 |
+ wdBookId: 'WORD_BOOK_000000000000043', |
|
109 |
+ wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
110 |
+ currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
111 |
+ wdBookTypeIdState: '', // 이동할 페이지 타입 id |
|
112 |
+ wordBookType: '', // 이동할 페이지 |
|
113 |
+ |
|
114 |
+ seq: this.$store.getters.seqNum, |
|
115 |
+ hiddenState: false, |
|
116 |
+ }; |
|
117 |
+ }, |
|
118 |
+ methods: { |
|
119 |
+ pageSetting() { |
|
120 |
+ this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
121 |
+ this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
122 |
+ this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
123 |
+ |
|
124 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
125 |
+ this.hiddenState = true; |
|
126 |
+ } |
|
127 |
+ this.fetchWordList(); |
|
128 |
+ }, |
|
129 |
+ |
|
130 |
+ async goToPrevPage() { |
|
131 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
132 |
+ alert('단어장 첫번째 페이지 입니다'); |
|
133 |
+ } else { |
|
134 |
+ this.currentWdBkIndex--; |
|
135 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
136 |
+ |
|
137 |
+ try { |
|
138 |
+ const response = await axios.post('/wordbook/find.json', { |
|
139 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
140 |
+ }); |
|
141 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
142 |
+ console.log('이전 단어장 타입 id: ', this.wdBookTypeIdState); |
|
143 |
+ |
|
144 |
+ switch (this.wdBookTypeIdState) { |
|
145 |
+ case '1': |
|
146 |
+ this.wordBookType = 'Chapter2'; |
|
147 |
+ break; |
|
148 |
+ case '2': |
|
149 |
+ this.wordBookType = 'Chapter2_3'; |
|
150 |
+ break; |
|
151 |
+ case '3': |
|
152 |
+ this.wordBookType = 'Chapter2_2'; |
|
153 |
+ break; |
|
154 |
+ case '4': |
|
155 |
+ this.wordBookType = 'Chapter2_9'; |
|
156 |
+ break; |
|
157 |
+ case '5': |
|
158 |
+ this.wordBookType = 'Chapter2_4'; |
|
159 |
+ break; |
|
160 |
+ default: |
|
161 |
+ this.wordBookType = null; |
|
162 |
+ } |
|
163 |
+ |
|
164 |
+ this.goToPage(this.wordBookType); |
|
165 |
+ } catch (error) { |
|
166 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
167 |
+ } |
|
168 |
+ } |
|
169 |
+ }, |
|
170 |
+ |
|
171 |
+ async goToNextPage() { |
|
172 |
+ if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
173 |
+ alert('단어장 학습 완료!'); |
|
174 |
+ this.complete(); |
|
175 |
+ } else { |
|
176 |
+ this.currentWdBkIndex++; |
|
177 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
178 |
+ |
|
179 |
+ try { |
|
180 |
+ const response = await axios.post('/wordbook/find.json', { |
|
181 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
182 |
+ }); |
|
183 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
184 |
+ console.log('다음 단어장 타입 id: ', this.wdBookTypeIdState); |
|
185 |
+ |
|
186 |
+ switch (this.wdBookTypeIdState) { |
|
187 |
+ case '1': |
|
188 |
+ this.wordBookType = 'Chapter2'; |
|
189 |
+ break; |
|
190 |
+ case '2': |
|
191 |
+ this.wordBookType = 'Chapter2_3'; |
|
192 |
+ break; |
|
193 |
+ case '3': |
|
194 |
+ this.wordBookType = 'Chapter2_2'; |
|
195 |
+ break; |
|
196 |
+ case '4': |
|
197 |
+ this.wordBookType = 'Chapter2_9'; |
|
198 |
+ break; |
|
199 |
+ case '5': |
|
200 |
+ this.wordBookType = 'Chapter2_4'; |
|
201 |
+ break; |
|
202 |
+ default: |
|
203 |
+ this.wordBookType = null; |
|
204 |
+ } |
|
205 |
+ |
|
206 |
+ this.goToPage(this.wordBookType); |
|
207 |
+ } catch (error) { |
|
208 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
209 |
+ } |
|
210 |
+ } |
|
211 |
+ }, |
|
212 |
+ |
|
213 |
+ complete() { |
|
214 |
+ const { unit_id, book_id } = this.$route.query; |
|
215 |
+ this.$router.push({ |
|
216 |
+ name: 'Dashboard', |
|
217 |
+ query: { value: this.seq, unit_id, book_id }, |
|
218 |
+ }); |
|
219 |
+ }, |
|
220 |
+ |
|
221 |
+ goToPage(page) { |
|
222 |
+ this.$router.push({ name: page }); |
|
223 |
+ }, |
|
224 |
+ |
|
225 |
+ updateContent(index) { |
|
226 |
+ this.selectedIndex = index; |
|
227 |
+ this.currentCon = this.items[index].con; |
|
228 |
+ console.log(this.currentCon.imgSrc); |
|
229 |
+ this.startTimer(); |
|
230 |
+ }, |
|
231 |
+ |
|
232 |
+ startTimer() { |
|
233 |
+ if (this.intervalId) { |
|
234 |
+ clearInterval(this.intervalId); |
|
235 |
+ } |
|
236 |
+ this.timer = 5; |
|
237 |
+ this.intervalId = setInterval(() => { |
|
238 |
+ if (this.timer > 0) { |
|
239 |
+ this.timer--; |
|
240 |
+ } else { |
|
241 |
+ clearInterval(this.intervalId); |
|
242 |
+ } |
|
243 |
+ }, 1000); |
|
244 |
+ }, |
|
245 |
+ |
|
246 |
+ // 녹음 시작/중지 토글 |
|
247 |
+ async toggleRecording() { |
|
248 |
+ if (this.isRecording) { |
|
249 |
+ console.log('녹음 그만!'); |
|
250 |
+ this.stopRecording(); // 녹음 중이면 중지 |
|
251 |
+ } else { |
|
252 |
+ console.log('녹음 시작!'); |
|
253 |
+ await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
254 |
+ } |
|
255 |
+ }, |
|
256 |
+ |
|
257 |
+ // 녹음 시작 |
|
258 |
+ async startRecording() { |
|
259 |
+ this.audioChunks = []; // 오디오 초기화 |
|
260 |
+ this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
261 |
+ this.mediaRecorder = new MediaRecorder(this.stream); |
|
262 |
+ this.mediaRecorder.ondataavailable = (event) => { |
|
263 |
+ this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
264 |
+ }; |
|
265 |
+ this.mediaRecorder.onstop = () => { |
|
266 |
+ this.audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' }); |
|
267 |
+ |
|
268 |
+ /******************************/ |
|
269 |
+ // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
270 |
+ // console.log('Audio URL:', this.audioURL); |
|
271 |
+ /******************************/ |
|
272 |
+ |
|
273 |
+ console.log('Recorded Audio Blob:', this.audioBlob); // 콘솔에 Blob 확인 |
|
274 |
+ this.sendAudioToServer(); // 서버로 오디오 전송 |
|
275 |
+ }; |
|
276 |
+ this.mediaRecorder.start(); // 녹음 시작 |
|
277 |
+ this.isRecording = true; // 녹음 상태 변경 |
|
278 |
+ }, |
|
279 |
+ |
|
280 |
+ // 녹음 중지 |
|
281 |
+ stopRecording() { |
|
282 |
+ this.mediaRecorder.stop(); // 녹음 중단 |
|
283 |
+ |
|
284 |
+ if (this.stream) { |
|
285 |
+ this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
286 |
+ } |
|
287 |
+ |
|
288 |
+ this.isRecording = false; // 녹음 상태 변경 |
|
289 |
+ }, |
|
290 |
+ |
|
291 |
+ // 오디오 전송 |
|
292 |
+ async sendAudioToServer() { |
|
293 |
+ const formData = new FormData(); |
|
294 |
+ formData.append('file', this.audioBlob, 'recording.wav'); |
|
295 |
+ try { |
|
296 |
+ const response = await axios.post('/api/speechToText.json', formData, { |
|
297 |
+ headers: { |
|
298 |
+ 'Content-Type': 'multipart/form-data', |
|
299 |
+ }, |
|
300 |
+ }); |
|
301 |
+ |
|
302 |
+ this.transcription = response.data.trim().toLowerCase(); |
|
303 |
+ this.nowWord = this.nowWord.toLowerCase(); |
|
304 |
+ |
|
305 |
+ console.log('지금 단어: ', this.nowWord); |
|
306 |
+ console.log('녹음 결과: ', this.transcription); |
|
307 |
+ |
|
308 |
+ if (this.transcription === this.nowWord) { |
|
309 |
+ this.$refs.speakText.innerText = '정답입니다! 잘했어요'; |
|
310 |
+ } else { |
|
311 |
+ this.$refs.speakText.innerText = '다시 말해보세요!'; |
|
312 |
+ } |
|
313 |
+ } catch (error) { |
|
314 |
+ console.log('파일 전송 실패: ', error); |
|
315 |
+ } |
|
316 |
+ }, |
|
317 |
+ |
|
318 |
+ // 단어 리스트를 서버에서 받아와 items에 적용하는 메서드 |
|
319 |
+ async fetchWordList() { |
|
320 |
+ try { |
|
321 |
+ const response = await axios.post('/word/getWordsByBookId.json', { |
|
322 |
+ wdBookId: this.wdBookId, |
|
323 |
+ }); |
|
324 |
+ |
|
325 |
+ this.wordList = response.data; |
|
326 |
+ |
|
327 |
+ const requests = this.wordList.map(async (word, index) => { |
|
328 |
+ // fileRpath를 받아오기 위한 요청 |
|
329 |
+ const fileResponse = await axios.post('/file/find.json', { |
|
330 |
+ file_mng_id: word.fileMngId, |
|
331 |
+ }); |
|
332 |
+ |
|
333 |
+ // fileResponse.data.list에서 fileRpath 값을 추출하여 imgSrc에 설정 |
|
334 |
+ const fileRpath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileRpath : null; |
|
335 |
+ const imgSrc = fileRpath ? `http://165.229.169.113:9080/${fileRpath}` : ''; |
|
336 |
+ |
|
337 |
+ return { |
|
338 |
+ imgSrc1: `client/resources/img/img53_${6 + index}_35s.png`, |
|
339 |
+ imgSrc2: `client/resources/img/img53_${1 + index}_35s.png`, |
|
340 |
+ con: { |
|
341 |
+ imgSrc, // fileRpath를 imgSrc에 설정 |
|
342 |
+ titleEm: word.wdNm.charAt(0), // 단어의 첫 글자 |
|
343 |
+ title: word.wdNm.slice(1), // 단어의 나머지 부분 |
|
344 |
+ boxText: '명', |
|
345 |
+ subtitle: word.wdMnng, // 단어의 의미 |
|
346 |
+ }, |
|
347 |
+ }; |
|
348 |
+ }); |
|
349 |
+ |
|
350 |
+ // 모든 요청이 완료될 때까지 대기 |
|
351 |
+ this.items = await Promise.all(requests); |
|
352 |
+ |
|
353 |
+ // items 리스트의 첫 번째 항목을 currentCon에 설정 |
|
354 |
+ if (this.items.length > 0) { |
|
355 |
+ this.currentCon = this.items[0].con; |
|
356 |
+ this.nowWord = this.currentCon.titleEm + this.currentCon.title; |
|
357 |
+ } |
|
358 |
+ } catch (error) { |
|
359 |
+ console.error('단어 목록을 불러오는 중 오류 발생:', error); |
|
360 |
+ } |
|
361 |
+ }, |
|
362 |
+ }, |
|
363 |
+ watch: { |
|
364 |
+ transcription: null, // 서버에서 받아온 텍스트 결과 |
|
365 |
+ currentCon: { |
|
366 |
+ handler(newValue) { |
|
367 |
+ // Update nowWord when currentCon changes |
|
368 |
+ this.nowWord = newValue.titleEm + newValue.title; |
|
369 |
+ }, |
|
370 |
+ deep: true, // Watch for deep changes in currentCon |
|
371 |
+ }, |
|
372 |
+ }, |
|
373 |
+ mounted() { |
|
374 |
+ this.pageSetting(); |
|
375 |
+ }, |
|
376 |
+ beforeDestroy() { |
|
377 |
+ if (this.intervalId) { |
|
378 |
+ clearInterval(this.intervalId); |
|
383 | 379 |
} |
384 |
- } catch (error) { |
|
385 |
- console.error("단어 목록을 불러오는 중 오류 발생:", error); |
|
386 |
- } |
|
387 | 380 |
}, |
388 |
- }, |
|
389 |
- watch: { |
|
390 |
- transcription: null, // 서버에서 받아온 텍스트 결과 |
|
391 |
- currentCon: { |
|
392 |
- handler(newValue) { |
|
393 |
- // Update nowWord when currentCon changes |
|
394 |
- this.nowWord = newValue.titleEm + newValue.title; |
|
395 |
- }, |
|
396 |
- deep: true, // Watch for deep changes in currentCon |
|
381 |
+ components: { |
|
382 |
+ BookInfo: BookInfo, |
|
397 | 383 |
}, |
398 |
- }, |
|
399 |
- mounted() { |
|
400 |
- this.pageSetting(); |
|
401 |
- }, |
|
402 |
- beforeDestroy() { |
|
403 |
- if (this.intervalId) { |
|
404 |
- clearInterval(this.intervalId); |
|
405 |
- } |
|
406 |
- }, |
|
407 | 384 |
}; |
408 | 385 |
</script> |
409 | 386 |
|
410 | 387 |
<style scoped> |
411 | 388 |
.popTxt img { |
412 |
- position: absolute; |
|
413 |
- top: 0; |
|
414 |
- left: 0; |
|
389 |
+ position: absolute; |
|
390 |
+ top: 0; |
|
391 |
+ left: 0; |
|
415 | 392 |
} |
416 | 393 |
|
417 | 394 |
.box23 { |
418 |
- display: flex; |
|
419 |
- align-items: center; |
|
420 |
- gap: 80px; |
|
421 |
- justify-content: center; |
|
395 |
+ display: flex; |
|
396 |
+ align-items: center; |
|
397 |
+ gap: 80px; |
|
398 |
+ justify-content: center; |
|
422 | 399 |
} |
423 | 400 |
|
424 | 401 |
.mic-btn { |
425 |
- cursor: pointer; |
|
402 |
+ cursor: pointer; |
|
426 | 403 |
} |
427 | 404 |
|
428 | 405 |
.mic-btn.notRecording { |
429 |
- background-image: none; |
|
430 |
- cursor: pointer; |
|
406 |
+ background-image: none; |
|
407 |
+ cursor: pointer; |
|
431 | 408 |
} |
432 | 409 |
|
433 | 410 |
.speakText { |
434 |
- background-color: #fff8e9; |
|
435 |
- border: 0; |
|
411 |
+ background-color: #fff8e9; |
|
412 |
+ border: 0; |
|
436 | 413 |
} |
437 | 414 |
|
438 | 415 |
.speakText span { |
439 |
- font-size: 28px; |
|
416 |
+ font-size: 28px; |
|
440 | 417 |
} |
441 | 418 |
|
442 | 419 |
.completeBtn { |
443 |
- margin-right: 100px; |
|
444 |
- background-color: #ffba08; |
|
445 |
- padding: 10px 30px; |
|
446 |
- border-radius: 10px; |
|
447 |
- font-size: 28px; |
|
448 |
- font-family: "ONEMobilePOPOTF"; |
|
420 |
+ margin-right: 100px; |
|
421 |
+ background-color: #ffba08; |
|
422 |
+ padding: 10px 30px; |
|
423 |
+ border-radius: 10px; |
|
424 |
+ font-size: 28px; |
|
425 |
+ font-family: 'ONEMobilePOPOTF'; |
|
449 | 426 |
} |
450 | 427 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_4.vue
+++ client/views/pages/main/Chapter/Chapter2_4.vue
... | ... | @@ -1,320 +1,293 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter2_2" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="goToPrevPage" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
30 |
- <div class="flex align-center mb30"> |
|
31 |
- <p class="subtitle2 mr20">다음을 듣고 맞는 단어를 선택하세요.</p> |
|
32 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
33 |
- </button> --> |
|
34 |
- </div> |
|
35 |
- |
|
36 |
- <div class="imgGroup"> |
|
37 |
- <div class="flex justify-center"> |
|
38 |
- <div class="listenGroup flex" style="gap: 60px"> |
|
39 |
- <button |
|
40 |
- class="popTxt" |
|
41 |
- v-for="(item, index) in items" |
|
42 |
- :key="index" |
|
43 |
- @click="updateContent(index)" |
|
44 |
- :class="{ active: selectedIndex === index }" |
|
45 |
- > |
|
46 |
- <img :src="item.imgSrc1" /> |
|
47 |
- <img |
|
48 |
- :src="item.imgSrc2" |
|
49 |
- v-if="selectedIndex === index" |
|
50 |
- style="display: block" |
|
51 |
- /> |
|
52 |
- <div class="textbox"> |
|
53 |
- <div style="height: 80%; line-height: 200px"> |
|
54 |
- <img :src="item.imgSrc" alt="" style="width: 120px" /> |
|
55 |
- </div> |
|
56 |
- <p class="subtitle3" style="height: 20%">{{ item.title }}</p> |
|
2 |
+ <div id="Chapter2_2" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
57 | 7 |
</div> |
58 |
- </button> |
|
59 |
- </div> |
|
60 |
- </div> |
|
61 |
- <div class="listen-btn mt50"> |
|
62 |
- <img |
|
63 |
- src="client/resources/img/btn10_s.png" |
|
64 |
- alt="Listen" |
|
65 |
- @click="playAudio" |
|
66 |
- /> |
|
67 |
- </div> |
|
68 |
- |
|
69 |
- <audio |
|
70 |
- id="audio-player" |
|
71 |
- src="client/resources/audio/bank.wav" |
|
72 |
- preload="auto" |
|
73 |
- ></audio> |
|
8 |
+ </router-link> |
|
74 | 9 |
</div> |
75 |
- </div> |
|
76 |
- <div class="next-btn" @click="goToNextPage"> |
|
77 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
78 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="goToPrevPage"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
20 |
+ <div class="flex align-center mb30"> |
|
21 |
+ <p class="subtitle2 mr20">다음을 듣고 맞는 단어를 선택하세요.</p> |
|
22 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
23 |
+ </button> --> |
|
24 |
+ </div> |
|
25 |
+ |
|
26 |
+ <div class="imgGroup"> |
|
27 |
+ <div class="flex justify-center"> |
|
28 |
+ <div class="listenGroup flex" style="gap: 60px"> |
|
29 |
+ <button |
|
30 |
+ class="popTxt" |
|
31 |
+ v-for="(item, index) in items" |
|
32 |
+ :key="index" |
|
33 |
+ @click="updateContent(index)" |
|
34 |
+ :class="{ active: selectedIndex === index }" |
|
35 |
+ > |
|
36 |
+ <img :src="item.imgSrc1" /> |
|
37 |
+ <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block" /> |
|
38 |
+ <div class="textbox"> |
|
39 |
+ <div style="height: 80%; line-height: 200px"> |
|
40 |
+ <img :src="item.imgSrc" alt="" style="width: 120px" /> |
|
41 |
+ </div> |
|
42 |
+ <p class="subtitle3" style="height: 20%">{{ item.title }}</p> |
|
43 |
+ </div> |
|
44 |
+ </button> |
|
45 |
+ </div> |
|
46 |
+ </div> |
|
47 |
+ <div class="listen-btn mt50"> |
|
48 |
+ <img src="client/resources/img/btn10_s.png" alt="Listen" @click="playAudio" /> |
|
49 |
+ </div> |
|
50 |
+ |
|
51 |
+ <audio id="audio-player" src="client/resources/audio/bank.wav" preload="auto"></audio> |
|
52 |
+ </div> |
|
53 |
+ </div> |
|
54 |
+ <div class="next-btn" @click="goToNextPage"> |
|
55 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
56 |
+ </div> |
|
57 |
+ </div> |
|
79 | 58 |
</div> |
80 |
- </div> |
|
81 | 59 |
</template> |
82 | 60 |
<script> |
83 |
-import SvgIcon from "@jamescoyle/vue-icon"; |
|
84 |
-import axios from "axios"; |
|
85 |
- |
|
61 |
+import SvgIcon from '@jamescoyle/vue-icon'; |
|
62 |
+import axios from 'axios'; |
|
63 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
86 | 64 |
export default { |
87 |
- data() { |
|
88 |
- return { |
|
89 |
- items: [], |
|
90 |
- selectedIndex: 0, |
|
65 |
+ data() { |
|
66 |
+ return { |
|
67 |
+ items: [], |
|
68 |
+ selectedIndex: 0, |
|
91 | 69 |
|
92 |
- wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
93 |
- wdBookId: "", // 현재 단어장 id |
|
94 |
- currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
95 |
- wdBookTypeIdState: "", // 이동할 페이지 타입 id |
|
96 |
- wordBookType: "", // 이동할 페이지 |
|
70 |
+ wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
71 |
+ wdBookId: '', // 현재 단어장 id |
|
72 |
+ currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
73 |
+ wdBookTypeIdState: '', // 이동할 페이지 타입 id |
|
74 |
+ wordBookType: '', // 이동할 페이지 |
|
97 | 75 |
|
98 |
- seq: this.$store.getters.seqNum, |
|
76 |
+ seq: this.$store.getters.seqNum, |
|
99 | 77 |
|
100 |
- hiddenState: false, |
|
101 |
- }; |
|
102 |
- }, |
|
103 |
- methods: { |
|
104 |
- pageSetting() { |
|
105 |
- this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
106 |
- this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
107 |
- this.wdBookId = |
|
108 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
109 |
- |
|
110 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
111 |
- this.hiddenState = true; |
|
112 |
- } |
|
113 |
- |
|
114 |
- this.fetchWordList(); |
|
78 |
+ hiddenState: false, |
|
79 |
+ }; |
|
115 | 80 |
}, |
81 |
+ methods: { |
|
82 |
+ pageSetting() { |
|
83 |
+ this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
84 |
+ this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
85 |
+ this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
116 | 86 |
|
117 |
- async fetchWordList() { |
|
118 |
- try { |
|
119 |
- const response = await axios.post("/word/getWordsByBookId.json", { |
|
120 |
- wdBookId: this.wdBookId, |
|
121 |
- }); |
|
87 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
88 |
+ this.hiddenState = true; |
|
89 |
+ } |
|
122 | 90 |
|
123 |
- const wordList = response.data; |
|
91 |
+ this.fetchWordList(); |
|
92 |
+ }, |
|
124 | 93 |
|
125 |
- // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
126 |
- const requests = wordList.map(async (word) => { |
|
127 |
- const fileResponse = await axios.post("/file/find.json", { |
|
128 |
- file_mng_id: word.fileMngId, |
|
129 |
- }); |
|
94 |
+ async fetchWordList() { |
|
95 |
+ try { |
|
96 |
+ const response = await axios.post('/word/getWordsByBookId.json', { |
|
97 |
+ wdBookId: this.wdBookId, |
|
98 |
+ }); |
|
130 | 99 |
|
131 |
- const fileRpath = |
|
132 |
- fileResponse.data.list.length > 0 |
|
133 |
- ? fileResponse.data.list[0].fileRpath |
|
134 |
- : null; |
|
135 |
- console.log("각 단어의 fileRpath: ", fileRpath); |
|
100 |
+ const wordList = response.data; |
|
136 | 101 |
|
137 |
- // items 배열에 새로운 항목 추가 |
|
138 |
- this.items.push({ |
|
139 |
- imgSrc1: "client/resources/img/img61_36s.png", |
|
140 |
- imgSrc2: "client/resources/img/img62_36s.png", |
|
141 |
- imgSrc: "http://165.229.169.113:9080/" + fileRpath, // 받아온 fileRpath로 이미지 설정 |
|
142 |
- title: word.wdNm, |
|
143 |
- }); |
|
144 |
- }); |
|
102 |
+ // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
103 |
+ const requests = wordList.map(async (word) => { |
|
104 |
+ const fileResponse = await axios.post('/file/find.json', { |
|
105 |
+ file_mng_id: word.fileMngId, |
|
106 |
+ }); |
|
145 | 107 |
|
146 |
- // 모든 요청이 완료될 때까지 대기 |
|
147 |
- await Promise.all(requests); |
|
148 |
- } catch (error) { |
|
149 |
- console.error("단어 목록을 불러오는 중 오류 발생:", error); |
|
150 |
- } |
|
108 |
+ const fileRpath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileRpath : null; |
|
109 |
+ console.log('각 단어의 fileRpath: ', fileRpath); |
|
110 |
+ |
|
111 |
+ // items 배열에 새로운 항목 추가 |
|
112 |
+ this.items.push({ |
|
113 |
+ imgSrc1: 'client/resources/img/img61_36s.png', |
|
114 |
+ imgSrc2: 'client/resources/img/img62_36s.png', |
|
115 |
+ imgSrc: 'http://165.229.169.113:9080/' + fileRpath, // 받아온 fileRpath로 이미지 설정 |
|
116 |
+ title: word.wdNm, |
|
117 |
+ }); |
|
118 |
+ }); |
|
119 |
+ |
|
120 |
+ // 모든 요청이 완료될 때까지 대기 |
|
121 |
+ await Promise.all(requests); |
|
122 |
+ } catch (error) { |
|
123 |
+ console.error('단어 목록을 불러오는 중 오류 발생:', error); |
|
124 |
+ } |
|
125 |
+ }, |
|
126 |
+ |
|
127 |
+ async goToPrevPage() { |
|
128 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
129 |
+ alert('단어장 첫번째 페이지 입니다'); |
|
130 |
+ } else { |
|
131 |
+ this.currentWdBkIndex--; |
|
132 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
133 |
+ |
|
134 |
+ try { |
|
135 |
+ const response = await axios.post('/wordbook/find.json', { |
|
136 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
137 |
+ }); |
|
138 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
139 |
+ console.log('이전 단어장 타입 id: ', this.wdBookTypeIdState); |
|
140 |
+ |
|
141 |
+ switch (this.wdBookTypeIdState) { |
|
142 |
+ case '1': |
|
143 |
+ this.wordBookType = 'Chapter2'; |
|
144 |
+ break; |
|
145 |
+ case '2': |
|
146 |
+ this.wordBookType = 'Chapter2_3'; |
|
147 |
+ break; |
|
148 |
+ case '3': |
|
149 |
+ this.wordBookType = 'Chapter2_2'; |
|
150 |
+ break; |
|
151 |
+ case '4': |
|
152 |
+ this.wordBookType = 'Chapter2_9'; |
|
153 |
+ break; |
|
154 |
+ case '5': |
|
155 |
+ this.wordBookType = 'Chapter2_4'; |
|
156 |
+ break; |
|
157 |
+ default: |
|
158 |
+ this.wordBookType = null; |
|
159 |
+ } |
|
160 |
+ |
|
161 |
+ this.goToPage(this.wordBookType); |
|
162 |
+ } catch (error) { |
|
163 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
164 |
+ } |
|
165 |
+ } |
|
166 |
+ }, |
|
167 |
+ |
|
168 |
+ async goToNextPage() { |
|
169 |
+ if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
170 |
+ alert('단어 학습 완료!'); |
|
171 |
+ this.complete(); |
|
172 |
+ } else { |
|
173 |
+ this.currentWdBkIndex++; |
|
174 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
175 |
+ |
|
176 |
+ try { |
|
177 |
+ const response = await axios.post('/wordbook/find.json', { |
|
178 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
179 |
+ }); |
|
180 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
181 |
+ console.log('다음 단어장 타입 id: ', this.wdBookTypeIdState); |
|
182 |
+ |
|
183 |
+ switch (this.wdBookTypeIdState) { |
|
184 |
+ case '1': |
|
185 |
+ this.wordBookType = 'Chapter2'; |
|
186 |
+ break; |
|
187 |
+ case '2': |
|
188 |
+ this.wordBookType = 'Chapter2_3'; |
|
189 |
+ break; |
|
190 |
+ case '3': |
|
191 |
+ this.wordBookType = 'Chapter2_2'; |
|
192 |
+ break; |
|
193 |
+ case '4': |
|
194 |
+ this.wordBookType = 'Chapter2_9'; |
|
195 |
+ break; |
|
196 |
+ case '5': |
|
197 |
+ this.wordBookType = 'Chapter2_4'; |
|
198 |
+ break; |
|
199 |
+ default: |
|
200 |
+ this.wordBookType = null; |
|
201 |
+ } |
|
202 |
+ |
|
203 |
+ this.goToPage(this.wordBookType); |
|
204 |
+ } catch (error) { |
|
205 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
206 |
+ } |
|
207 |
+ } |
|
208 |
+ }, |
|
209 |
+ |
|
210 |
+ complete() { |
|
211 |
+ const { unit_id, book_id } = this.$route.query; |
|
212 |
+ this.$router.push({ |
|
213 |
+ name: 'Dashboard', |
|
214 |
+ query: { value: this.seq, unit_id, book_id }, |
|
215 |
+ }); |
|
216 |
+ }, |
|
217 |
+ |
|
218 |
+ goToPage(page) { |
|
219 |
+ this.$router.push({ name: page }); |
|
220 |
+ }, |
|
221 |
+ updateContent(index) { |
|
222 |
+ this.selectedIndex = index; |
|
223 |
+ this.currentCon = this.items[index].con; |
|
224 |
+ setTimeout(() => { |
|
225 |
+ if (index == 1) { |
|
226 |
+ alert('정답입니다!'); |
|
227 |
+ this.goToNextPage(); |
|
228 |
+ } else { |
|
229 |
+ alert('오답입니다! 다시 한번 단어를 듣고 정답을 맞춰보세요!'); |
|
230 |
+ this.playAudio(); |
|
231 |
+ } |
|
232 |
+ }, 0); |
|
233 |
+ }, |
|
234 |
+ playAudio() { |
|
235 |
+ const audio = document.getElementById('audio-player'); |
|
236 |
+ audio.play(); |
|
237 |
+ console.log('playing'); |
|
238 |
+ }, |
|
151 | 239 |
}, |
152 |
- |
|
153 |
- async goToPrevPage() { |
|
154 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
155 |
- alert("단어장 첫번째 페이지 입니다"); |
|
156 |
- } else { |
|
157 |
- this.currentWdBkIndex--; |
|
158 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
159 |
- |
|
160 |
- try { |
|
161 |
- const response = await axios.post("/wordbook/find.json", { |
|
162 |
- wdBookId: |
|
163 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
164 |
- }); |
|
165 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
166 |
- console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState); |
|
167 |
- |
|
168 |
- switch (this.wdBookTypeIdState) { |
|
169 |
- case "1": |
|
170 |
- this.wordBookType = "Chapter2"; |
|
171 |
- break; |
|
172 |
- case "2": |
|
173 |
- this.wordBookType = "Chapter2_3"; |
|
174 |
- break; |
|
175 |
- case "3": |
|
176 |
- this.wordBookType = "Chapter2_2"; |
|
177 |
- break; |
|
178 |
- case "4": |
|
179 |
- this.wordBookType = "Chapter2_9"; |
|
180 |
- break; |
|
181 |
- case "5": |
|
182 |
- this.wordBookType = "Chapter2_4"; |
|
183 |
- break; |
|
184 |
- default: |
|
185 |
- this.wordBookType = null; |
|
186 |
- } |
|
187 |
- |
|
188 |
- this.goToPage(this.wordBookType); |
|
189 |
- } catch (error) { |
|
190 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
191 |
- } |
|
192 |
- } |
|
240 |
+ components: { |
|
241 |
+ SvgIcon, |
|
242 |
+ BookInfo: BookInfo, |
|
193 | 243 |
}, |
194 |
- |
|
195 |
- async goToNextPage() { |
|
196 |
- if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
197 |
- alert("단어 학습 완료!"); |
|
198 |
- this.complete(); |
|
199 |
- } else { |
|
200 |
- this.currentWdBkIndex++; |
|
201 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
202 |
- |
|
203 |
- try { |
|
204 |
- const response = await axios.post("/wordbook/find.json", { |
|
205 |
- wdBookId: |
|
206 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
207 |
- }); |
|
208 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
209 |
- console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState); |
|
210 |
- |
|
211 |
- switch (this.wdBookTypeIdState) { |
|
212 |
- case "1": |
|
213 |
- this.wordBookType = "Chapter2"; |
|
214 |
- break; |
|
215 |
- case "2": |
|
216 |
- this.wordBookType = "Chapter2_3"; |
|
217 |
- break; |
|
218 |
- case "3": |
|
219 |
- this.wordBookType = "Chapter2_2"; |
|
220 |
- break; |
|
221 |
- case "4": |
|
222 |
- this.wordBookType = "Chapter2_9"; |
|
223 |
- break; |
|
224 |
- case "5": |
|
225 |
- this.wordBookType = "Chapter2_4"; |
|
226 |
- break; |
|
227 |
- default: |
|
228 |
- this.wordBookType = null; |
|
229 |
- } |
|
230 |
- |
|
231 |
- this.goToPage(this.wordBookType); |
|
232 |
- } catch (error) { |
|
233 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
234 |
- } |
|
235 |
- } |
|
244 |
+ mounted() { |
|
245 |
+ this.pageSetting(); |
|
236 | 246 |
}, |
237 |
- |
|
238 |
- complete() { |
|
239 |
- const { unit_id, book_id } = this.$route.query; |
|
240 |
- this.$router.push({ |
|
241 |
- name: "Dashboard", |
|
242 |
- query: { value: this.seq, unit_id, book_id }, |
|
243 |
- }); |
|
244 |
- }, |
|
245 |
- |
|
246 |
- goToPage(page) { |
|
247 |
- this.$router.push({ name: page }); |
|
248 |
- }, |
|
249 |
- updateContent(index) { |
|
250 |
- this.selectedIndex = index; |
|
251 |
- this.currentCon = this.items[index].con; |
|
252 |
- setTimeout(() => { |
|
253 |
- if (index == 1) { |
|
254 |
- alert("정답입니다!"); |
|
255 |
- this.goToNextPage(); |
|
256 |
- } else { |
|
257 |
- alert("오답입니다! 다시 한번 단어를 듣고 정답을 맞춰보세요!"); |
|
258 |
- this.playAudio(); |
|
259 |
- } |
|
260 |
- }, 0); |
|
261 |
- }, |
|
262 |
- playAudio() { |
|
263 |
- const audio = document.getElementById("audio-player"); |
|
264 |
- audio.play(); |
|
265 |
- console.log("playing"); |
|
266 |
- }, |
|
267 |
- }, |
|
268 |
- components: { |
|
269 |
- SvgIcon, |
|
270 |
- }, |
|
271 |
- mounted() { |
|
272 |
- this.pageSetting(); |
|
273 |
- }, |
|
274 | 247 |
}; |
275 | 248 |
</script> |
276 | 249 |
|
277 | 250 |
<style scoped> |
278 | 251 |
.listenGroup { |
279 |
- height: 305px; |
|
252 |
+ height: 305px; |
|
280 | 253 |
} |
281 | 254 |
|
282 | 255 |
.listenGroup button { |
283 |
- position: relative; |
|
256 |
+ position: relative; |
|
284 | 257 |
} |
285 | 258 |
|
286 | 259 |
.listenGroup .textbox { |
287 |
- width: 184px; |
|
288 |
- height: 206px; |
|
289 |
- left: 46%; |
|
290 |
- top: 43%; |
|
260 |
+ width: 184px; |
|
261 |
+ height: 206px; |
|
262 |
+ left: 46%; |
|
263 |
+ top: 43%; |
|
291 | 264 |
} |
292 | 265 |
|
293 | 266 |
.look-text { |
294 |
- bottom: 50px; |
|
267 |
+ bottom: 50px; |
|
295 | 268 |
} |
296 | 269 |
|
297 | 270 |
.btnGroup { |
298 |
- width: 1060px; |
|
299 |
- height: 340px; |
|
271 |
+ width: 1060px; |
|
272 |
+ height: 340px; |
|
300 | 273 |
} |
301 | 274 |
|
302 | 275 |
.popTxt { |
303 |
- width: 216px; |
|
276 |
+ width: 216px; |
|
304 | 277 |
} |
305 | 278 |
|
306 | 279 |
.popTxt > img { |
307 |
- position: absolute; |
|
308 |
- top: 0; |
|
309 |
- left: 0; |
|
280 |
+ position: absolute; |
|
281 |
+ top: 0; |
|
282 |
+ left: 0; |
|
310 | 283 |
} |
311 | 284 |
|
312 | 285 |
.completeBtn { |
313 |
- margin-right: 100px; |
|
314 |
- background-color: #ffba08; |
|
315 |
- padding: 10px 30px; |
|
316 |
- border-radius: 10px; |
|
317 |
- font-size: 28px; |
|
318 |
- font-family: "ONEMobilePOPOTF"; |
|
286 |
+ margin-right: 100px; |
|
287 |
+ background-color: #ffba08; |
|
288 |
+ padding: 10px 30px; |
|
289 |
+ border-radius: 10px; |
|
290 |
+ font-size: 28px; |
|
291 |
+ font-family: 'ONEMobilePOPOTF'; |
|
319 | 292 |
} |
320 | 293 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_5.vue
+++ client/views/pages/main/Chapter/Chapter2_5.vue
... | ... | @@ -1,512 +1,492 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
35 | 13 |
</div> |
36 |
- <div class="flex align-center mb30"> |
|
37 |
- <p class="subtitle2 mr20">그림을 보고 문장을 완성시켜줘!</p> |
|
38 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ <div class="flex align-center mb30"> |
|
27 |
+ <p class="subtitle2 mr20">그림을 보고 문장을 완성시켜줘!</p> |
|
28 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
39 | 29 |
</button> --> |
40 |
- </div> |
|
30 |
+ </div> |
|
41 | 31 |
|
42 |
- <div class="text-ct"> |
|
43 |
- <!-- <p class="title1 mb40" style="color: #464749;">The sun rises in the east and sets in the west. It is very hot during summer.</p> |
|
32 |
+ <div class="text-ct"> |
|
33 |
+ <!-- <p class="title1 mb40" style="color: #464749;">The sun rises in the east and sets in the west. It is very hot during summer.</p> |
|
44 | 34 |
<img src="../../../../resources/img/img65_37s.png" alt=""> --> |
45 | 35 |
|
46 |
- <img |
|
47 |
- class="exampleImg" |
|
48 |
- :src="imgUrl" |
|
49 |
- reloadable="true" |
|
50 |
- alt="example img" |
|
51 |
- /> |
|
36 |
+ <img class="exampleImg" :src="imgUrl" reloadable="true" alt="example img" /> |
|
52 | 37 |
|
53 |
- <!-- 정답 칸 --> |
|
54 |
- <div class="dropGroup flex align-center justify-center mt30"> |
|
55 |
- <span class="mr30">{{ beforeQuestion }}</span> |
|
38 |
+ <!-- 정답 칸 --> |
|
39 |
+ <div class="dropGroup flex align-center justify-center mt30"> |
|
40 |
+ <span class="mr30">{{ beforeQuestion }}</span> |
|
56 | 41 |
|
57 |
- <!-- 드롭 가능한 영역 --> |
|
58 |
- <div class="dropContainer" id="targetContainer"> |
|
59 |
- <div |
|
60 |
- v-for="(slot, index) in answerLength" |
|
61 |
- :key="index" |
|
62 |
- class="dropSlot" |
|
63 |
- @dragover.prevent |
|
64 |
- @drop="onDrop($event, index)" |
|
65 |
- > |
|
66 |
- <div |
|
67 |
- class="dropSlot-inner" |
|
68 |
- draggable="true" |
|
69 |
- @dragstart="onDragStart($event, userAnswer[index], index)" |
|
70 |
- > |
|
71 |
- <img |
|
72 |
- src="../../../../resources/img/img64_37s.png" |
|
73 |
- alt="answer slot" |
|
74 |
- /> |
|
75 |
- <div v-if="userAnswer[index]" class="dropped-char"> |
|
76 |
- {{ userAnswer[index].toUpperCase() }} |
|
77 |
- </div> |
|
42 |
+ <!-- 드롭 가능한 영역 --> |
|
43 |
+ <div class="dropContainer" id="targetContainer"> |
|
44 |
+ <div |
|
45 |
+ v-for="(slot, index) in answerLength" |
|
46 |
+ :key="index" |
|
47 |
+ class="dropSlot" |
|
48 |
+ @dragover.prevent |
|
49 |
+ @drop="onDrop($event, index)" |
|
50 |
+ > |
|
51 |
+ <div |
|
52 |
+ class="dropSlot-inner" |
|
53 |
+ draggable="true" |
|
54 |
+ @dragstart="onDragStart($event, userAnswer[index], index)" |
|
55 |
+ > |
|
56 |
+ <img src="../../../../resources/img/img64_37s.png" alt="answer slot" /> |
|
57 |
+ <div v-if="userAnswer[index]" class="dropped-char"> |
|
58 |
+ {{ userAnswer[index].toUpperCase() }} |
|
59 |
+ </div> |
|
60 |
+ </div> |
|
61 |
+ </div> |
|
62 |
+ </div> |
|
63 |
+ |
|
64 |
+ <span class="mr30">{{ afterQuestion }}</span> |
|
65 |
+ </div> |
|
66 |
+ |
|
67 |
+ <!-- 드래그 가능한 버튼 --> |
|
68 |
+ <div class="dragGroup mt40" id="sourceContainer"> |
|
69 |
+ <button |
|
70 |
+ v-for="(char, index) in choiceCharacters" |
|
71 |
+ :key="index" |
|
72 |
+ draggable="true" |
|
73 |
+ @dragstart="onDragStart($event, char)" |
|
74 |
+ > |
|
75 |
+ <img src="../../../../resources/img/img63_37s_2.png" alt="drag letter" /> |
|
76 |
+ <p>{{ char.toUpperCase() }}</p> |
|
77 |
+ </button> |
|
78 |
+ </div> |
|
78 | 79 |
</div> |
79 |
- </div> |
|
80 | 80 |
</div> |
81 |
- |
|
82 |
- <span class="mr30">{{ afterQuestion }}</span> |
|
83 |
- </div> |
|
84 |
- |
|
85 |
- <!-- 드래그 가능한 버튼 --> |
|
86 |
- <div class="dragGroup mt40" id="sourceContainer"> |
|
87 |
- <button |
|
88 |
- v-for="(char, index) in choiceCharacters" |
|
89 |
- :key="index" |
|
90 |
- draggable="true" |
|
91 |
- @dragstart="onDragStart($event, char)" |
|
92 |
- > |
|
93 |
- <img |
|
94 |
- src="../../../../resources/img/img63_37s_2.png" |
|
95 |
- alt="drag letter" |
|
96 |
- /> |
|
97 |
- <p>{{ char.toUpperCase() }}</p> |
|
98 |
- </button> |
|
99 |
- </div> |
|
81 |
+ <div class="next-btn" @click="nextProblem()"> |
|
82 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
83 |
+ </div> |
|
100 | 84 |
</div> |
101 |
- </div> |
|
102 |
- <div class="next-btn" @click="nextProblem()"> |
|
103 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
104 |
- </div> |
|
105 | 85 |
</div> |
106 |
- </div> |
|
107 | 86 |
</template> |
108 | 87 |
|
109 | 88 |
<script> |
110 |
-import axios from "axios"; |
|
89 |
+import axios from 'axios'; |
|
90 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
111 | 91 |
export default { |
112 |
- data() { |
|
113 |
- return { |
|
114 |
- imgSrc: "client/resources/img/jumpingRabbit.gif", |
|
115 |
- example: "", |
|
116 |
- beforeQuestion: "", |
|
117 |
- afterQuestion: "", |
|
118 |
- choice: "", |
|
119 |
- answer: "", |
|
120 |
- answerLength: 0, // 초기화 시 0으로 설정 |
|
92 |
+ data() { |
|
93 |
+ return { |
|
94 |
+ imgSrc: 'client/resources/img/jumpingRabbit.gif', |
|
95 |
+ example: '', |
|
96 |
+ beforeQuestion: '', |
|
97 |
+ afterQuestion: '', |
|
98 |
+ choice: '', |
|
99 |
+ answer: '', |
|
100 |
+ answerLength: 0, // 초기화 시 0으로 설정 |
|
121 | 101 |
|
122 |
- userAnswer: [], // 초기화 시 빈 배열로 설정 |
|
123 |
- draggedChar: null, // 드래그한 문자를 임시로 저장 |
|
102 |
+ userAnswer: [], // 초기화 시 빈 배열로 설정 |
|
103 |
+ draggedChar: null, // 드래그한 문자를 임시로 저장 |
|
124 | 104 |
|
125 |
- prblm_id: [], |
|
126 |
- unit_id: null, |
|
127 |
- dataList: [], |
|
105 |
+ prblm_id: [], |
|
106 |
+ unit_id: null, |
|
107 |
+ dataList: [], |
|
128 | 108 |
|
129 |
- seq: this.$store.getters.seqNum, |
|
130 |
- hiddenState: false, |
|
109 |
+ seq: this.$store.getters.seqNum, |
|
110 |
+ hiddenState: false, |
|
131 | 111 |
|
132 |
- imgUrl: null, |
|
133 |
- }; |
|
134 |
- }, |
|
135 |
- computed: {}, |
|
136 |
- methods: { |
|
137 |
- complete() { |
|
138 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
139 |
- const savedState = localStorage.getItem("vuexState"); |
|
140 |
- if (savedState) { |
|
141 |
- const parsedState = JSON.parse(savedState); |
|
142 |
- const currentDashboard = parsedState.currentDashboard; |
|
143 |
- |
|
144 |
- const { unit_id, book_id } = this.$route.query; |
|
145 |
- if (currentDashboard === "Learning") { |
|
146 |
- // Learning 모드일 때 Dashboard로 이동 |
|
147 |
- this.$router.push({ |
|
148 |
- name: "Dashboard", |
|
149 |
- query: { value: this.seq, unit_id, book_id }, |
|
150 |
- }); |
|
151 |
- } else if (currentDashboard === "AI") { |
|
152 |
- // AI 모드일 때 AIDashboard로 이동 |
|
153 |
- this.$router.push({ |
|
154 |
- name: "AIDashboard", |
|
155 |
- query: { value: this.seq, unit_id, book_id }, |
|
156 |
- }); |
|
157 |
- } |
|
158 |
- } else { |
|
159 |
- console.error("currentDashboard 값이 없습니다."); |
|
160 |
- } |
|
112 |
+ imgUrl: null, |
|
113 |
+ }; |
|
161 | 114 |
}, |
162 |
- goToPage(page) { |
|
163 |
- this.$router.push({ name: page }); |
|
164 |
- }, |
|
165 |
- splitExample() { |
|
166 |
- const parts = this.example.split("/?/"); |
|
167 |
- if (parts.length === 2) { |
|
168 |
- this.beforeQuestion = parts[0]; |
|
169 |
- this.afterQuestion = parts[1]; |
|
170 |
- } |
|
171 |
- }, |
|
172 |
- // 드래그 시작 시 호출 |
|
173 |
- onDragStart(event, char) { |
|
174 |
- this.draggedChar = char; |
|
175 |
- }, |
|
176 |
- // 드롭 시 호출 |
|
177 |
- onDrop(event, index) { |
|
178 |
- if (this.userAnswer[index] === "") { |
|
179 |
- this.userAnswer.splice(index, 1, this.draggedChar); |
|
180 |
- const charIndex = this.choiceCharacters.indexOf(this.draggedChar); |
|
181 |
- console.log(charIndex); |
|
182 |
- if (charIndex > -1) { |
|
183 |
- this.choiceCharacters.splice(charIndex, 1); // 드래그한 문자를 choice에서 제거 |
|
184 |
- } |
|
185 |
- this.draggedChar = null; |
|
186 |
- this.checkAnswer(); // 드롭 후 정답을 확인 |
|
187 |
- } |
|
188 |
- }, |
|
189 |
- checkAnswer() { |
|
190 |
- // userAnswer 배열이 모두 채워졌는지 확인 |
|
191 |
- if (!this.userAnswer.includes("")) { |
|
192 |
- setTimeout(() => { |
|
193 |
- if (this.userAnswer.join("") === this.answer) { |
|
194 |
- alert("정답입니다!"); |
|
195 |
- this.nextProblem(); |
|
196 |
- } else { |
|
197 |
- alert("오답입니다!"); |
|
198 |
- } |
|
199 |
- }, 0); |
|
200 |
- } |
|
201 |
- }, |
|
202 |
- initializeUserAnswer() { |
|
203 |
- this.answerLength = this.answer.length; // answer의 길이를 answerLength에 설정 |
|
204 |
- this.userAnswer = Array(this.answerLength).fill(""); // answerLength만큼 빈 배열 생성 |
|
205 |
- }, |
|
206 |
- returnPage() { |
|
207 |
- window.location.reload(); |
|
208 |
- }, |
|
209 |
- // async getProblem() { |
|
210 |
- // const prblmId = this.currentLearningId.prblm_id; |
|
115 |
+ computed: {}, |
|
116 |
+ methods: { |
|
117 |
+ complete() { |
|
118 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
119 |
+ const savedState = localStorage.getItem('vuexState'); |
|
120 |
+ if (savedState) { |
|
121 |
+ const parsedState = JSON.parse(savedState); |
|
122 |
+ const currentDashboard = parsedState.currentDashboard; |
|
211 | 123 |
|
212 |
- // try { |
|
213 |
- // const res = await axios.post( |
|
214 |
- // "problem/problemInfo.json", |
|
215 |
- // { |
|
216 |
- // prblmId: prblmId, |
|
217 |
- // }, |
|
218 |
- // { |
|
219 |
- // headers: { |
|
220 |
- // "Content-Type": "application/json; charset=UTF-8", |
|
221 |
- // }, |
|
222 |
- // } |
|
223 |
- // ); |
|
224 |
- |
|
225 |
- // console.log("problem - response : ", res.data); |
|
226 |
- // this.dataList = res.data.problem; |
|
227 |
- // this.problemDetail = res.data.problemDetail[0]; |
|
228 |
- // this.example = this.dataList.prblmExpln; |
|
229 |
- // this.answer = this.problemDetail.prblmDtlExpln; |
|
230 |
- // this.choice = this.answer ? this.shuffleString(this.answer) : ""; |
|
231 |
- // this.splitExample(); |
|
232 |
- // this.initializeUserAnswer(); |
|
233 |
- // this.choiceCharacters = this.choice.split(""); |
|
234 |
- |
|
235 |
- // const fileInfo = await this.findFile(this.dataList.fileMngId); |
|
236 |
- // if (fileInfo) { |
|
237 |
- // this.imgUrl = "http://165.229.169.113:9080/" + fileInfo.fileRpath; |
|
238 |
- // console.log(this.imgUrl); |
|
239 |
- // } else { |
|
240 |
- // console.warn("No file found for the given fileMngId."); |
|
241 |
- // } |
|
242 |
- // } catch (error) { |
|
243 |
- // console.log("problem - error : ", error); |
|
244 |
- // } |
|
245 |
- // }, |
|
246 |
- |
|
247 |
- async getProblem() { |
|
248 |
- // 로컬 스토리지에서 currentDashboard를 확인 |
|
249 |
- const savedState = localStorage.getItem("vuexState"); |
|
250 |
- let prblmId = null; |
|
251 |
- |
|
252 |
- if (savedState) { |
|
253 |
- const parsedState = JSON.parse(savedState); |
|
254 |
- const currentDashboard = parsedState.currentDashboard; |
|
255 |
- |
|
256 |
- if (currentDashboard === "AI") { |
|
257 |
- // AI 모드일 경우 로컬 스토리지에서 currentLearningIds를 사용 |
|
258 |
- prblmId = parsedState.currentLearningIds; // 로컬스토리지에서 가져온 currentLearningIds 사용 |
|
259 |
- console.log("AI 모드에서 currentLearningIds 사용:", prblmId); |
|
260 |
- } else { |
|
261 |
- // Learning 모드일 경우 기존 방식 사용 |
|
262 |
- prblmId = this.currentLearningId.prblm_id; |
|
263 |
- console.log("Learning 모드에서 currentLearningId 사용:", prblmId); |
|
264 |
- } |
|
265 |
- } |
|
266 |
- |
|
267 |
- try { |
|
268 |
- const res = await axios.post( |
|
269 |
- "problem/problemInfo.json", |
|
270 |
- { |
|
271 |
- prblmId: prblmId, // AI 모드 또는 Learning 모드에 따라 결정된 prblmId 사용 |
|
272 |
- }, |
|
273 |
- { |
|
274 |
- headers: { |
|
275 |
- "Content-Type": "application/json; charset=UTF-8", |
|
124 |
+ const { unit_id, book_id } = this.$route.query; |
|
125 |
+ if (currentDashboard === 'Learning') { |
|
126 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
127 |
+ this.$router.push({ |
|
128 |
+ name: 'Dashboard', |
|
129 |
+ query: { value: this.seq, unit_id, book_id }, |
|
130 |
+ }); |
|
131 |
+ } else if (currentDashboard === 'AI') { |
|
132 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
133 |
+ this.$router.push({ |
|
134 |
+ name: 'AIDashboard', |
|
135 |
+ query: { value: this.seq, unit_id, book_id }, |
|
136 |
+ }); |
|
137 |
+ } |
|
138 |
+ } else { |
|
139 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
276 | 140 |
} |
277 |
- } |
|
278 |
- ); |
|
141 |
+ }, |
|
142 |
+ goToPage(page) { |
|
143 |
+ this.$router.push({ name: page }); |
|
144 |
+ }, |
|
145 |
+ splitExample() { |
|
146 |
+ const parts = this.example.split('/?/'); |
|
147 |
+ if (parts.length === 2) { |
|
148 |
+ this.beforeQuestion = parts[0]; |
|
149 |
+ this.afterQuestion = parts[1]; |
|
150 |
+ } |
|
151 |
+ }, |
|
152 |
+ // 드래그 시작 시 호출 |
|
153 |
+ onDragStart(event, char) { |
|
154 |
+ this.draggedChar = char; |
|
155 |
+ }, |
|
156 |
+ // 드롭 시 호출 |
|
157 |
+ onDrop(event, index) { |
|
158 |
+ if (this.userAnswer[index] === '') { |
|
159 |
+ this.userAnswer.splice(index, 1, this.draggedChar); |
|
160 |
+ const charIndex = this.choiceCharacters.indexOf(this.draggedChar); |
|
161 |
+ console.log(charIndex); |
|
162 |
+ if (charIndex > -1) { |
|
163 |
+ this.choiceCharacters.splice(charIndex, 1); // 드래그한 문자를 choice에서 제거 |
|
164 |
+ } |
|
165 |
+ this.draggedChar = null; |
|
166 |
+ this.checkAnswer(); // 드롭 후 정답을 확인 |
|
167 |
+ } |
|
168 |
+ }, |
|
169 |
+ checkAnswer() { |
|
170 |
+ // userAnswer 배열이 모두 채워졌는지 확인 |
|
171 |
+ if (!this.userAnswer.includes('')) { |
|
172 |
+ setTimeout(() => { |
|
173 |
+ if (this.userAnswer.join('') === this.answer) { |
|
174 |
+ alert('정답입니다!'); |
|
175 |
+ this.nextProblem(); |
|
176 |
+ } else { |
|
177 |
+ alert('오답입니다!'); |
|
178 |
+ } |
|
179 |
+ }, 0); |
|
180 |
+ } |
|
181 |
+ }, |
|
182 |
+ initializeUserAnswer() { |
|
183 |
+ this.answerLength = this.answer.length; // answer의 길이를 answerLength에 설정 |
|
184 |
+ this.userAnswer = Array(this.answerLength).fill(''); // answerLength만큼 빈 배열 생성 |
|
185 |
+ }, |
|
186 |
+ returnPage() { |
|
187 |
+ window.location.reload(); |
|
188 |
+ }, |
|
189 |
+ // async getProblem() { |
|
190 |
+ // const prblmId = this.currentLearningId.prblm_id; |
|
279 | 191 |
|
280 |
- console.log("problem - response : ", res.data); |
|
281 |
- this.dataList = res.data.problem; |
|
282 |
- this.problemDetail = res.data.problemDetail[0]; |
|
283 |
- this.example = this.dataList.prblmExpln; |
|
284 |
- this.answer = this.problemDetail.prblmDtlExpln; |
|
285 |
- this.choice = this.answer ? this.shuffleString(this.answer) : ""; |
|
286 |
- this.splitExample(); |
|
287 |
- this.initializeUserAnswer(); |
|
288 |
- this.choiceCharacters = this.choice.split(""); |
|
192 |
+ // try { |
|
193 |
+ // const res = await axios.post( |
|
194 |
+ // "problem/problemInfo.json", |
|
195 |
+ // { |
|
196 |
+ // prblmId: prblmId, |
|
197 |
+ // }, |
|
198 |
+ // { |
|
199 |
+ // headers: { |
|
200 |
+ // "Content-Type": "application/json; charset=UTF-8", |
|
201 |
+ // }, |
|
202 |
+ // } |
|
203 |
+ // ); |
|
289 | 204 |
|
290 |
- const fileInfo = await this.findFile(this.dataList.fileMngId); |
|
291 |
- if (fileInfo) { |
|
292 |
- this.imgUrl = "http://165.229.169.113:9080/" + fileInfo.fileRpath; |
|
293 |
- console.log(this.imgUrl); |
|
294 |
- } else { |
|
295 |
- console.warn("No file found for the given fileMngId."); |
|
205 |
+ // console.log("problem - response : ", res.data); |
|
206 |
+ // this.dataList = res.data.problem; |
|
207 |
+ // this.problemDetail = res.data.problemDetail[0]; |
|
208 |
+ // this.example = this.dataList.prblmExpln; |
|
209 |
+ // this.answer = this.problemDetail.prblmDtlExpln; |
|
210 |
+ // this.choice = this.answer ? this.shuffleString(this.answer) : ""; |
|
211 |
+ // this.splitExample(); |
|
212 |
+ // this.initializeUserAnswer(); |
|
213 |
+ // this.choiceCharacters = this.choice.split(""); |
|
214 |
+ |
|
215 |
+ // const fileInfo = await this.findFile(this.dataList.fileMngId); |
|
216 |
+ // if (fileInfo) { |
|
217 |
+ // this.imgUrl = "http://165.229.169.113:9080/" + fileInfo.fileRpath; |
|
218 |
+ // console.log(this.imgUrl); |
|
219 |
+ // } else { |
|
220 |
+ // console.warn("No file found for the given fileMngId."); |
|
221 |
+ // } |
|
222 |
+ // } catch (error) { |
|
223 |
+ // console.log("problem - error : ", error); |
|
224 |
+ // } |
|
225 |
+ // }, |
|
226 |
+ |
|
227 |
+ async getProblem() { |
|
228 |
+ // 로컬 스토리지에서 currentDashboard를 확인 |
|
229 |
+ const savedState = localStorage.getItem('vuexState'); |
|
230 |
+ let prblmId = null; |
|
231 |
+ |
|
232 |
+ if (savedState) { |
|
233 |
+ const parsedState = JSON.parse(savedState); |
|
234 |
+ const currentDashboard = parsedState.currentDashboard; |
|
235 |
+ |
|
236 |
+ if (currentDashboard === 'AI') { |
|
237 |
+ // AI 모드일 경우 로컬 스토리지에서 currentLearningIds를 사용 |
|
238 |
+ prblmId = parsedState.currentLearningIds; // 로컬스토리지에서 가져온 currentLearningIds 사용 |
|
239 |
+ console.log('AI 모드에서 currentLearningIds 사용:', prblmId); |
|
240 |
+ } else { |
|
241 |
+ // Learning 모드일 경우 기존 방식 사용 |
|
242 |
+ prblmId = this.currentLearningId.prblm_id; |
|
243 |
+ console.log('Learning 모드에서 currentLearningId 사용:', prblmId); |
|
244 |
+ } |
|
245 |
+ } |
|
246 |
+ |
|
247 |
+ try { |
|
248 |
+ const res = await axios.post( |
|
249 |
+ 'problem/problemInfo.json', |
|
250 |
+ { |
|
251 |
+ prblmId: prblmId, // AI 모드 또는 Learning 모드에 따라 결정된 prblmId 사용 |
|
252 |
+ }, |
|
253 |
+ { |
|
254 |
+ headers: { |
|
255 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
256 |
+ }, |
|
257 |
+ } |
|
258 |
+ ); |
|
259 |
+ |
|
260 |
+ console.log('problem - response : ', res.data); |
|
261 |
+ this.dataList = res.data.problem; |
|
262 |
+ this.problemDetail = res.data.problemDetail[0]; |
|
263 |
+ this.example = this.dataList.prblmExpln; |
|
264 |
+ this.answer = this.problemDetail.prblmDtlExpln; |
|
265 |
+ this.choice = this.answer ? this.shuffleString(this.answer) : ''; |
|
266 |
+ this.splitExample(); |
|
267 |
+ this.initializeUserAnswer(); |
|
268 |
+ this.choiceCharacters = this.choice.split(''); |
|
269 |
+ |
|
270 |
+ const fileInfo = await this.findFile(this.dataList.fileMngId); |
|
271 |
+ if (fileInfo) { |
|
272 |
+ this.imgUrl = 'http://165.229.169.113:9080/' + fileInfo.fileRpath; |
|
273 |
+ console.log(this.imgUrl); |
|
274 |
+ } else { |
|
275 |
+ console.warn('No file found for the given fileMngId.'); |
|
276 |
+ } |
|
277 |
+ } catch (error) { |
|
278 |
+ console.log('problem - error : ', error); |
|
279 |
+ } |
|
280 |
+ }, |
|
281 |
+ |
|
282 |
+ shuffleString(string) { |
|
283 |
+ const array = string.split(''); |
|
284 |
+ for (let i = array.length - 1; i > 0; i--) { |
|
285 |
+ const j = Math.floor(Math.random() * (i + 1)); |
|
286 |
+ [array[i], array[j]] = [array[j], array[i]]; |
|
287 |
+ } |
|
288 |
+ return array.join(''); |
|
289 |
+ }, |
|
290 |
+ async findFile(file_mng_id) { |
|
291 |
+ try { |
|
292 |
+ const res = await axios.post( |
|
293 |
+ '/file/find.json', |
|
294 |
+ { |
|
295 |
+ file_mng_id: file_mng_id, |
|
296 |
+ }, |
|
297 |
+ { |
|
298 |
+ headers: { |
|
299 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
300 |
+ }, |
|
301 |
+ } |
|
302 |
+ ); |
|
303 |
+ return res.data.list[0]; |
|
304 |
+ } catch (error) { |
|
305 |
+ console.log('result - error : ', error); |
|
306 |
+ return null; |
|
307 |
+ } |
|
308 |
+ }, |
|
309 |
+ nextProblem() { |
|
310 |
+ const problemData = { |
|
311 |
+ prblmImfo: this.currentLearningId, |
|
312 |
+ prblmNumber: this.currentProblemIndex, |
|
313 |
+ prblmAns: this.selectedButton, |
|
314 |
+ }; |
|
315 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
316 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
317 |
+ this.$store.dispatch('goToNextProblem'); |
|
318 |
+ this.handleProblemDetail(this.currentLearningId); |
|
319 |
+ this.goToPage(this.problemType); |
|
320 |
+ } else { |
|
321 |
+ // 마지막 문제면 이동 |
|
322 |
+ // this.goToPage("Chapter4"); |
|
323 |
+ alert('문제 학습 완료'); |
|
324 |
+ this.complete(); |
|
325 |
+ } |
|
326 |
+ }, |
|
327 |
+ previousProblem() { |
|
328 |
+ if (this.currentProblemIndex > 0) { |
|
329 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
330 |
+ this.handleProblemDetail(this.currentLearningId); |
|
331 |
+ this.goToPage(this.problemType); |
|
332 |
+ } |
|
333 |
+ }, |
|
334 |
+ |
|
335 |
+ handleProblemDetail(item) { |
|
336 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
337 |
+ this.problemType = 'Chapter3'; |
|
338 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
339 |
+ this.problemType = 'Chapter3_1'; |
|
340 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
341 |
+ this.problemType = 'Chapter3_2'; |
|
342 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
343 |
+ this.problemType = 'Chapter3_3'; |
|
344 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
345 |
+ this.problemType = 'Chapter3_3_1'; |
|
346 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
347 |
+ this.problemType = 'Chapter3_4'; |
|
348 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
349 |
+ this.problemType = 'Chapter3_5'; |
|
350 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
351 |
+ this.problemType = 'Chapter3_6'; |
|
352 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
353 |
+ this.problemType = 'Chapter3_7'; |
|
354 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
355 |
+ this.problemType = 'Chapter3_8'; |
|
356 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
357 |
+ this.problemType = 'Chapter3_9'; |
|
358 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
359 |
+ this.problemType = 'Chapter3_10'; |
|
360 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
361 |
+ this.problemType = 'Chapter3_11'; |
|
362 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
363 |
+ this.problemType = 'Chapter3_12'; |
|
364 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
365 |
+ this.problemType = 'Chapter3_13'; |
|
366 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
367 |
+ this.problemType = 'Chapter3_14'; |
|
368 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
369 |
+ this.problemType = 'Chapter3_15'; |
|
370 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
371 |
+ this.problemType = 'Chapter2_8'; |
|
372 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
373 |
+ this.problemType = 'Chapter2_7'; |
|
374 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
375 |
+ this.problemType = 'Chapter2_5'; |
|
376 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
377 |
+ this.problemType = 'Chapter2_6'; |
|
378 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
379 |
+ this.problemType = 'Chapter2_10'; |
|
380 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
381 |
+ this.problemType = 'Chapter2_11'; |
|
382 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
383 |
+ this.problemType = 'Chapter2_13'; |
|
384 |
+ } |
|
385 |
+ }, |
|
386 |
+ }, |
|
387 |
+ computed: { |
|
388 |
+ currentLearningId() { |
|
389 |
+ return this.$store.getters.currentLearningId; |
|
390 |
+ }, |
|
391 |
+ currentLabel() { |
|
392 |
+ return this.$store.getters.currentLabel; |
|
393 |
+ }, |
|
394 |
+ currentProblemIndex() { |
|
395 |
+ return this.$store.getters.currentProblemIndex; |
|
396 |
+ }, |
|
397 |
+ isPreviousButtonDisabled() { |
|
398 |
+ return this.currentProblemIndex === 0; |
|
399 |
+ }, |
|
400 |
+ }, |
|
401 |
+ created() { |
|
402 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
403 |
+ console.log('Current Label:', this.currentLabel); |
|
404 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
405 |
+ |
|
406 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
407 |
+ }, |
|
408 |
+ mounted() { |
|
409 |
+ this.getProblem(); |
|
410 |
+ |
|
411 |
+ if (this.currentProblemIndex == 0) { |
|
412 |
+ this.hiddenState = true; |
|
296 | 413 |
} |
297 |
- } catch (error) { |
|
298 |
- console.log("problem - error : ", error); |
|
299 |
- } |
|
300 | 414 |
}, |
301 |
- |
|
302 |
- shuffleString(string) { |
|
303 |
- const array = string.split(""); |
|
304 |
- for (let i = array.length - 1; i > 0; i--) { |
|
305 |
- const j = Math.floor(Math.random() * (i + 1)); |
|
306 |
- [array[i], array[j]] = [array[j], array[i]]; |
|
307 |
- } |
|
308 |
- return array.join(""); |
|
415 |
+ components: { |
|
416 |
+ BookInfo: BookInfo, |
|
309 | 417 |
}, |
310 |
- async findFile(file_mng_id) { |
|
311 |
- try { |
|
312 |
- const res = await axios.post( |
|
313 |
- "/file/find.json", |
|
314 |
- { |
|
315 |
- file_mng_id: file_mng_id, |
|
316 |
- }, |
|
317 |
- { |
|
318 |
- headers: { |
|
319 |
- "Content-Type": "application/json; charset=UTF-8", |
|
320 |
- }, |
|
321 |
- } |
|
322 |
- ); |
|
323 |
- return res.data.list[0]; |
|
324 |
- } catch (error) { |
|
325 |
- console.log("result - error : ", error); |
|
326 |
- return null; |
|
327 |
- } |
|
328 |
- }, |
|
329 |
- nextProblem() { |
|
330 |
- const problemData = { |
|
331 |
- prblmImfo: this.currentLearningId, |
|
332 |
- prblmNumber: this.currentProblemIndex, |
|
333 |
- prblmAns: this.selectedButton, |
|
334 |
- }; |
|
335 |
- this.$store.dispatch("saveProblemData", problemData); |
|
336 |
- if ( |
|
337 |
- this.currentProblemIndex < |
|
338 |
- this.$store.state.currentLearningIds.length - 1 |
|
339 |
- ) { |
|
340 |
- this.$store.dispatch("goToNextProblem"); |
|
341 |
- this.handleProblemDetail(this.currentLearningId); |
|
342 |
- this.goToPage(this.problemType); |
|
343 |
- } else { |
|
344 |
- // 마지막 문제면 이동 |
|
345 |
- // this.goToPage("Chapter4"); |
|
346 |
- alert("문제 학습 완료"); |
|
347 |
- this.complete(); |
|
348 |
- } |
|
349 |
- }, |
|
350 |
- previousProblem() { |
|
351 |
- if (this.currentProblemIndex > 0) { |
|
352 |
- this.$store.dispatch("goToPreviousProblem"); |
|
353 |
- this.handleProblemDetail(this.currentLearningId); |
|
354 |
- this.goToPage(this.problemType); |
|
355 |
- } |
|
356 |
- }, |
|
357 |
- |
|
358 |
- handleProblemDetail(item) { |
|
359 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
360 |
- this.problemType = "Chapter3"; |
|
361 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
362 |
- this.problemType = "Chapter3_1"; |
|
363 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
364 |
- this.problemType = "Chapter3_2"; |
|
365 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
366 |
- this.problemType = "Chapter3_3"; |
|
367 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
368 |
- this.problemType = "Chapter3_3_1"; |
|
369 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
370 |
- this.problemType = "Chapter3_4"; |
|
371 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
372 |
- this.problemType = "Chapter3_5"; |
|
373 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
374 |
- this.problemType = "Chapter3_6"; |
|
375 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
376 |
- this.problemType = "Chapter3_7"; |
|
377 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
378 |
- this.problemType = "Chapter3_8"; |
|
379 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
380 |
- this.problemType = "Chapter3_9"; |
|
381 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
382 |
- this.problemType = "Chapter3_10"; |
|
383 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
384 |
- this.problemType = "Chapter3_11"; |
|
385 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
386 |
- this.problemType = "Chapter3_12"; |
|
387 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
388 |
- this.problemType = "Chapter3_13"; |
|
389 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
390 |
- this.problemType = "Chapter3_14"; |
|
391 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
392 |
- this.problemType = "Chapter3_15"; |
|
393 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
394 |
- this.problemType = "Chapter2_8"; |
|
395 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
396 |
- this.problemType = "Chapter2_7"; |
|
397 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
398 |
- this.problemType = "Chapter2_5"; |
|
399 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
400 |
- this.problemType = "Chapter2_6"; |
|
401 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
402 |
- this.problemType = "Chapter2_10"; |
|
403 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
404 |
- this.problemType = "Chapter2_11"; |
|
405 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
406 |
- this.problemType = "Chapter2_13"; |
|
407 |
- } |
|
408 |
- }, |
|
409 |
- }, |
|
410 |
- computed: { |
|
411 |
- currentLearningId() { |
|
412 |
- return this.$store.getters.currentLearningId; |
|
413 |
- }, |
|
414 |
- currentLabel() { |
|
415 |
- return this.$store.getters.currentLabel; |
|
416 |
- }, |
|
417 |
- currentProblemIndex() { |
|
418 |
- return this.$store.getters.currentProblemIndex; |
|
419 |
- }, |
|
420 |
- isPreviousButtonDisabled() { |
|
421 |
- return this.currentProblemIndex === 0; |
|
422 |
- }, |
|
423 |
- }, |
|
424 |
- created() { |
|
425 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
426 |
- console.log("Current Label:", this.currentLabel); |
|
427 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
428 |
- |
|
429 |
- // Fetch or process the current problem based on `currentLearningId` |
|
430 |
- }, |
|
431 |
- mounted() { |
|
432 |
- this.getProblem(); |
|
433 |
- |
|
434 |
- if (this.currentProblemIndex == 0) { |
|
435 |
- this.hiddenState = true; |
|
436 |
- } |
|
437 |
- }, |
|
438 | 418 |
}; |
439 | 419 |
</script> |
440 | 420 |
<style scoped> |
441 | 421 |
.dropContainer { |
442 |
- display: flex; |
|
443 |
- flex-direction: row; |
|
444 |
- align-items: center; |
|
445 |
- justify-content: center; |
|
446 |
- gap: 10px; |
|
422 |
+ display: flex; |
|
423 |
+ flex-direction: row; |
|
424 |
+ align-items: center; |
|
425 |
+ justify-content: center; |
|
426 |
+ gap: 10px; |
|
447 | 427 |
} |
448 | 428 |
|
449 | 429 |
.dropGroup button { |
450 |
- position: relative; |
|
430 |
+ position: relative; |
|
451 | 431 |
} |
452 | 432 |
|
453 | 433 |
.dropGroup button p { |
454 |
- font-size: 48px; |
|
434 |
+ font-size: 48px; |
|
455 | 435 |
} |
456 | 436 |
|
457 | 437 |
.dragGroup button p { |
458 |
- font-size: 48px; |
|
438 |
+ font-size: 48px; |
|
459 | 439 |
} |
460 | 440 |
|
461 | 441 |
.dropGroup span { |
462 |
- margin: 0px 10px; |
|
442 |
+ margin: 0px 10px; |
|
463 | 443 |
} |
464 | 444 |
|
465 | 445 |
.dropSlot { |
466 |
- position: relative; |
|
467 |
- width: 64px; |
|
468 |
- height: 64px; |
|
446 |
+ position: relative; |
|
447 |
+ width: 64px; |
|
448 |
+ height: 64px; |
|
469 | 449 |
} |
470 | 450 |
|
471 | 451 |
.dropSlot-inner { |
472 |
- position: relative; |
|
473 |
- width: 100%; |
|
474 |
- height: 100%; |
|
452 |
+ position: relative; |
|
453 |
+ width: 100%; |
|
454 |
+ height: 100%; |
|
475 | 455 |
} |
476 | 456 |
|
477 | 457 |
.dropped-char { |
478 |
- font-family: "ONEMobilePOPOTF"; |
|
479 |
- position: absolute; |
|
480 |
- top: 55%; |
|
481 |
- left: 55%; |
|
482 |
- transform: translate(-50%, -50%); |
|
483 |
- font-size: 48px; |
|
484 |
- font-weight: bold; |
|
485 |
- color: black; |
|
486 |
- pointer-events: none; |
|
458 |
+ font-family: 'ONEMobilePOPOTF'; |
|
459 |
+ position: absolute; |
|
460 |
+ top: 55%; |
|
461 |
+ left: 55%; |
|
462 |
+ transform: translate(-50%, -50%); |
|
463 |
+ font-size: 48px; |
|
464 |
+ font-weight: bold; |
|
465 |
+ color: black; |
|
466 |
+ pointer-events: none; |
|
487 | 467 |
} |
488 | 468 |
|
489 | 469 |
.dragGroup button p { |
490 |
- font-size: 48px; |
|
470 |
+ font-size: 48px; |
|
491 | 471 |
} |
492 | 472 |
|
493 | 473 |
.exampleImg { |
494 |
- width: 15%; |
|
474 |
+ width: 15%; |
|
495 | 475 |
} |
496 | 476 |
|
497 | 477 |
#sourceContainer { |
498 |
- display: flex; |
|
499 |
- align-items: center; |
|
500 |
- justify-content: center; |
|
501 |
- gap: 20px; |
|
478 |
+ display: flex; |
|
479 |
+ align-items: center; |
|
480 |
+ justify-content: center; |
|
481 |
+ gap: 20px; |
|
502 | 482 |
} |
503 | 483 |
|
504 | 484 |
.completeBtn { |
505 |
- margin-right: 100px; |
|
506 |
- background-color: #ffba08; |
|
507 |
- padding: 10px 30px; |
|
508 |
- border-radius: 10px; |
|
509 |
- font-size: 28px; |
|
510 |
- font-family: "ONEMobilePOPOTF"; |
|
485 |
+ margin-right: 100px; |
|
486 |
+ background-color: #ffba08; |
|
487 |
+ padding: 10px 30px; |
|
488 |
+ border-radius: 10px; |
|
489 |
+ font-size: 28px; |
|
490 |
+ font-family: 'ONEMobilePOPOTF'; |
|
511 | 491 |
} |
512 | 492 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_6.vue
+++ client/views/pages/main/Chapter/Chapter2_6.vue
... | ... | @@ -1,393 +1,345 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
35 | 13 |
</div> |
36 |
- <div class="flex align-center mb30"> |
|
37 |
- <p class="subtitle2 mr20"> |
|
38 |
- 앗! 퍼즐이 망가졌어! 퍼즐을 맞춰 문장을 완성해보자! |
|
39 |
- </p> |
|
40 |
- </div> |
|
41 |
- <div class="text-ct"> |
|
42 |
- <div class="dropGroup"> |
|
43 |
- <div class="flex justify-center"> |
|
44 |
- <div |
|
45 |
- class="popTxt" |
|
46 |
- id="drop1" |
|
47 |
- @dragover.prevent |
|
48 |
- @drop="handleDrop(1)" |
|
49 |
- > |
|
50 |
- <img src="../../../../resources/img/img66_38s_1.png" alt="" /> |
|
51 |
- <button v-if="showButton1"> |
|
52 |
- <img |
|
53 |
- src="../../../../resources/img/img66_38s_1_color.png" |
|
54 |
- alt="" |
|
55 |
- /> |
|
56 |
- <p>{{ answerArr[0] }}</p> |
|
57 |
- </button> |
|
58 |
- </div> |
|
59 |
- <div |
|
60 |
- class="popTxt" |
|
61 |
- id="drop2" |
|
62 |
- @dragover.prevent |
|
63 |
- @drop="handleDrop(2)" |
|
64 |
- > |
|
65 |
- <img src="../../../../resources/img/img66_38s_2.png" alt="" /> |
|
66 |
- <button v-if="showButton2"> |
|
67 |
- <img |
|
68 |
- src="../../../../resources/img/img66_38s_2_color.png" |
|
69 |
- alt="" |
|
70 |
- /> |
|
71 |
- <p>{{ answerArr[1] }}</p> |
|
72 |
- </button> |
|
73 |
- </div> |
|
74 |
- <div |
|
75 |
- class="popTxt" |
|
76 |
- id="drop3" |
|
77 |
- @dragover.prevent |
|
78 |
- @drop="handleDrop(3)" |
|
79 |
- > |
|
80 |
- <img src="../../../../resources/img/img66_38s_3.png" alt="" /> |
|
81 |
- <button v-if="showButton3"> |
|
82 |
- <img |
|
83 |
- src="../../../../resources/img/img66_38s_3_color.png" |
|
84 |
- alt="" |
|
85 |
- /> |
|
86 |
- <p>{{ answerArr[2] }}</p> |
|
87 |
- </button> |
|
88 |
- </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
89 | 17 |
</div> |
90 |
- </div> |
|
91 |
- <div class="dragGroup"> |
|
92 |
- <article |
|
93 |
- style="right: 0; top: 36%" |
|
94 |
- @dragstart="handleDragStart(1)" |
|
95 |
- v-show="!dragHidden1" |
|
96 |
- > |
|
97 |
- <button id="drag1" draggable="true"> |
|
98 |
- <img src="../../../../resources/img/img67_38s.png" alt="" /> |
|
99 |
- <p>{{ answerArr[0] }}</p> |
|
100 |
- </button> |
|
101 |
- </article> |
|
102 |
- <article |
|
103 |
- style="left: 0; top: 36%" |
|
104 |
- @dragstart="handleDragStart(2)" |
|
105 |
- v-show="!dragHidden2" |
|
106 |
- > |
|
107 |
- <button id="drag2" draggable="true"> |
|
108 |
- <img src="../../../../resources/img/img68_38s.png" alt="" /> |
|
109 |
- <p>{{ answerArr[1] }}</p> |
|
110 |
- </button> |
|
111 |
- </article> |
|
112 |
- <article |
|
113 |
- style="left: 50%; top: 10%" |
|
114 |
- @dragstart="handleDragStart(3)" |
|
115 |
- v-show="!dragHidden3" |
|
116 |
- > |
|
117 |
- <button id="drag3" draggable="true"> |
|
118 |
- <img src="../../../../resources/img/img69_38s.png" alt="" /> |
|
119 |
- <p>{{ answerArr[2] }}</p> |
|
120 |
- </button> |
|
121 |
- </article> |
|
122 |
- </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ <div class="flex align-center mb30"> |
|
27 |
+ <p class="subtitle2 mr20">앗! 퍼즐이 망가졌어! 퍼즐을 맞춰 문장을 완성해보자!</p> |
|
28 |
+ </div> |
|
29 |
+ <div class="text-ct"> |
|
30 |
+ <div class="dropGroup"> |
|
31 |
+ <div class="flex justify-center"> |
|
32 |
+ <div class="popTxt" id="drop1" @dragover.prevent @drop="handleDrop(1)"> |
|
33 |
+ <img src="../../../../resources/img/img66_38s_1.png" alt="" /> |
|
34 |
+ <button v-if="showButton1"> |
|
35 |
+ <img src="../../../../resources/img/img66_38s_1_color.png" alt="" /> |
|
36 |
+ <p>{{ answerArr[0] }}</p> |
|
37 |
+ </button> |
|
38 |
+ </div> |
|
39 |
+ <div class="popTxt" id="drop2" @dragover.prevent @drop="handleDrop(2)"> |
|
40 |
+ <img src="../../../../resources/img/img66_38s_2.png" alt="" /> |
|
41 |
+ <button v-if="showButton2"> |
|
42 |
+ <img src="../../../../resources/img/img66_38s_2_color.png" alt="" /> |
|
43 |
+ <p>{{ answerArr[1] }}</p> |
|
44 |
+ </button> |
|
45 |
+ </div> |
|
46 |
+ <div class="popTxt" id="drop3" @dragover.prevent @drop="handleDrop(3)"> |
|
47 |
+ <img src="../../../../resources/img/img66_38s_3.png" alt="" /> |
|
48 |
+ <button v-if="showButton3"> |
|
49 |
+ <img src="../../../../resources/img/img66_38s_3_color.png" alt="" /> |
|
50 |
+ <p>{{ answerArr[2] }}</p> |
|
51 |
+ </button> |
|
52 |
+ </div> |
|
53 |
+ </div> |
|
54 |
+ </div> |
|
55 |
+ <div class="dragGroup"> |
|
56 |
+ <article style="right: 0; top: 36%" @dragstart="handleDragStart(1)" v-show="!dragHidden1"> |
|
57 |
+ <button id="drag1" draggable="true"> |
|
58 |
+ <img src="../../../../resources/img/img67_38s.png" alt="" /> |
|
59 |
+ <p>{{ answerArr[0] }}</p> |
|
60 |
+ </button> |
|
61 |
+ </article> |
|
62 |
+ <article style="left: 0; top: 36%" @dragstart="handleDragStart(2)" v-show="!dragHidden2"> |
|
63 |
+ <button id="drag2" draggable="true"> |
|
64 |
+ <img src="../../../../resources/img/img68_38s.png" alt="" /> |
|
65 |
+ <p>{{ answerArr[1] }}</p> |
|
66 |
+ </button> |
|
67 |
+ </article> |
|
68 |
+ <article style="left: 50%; top: 10%" @dragstart="handleDragStart(3)" v-show="!dragHidden3"> |
|
69 |
+ <button id="drag3" draggable="true"> |
|
70 |
+ <img src="../../../../resources/img/img69_38s.png" alt="" /> |
|
71 |
+ <p>{{ answerArr[2] }}</p> |
|
72 |
+ </button> |
|
73 |
+ </article> |
|
74 |
+ </div> |
|
75 |
+ </div> |
|
76 |
+ </div> |
|
77 |
+ <div class="next-btn" @click="nextProblem()"> |
|
78 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
79 |
+ </div> |
|
123 | 80 |
</div> |
124 |
- </div> |
|
125 |
- <div class="next-btn" @click="nextProblem()"> |
|
126 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
127 |
- </div> |
|
128 | 81 |
</div> |
129 |
- </div> |
|
130 | 82 |
</template> |
131 | 83 |
|
132 | 84 |
<script> |
133 |
-import axios from "axios"; |
|
134 |
- |
|
85 |
+import axios from 'axios'; |
|
86 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
135 | 87 |
export default { |
136 |
- data() { |
|
137 |
- return { |
|
138 |
- showButton1: false, |
|
139 |
- showButton2: false, |
|
140 |
- showButton3: false, |
|
141 |
- dragHidden1: false, |
|
142 |
- dragHidden2: false, |
|
143 |
- dragHidden3: false, |
|
144 |
- currentDrag: null, // 드래그 중인 퍼즐의 번호를 저장합니다. |
|
145 |
- prblm_id: [], |
|
146 |
- problemData: [], |
|
147 |
- answerArr: [], |
|
148 |
- correctNum: 0, |
|
88 |
+ data() { |
|
89 |
+ return { |
|
90 |
+ showButton1: false, |
|
91 |
+ showButton2: false, |
|
92 |
+ showButton3: false, |
|
93 |
+ dragHidden1: false, |
|
94 |
+ dragHidden2: false, |
|
95 |
+ dragHidden3: false, |
|
96 |
+ currentDrag: null, // 드래그 중인 퍼즐의 번호를 저장합니다. |
|
97 |
+ prblm_id: [], |
|
98 |
+ problemData: [], |
|
99 |
+ answerArr: [], |
|
100 |
+ correctNum: 0, |
|
149 | 101 |
|
150 |
- seq: this.$store.getters.seqNum, |
|
151 |
- hiddenState: false, |
|
152 |
- }; |
|
153 |
- }, |
|
154 |
- methods: { |
|
155 |
- complete() { |
|
156 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
157 |
- const savedState = localStorage.getItem("vuexState"); |
|
158 |
- if (savedState) { |
|
159 |
- const parsedState = JSON.parse(savedState); |
|
160 |
- const currentDashboard = parsedState.currentDashboard; |
|
102 |
+ seq: this.$store.getters.seqNum, |
|
103 |
+ hiddenState: false, |
|
104 |
+ }; |
|
105 |
+ }, |
|
106 |
+ methods: { |
|
107 |
+ complete() { |
|
108 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
109 |
+ const savedState = localStorage.getItem('vuexState'); |
|
110 |
+ if (savedState) { |
|
111 |
+ const parsedState = JSON.parse(savedState); |
|
112 |
+ const currentDashboard = parsedState.currentDashboard; |
|
161 | 113 |
|
162 |
- const { unit_id, book_id } = this.$route.query; |
|
163 |
- if (currentDashboard === "Learning") { |
|
164 |
- // Learning 모드일 때 Dashboard로 이동 |
|
165 |
- this.$router.push({ |
|
166 |
- name: "Dashboard", |
|
167 |
- query: { value: this.seq, unit_id, book_id }, |
|
168 |
- }); |
|
169 |
- } else if (currentDashboard === "AI") { |
|
170 |
- // AI 모드일 때 AIDashboard로 이동 |
|
171 |
- this.$router.push({ |
|
172 |
- name: "AIDashboard", |
|
173 |
- query: { value: this.seq, unit_id, book_id }, |
|
174 |
- }); |
|
114 |
+ const { unit_id, book_id } = this.$route.query; |
|
115 |
+ if (currentDashboard === 'Learning') { |
|
116 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
117 |
+ this.$router.push({ |
|
118 |
+ name: 'Dashboard', |
|
119 |
+ query: { value: this.seq, unit_id, book_id }, |
|
120 |
+ }); |
|
121 |
+ } else if (currentDashboard === 'AI') { |
|
122 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
123 |
+ this.$router.push({ |
|
124 |
+ name: 'AIDashboard', |
|
125 |
+ query: { value: this.seq, unit_id, book_id }, |
|
126 |
+ }); |
|
127 |
+ } |
|
128 |
+ } else { |
|
129 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
130 |
+ } |
|
131 |
+ }, |
|
132 |
+ goToPage(page) { |
|
133 |
+ this.$router.push({ name: page }); |
|
134 |
+ }, |
|
135 |
+ returnPage() { |
|
136 |
+ // 페이지 새로 고침 |
|
137 |
+ window.location.reload(); |
|
138 |
+ }, |
|
139 |
+ handleDragStart(dragNumber) { |
|
140 |
+ // 현재 드래그 중인 퍼즐의 번호를 저장 |
|
141 |
+ this.currentDrag = dragNumber; |
|
142 |
+ }, |
|
143 |
+ handleDrop(dropNumber) { |
|
144 |
+ // 드래그한 퍼즐의 번호와 드롭할 영역의 번호가 일치하는지 확인 |
|
145 |
+ if (this.currentDrag === dropNumber) { |
|
146 |
+ this.showButton(dropNumber); // 버튼을 보여주고 |
|
147 |
+ this.hideDragButton(dropNumber); // 드래그한 퍼즐은 숨김 |
|
148 |
+ this.correctNum++; |
|
149 |
+ } else { |
|
150 |
+ // 오답일 경우 알림 표시 |
|
151 |
+ alert('오답입니다! 다시 시도해보세요.'); |
|
152 |
+ } |
|
153 |
+ |
|
154 |
+ if (this.correctNum === 3) { |
|
155 |
+ setTimeout(() => { |
|
156 |
+ alert('정답입니다!'); |
|
157 |
+ this.nextProblem(); |
|
158 |
+ }, 100); |
|
159 |
+ } |
|
160 |
+ |
|
161 |
+ // 드래그 후 상태 초기화 |
|
162 |
+ this.currentDrag = null; |
|
163 |
+ }, |
|
164 |
+ hideDragButton(dragNumber) { |
|
165 |
+ if (dragNumber === 1) { |
|
166 |
+ this.dragHidden1 = true; |
|
167 |
+ } else if (dragNumber === 2) { |
|
168 |
+ this.dragHidden2 = true; |
|
169 |
+ } else if (dragNumber === 3) { |
|
170 |
+ this.dragHidden3 = true; |
|
171 |
+ } |
|
172 |
+ }, |
|
173 |
+ showButton(dropNumber) { |
|
174 |
+ if (dropNumber === 1) { |
|
175 |
+ this.showButton1 = true; |
|
176 |
+ } else if (dropNumber === 2) { |
|
177 |
+ this.showButton2 = true; |
|
178 |
+ } else if (dropNumber === 3) { |
|
179 |
+ this.showButton3 = true; |
|
180 |
+ } |
|
181 |
+ }, |
|
182 |
+ fetchProblemData() { |
|
183 |
+ axios({ |
|
184 |
+ url: '/problem/problemInfo.json', |
|
185 |
+ method: 'post', |
|
186 |
+ headers: { |
|
187 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
188 |
+ }, |
|
189 |
+ data: { |
|
190 |
+ prblmId: this.prblm_id.prblm_id, |
|
191 |
+ }, |
|
192 |
+ }) |
|
193 |
+ .then((response) => { |
|
194 |
+ this.problemData = response.data; |
|
195 |
+ console.log('problemData', this.problemData); |
|
196 |
+ this.sortingProblem(); |
|
197 |
+ }) |
|
198 |
+ .catch((error) => { |
|
199 |
+ this.state = 'noProblem'; |
|
200 |
+ console.error('Error fetching problemData:', error); |
|
201 |
+ }); |
|
202 |
+ }, |
|
203 |
+ sortingProblem() { |
|
204 |
+ let prblmExpln = this.problemData.problem.prblmExpln; |
|
205 |
+ let prblmArr = prblmExpln.split('/'); |
|
206 |
+ this.answerArr = prblmArr; |
|
207 |
+ |
|
208 |
+ // for (let i = prblmArr.length - 1; i > 0; i--) { |
|
209 |
+ // const j = Math.floor(Math.random() * (i + 1)); |
|
210 |
+ // [prblmArr[i], prblmArr[j]] = [prblmArr[j], prblmArr[i]]; |
|
211 |
+ // } |
|
212 |
+ |
|
213 |
+ // this.prblmArr = prblmArr; |
|
214 |
+ // console.log(prblmArr); |
|
215 |
+ }, |
|
216 |
+ nextProblem() { |
|
217 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
218 |
+ this.$store.dispatch('goToNextProblem'); |
|
219 |
+ this.handleProblemDetail(this.currentLearningId); |
|
220 |
+ this.goToPage(this.problemType); |
|
221 |
+ } else { |
|
222 |
+ // 마지막 문제면 이동 |
|
223 |
+ // this.goToPage("Chapter4"); |
|
224 |
+ alert('문제 학습 완료'); |
|
225 |
+ this.complete(); |
|
226 |
+ } |
|
227 |
+ }, |
|
228 |
+ previousProblem() { |
|
229 |
+ if (this.currentProblemIndex > 0) { |
|
230 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
231 |
+ this.handleProblemDetail(this.currentLearningId); |
|
232 |
+ this.goToPage(this.problemType); |
|
233 |
+ } |
|
234 |
+ }, |
|
235 |
+ |
|
236 |
+ handleProblemDetail(item) { |
|
237 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
238 |
+ this.problemType = 'Chapter3'; |
|
239 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
240 |
+ this.problemType = 'Chapter3_1'; |
|
241 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
242 |
+ this.problemType = 'Chapter3_2'; |
|
243 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
244 |
+ this.problemType = 'Chapter3_3'; |
|
245 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
246 |
+ this.problemType = 'Chapter3_3_1'; |
|
247 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
248 |
+ this.problemType = 'Chapter3_4'; |
|
249 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
250 |
+ this.problemType = 'Chapter3_5'; |
|
251 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
252 |
+ this.problemType = 'Chapter3_6'; |
|
253 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
254 |
+ this.problemType = 'Chapter3_7'; |
|
255 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
256 |
+ this.problemType = 'Chapter3_8'; |
|
257 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
258 |
+ this.problemType = 'Chapter3_9'; |
|
259 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
260 |
+ this.problemType = 'Chapter3_10'; |
|
261 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
262 |
+ this.problemType = 'Chapter3_11'; |
|
263 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
264 |
+ this.problemType = 'Chapter3_12'; |
|
265 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
266 |
+ this.problemType = 'Chapter3_13'; |
|
267 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
268 |
+ this.problemType = 'Chapter3_14'; |
|
269 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
270 |
+ this.problemType = 'Chapter3_15'; |
|
271 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
272 |
+ this.problemType = 'Chapter2_8'; |
|
273 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
274 |
+ this.problemType = 'Chapter2_7'; |
|
275 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
276 |
+ this.problemType = 'Chapter2_5'; |
|
277 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
278 |
+ this.problemType = 'Chapter2_6'; |
|
279 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
280 |
+ this.problemType = 'Chapter2_10'; |
|
281 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
282 |
+ this.problemType = 'Chapter2_11'; |
|
283 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
284 |
+ this.problemType = 'Chapter2_13'; |
|
285 |
+ } |
|
286 |
+ }, |
|
287 |
+ }, |
|
288 |
+ computed: { |
|
289 |
+ currentLearningId() { |
|
290 |
+ return this.$store.getters.currentLearningId; |
|
291 |
+ }, |
|
292 |
+ currentLabel() { |
|
293 |
+ return this.$store.getters.currentLabel; |
|
294 |
+ }, |
|
295 |
+ currentProblemIndex() { |
|
296 |
+ return this.$store.getters.currentProblemIndex; |
|
297 |
+ }, |
|
298 |
+ isPreviousButtonDisabled() { |
|
299 |
+ return this.currentProblemIndex === 0; |
|
300 |
+ }, |
|
301 |
+ }, |
|
302 |
+ created() { |
|
303 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
304 |
+ this.prblm_id = this.currentLearningId; |
|
305 |
+ console.log('Current Label:', this.currentLabel); |
|
306 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
307 |
+ |
|
308 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
309 |
+ }, |
|
310 |
+ mounted() { |
|
311 |
+ this.fetchProblemData(); |
|
312 |
+ if (this.currentProblemIndex == 0) { |
|
313 |
+ this.hiddenState = true; |
|
175 | 314 |
} |
176 |
- } else { |
|
177 |
- console.error("currentDashboard 값이 없습니다."); |
|
178 |
- } |
|
179 | 315 |
}, |
180 |
- goToPage(page) { |
|
181 |
- this.$router.push({ name: page }); |
|
316 |
+ components: { |
|
317 |
+ BookInfo: BookInfo, |
|
182 | 318 |
}, |
183 |
- returnPage() { |
|
184 |
- // 페이지 새로 고침 |
|
185 |
- window.location.reload(); |
|
186 |
- }, |
|
187 |
- handleDragStart(dragNumber) { |
|
188 |
- // 현재 드래그 중인 퍼즐의 번호를 저장 |
|
189 |
- this.currentDrag = dragNumber; |
|
190 |
- }, |
|
191 |
- handleDrop(dropNumber) { |
|
192 |
- // 드래그한 퍼즐의 번호와 드롭할 영역의 번호가 일치하는지 확인 |
|
193 |
- if (this.currentDrag === dropNumber) { |
|
194 |
- this.showButton(dropNumber); // 버튼을 보여주고 |
|
195 |
- this.hideDragButton(dropNumber); // 드래그한 퍼즐은 숨김 |
|
196 |
- this.correctNum++; |
|
197 |
- } else { |
|
198 |
- // 오답일 경우 알림 표시 |
|
199 |
- alert("오답입니다! 다시 시도해보세요."); |
|
200 |
- } |
|
201 |
- |
|
202 |
- if (this.correctNum === 3) { |
|
203 |
- setTimeout(() => { |
|
204 |
- alert("정답입니다!"); |
|
205 |
- this.nextProblem(); |
|
206 |
- }, 100); |
|
207 |
- } |
|
208 |
- |
|
209 |
- // 드래그 후 상태 초기화 |
|
210 |
- this.currentDrag = null; |
|
211 |
- }, |
|
212 |
- hideDragButton(dragNumber) { |
|
213 |
- if (dragNumber === 1) { |
|
214 |
- this.dragHidden1 = true; |
|
215 |
- } else if (dragNumber === 2) { |
|
216 |
- this.dragHidden2 = true; |
|
217 |
- } else if (dragNumber === 3) { |
|
218 |
- this.dragHidden3 = true; |
|
219 |
- } |
|
220 |
- }, |
|
221 |
- showButton(dropNumber) { |
|
222 |
- if (dropNumber === 1) { |
|
223 |
- this.showButton1 = true; |
|
224 |
- } else if (dropNumber === 2) { |
|
225 |
- this.showButton2 = true; |
|
226 |
- } else if (dropNumber === 3) { |
|
227 |
- this.showButton3 = true; |
|
228 |
- } |
|
229 |
- }, |
|
230 |
- fetchProblemData() { |
|
231 |
- axios({ |
|
232 |
- url: "/problem/problemInfo.json", |
|
233 |
- method: "post", |
|
234 |
- headers: { |
|
235 |
- "Content-Type": "application/json; charset=UTF-8", |
|
236 |
- }, |
|
237 |
- data: { |
|
238 |
- prblmId: this.prblm_id.prblm_id, |
|
239 |
- }, |
|
240 |
- }) |
|
241 |
- .then((response) => { |
|
242 |
- this.problemData = response.data; |
|
243 |
- console.log("problemData", this.problemData); |
|
244 |
- this.sortingProblem(); |
|
245 |
- }) |
|
246 |
- .catch((error) => { |
|
247 |
- this.state = "noProblem"; |
|
248 |
- console.error("Error fetching problemData:", error); |
|
249 |
- }); |
|
250 |
- }, |
|
251 |
- sortingProblem() { |
|
252 |
- let prblmExpln = this.problemData.problem.prblmExpln; |
|
253 |
- let prblmArr = prblmExpln.split("/"); |
|
254 |
- this.answerArr = prblmArr; |
|
255 |
- |
|
256 |
- // for (let i = prblmArr.length - 1; i > 0; i--) { |
|
257 |
- // const j = Math.floor(Math.random() * (i + 1)); |
|
258 |
- // [prblmArr[i], prblmArr[j]] = [prblmArr[j], prblmArr[i]]; |
|
259 |
- // } |
|
260 |
- |
|
261 |
- // this.prblmArr = prblmArr; |
|
262 |
- // console.log(prblmArr); |
|
263 |
- }, |
|
264 |
- nextProblem() { |
|
265 |
- if ( |
|
266 |
- this.currentProblemIndex < |
|
267 |
- this.$store.state.currentLearningIds.length - 1 |
|
268 |
- ) { |
|
269 |
- this.$store.dispatch("goToNextProblem"); |
|
270 |
- this.handleProblemDetail(this.currentLearningId); |
|
271 |
- this.goToPage(this.problemType); |
|
272 |
- } else { |
|
273 |
- // 마지막 문제면 이동 |
|
274 |
- // this.goToPage("Chapter4"); |
|
275 |
- alert("문제 학습 완료"); |
|
276 |
- this.complete(); |
|
277 |
- } |
|
278 |
- }, |
|
279 |
- previousProblem() { |
|
280 |
- if (this.currentProblemIndex > 0) { |
|
281 |
- this.$store.dispatch("goToPreviousProblem"); |
|
282 |
- this.handleProblemDetail(this.currentLearningId); |
|
283 |
- this.goToPage(this.problemType); |
|
284 |
- } |
|
285 |
- }, |
|
286 |
- |
|
287 |
- handleProblemDetail(item) { |
|
288 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
289 |
- this.problemType = "Chapter3"; |
|
290 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
291 |
- this.problemType = "Chapter3_1"; |
|
292 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
293 |
- this.problemType = "Chapter3_2"; |
|
294 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
295 |
- this.problemType = "Chapter3_3"; |
|
296 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
297 |
- this.problemType = "Chapter3_3_1"; |
|
298 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
299 |
- this.problemType = "Chapter3_4"; |
|
300 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
301 |
- this.problemType = "Chapter3_5"; |
|
302 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
303 |
- this.problemType = "Chapter3_6"; |
|
304 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
305 |
- this.problemType = "Chapter3_7"; |
|
306 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
307 |
- this.problemType = "Chapter3_8"; |
|
308 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
309 |
- this.problemType = "Chapter3_9"; |
|
310 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
311 |
- this.problemType = "Chapter3_10"; |
|
312 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
313 |
- this.problemType = "Chapter3_11"; |
|
314 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
315 |
- this.problemType = "Chapter3_12"; |
|
316 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
317 |
- this.problemType = "Chapter3_13"; |
|
318 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
319 |
- this.problemType = "Chapter3_14"; |
|
320 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
321 |
- this.problemType = "Chapter3_15"; |
|
322 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
323 |
- this.problemType = "Chapter2_8"; |
|
324 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
325 |
- this.problemType = "Chapter2_7"; |
|
326 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
327 |
- this.problemType = "Chapter2_5"; |
|
328 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
329 |
- this.problemType = "Chapter2_6"; |
|
330 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
331 |
- this.problemType = "Chapter2_10"; |
|
332 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
333 |
- this.problemType = "Chapter2_11"; |
|
334 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
335 |
- this.problemType = "Chapter2_13"; |
|
336 |
- } |
|
337 |
- }, |
|
338 |
- }, |
|
339 |
- computed: { |
|
340 |
- currentLearningId() { |
|
341 |
- return this.$store.getters.currentLearningId; |
|
342 |
- }, |
|
343 |
- currentLabel() { |
|
344 |
- return this.$store.getters.currentLabel; |
|
345 |
- }, |
|
346 |
- currentProblemIndex() { |
|
347 |
- return this.$store.getters.currentProblemIndex; |
|
348 |
- }, |
|
349 |
- isPreviousButtonDisabled() { |
|
350 |
- return this.currentProblemIndex === 0; |
|
351 |
- }, |
|
352 |
- }, |
|
353 |
- created() { |
|
354 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
355 |
- this.prblm_id = this.currentLearningId; |
|
356 |
- console.log("Current Label:", this.currentLabel); |
|
357 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
358 |
- |
|
359 |
- // Fetch or process the current problem based on `currentLearningId` |
|
360 |
- }, |
|
361 |
- mounted() { |
|
362 |
- this.fetchProblemData(); |
|
363 |
- if (this.currentProblemIndex == 0) { |
|
364 |
- this.hiddenState = true; |
|
365 |
- } |
|
366 |
- }, |
|
367 | 319 |
}; |
368 | 320 |
</script> |
369 | 321 |
|
370 | 322 |
<style scoped> |
371 | 323 |
.dropGroup button { |
372 |
- left: 0; |
|
324 |
+ left: 0; |
|
373 | 325 |
} |
374 | 326 |
|
375 | 327 |
.dragGroup button p { |
376 |
- color: #fff; |
|
377 |
- font-size: 35px; |
|
328 |
+ color: #fff; |
|
329 |
+ font-size: 35px; |
|
378 | 330 |
} |
379 | 331 |
|
380 | 332 |
.dropGroup button p { |
381 |
- font-size: 48px; |
|
382 |
- color: #fff; |
|
333 |
+ font-size: 48px; |
|
334 |
+ color: #fff; |
|
383 | 335 |
} |
384 | 336 |
|
385 | 337 |
.completeBtn { |
386 |
- margin-right: 100px; |
|
387 |
- background-color: #ffba08; |
|
388 |
- padding: 10px 30px; |
|
389 |
- border-radius: 10px; |
|
390 |
- font-size: 28px; |
|
391 |
- font-family: "ONEMobilePOPOTF"; |
|
338 |
+ margin-right: 100px; |
|
339 |
+ background-color: #ffba08; |
|
340 |
+ padding: 10px 30px; |
|
341 |
+ border-radius: 10px; |
|
342 |
+ font-size: 28px; |
|
343 |
+ font-family: 'ONEMobilePOPOTF'; |
|
392 | 344 |
} |
393 | 345 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_7.vue
+++ client/views/pages/main/Chapter/Chapter2_7.vue
... | ... | @@ -1,473 +1,453 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
35 | 13 |
</div> |
36 |
- <div class="flex align-center mb30"> |
|
37 |
- <p class="subtitle2 mr20"> |
|
38 |
- 앗! 다리가 무너져서 건널 수가 없어! 다리 조각을 옮겨줘! |
|
39 |
- </p> |
|
40 |
- </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ <div class="flex align-center mb30"> |
|
27 |
+ <p class="subtitle2 mr20">앗! 다리가 무너져서 건널 수가 없어! 다리 조각을 옮겨줘!</p> |
|
28 |
+ </div> |
|
41 | 29 |
|
42 |
- <div class="text-ct flex justify-center" style="gap: 80px"> |
|
43 |
- <div class="dropGroup flex align-center justify-center"> |
|
44 |
- <div class="flex" style="gap: 20px; position: relative"> |
|
45 |
- <img src="../../../../resources/img/img70_39s.png" alt="" /> |
|
46 |
- <div class="textbox"> |
|
47 |
- <p |
|
48 |
- v-if="problemArr.length > 0" |
|
49 |
- style="left: -180px; bottom: -200px" |
|
50 |
- > |
|
51 |
- {{ problemArr[0] }} |
|
52 |
- </p> |
|
53 |
- <p |
|
54 |
- v-if="problemArr.length > 1" |
|
55 |
- id="bridgeTarget" |
|
56 |
- style="left: -105px; bottom: -150px" |
|
57 |
- @dragover.prevent |
|
58 |
- @drop="handleDrop" |
|
59 |
- > |
|
60 |
- {{ problemArr[1] }} |
|
61 |
- </p> |
|
62 |
- <p |
|
63 |
- v-if="problemArr.length > 2" |
|
64 |
- style="left: -30px; bottom: -65px" |
|
65 |
- > |
|
66 |
- {{ problemArr[2] }} |
|
67 |
- </p> |
|
68 |
- </div> |
|
30 |
+ <div class="text-ct flex justify-center" style="gap: 80px"> |
|
31 |
+ <div class="dropGroup flex align-center justify-center"> |
|
32 |
+ <div class="flex" style="gap: 20px; position: relative"> |
|
33 |
+ <img src="../../../../resources/img/img70_39s.png" alt="" /> |
|
34 |
+ <div class="textbox"> |
|
35 |
+ <p v-if="problemArr.length > 0" style="left: -180px; bottom: -200px"> |
|
36 |
+ {{ problemArr[0] }} |
|
37 |
+ </p> |
|
38 |
+ <p |
|
39 |
+ v-if="problemArr.length > 1" |
|
40 |
+ id="bridgeTarget" |
|
41 |
+ style="left: -105px; bottom: -150px" |
|
42 |
+ @dragover.prevent |
|
43 |
+ @drop="handleDrop" |
|
44 |
+ > |
|
45 |
+ {{ problemArr[1] }} |
|
46 |
+ </p> |
|
47 |
+ <p v-if="problemArr.length > 2" style="left: -30px; bottom: -65px"> |
|
48 |
+ {{ problemArr[2] }} |
|
49 |
+ </p> |
|
50 |
+ </div> |
|
51 |
+ </div> |
|
52 |
+ </div> |
|
53 |
+ <div class="dragGroup mt40"> |
|
54 |
+ <div> |
|
55 |
+ <button |
|
56 |
+ v-if="answerArr.length > 0 && answerArr[0].prblmDtlExpln" |
|
57 |
+ :id="answerArr[0].prblmDtlExpln" |
|
58 |
+ draggable="true" |
|
59 |
+ @dragstart="handleDragStart" |
|
60 |
+ > |
|
61 |
+ <img src="../../../../resources/img/img71_39s.png" alt="" /> |
|
62 |
+ <p>{{ answerArr[0].prblmDtlExpln }}</p> |
|
63 |
+ </button> |
|
64 |
+ <button |
|
65 |
+ v-if="answerArr.length > 1 && answerArr[1].prblmDtlExpln" |
|
66 |
+ :id="answerArr[1].prblmDtlExpln" |
|
67 |
+ draggable="true" |
|
68 |
+ @dragstart="handleDragStart" |
|
69 |
+ > |
|
70 |
+ <img src="../../../../resources/img/img71_39s.png" alt="" /> |
|
71 |
+ <p>{{ answerArr[1].prblmDtlExpln }}</p> |
|
72 |
+ </button> |
|
73 |
+ <button |
|
74 |
+ v-if="answerArr.length > 2 && answerArr[2].prblmDtlExpln" |
|
75 |
+ :id="answerArr[2].prblmDtlExpln" |
|
76 |
+ draggable="true" |
|
77 |
+ @dragstart="handleDragStart" |
|
78 |
+ > |
|
79 |
+ <img src="../../../../resources/img/img71_39s.png" alt="" /> |
|
80 |
+ <p>{{ answerArr[2].prblmDtlExpln }}</p> |
|
81 |
+ </button> |
|
82 |
+ </div> |
|
83 |
+ </div> |
|
84 |
+ </div> |
|
69 | 85 |
</div> |
70 |
- </div> |
|
71 |
- <div class="dragGroup mt40"> |
|
72 |
- <div> |
|
73 |
- <button |
|
74 |
- v-if="answerArr.length > 0 && answerArr[0].prblmDtlExpln" |
|
75 |
- :id="answerArr[0].prblmDtlExpln" |
|
76 |
- draggable="true" |
|
77 |
- @dragstart="handleDragStart" |
|
78 |
- > |
|
79 |
- <img src="../../../../resources/img/img71_39s.png" alt="" /> |
|
80 |
- <p>{{ answerArr[0].prblmDtlExpln }}</p> |
|
81 |
- </button> |
|
82 |
- <button |
|
83 |
- v-if="answerArr.length > 1 && answerArr[1].prblmDtlExpln" |
|
84 |
- :id="answerArr[1].prblmDtlExpln" |
|
85 |
- draggable="true" |
|
86 |
- @dragstart="handleDragStart" |
|
87 |
- > |
|
88 |
- <img src="../../../../resources/img/img71_39s.png" alt="" /> |
|
89 |
- <p>{{ answerArr[1].prblmDtlExpln }}</p> |
|
90 |
- </button> |
|
91 |
- <button |
|
92 |
- v-if="answerArr.length > 2 && answerArr[2].prblmDtlExpln" |
|
93 |
- :id="answerArr[2].prblmDtlExpln" |
|
94 |
- draggable="true" |
|
95 |
- @dragstart="handleDragStart" |
|
96 |
- > |
|
97 |
- <img src="../../../../resources/img/img71_39s.png" alt="" /> |
|
98 |
- <p>{{ answerArr[2].prblmDtlExpln }}</p> |
|
99 |
- </button> |
|
86 |
+ <div class="next-btn" @click="nextProblem()"> |
|
87 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
100 | 88 |
</div> |
101 |
- </div> |
|
102 | 89 |
</div> |
103 |
- </div> |
|
104 |
- <div class="next-btn" @click="nextProblem()"> |
|
105 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
106 |
- </div> |
|
107 | 90 |
</div> |
108 |
- </div> |
|
109 | 91 |
</template> |
110 | 92 |
|
111 | 93 |
<script> |
112 |
-import axios from "axios"; |
|
113 |
- |
|
94 |
+import axios from 'axios'; |
|
95 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
114 | 96 |
export default { |
115 |
- data() { |
|
116 |
- return { |
|
117 |
- draggedElementId: null, // 드래그한 요소의 ID를 저장 |
|
118 |
- correctAnswer: "", // 정답 설정 |
|
119 |
- prblm_id: [], |
|
120 |
- problemData: [], |
|
121 |
- problemArr: [], |
|
122 |
- answerArr: [], |
|
123 |
- seq: this.$store.getters.seqNum, |
|
124 |
- hiddenState: false, |
|
125 |
- isAIMode: false, // AI 모드 여부를 확인할 변수 |
|
126 |
- }; |
|
127 |
- }, |
|
128 |
- methods: { |
|
129 |
- complete() { |
|
130 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
131 |
- const savedState = localStorage.getItem("vuexState"); |
|
132 |
- if (savedState) { |
|
133 |
- const parsedState = JSON.parse(savedState); |
|
134 |
- const currentDashboard = parsedState.currentDashboard; |
|
97 |
+ data() { |
|
98 |
+ return { |
|
99 |
+ draggedElementId: null, // 드래그한 요소의 ID를 저장 |
|
100 |
+ correctAnswer: '', // 정답 설정 |
|
101 |
+ prblm_id: [], |
|
102 |
+ problemData: [], |
|
103 |
+ problemArr: [], |
|
104 |
+ answerArr: [], |
|
105 |
+ seq: this.$store.getters.seqNum, |
|
106 |
+ hiddenState: false, |
|
107 |
+ isAIMode: false, // AI 모드 여부를 확인할 변수 |
|
108 |
+ }; |
|
109 |
+ }, |
|
110 |
+ methods: { |
|
111 |
+ complete() { |
|
112 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
113 |
+ const savedState = localStorage.getItem('vuexState'); |
|
114 |
+ if (savedState) { |
|
115 |
+ const parsedState = JSON.parse(savedState); |
|
116 |
+ const currentDashboard = parsedState.currentDashboard; |
|
135 | 117 |
|
136 |
- const { unit_id, book_id } = this.$route.query; |
|
137 |
- if (currentDashboard === "Learning") { |
|
138 |
- // Learning 모드일 때 Dashboard로 이동 |
|
139 |
- this.$router.push({ |
|
140 |
- name: "Dashboard", |
|
141 |
- query: { value: this.seq, unit_id, book_id }, |
|
142 |
- }); |
|
143 |
- } else if (currentDashboard === "AI") { |
|
144 |
- // AI 모드일 때 AIDashboard로 이동 |
|
145 |
- this.$router.push({ |
|
146 |
- name: "AIDashboard", |
|
147 |
- query: { value: this.seq, unit_id, book_id }, |
|
148 |
- }); |
|
118 |
+ const { unit_id, book_id } = this.$route.query; |
|
119 |
+ if (currentDashboard === 'Learning') { |
|
120 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
121 |
+ this.$router.push({ |
|
122 |
+ name: 'Dashboard', |
|
123 |
+ query: { value: this.seq, unit_id, book_id }, |
|
124 |
+ }); |
|
125 |
+ } else if (currentDashboard === 'AI') { |
|
126 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
127 |
+ this.$router.push({ |
|
128 |
+ name: 'AIDashboard', |
|
129 |
+ query: { value: this.seq, unit_id, book_id }, |
|
130 |
+ }); |
|
131 |
+ } |
|
132 |
+ } else { |
|
133 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
134 |
+ } |
|
135 |
+ }, |
|
136 |
+ goToPage(page) { |
|
137 |
+ this.$router.push({ name: page }); |
|
138 |
+ }, |
|
139 |
+ returnPage() { |
|
140 |
+ // 페이지 새로 고침 |
|
141 |
+ window.location.reload(); |
|
142 |
+ }, |
|
143 |
+ handleDragStart(event) { |
|
144 |
+ // 드래그한 요소의 ID를 저장 |
|
145 |
+ this.draggedElementId = event.target.id; |
|
146 |
+ }, |
|
147 |
+ handleDrop(event) { |
|
148 |
+ const dropZone = event.target; |
|
149 |
+ const draggedElement = document.getElementById(this.draggedElementId); |
|
150 |
+ |
|
151 |
+ if (draggedElement) { |
|
152 |
+ // 새로운 버튼을 드롭 영역에 추가 |
|
153 |
+ const cloneElement = draggedElement.cloneNode(true); |
|
154 |
+ cloneElement.style.position = 'absolute'; |
|
155 |
+ cloneElement.style.top = '-70px'; |
|
156 |
+ cloneElement.style.left = '-50px'; |
|
157 |
+ dropZone.innerHTML = ''; // 기존 ? 텍스트 제거 |
|
158 |
+ dropZone.appendChild(cloneElement); |
|
159 |
+ |
|
160 |
+ // DOM 업데이트 후 알림을 비동기적으로 처리 |
|
161 |
+ setTimeout(() => { |
|
162 |
+ if (this.draggedElementId === this.correctAnswer) { |
|
163 |
+ alert('정답입니다!'); |
|
164 |
+ this.nextProblem(); |
|
165 |
+ } else { |
|
166 |
+ alert('오답입니다!'); |
|
167 |
+ draggedElement.style.visibility = 'visible'; // 다시 보이게 하기 |
|
168 |
+ dropZone.innerHTML = '?'; // 드롭된 영역 초기화 |
|
169 |
+ } |
|
170 |
+ |
|
171 |
+ // 드래그 상태 초기화 |
|
172 |
+ this.draggedElementId = null; |
|
173 |
+ }, 0); |
|
174 |
+ } |
|
175 |
+ }, |
|
176 |
+ |
|
177 |
+ // fetchProblemData() { |
|
178 |
+ // axios({ |
|
179 |
+ // url: "/problem/problemInfo.json", |
|
180 |
+ // method: "post", |
|
181 |
+ // headers: { |
|
182 |
+ // "Content-Type": "application/json; charset=UTF-8", |
|
183 |
+ // }, |
|
184 |
+ // data: { |
|
185 |
+ // prblmId: this.prblm_id.prblm_id, |
|
186 |
+ // }, |
|
187 |
+ // }) |
|
188 |
+ // .then((response) => { |
|
189 |
+ // this.problemData = response.data; |
|
190 |
+ // console.log("problemData", this.problemData); |
|
191 |
+ // this.sortingProblem(); |
|
192 |
+ // }) |
|
193 |
+ // .catch((error) => { |
|
194 |
+ // this.state = "noProblem"; |
|
195 |
+ // console.error("Error fetching problemData:", error); |
|
196 |
+ // }); |
|
197 |
+ // }, |
|
198 |
+ |
|
199 |
+ fetchProblemData() { |
|
200 |
+ // 로컬 스토리지에서 currentDashboard를 확인 |
|
201 |
+ const savedState = localStorage.getItem('vuexState'); |
|
202 |
+ if (savedState) { |
|
203 |
+ const parsedState = JSON.parse(savedState); |
|
204 |
+ const currentDashboard = parsedState.currentDashboard; |
|
205 |
+ |
|
206 |
+ if (currentDashboard === 'AI') { |
|
207 |
+ // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
208 |
+ const currentLearningId = parsedState.currentLearningIds; |
|
209 |
+ console.log('AI 모드에서 currentLearningId 사용:', currentLearningId); |
|
210 |
+ |
|
211 |
+ // currentLearningId로 문제 데이터 가져오기 |
|
212 |
+ axios({ |
|
213 |
+ url: '/problem/problemInfo.json', |
|
214 |
+ method: 'post', |
|
215 |
+ headers: { |
|
216 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
217 |
+ }, |
|
218 |
+ data: { |
|
219 |
+ prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
220 |
+ }, |
|
221 |
+ }) |
|
222 |
+ .then((response) => { |
|
223 |
+ this.problemData = response.data; |
|
224 |
+ console.log('AI 모드 problemData', this.problemData); |
|
225 |
+ this.sortingProblem(); |
|
226 |
+ }) |
|
227 |
+ .catch((error) => { |
|
228 |
+ this.state = 'noProblem'; |
|
229 |
+ console.error('Error fetching AI problemData:', error); |
|
230 |
+ }); |
|
231 |
+ } else { |
|
232 |
+ // Learning 모드일 경우 기존 로직 사용 |
|
233 |
+ console.log('Learning 모드에서 prblm_id 사용:', this.prblm_id); |
|
234 |
+ |
|
235 |
+ axios({ |
|
236 |
+ url: '/problem/problemInfo.json', |
|
237 |
+ method: 'post', |
|
238 |
+ headers: { |
|
239 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
240 |
+ }, |
|
241 |
+ data: { |
|
242 |
+ prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
243 |
+ }, |
|
244 |
+ }) |
|
245 |
+ .then((response) => { |
|
246 |
+ this.problemData = response.data; |
|
247 |
+ console.log('Learning 모드 problemData', this.problemData); |
|
248 |
+ this.sortingProblem(); |
|
249 |
+ }) |
|
250 |
+ .catch((error) => { |
|
251 |
+ this.state = 'noProblem'; |
|
252 |
+ console.error('Error fetching problemData:', error); |
|
253 |
+ }); |
|
254 |
+ } |
|
255 |
+ } else { |
|
256 |
+ console.error('vuexState가 로컬스토리지에 없습니다.'); |
|
257 |
+ } |
|
258 |
+ }, |
|
259 |
+ |
|
260 |
+ sortingProblem() { |
|
261 |
+ let prblmExpln = this.problemData.problem.prblmExpln; |
|
262 |
+ let prblmArr = prblmExpln.split('/'); |
|
263 |
+ this.problemArr = prblmArr; |
|
264 |
+ |
|
265 |
+ for (let i = 0; i < this.problemData.problemDetail.length; i++) { |
|
266 |
+ // this.answerArr[i].prblmDtlExpln = |
|
267 |
+ // this.problemData.problemDetail[i].prblmDtlExpln; |
|
268 |
+ // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn; |
|
269 |
+ this.answerArr[i] = this.problemData.problemDetail[i]; |
|
270 |
+ } |
|
271 |
+ console.log('answerArr', this.answerArr); |
|
272 |
+ |
|
273 |
+ for (let i = 0; i < this.answerArr.length; i++) { |
|
274 |
+ if (this.answerArr[i].prblmYn == 'Y') { |
|
275 |
+ this.correctAnswer = this.answerArr[i].prblmDtlExpln; |
|
276 |
+ break; |
|
277 |
+ } |
|
278 |
+ } |
|
279 |
+ |
|
280 |
+ // for (let i = prblmArr.length - 1; i > 0; i--) { |
|
281 |
+ // const j = Math.floor(Math.random() * (i + 1)); |
|
282 |
+ // [prblmArr[i], prblmArr[j]] = [prblmArr[j], prblmArr[i]]; |
|
283 |
+ // } |
|
284 |
+ |
|
285 |
+ // this.prblmArr = prblmArr; |
|
286 |
+ // console.log(prblmArr); |
|
287 |
+ }, |
|
288 |
+ |
|
289 |
+ nextProblem() { |
|
290 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
291 |
+ this.$store.dispatch('goToNextProblem'); |
|
292 |
+ this.handleProblemDetail(this.currentLearningId); |
|
293 |
+ this.goToPage(this.problemType); |
|
294 |
+ } else { |
|
295 |
+ // 마지막 문제면 이동 |
|
296 |
+ // this.goToPage("Chapter4"); |
|
297 |
+ alert('문제 학습 완료'); |
|
298 |
+ this.complete(); |
|
299 |
+ } |
|
300 |
+ }, |
|
301 |
+ previousProblem() { |
|
302 |
+ if (this.currentProblemIndex > 0) { |
|
303 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
304 |
+ this.handleProblemDetail(this.currentLearningId); |
|
305 |
+ this.goToPage(this.problemType); |
|
306 |
+ } |
|
307 |
+ }, |
|
308 |
+ |
|
309 |
+ hideNavigationButtons() { |
|
310 |
+ // pre-btn과 next-btn을 숨김 |
|
311 |
+ const preBtn = document.querySelector('.pre-btn'); |
|
312 |
+ const nextBtn = document.querySelector('.next-btn'); |
|
313 |
+ if (preBtn) preBtn.style.display = 'none'; |
|
314 |
+ if (nextBtn) nextBtn.style.display = 'none'; |
|
315 |
+ }, |
|
316 |
+ |
|
317 |
+ handleProblemDetail(item) { |
|
318 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
319 |
+ this.problemType = 'Chapter3'; |
|
320 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
321 |
+ this.problemType = 'Chapter3_1'; |
|
322 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
323 |
+ this.problemType = 'Chapter3_2'; |
|
324 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
325 |
+ this.problemType = 'Chapter3_3'; |
|
326 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
327 |
+ this.problemType = 'Chapter3_3_1'; |
|
328 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
329 |
+ this.problemType = 'Chapter3_4'; |
|
330 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
331 |
+ this.problemType = 'Chapter3_5'; |
|
332 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
333 |
+ this.problemType = 'Chapter3_6'; |
|
334 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
335 |
+ this.problemType = 'Chapter3_7'; |
|
336 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
337 |
+ this.problemType = 'Chapter3_8'; |
|
338 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
339 |
+ this.problemType = 'Chapter3_9'; |
|
340 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
341 |
+ this.problemType = 'Chapter3_10'; |
|
342 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
343 |
+ this.problemType = 'Chapter3_11'; |
|
344 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
345 |
+ this.problemType = 'Chapter3_12'; |
|
346 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
347 |
+ this.problemType = 'Chapter3_13'; |
|
348 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
349 |
+ this.problemType = 'Chapter3_14'; |
|
350 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
351 |
+ this.problemType = 'Chapter3_15'; |
|
352 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
353 |
+ this.problemType = 'Chapter2_8'; |
|
354 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
355 |
+ this.problemType = 'Chapter2_7'; |
|
356 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
357 |
+ this.problemType = 'Chapter2_5'; |
|
358 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
359 |
+ this.problemType = 'Chapter2_6'; |
|
360 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
361 |
+ this.problemType = 'Chapter2_10'; |
|
362 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
363 |
+ this.problemType = 'Chapter2_11'; |
|
364 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
365 |
+ this.problemType = 'Chapter2_13'; |
|
366 |
+ } |
|
367 |
+ }, |
|
368 |
+ }, |
|
369 |
+ computed: { |
|
370 |
+ currentLearningId() { |
|
371 |
+ return this.$store.getters.currentLearningId; |
|
372 |
+ }, |
|
373 |
+ currentLabel() { |
|
374 |
+ return this.$store.getters.currentLabel; |
|
375 |
+ }, |
|
376 |
+ currentProblemIndex() { |
|
377 |
+ return this.$store.getters.currentProblemIndex; |
|
378 |
+ }, |
|
379 |
+ isPreviousButtonDisabled() { |
|
380 |
+ return this.currentProblemIndex === 0; |
|
381 |
+ }, |
|
382 |
+ }, |
|
383 |
+ created() { |
|
384 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
385 |
+ this.prblm_id = this.currentLearningId; |
|
386 |
+ console.log('Current Label:', this.currentLabel); |
|
387 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
388 |
+ |
|
389 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
390 |
+ }, |
|
391 |
+ mounted() { |
|
392 |
+ this.fetchProblemData(); |
|
393 |
+ |
|
394 |
+ // 로컬 스토리지에서 currentDashboard 값을 확인 |
|
395 |
+ const savedState = localStorage.getItem('vuexState'); |
|
396 |
+ if (savedState) { |
|
397 |
+ const parsedState = JSON.parse(savedState); |
|
398 |
+ const currentDashboard = parsedState.currentDashboard; |
|
399 |
+ |
|
400 |
+ // AI 모드일 경우 pre-btn과 next-btn 숨기기 |
|
401 |
+ if (currentDashboard === 'AI') { |
|
402 |
+ this.isAIMode = true; |
|
403 |
+ this.hideNavigationButtons(); |
|
404 |
+ } |
|
149 | 405 |
} |
150 |
- } else { |
|
151 |
- console.error("currentDashboard 값이 없습니다."); |
|
152 |
- } |
|
153 |
- }, |
|
154 |
- goToPage(page) { |
|
155 |
- this.$router.push({ name: page }); |
|
156 |
- }, |
|
157 |
- returnPage() { |
|
158 |
- // 페이지 새로 고침 |
|
159 |
- window.location.reload(); |
|
160 |
- }, |
|
161 |
- handleDragStart(event) { |
|
162 |
- // 드래그한 요소의 ID를 저장 |
|
163 |
- this.draggedElementId = event.target.id; |
|
164 |
- }, |
|
165 |
- handleDrop(event) { |
|
166 |
- const dropZone = event.target; |
|
167 |
- const draggedElement = document.getElementById(this.draggedElementId); |
|
168 | 406 |
|
169 |
- if (draggedElement) { |
|
170 |
- // 새로운 버튼을 드롭 영역에 추가 |
|
171 |
- const cloneElement = draggedElement.cloneNode(true); |
|
172 |
- cloneElement.style.position = "absolute"; |
|
173 |
- cloneElement.style.top = "-70px"; |
|
174 |
- cloneElement.style.left = "-50px"; |
|
175 |
- dropZone.innerHTML = ""; // 기존 ? 텍스트 제거 |
|
176 |
- dropZone.appendChild(cloneElement); |
|
177 |
- |
|
178 |
- // DOM 업데이트 후 알림을 비동기적으로 처리 |
|
179 |
- setTimeout(() => { |
|
180 |
- if (this.draggedElementId === this.correctAnswer) { |
|
181 |
- alert("정답입니다!"); |
|
182 |
- this.nextProblem(); |
|
183 |
- } else { |
|
184 |
- alert("오답입니다!"); |
|
185 |
- draggedElement.style.visibility = "visible"; // 다시 보이게 하기 |
|
186 |
- dropZone.innerHTML = "?"; // 드롭된 영역 초기화 |
|
187 |
- } |
|
188 |
- |
|
189 |
- // 드래그 상태 초기화 |
|
190 |
- this.draggedElementId = null; |
|
191 |
- }, 0); |
|
192 |
- } |
|
193 |
- }, |
|
194 |
- |
|
195 |
- // fetchProblemData() { |
|
196 |
- // axios({ |
|
197 |
- // url: "/problem/problemInfo.json", |
|
198 |
- // method: "post", |
|
199 |
- // headers: { |
|
200 |
- // "Content-Type": "application/json; charset=UTF-8", |
|
201 |
- // }, |
|
202 |
- // data: { |
|
203 |
- // prblmId: this.prblm_id.prblm_id, |
|
204 |
- // }, |
|
205 |
- // }) |
|
206 |
- // .then((response) => { |
|
207 |
- // this.problemData = response.data; |
|
208 |
- // console.log("problemData", this.problemData); |
|
209 |
- // this.sortingProblem(); |
|
210 |
- // }) |
|
211 |
- // .catch((error) => { |
|
212 |
- // this.state = "noProblem"; |
|
213 |
- // console.error("Error fetching problemData:", error); |
|
214 |
- // }); |
|
215 |
- // }, |
|
216 |
- |
|
217 |
- fetchProblemData() { |
|
218 |
- // 로컬 스토리지에서 currentDashboard를 확인 |
|
219 |
- const savedState = localStorage.getItem("vuexState"); |
|
220 |
- if (savedState) { |
|
221 |
- const parsedState = JSON.parse(savedState); |
|
222 |
- const currentDashboard = parsedState.currentDashboard; |
|
223 |
- |
|
224 |
- if (currentDashboard === "AI") { |
|
225 |
- // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
226 |
- const currentLearningId = parsedState.currentLearningIds; |
|
227 |
- console.log("AI 모드에서 currentLearningId 사용:", currentLearningId); |
|
228 |
- |
|
229 |
- // currentLearningId로 문제 데이터 가져오기 |
|
230 |
- axios({ |
|
231 |
- url: "/problem/problemInfo.json", |
|
232 |
- method: "post", |
|
233 |
- headers: { |
|
234 |
- "Content-Type": "application/json; charset=UTF-8", |
|
235 |
- }, |
|
236 |
- data: { |
|
237 |
- prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
238 |
- }, |
|
239 |
- }) |
|
240 |
- .then((response) => { |
|
241 |
- this.problemData = response.data; |
|
242 |
- console.log("AI 모드 problemData", this.problemData); |
|
243 |
- this.sortingProblem(); |
|
244 |
- }) |
|
245 |
- .catch((error) => { |
|
246 |
- this.state = "noProblem"; |
|
247 |
- console.error("Error fetching AI problemData:", error); |
|
248 |
- }); |
|
249 |
- |
|
250 |
- } else { |
|
251 |
- // Learning 모드일 경우 기존 로직 사용 |
|
252 |
- console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id); |
|
253 |
- |
|
254 |
- axios({ |
|
255 |
- url: "/problem/problemInfo.json", |
|
256 |
- method: "post", |
|
257 |
- headers: { |
|
258 |
- "Content-Type": "application/json; charset=UTF-8", |
|
259 |
- }, |
|
260 |
- data: { |
|
261 |
- prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
262 |
- }, |
|
263 |
- }) |
|
264 |
- .then((response) => { |
|
265 |
- this.problemData = response.data; |
|
266 |
- console.log("Learning 모드 problemData", this.problemData); |
|
267 |
- this.sortingProblem(); |
|
268 |
- }) |
|
269 |
- .catch((error) => { |
|
270 |
- this.state = "noProblem"; |
|
271 |
- console.error("Error fetching problemData:", error); |
|
272 |
- }); |
|
407 |
+ if (this.currentProblemIndex == 0) { |
|
408 |
+ this.hiddenState = true; |
|
273 | 409 |
} |
274 |
- } else { |
|
275 |
- console.error("vuexState가 로컬스토리지에 없습니다."); |
|
276 |
- } |
|
277 | 410 |
}, |
278 |
- |
|
279 |
- sortingProblem() { |
|
280 |
- let prblmExpln = this.problemData.problem.prblmExpln; |
|
281 |
- let prblmArr = prblmExpln.split("/"); |
|
282 |
- this.problemArr = prblmArr; |
|
283 |
- |
|
284 |
- for (let i = 0; i < this.problemData.problemDetail.length; i++) { |
|
285 |
- // this.answerArr[i].prblmDtlExpln = |
|
286 |
- // this.problemData.problemDetail[i].prblmDtlExpln; |
|
287 |
- // this.answerArr[i].prblmYn = this.problemData.problemDetail[i].prblmYn; |
|
288 |
- this.answerArr[i] = this.problemData.problemDetail[i]; |
|
289 |
- } |
|
290 |
- console.log("answerArr", this.answerArr); |
|
291 |
- |
|
292 |
- for (let i = 0; i < this.answerArr.length; i++) { |
|
293 |
- if (this.answerArr[i].prblmYn == "Y") { |
|
294 |
- this.correctAnswer = this.answerArr[i].prblmDtlExpln; |
|
295 |
- break; |
|
296 |
- } |
|
297 |
- } |
|
298 |
- |
|
299 |
- // for (let i = prblmArr.length - 1; i > 0; i--) { |
|
300 |
- // const j = Math.floor(Math.random() * (i + 1)); |
|
301 |
- // [prblmArr[i], prblmArr[j]] = [prblmArr[j], prblmArr[i]]; |
|
302 |
- // } |
|
303 |
- |
|
304 |
- // this.prblmArr = prblmArr; |
|
305 |
- // console.log(prblmArr); |
|
411 |
+ components: { |
|
412 |
+ BookInfo: BookInfo, |
|
306 | 413 |
}, |
307 |
- |
|
308 |
- nextProblem() { |
|
309 |
- if ( |
|
310 |
- this.currentProblemIndex < |
|
311 |
- this.$store.state.currentLearningIds.length - 1 |
|
312 |
- ) { |
|
313 |
- this.$store.dispatch("goToNextProblem"); |
|
314 |
- this.handleProblemDetail(this.currentLearningId); |
|
315 |
- this.goToPage(this.problemType); |
|
316 |
- } else { |
|
317 |
- // 마지막 문제면 이동 |
|
318 |
- // this.goToPage("Chapter4"); |
|
319 |
- alert("문제 학습 완료"); |
|
320 |
- this.complete(); |
|
321 |
- } |
|
322 |
- }, |
|
323 |
- previousProblem() { |
|
324 |
- if (this.currentProblemIndex > 0) { |
|
325 |
- this.$store.dispatch("goToPreviousProblem"); |
|
326 |
- this.handleProblemDetail(this.currentLearningId); |
|
327 |
- this.goToPage(this.problemType); |
|
328 |
- } |
|
329 |
- }, |
|
330 |
- |
|
331 |
- hideNavigationButtons() { |
|
332 |
- // pre-btn과 next-btn을 숨김 |
|
333 |
- const preBtn = document.querySelector('.pre-btn'); |
|
334 |
- const nextBtn = document.querySelector('.next-btn'); |
|
335 |
- if (preBtn) preBtn.style.display = 'none'; |
|
336 |
- if (nextBtn) nextBtn.style.display = 'none'; |
|
337 |
- }, |
|
338 |
- |
|
339 |
- handleProblemDetail(item) { |
|
340 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
341 |
- this.problemType = "Chapter3"; |
|
342 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
343 |
- this.problemType = "Chapter3_1"; |
|
344 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
345 |
- this.problemType = "Chapter3_2"; |
|
346 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
347 |
- this.problemType = "Chapter3_3"; |
|
348 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
349 |
- this.problemType = "Chapter3_3_1"; |
|
350 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
351 |
- this.problemType = "Chapter3_4"; |
|
352 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
353 |
- this.problemType = "Chapter3_5"; |
|
354 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
355 |
- this.problemType = "Chapter3_6"; |
|
356 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
357 |
- this.problemType = "Chapter3_7"; |
|
358 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
359 |
- this.problemType = "Chapter3_8"; |
|
360 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
361 |
- this.problemType = "Chapter3_9"; |
|
362 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
363 |
- this.problemType = "Chapter3_10"; |
|
364 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
365 |
- this.problemType = "Chapter3_11"; |
|
366 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
367 |
- this.problemType = "Chapter3_12"; |
|
368 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
369 |
- this.problemType = "Chapter3_13"; |
|
370 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
371 |
- this.problemType = "Chapter3_14"; |
|
372 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
373 |
- this.problemType = "Chapter3_15"; |
|
374 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
375 |
- this.problemType = "Chapter2_8"; |
|
376 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
377 |
- this.problemType = "Chapter2_7"; |
|
378 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
379 |
- this.problemType = "Chapter2_5"; |
|
380 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
381 |
- this.problemType = "Chapter2_6"; |
|
382 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
383 |
- this.problemType = "Chapter2_10"; |
|
384 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
385 |
- this.problemType = "Chapter2_11"; |
|
386 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
387 |
- this.problemType = "Chapter2_13"; |
|
388 |
- } |
|
389 |
- }, |
|
390 |
- |
|
391 |
- }, |
|
392 |
- computed: { |
|
393 |
- currentLearningId() { |
|
394 |
- return this.$store.getters.currentLearningId; |
|
395 |
- }, |
|
396 |
- currentLabel() { |
|
397 |
- return this.$store.getters.currentLabel; |
|
398 |
- }, |
|
399 |
- currentProblemIndex() { |
|
400 |
- return this.$store.getters.currentProblemIndex; |
|
401 |
- }, |
|
402 |
- isPreviousButtonDisabled() { |
|
403 |
- return this.currentProblemIndex === 0; |
|
404 |
- }, |
|
405 |
- }, |
|
406 |
- created() { |
|
407 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
408 |
- this.prblm_id = this.currentLearningId; |
|
409 |
- console.log("Current Label:", this.currentLabel); |
|
410 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
411 |
- |
|
412 |
- // Fetch or process the current problem based on `currentLearningId` |
|
413 |
- }, |
|
414 |
- mounted() { |
|
415 |
- this.fetchProblemData(); |
|
416 |
- |
|
417 |
- // 로컬 스토리지에서 currentDashboard 값을 확인 |
|
418 |
- const savedState = localStorage.getItem("vuexState"); |
|
419 |
- if (savedState) { |
|
420 |
- const parsedState = JSON.parse(savedState); |
|
421 |
- const currentDashboard = parsedState.currentDashboard; |
|
422 |
- |
|
423 |
- // AI 모드일 경우 pre-btn과 next-btn 숨기기 |
|
424 |
- if (currentDashboard === "AI") { |
|
425 |
- this.isAIMode = true; |
|
426 |
- this.hideNavigationButtons(); |
|
427 |
- } |
|
428 |
- } |
|
429 |
- |
|
430 |
- if (this.currentProblemIndex == 0) { |
|
431 |
- this.hiddenState = true; |
|
432 |
- } |
|
433 |
- }, |
|
434 | 414 |
}; |
435 | 415 |
</script> |
436 | 416 |
|
437 | 417 |
<style scoped> |
438 | 418 |
.textbox p { |
439 |
- position: absolute; |
|
419 |
+ position: absolute; |
|
440 | 420 |
} |
441 | 421 |
|
442 | 422 |
.dragGroup button { |
443 |
- display: block; |
|
423 |
+ display: block; |
|
444 | 424 |
} |
445 | 425 |
|
446 | 426 |
.dragGroup button p, |
447 | 427 |
.textbox p { |
448 |
- width: fit-content; |
|
449 |
- height: fit-content; |
|
450 |
- background: #ffffffb8; |
|
451 |
- border-radius: 5px; |
|
452 |
- padding: 10px; |
|
453 |
- font-size: 30px; |
|
454 |
- font-family: "ONEMobilePOP"; |
|
428 |
+ width: fit-content; |
|
429 |
+ height: fit-content; |
|
430 |
+ background: #ffffffb8; |
|
431 |
+ border-radius: 5px; |
|
432 |
+ padding: 10px; |
|
433 |
+ font-size: 30px; |
|
434 |
+ font-family: 'ONEMobilePOP'; |
|
455 | 435 |
} |
456 | 436 |
|
457 | 437 |
.dragGroup button { |
458 |
- cursor: grab; |
|
438 |
+ cursor: grab; |
|
459 | 439 |
} |
460 | 440 |
|
461 |
-.dragGroup button[draggable="true"]:active { |
|
462 |
- cursor: grabbing; |
|
441 |
+.dragGroup button[draggable='true']:active { |
|
442 |
+ cursor: grabbing; |
|
463 | 443 |
} |
464 | 444 |
|
465 | 445 |
.completeBtn { |
466 |
- margin-right: 100px; |
|
467 |
- background-color: #ffba08; |
|
468 |
- padding: 10px 30px; |
|
469 |
- border-radius: 10px; |
|
470 |
- font-size: 28px; |
|
471 |
- font-family: "ONEMobilePOPOTF"; |
|
446 |
+ margin-right: 100px; |
|
447 |
+ background-color: #ffba08; |
|
448 |
+ padding: 10px 30px; |
|
449 |
+ border-radius: 10px; |
|
450 |
+ font-size: 28px; |
|
451 |
+ font-family: 'ONEMobilePOPOTF'; |
|
472 | 452 |
} |
473 | 453 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_8.vue
+++ client/views/pages/main/Chapter/Chapter2_8.vue
... | ... | @@ -1,467 +1,424 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="previousProblem()" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
31 |
- <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
32 |
- <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
33 |
- <p>되돌리기</p> |
|
34 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
35 | 13 |
</div> |
36 |
- <div class="flex align-center mb30"> |
|
37 |
- <p class="subtitle2 mr20"> |
|
38 |
- 앗! 퍼즐이 망가졌어! 퍼즐을 맞춰 문장을 완성해보자! |
|
39 |
- </p> |
|
40 |
- </div> |
|
41 |
- |
|
42 |
- <div class="text-ct"> |
|
43 |
- <div class="dropGroup flex align-center justify-center mt30"> |
|
44 |
- <div style="position: relative"> |
|
45 |
- <img src="../../../../resources/img/img28_s.png" alt="" /> |
|
46 |
- <button |
|
47 |
- class="dropzone" |
|
48 |
- :data-answer="answerArr[0]" |
|
49 |
- style="left: 30px; top: 167px" |
|
50 |
- > |
|
51 |
- <img src="../../../../resources/img/img29_s_01.png" alt="" /> |
|
52 |
- <p style="font-size: 35px">?</p> |
|
53 |
- </button> |
|
54 |
- <button |
|
55 |
- class="dropzone" |
|
56 |
- :data-answer="answerArr[1]" |
|
57 |
- style="right: 409px; top: 133px" |
|
58 |
- > |
|
59 |
- <img src="../../../../resources/img/img30_s_01.png" alt="" /> |
|
60 |
- <p style="font-size: 35px">?</p> |
|
61 |
- </button> |
|
62 |
- <button |
|
63 |
- class="dropzone" |
|
64 |
- :data-answer="answerArr[2]" |
|
65 |
- style="right: 46px; top: 128px" |
|
66 |
- > |
|
67 |
- <img src="../../../../resources/img/img31_s_01.png" alt="" /> |
|
68 |
- <p style="font-size: 35px">?</p> |
|
69 |
- </button> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
70 | 17 |
</div> |
71 |
- </div> |
|
72 |
- <div class="dragGroup flex justify-center" style="gap: 20px"> |
|
73 |
- <article style="right: 0; top: 36%"> |
|
74 |
- <button |
|
75 |
- class="draggable" |
|
76 |
- :data-text="answerArr[0]" |
|
77 |
- draggable="true" |
|
78 |
- > |
|
79 |
- <img src="../../../../resources/img/img29_s.png" alt="" /> |
|
80 |
- <p style="font-size: 35px">{{ answerArr[0] }}</p> |
|
81 |
- </button> |
|
82 |
- </article> |
|
83 |
- <article style="left: 0; top: 36%"> |
|
84 |
- <button |
|
85 |
- class="draggable" |
|
86 |
- :data-text="answerArr[1]" |
|
87 |
- draggable="true" |
|
88 |
- > |
|
89 |
- <img src="../../../../resources/img/img30_s.png" alt="" /> |
|
90 |
- <p style="font-size: 35px">{{ answerArr[1] }}</p> |
|
91 |
- </button> |
|
92 |
- </article> |
|
93 |
- <article style="left: 50%; top: 10%"> |
|
94 |
- <button |
|
95 |
- class="draggable" |
|
96 |
- :data-text="answerArr[2]" |
|
97 |
- draggable="true" |
|
98 |
- > |
|
99 |
- <img src="../../../../resources/img/img31_s.png" alt="" /> |
|
100 |
- <p style="font-size: 35px">{{ answerArr[2] }}</p> |
|
101 |
- </button> |
|
102 |
- </article> |
|
103 |
- </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">step3 - 놀면서 배우는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem"> |
|
22 |
+ <img src="../../../../resources/img/btn_return_50x50.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ <div class="flex align-center mb30"> |
|
27 |
+ <p class="subtitle2 mr20">앗! 퍼즐이 망가졌어! 퍼즐을 맞춰 문장을 완성해보자!</p> |
|
28 |
+ </div> |
|
29 |
+ |
|
30 |
+ <div class="text-ct"> |
|
31 |
+ <div class="dropGroup flex align-center justify-center mt30"> |
|
32 |
+ <div style="position: relative"> |
|
33 |
+ <img src="../../../../resources/img/img28_s.png" alt="" /> |
|
34 |
+ <button class="dropzone" :data-answer="answerArr[0]" style="left: 30px; top: 167px"> |
|
35 |
+ <img src="../../../../resources/img/img29_s_01.png" alt="" /> |
|
36 |
+ <p style="font-size: 35px">?</p> |
|
37 |
+ </button> |
|
38 |
+ <button class="dropzone" :data-answer="answerArr[1]" style="right: 409px; top: 133px"> |
|
39 |
+ <img src="../../../../resources/img/img30_s_01.png" alt="" /> |
|
40 |
+ <p style="font-size: 35px">?</p> |
|
41 |
+ </button> |
|
42 |
+ <button class="dropzone" :data-answer="answerArr[2]" style="right: 46px; top: 128px"> |
|
43 |
+ <img src="../../../../resources/img/img31_s_01.png" alt="" /> |
|
44 |
+ <p style="font-size: 35px">?</p> |
|
45 |
+ </button> |
|
46 |
+ </div> |
|
47 |
+ </div> |
|
48 |
+ <div class="dragGroup flex justify-center" style="gap: 20px"> |
|
49 |
+ <article style="right: 0; top: 36%"> |
|
50 |
+ <button class="draggable" :data-text="answerArr[0]" draggable="true"> |
|
51 |
+ <img src="../../../../resources/img/img29_s.png" alt="" /> |
|
52 |
+ <p style="font-size: 35px">{{ answerArr[0] }}</p> |
|
53 |
+ </button> |
|
54 |
+ </article> |
|
55 |
+ <article style="left: 0; top: 36%"> |
|
56 |
+ <button class="draggable" :data-text="answerArr[1]" draggable="true"> |
|
57 |
+ <img src="../../../../resources/img/img30_s.png" alt="" /> |
|
58 |
+ <p style="font-size: 35px">{{ answerArr[1] }}</p> |
|
59 |
+ </button> |
|
60 |
+ </article> |
|
61 |
+ <article style="left: 50%; top: 10%"> |
|
62 |
+ <button class="draggable" :data-text="answerArr[2]" draggable="true"> |
|
63 |
+ <img src="../../../../resources/img/img31_s.png" alt="" /> |
|
64 |
+ <p style="font-size: 35px">{{ answerArr[2] }}</p> |
|
65 |
+ </button> |
|
66 |
+ </article> |
|
67 |
+ </div> |
|
68 |
+ </div> |
|
69 |
+ </div> |
|
70 |
+ <div class="next-btn" @click="nextProblem()"> |
|
71 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
72 |
+ </div> |
|
104 | 73 |
</div> |
105 |
- </div> |
|
106 |
- <div class="next-btn" @click="nextProblem()"> |
|
107 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
108 |
- </div> |
|
109 | 74 |
</div> |
110 |
- </div> |
|
111 | 75 |
</template> |
112 | 76 |
|
113 | 77 |
<script> |
114 |
-import axios from "axios"; |
|
115 |
- |
|
78 |
+import axios from 'axios'; |
|
79 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
116 | 80 |
export default { |
117 |
- data() { |
|
118 |
- return { |
|
119 |
- draggedElement: null, // 현재 드래그 중인 요소 |
|
120 |
- prblm_id: [], |
|
121 |
- problemData: [], |
|
122 |
- answerArr: [], |
|
81 |
+ data() { |
|
82 |
+ return { |
|
83 |
+ draggedElement: null, // 현재 드래그 중인 요소 |
|
84 |
+ prblm_id: [], |
|
85 |
+ problemData: [], |
|
86 |
+ answerArr: [], |
|
123 | 87 |
|
124 |
- // prblmArr: [], |
|
125 |
- seq: this.$store.getters.seqNum, |
|
126 |
- hiddenState: false, |
|
127 |
- correctNum: 0, |
|
128 |
- }; |
|
129 |
- }, |
|
130 |
- methods: { |
|
131 |
- complete() { |
|
132 |
- // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
133 |
- const savedState = localStorage.getItem("vuexState"); |
|
134 |
- if (savedState) { |
|
135 |
- const parsedState = JSON.parse(savedState); |
|
136 |
- const currentDashboard = parsedState.currentDashboard; |
|
88 |
+ // prblmArr: [], |
|
89 |
+ seq: this.$store.getters.seqNum, |
|
90 |
+ hiddenState: false, |
|
91 |
+ correctNum: 0, |
|
92 |
+ }; |
|
93 |
+ }, |
|
94 |
+ methods: { |
|
95 |
+ complete() { |
|
96 |
+ // 로컬 스토리지에서 currentDashboard 값을 가져옴 |
|
97 |
+ const savedState = localStorage.getItem('vuexState'); |
|
98 |
+ if (savedState) { |
|
99 |
+ const parsedState = JSON.parse(savedState); |
|
100 |
+ const currentDashboard = parsedState.currentDashboard; |
|
137 | 101 |
|
138 |
- const { unit_id, book_id } = this.$route.query; |
|
139 |
- if (currentDashboard === "Learning") { |
|
140 |
- // Learning 모드일 때 Dashboard로 이동 |
|
141 |
- this.$router.push({ |
|
142 |
- name: "Dashboard", |
|
143 |
- query: { value: this.seq, unit_id, book_id }, |
|
144 |
- }); |
|
145 |
- } else if (currentDashboard === "AI") { |
|
146 |
- // AI 모드일 때 AIDashboard로 이동 |
|
147 |
- this.$router.push({ |
|
148 |
- name: "AIDashboard", |
|
149 |
- query: { value: this.seq, unit_id, book_id }, |
|
150 |
- }); |
|
102 |
+ const { unit_id, book_id } = this.$route.query; |
|
103 |
+ if (currentDashboard === 'Learning') { |
|
104 |
+ // Learning 모드일 때 Dashboard로 이동 |
|
105 |
+ this.$router.push({ |
|
106 |
+ name: 'Dashboard', |
|
107 |
+ query: { value: this.seq, unit_id, book_id }, |
|
108 |
+ }); |
|
109 |
+ } else if (currentDashboard === 'AI') { |
|
110 |
+ // AI 모드일 때 AIDashboard로 이동 |
|
111 |
+ this.$router.push({ |
|
112 |
+ name: 'AIDashboard', |
|
113 |
+ query: { value: this.seq, unit_id, book_id }, |
|
114 |
+ }); |
|
115 |
+ } |
|
116 |
+ } else { |
|
117 |
+ console.error('currentDashboard 값이 없습니다.'); |
|
118 |
+ } |
|
119 |
+ }, |
|
120 |
+ goToPage(page) { |
|
121 |
+ this.$router.push({ name: page }); |
|
122 |
+ }, |
|
123 |
+ returnPage() { |
|
124 |
+ window.location.reload(); |
|
125 |
+ }, |
|
126 |
+ handleDragStart(event) { |
|
127 |
+ this.draggedElement = event.target.closest('.draggable'); // 드래그한 요소 저장 |
|
128 |
+ event.dataTransfer.setData('text/plain', event.target.dataset.text); |
|
129 |
+ event.target.style.cursor = 'grabbing'; // 드래그 중 커서 변경 |
|
130 |
+ }, |
|
131 |
+ handleDragEnd(event) { |
|
132 |
+ event.target.style.cursor = 'grab'; // 드래그 종료 후 커서 변경 |
|
133 |
+ }, |
|
134 |
+ handleDragOver(event) { |
|
135 |
+ event.preventDefault(); // 드롭 허용 |
|
136 |
+ }, |
|
137 |
+ handleDrop(event) { |
|
138 |
+ event.preventDefault(); |
|
139 |
+ const dropZone = event.target.closest('button.dropzone'); |
|
140 |
+ const draggedText = this.draggedElement ? this.draggedElement.dataset.text : ''; |
|
141 |
+ |
|
142 |
+ if (dropZone) { |
|
143 |
+ const expectedText = dropZone.dataset.answer; |
|
144 |
+ if (draggedText === expectedText) { |
|
145 |
+ // 드래그된 텍스트가 정답인 경우 |
|
146 |
+ const rect = dropZone.getBoundingClientRect(); |
|
147 |
+ // 버튼의 이미지 및 텍스트를 드롭존에 맞게 설정 |
|
148 |
+ dropZone.querySelector('p').textContent = draggedText; |
|
149 |
+ dropZone.querySelector('img').style.display = 'none'; // 기존 이미지 숨기기 |
|
150 |
+ |
|
151 |
+ // 드래그된 버튼의 이미지와 텍스트를 드롭존에 복사 |
|
152 |
+ const draggedImage = this.draggedElement.querySelector('img').cloneNode(); |
|
153 |
+ const draggedTextElement = this.draggedElement.querySelector('p').cloneNode(); |
|
154 |
+ |
|
155 |
+ // 드롭존에 이미지 및 텍스트를 추가 |
|
156 |
+ dropZone.appendChild(draggedImage); |
|
157 |
+ dropZone.appendChild(draggedTextElement); |
|
158 |
+ |
|
159 |
+ // 드래그한 요소 숨기기 |
|
160 |
+ this.draggedElement.style.display = 'none'; |
|
161 |
+ this.correctNum++; |
|
162 |
+ } else { |
|
163 |
+ // 정답이 아닌 경우 |
|
164 |
+ alert('오답입니다! 다시 시도해보세요.'); // 오답 경고 메시지 |
|
165 |
+ } |
|
166 |
+ } |
|
167 |
+ |
|
168 |
+ if (this.correctNum === 3) { |
|
169 |
+ setTimeout(() => { |
|
170 |
+ alert('정답입니다!'); |
|
171 |
+ this.nextProblem(); |
|
172 |
+ }, 100); |
|
173 |
+ } |
|
174 |
+ |
|
175 |
+ this.draggedElement = null; // 드래그 상태 초기화 |
|
176 |
+ }, |
|
177 |
+ storeProblemId() { |
|
178 |
+ this.prblm_id = this.$store.getters.currentLearningId; |
|
179 |
+ console.log('prblm_id', this.prblm_id); |
|
180 |
+ this.problemData = this.prblm_id; |
|
181 |
+ // this.fetchProblemData(); |
|
182 |
+ }, |
|
183 |
+ nextProblem() { |
|
184 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
185 |
+ this.$store.dispatch('goToNextProblem'); |
|
186 |
+ this.handleProblemDetail(this.currentLearningId); |
|
187 |
+ this.goToPage(this.problemType); |
|
188 |
+ } else { |
|
189 |
+ // 마지막 문제면 이동 |
|
190 |
+ // this.goToPage("Chapter4"); |
|
191 |
+ alert('문제 학습 완료'); |
|
192 |
+ this.complete(); |
|
193 |
+ // this.goToPage("Dashboard"); |
|
194 |
+ } |
|
195 |
+ }, |
|
196 |
+ previousProblem() { |
|
197 |
+ if (this.currentProblemIndex > 0) { |
|
198 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
199 |
+ this.handleProblemDetail(this.currentLearningId); |
|
200 |
+ this.goToPage(this.problemType); |
|
201 |
+ } |
|
202 |
+ }, |
|
203 |
+ |
|
204 |
+ handleProblemDetail(item) { |
|
205 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
206 |
+ this.problemType = 'Chapter3'; |
|
207 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
208 |
+ this.problemType = 'Chapter3_1'; |
|
209 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
210 |
+ this.problemType = 'Chapter3_2'; |
|
211 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
212 |
+ this.problemType = 'Chapter3_3'; |
|
213 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
214 |
+ this.problemType = 'Chapter3_3_1'; |
|
215 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
216 |
+ this.problemType = 'Chapter3_4'; |
|
217 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
218 |
+ this.problemType = 'Chapter3_5'; |
|
219 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
220 |
+ this.problemType = 'Chapter3_6'; |
|
221 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
222 |
+ this.problemType = 'Chapter3_7'; |
|
223 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
224 |
+ this.problemType = 'Chapter3_8'; |
|
225 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
226 |
+ this.problemType = 'Chapter3_9'; |
|
227 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
228 |
+ this.problemType = 'Chapter3_10'; |
|
229 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
230 |
+ this.problemType = 'Chapter3_11'; |
|
231 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
232 |
+ this.problemType = 'Chapter3_12'; |
|
233 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
234 |
+ this.problemType = 'Chapter3_13'; |
|
235 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
236 |
+ this.problemType = 'Chapter3_14'; |
|
237 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
238 |
+ this.problemType = 'Chapter3_15'; |
|
239 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
240 |
+ this.problemType = 'Chapter2_8'; |
|
241 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
242 |
+ this.problemType = 'Chapter2_7'; |
|
243 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
244 |
+ this.problemType = 'Chapter2_5'; |
|
245 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
246 |
+ this.problemType = 'Chapter2_6'; |
|
247 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
248 |
+ this.problemType = 'Chapter2_10'; |
|
249 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
250 |
+ this.problemType = 'Chapter2_11'; |
|
251 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
252 |
+ this.problemType = 'Chapter2_13'; |
|
253 |
+ } |
|
254 |
+ }, |
|
255 |
+ |
|
256 |
+ // fetchProblemData() { |
|
257 |
+ // axios({ |
|
258 |
+ // url: "/problem/problemInfo.json", |
|
259 |
+ // method: "post", |
|
260 |
+ // headers: { |
|
261 |
+ // "Content-Type": "application/json; charset=UTF-8", |
|
262 |
+ // }, |
|
263 |
+ // data: { |
|
264 |
+ // prblmId: this.prblm_id.prblm_id, |
|
265 |
+ // }, |
|
266 |
+ // }) |
|
267 |
+ // .then((response) => { |
|
268 |
+ // this.problemData = response.data; |
|
269 |
+ // console.log("problemData", this.problemData); |
|
270 |
+ // this.sortingProblem(); |
|
271 |
+ // }) |
|
272 |
+ // .catch((error) => { |
|
273 |
+ // this.state = "noProblem"; |
|
274 |
+ // console.error("Error fetching problemData:", error); |
|
275 |
+ // }); |
|
276 |
+ // }, |
|
277 |
+ |
|
278 |
+ fetchProblemData() { |
|
279 |
+ // 로컬 스토리지에서 currentDashboard를 확인 |
|
280 |
+ const savedState = localStorage.getItem('vuexState'); |
|
281 |
+ if (savedState) { |
|
282 |
+ const parsedState = JSON.parse(savedState); |
|
283 |
+ const currentDashboard = parsedState.currentDashboard; |
|
284 |
+ |
|
285 |
+ if (currentDashboard === 'AI') { |
|
286 |
+ // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
287 |
+ const currentLearningId = parsedState.currentLearningIds; |
|
288 |
+ console.log('AI 모드에서 currentLearningId 사용:', currentLearningId); |
|
289 |
+ |
|
290 |
+ // currentLearningId로 문제 데이터 가져오기 |
|
291 |
+ axios({ |
|
292 |
+ url: '/problem/problemInfo.json', |
|
293 |
+ method: 'post', |
|
294 |
+ headers: { |
|
295 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
296 |
+ }, |
|
297 |
+ data: { |
|
298 |
+ prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
299 |
+ }, |
|
300 |
+ }) |
|
301 |
+ .then((response) => { |
|
302 |
+ this.problemData = response.data; |
|
303 |
+ console.log('AI 모드 problemData', this.problemData); |
|
304 |
+ this.sortingProblem(); |
|
305 |
+ }) |
|
306 |
+ .catch((error) => { |
|
307 |
+ this.state = 'noProblem'; |
|
308 |
+ console.error('Error fetching AI problemData:', error); |
|
309 |
+ }); |
|
310 |
+ } else { |
|
311 |
+ // Learning 모드일 경우 기존 로직 사용 |
|
312 |
+ console.log('Learning 모드에서 prblm_id 사용:', this.prblm_id); |
|
313 |
+ |
|
314 |
+ axios({ |
|
315 |
+ url: '/problem/problemInfo.json', |
|
316 |
+ method: 'post', |
|
317 |
+ headers: { |
|
318 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
319 |
+ }, |
|
320 |
+ data: { |
|
321 |
+ prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
322 |
+ }, |
|
323 |
+ }) |
|
324 |
+ .then((response) => { |
|
325 |
+ this.problemData = response.data; |
|
326 |
+ console.log('Learning 모드 problemData', this.problemData); |
|
327 |
+ this.sortingProblem(); |
|
328 |
+ }) |
|
329 |
+ .catch((error) => { |
|
330 |
+ this.state = 'noProblem'; |
|
331 |
+ console.error('Error fetching problemData:', error); |
|
332 |
+ }); |
|
333 |
+ } |
|
334 |
+ } else { |
|
335 |
+ console.error('vuexState가 로컬스토리지에 없습니다.'); |
|
336 |
+ } |
|
337 |
+ }, |
|
338 |
+ |
|
339 |
+ sortingProblem() { |
|
340 |
+ let prblmExpln = this.problemData.problem.prblmExpln; |
|
341 |
+ let prblmArr = prblmExpln.split('/'); |
|
342 |
+ this.answerArr = prblmArr; |
|
343 |
+ |
|
344 |
+ // for (let i = prblmArr.length - 1; i > 0; i--) { |
|
345 |
+ // const j = Math.floor(Math.random() * (i + 1)); |
|
346 |
+ // [prblmArr[i], prblmArr[j]] = [prblmArr[j], prblmArr[i]]; |
|
347 |
+ // } |
|
348 |
+ |
|
349 |
+ // this.prblmArr = prblmArr; |
|
350 |
+ // console.log(prblmArr); |
|
351 |
+ }, |
|
352 |
+ }, |
|
353 |
+ computed: { |
|
354 |
+ currentLearningId() { |
|
355 |
+ return this.$store.getters.currentLearningId; |
|
356 |
+ }, |
|
357 |
+ currentLabel() { |
|
358 |
+ return this.$store.getters.currentLabel; |
|
359 |
+ }, |
|
360 |
+ currentProblemIndex() { |
|
361 |
+ return this.$store.getters.currentProblemIndex; |
|
362 |
+ }, |
|
363 |
+ isPreviousButtonDisabled() { |
|
364 |
+ return this.currentProblemIndex === 0; |
|
365 |
+ }, |
|
366 |
+ }, |
|
367 |
+ created() { |
|
368 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
369 |
+ this.prblm_id = this.currentLearningId; |
|
370 |
+ console.log('Current Label:', this.currentLabel); |
|
371 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
372 |
+ |
|
373 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
374 |
+ }, |
|
375 |
+ mounted() { |
|
376 |
+ this.fetchProblemData(); |
|
377 |
+ // this.storeProblemId(); |
|
378 |
+ // this.storeLearningId(); |
|
379 |
+ if (this.currentProblemIndex == 0) { |
|
380 |
+ this.hiddenState = true; |
|
151 | 381 |
} |
152 |
- } else { |
|
153 |
- console.error("currentDashboard 값이 없습니다."); |
|
154 |
- } |
|
382 |
+ |
|
383 |
+ this.$route.query; |
|
384 |
+ // 드래그 가능한 요소에 드래그 시작 및 종료 이벤트 추가 |
|
385 |
+ document.querySelectorAll('.draggable').forEach((button) => { |
|
386 |
+ button.addEventListener('dragstart', this.handleDragStart); |
|
387 |
+ button.addEventListener('dragend', this.handleDragEnd); |
|
388 |
+ }); |
|
389 |
+ |
|
390 |
+ // 드롭 가능한 영역에 드래그 오버 및 드롭 이벤트 추가 |
|
391 |
+ document.querySelectorAll('.dropzone').forEach((zone) => { |
|
392 |
+ zone.addEventListener('dragover', this.handleDragOver); |
|
393 |
+ zone.addEventListener('drop', this.handleDrop); |
|
394 |
+ }); |
|
155 | 395 |
}, |
156 |
- goToPage(page) { |
|
157 |
- this.$router.push({ name: page }); |
|
396 |
+ components: { |
|
397 |
+ BookInfo: BookInfo, |
|
158 | 398 |
}, |
159 |
- returnPage() { |
|
160 |
- window.location.reload(); |
|
161 |
- }, |
|
162 |
- handleDragStart(event) { |
|
163 |
- this.draggedElement = event.target.closest(".draggable"); // 드래그한 요소 저장 |
|
164 |
- event.dataTransfer.setData("text/plain", event.target.dataset.text); |
|
165 |
- event.target.style.cursor = "grabbing"; // 드래그 중 커서 변경 |
|
166 |
- }, |
|
167 |
- handleDragEnd(event) { |
|
168 |
- event.target.style.cursor = "grab"; // 드래그 종료 후 커서 변경 |
|
169 |
- }, |
|
170 |
- handleDragOver(event) { |
|
171 |
- event.preventDefault(); // 드롭 허용 |
|
172 |
- }, |
|
173 |
- handleDrop(event) { |
|
174 |
- event.preventDefault(); |
|
175 |
- const dropZone = event.target.closest("button.dropzone"); |
|
176 |
- const draggedText = this.draggedElement |
|
177 |
- ? this.draggedElement.dataset.text |
|
178 |
- : ""; |
|
179 |
- |
|
180 |
- if (dropZone) { |
|
181 |
- const expectedText = dropZone.dataset.answer; |
|
182 |
- if (draggedText === expectedText) { |
|
183 |
- // 드래그된 텍스트가 정답인 경우 |
|
184 |
- const rect = dropZone.getBoundingClientRect(); |
|
185 |
- // 버튼의 이미지 및 텍스트를 드롭존에 맞게 설정 |
|
186 |
- dropZone.querySelector("p").textContent = draggedText; |
|
187 |
- dropZone.querySelector("img").style.display = "none"; // 기존 이미지 숨기기 |
|
188 |
- |
|
189 |
- // 드래그된 버튼의 이미지와 텍스트를 드롭존에 복사 |
|
190 |
- const draggedImage = this.draggedElement |
|
191 |
- .querySelector("img") |
|
192 |
- .cloneNode(); |
|
193 |
- const draggedTextElement = this.draggedElement |
|
194 |
- .querySelector("p") |
|
195 |
- .cloneNode(); |
|
196 |
- |
|
197 |
- // 드롭존에 이미지 및 텍스트를 추가 |
|
198 |
- dropZone.appendChild(draggedImage); |
|
199 |
- dropZone.appendChild(draggedTextElement); |
|
200 |
- |
|
201 |
- // 드래그한 요소 숨기기 |
|
202 |
- this.draggedElement.style.display = "none"; |
|
203 |
- this.correctNum++; |
|
204 |
- } else { |
|
205 |
- // 정답이 아닌 경우 |
|
206 |
- alert("오답입니다! 다시 시도해보세요."); // 오답 경고 메시지 |
|
207 |
- } |
|
208 |
- } |
|
209 |
- |
|
210 |
- if (this.correctNum === 3) { |
|
211 |
- setTimeout(() => { |
|
212 |
- alert("정답입니다!"); |
|
213 |
- this.nextProblem(); |
|
214 |
- }, 100); |
|
215 |
- } |
|
216 |
- |
|
217 |
- this.draggedElement = null; // 드래그 상태 초기화 |
|
218 |
- }, |
|
219 |
- storeProblemId() { |
|
220 |
- this.prblm_id = this.$store.getters.currentLearningId; |
|
221 |
- console.log("prblm_id", this.prblm_id); |
|
222 |
- this.problemData = this.prblm_id; |
|
223 |
- // this.fetchProblemData(); |
|
224 |
- }, |
|
225 |
- nextProblem() { |
|
226 |
- if ( |
|
227 |
- this.currentProblemIndex < |
|
228 |
- this.$store.state.currentLearningIds.length - 1 |
|
229 |
- ) { |
|
230 |
- this.$store.dispatch("goToNextProblem"); |
|
231 |
- this.handleProblemDetail(this.currentLearningId); |
|
232 |
- this.goToPage(this.problemType); |
|
233 |
- } else { |
|
234 |
- // 마지막 문제면 이동 |
|
235 |
- // this.goToPage("Chapter4"); |
|
236 |
- alert("문제 학습 완료"); |
|
237 |
- this.complete(); |
|
238 |
- // this.goToPage("Dashboard"); |
|
239 |
- } |
|
240 |
- }, |
|
241 |
- previousProblem() { |
|
242 |
- if (this.currentProblemIndex > 0) { |
|
243 |
- this.$store.dispatch("goToPreviousProblem"); |
|
244 |
- this.handleProblemDetail(this.currentLearningId); |
|
245 |
- this.goToPage(this.problemType); |
|
246 |
- } |
|
247 |
- }, |
|
248 |
- |
|
249 |
- handleProblemDetail(item) { |
|
250 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
251 |
- this.problemType = "Chapter3"; |
|
252 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
253 |
- this.problemType = "Chapter3_1"; |
|
254 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
255 |
- this.problemType = "Chapter3_2"; |
|
256 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
257 |
- this.problemType = "Chapter3_3"; |
|
258 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
259 |
- this.problemType = "Chapter3_3_1"; |
|
260 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
261 |
- this.problemType = "Chapter3_4"; |
|
262 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
263 |
- this.problemType = "Chapter3_5"; |
|
264 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
265 |
- this.problemType = "Chapter3_6"; |
|
266 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
267 |
- this.problemType = "Chapter3_7"; |
|
268 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
269 |
- this.problemType = "Chapter3_8"; |
|
270 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
271 |
- this.problemType = "Chapter3_9"; |
|
272 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
273 |
- this.problemType = "Chapter3_10"; |
|
274 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
275 |
- this.problemType = "Chapter3_11"; |
|
276 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
277 |
- this.problemType = "Chapter3_12"; |
|
278 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
279 |
- this.problemType = "Chapter3_13"; |
|
280 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
281 |
- this.problemType = "Chapter3_14"; |
|
282 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
283 |
- this.problemType = "Chapter3_15"; |
|
284 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
285 |
- this.problemType = "Chapter2_8"; |
|
286 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
287 |
- this.problemType = "Chapter2_7"; |
|
288 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
289 |
- this.problemType = "Chapter2_5"; |
|
290 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
291 |
- this.problemType = "Chapter2_6"; |
|
292 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
293 |
- this.problemType = "Chapter2_10"; |
|
294 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
295 |
- this.problemType = "Chapter2_11"; |
|
296 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
297 |
- this.problemType = "Chapter2_13"; |
|
298 |
- } |
|
299 |
- }, |
|
300 |
- |
|
301 |
- // fetchProblemData() { |
|
302 |
- // axios({ |
|
303 |
- // url: "/problem/problemInfo.json", |
|
304 |
- // method: "post", |
|
305 |
- // headers: { |
|
306 |
- // "Content-Type": "application/json; charset=UTF-8", |
|
307 |
- // }, |
|
308 |
- // data: { |
|
309 |
- // prblmId: this.prblm_id.prblm_id, |
|
310 |
- // }, |
|
311 |
- // }) |
|
312 |
- // .then((response) => { |
|
313 |
- // this.problemData = response.data; |
|
314 |
- // console.log("problemData", this.problemData); |
|
315 |
- // this.sortingProblem(); |
|
316 |
- // }) |
|
317 |
- // .catch((error) => { |
|
318 |
- // this.state = "noProblem"; |
|
319 |
- // console.error("Error fetching problemData:", error); |
|
320 |
- // }); |
|
321 |
- // }, |
|
322 |
- |
|
323 |
- fetchProblemData() { |
|
324 |
- // 로컬 스토리지에서 currentDashboard를 확인 |
|
325 |
- const savedState = localStorage.getItem("vuexState"); |
|
326 |
- if (savedState) { |
|
327 |
- const parsedState = JSON.parse(savedState); |
|
328 |
- const currentDashboard = parsedState.currentDashboard; |
|
329 |
- |
|
330 |
- if (currentDashboard === "AI") { |
|
331 |
- // AI 모드일 경우 로컬 스토리지에서 currentLearningId를 가져와 사용 |
|
332 |
- const currentLearningId = parsedState.currentLearningIds; |
|
333 |
- console.log("AI 모드에서 currentLearningId 사용:", currentLearningId); |
|
334 |
- |
|
335 |
- // currentLearningId로 문제 데이터 가져오기 |
|
336 |
- axios({ |
|
337 |
- url: "/problem/problemInfo.json", |
|
338 |
- method: "post", |
|
339 |
- headers: { |
|
340 |
- "Content-Type": "application/json; charset=UTF-8", |
|
341 |
- }, |
|
342 |
- data: { |
|
343 |
- prblmId: currentLearningId, // 로컬스토리지에서 가져온 currentLearningId 사용 |
|
344 |
- }, |
|
345 |
- }) |
|
346 |
- .then((response) => { |
|
347 |
- this.problemData = response.data; |
|
348 |
- console.log("AI 모드 problemData", this.problemData); |
|
349 |
- this.sortingProblem(); |
|
350 |
- }) |
|
351 |
- .catch((error) => { |
|
352 |
- this.state = "noProblem"; |
|
353 |
- console.error("Error fetching AI problemData:", error); |
|
354 |
- }); |
|
355 |
- |
|
356 |
- } else { |
|
357 |
- // Learning 모드일 경우 기존 로직 사용 |
|
358 |
- console.log("Learning 모드에서 prblm_id 사용:", this.prblm_id); |
|
359 |
- |
|
360 |
- axios({ |
|
361 |
- url: "/problem/problemInfo.json", |
|
362 |
- method: "post", |
|
363 |
- headers: { |
|
364 |
- "Content-Type": "application/json; charset=UTF-8", |
|
365 |
- }, |
|
366 |
- data: { |
|
367 |
- prblmId: this.prblm_id.prblm_id, // 기존 방식 사용 |
|
368 |
- }, |
|
369 |
- }) |
|
370 |
- .then((response) => { |
|
371 |
- this.problemData = response.data; |
|
372 |
- console.log("Learning 모드 problemData", this.problemData); |
|
373 |
- this.sortingProblem(); |
|
374 |
- }) |
|
375 |
- .catch((error) => { |
|
376 |
- this.state = "noProblem"; |
|
377 |
- console.error("Error fetching problemData:", error); |
|
378 |
- }); |
|
379 |
- } |
|
380 |
- } else { |
|
381 |
- console.error("vuexState가 로컬스토리지에 없습니다."); |
|
382 |
- } |
|
383 |
- }, |
|
384 |
- |
|
385 |
- sortingProblem() { |
|
386 |
- let prblmExpln = this.problemData.problem.prblmExpln; |
|
387 |
- let prblmArr = prblmExpln.split("/"); |
|
388 |
- this.answerArr = prblmArr; |
|
389 |
- |
|
390 |
- // for (let i = prblmArr.length - 1; i > 0; i--) { |
|
391 |
- // const j = Math.floor(Math.random() * (i + 1)); |
|
392 |
- // [prblmArr[i], prblmArr[j]] = [prblmArr[j], prblmArr[i]]; |
|
393 |
- // } |
|
394 |
- |
|
395 |
- // this.prblmArr = prblmArr; |
|
396 |
- // console.log(prblmArr); |
|
397 |
- }, |
|
398 |
- }, |
|
399 |
- computed: { |
|
400 |
- currentLearningId() { |
|
401 |
- return this.$store.getters.currentLearningId; |
|
402 |
- }, |
|
403 |
- currentLabel() { |
|
404 |
- return this.$store.getters.currentLabel; |
|
405 |
- }, |
|
406 |
- currentProblemIndex() { |
|
407 |
- return this.$store.getters.currentProblemIndex; |
|
408 |
- }, |
|
409 |
- isPreviousButtonDisabled() { |
|
410 |
- return this.currentProblemIndex === 0; |
|
411 |
- }, |
|
412 |
- }, |
|
413 |
- created() { |
|
414 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
415 |
- this.prblm_id = this.currentLearningId; |
|
416 |
- console.log("Current Label:", this.currentLabel); |
|
417 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
418 |
- |
|
419 |
- // Fetch or process the current problem based on `currentLearningId` |
|
420 |
- }, |
|
421 |
- mounted() { |
|
422 |
- this.fetchProblemData(); |
|
423 |
- // this.storeProblemId(); |
|
424 |
- // this.storeLearningId(); |
|
425 |
- if (this.currentProblemIndex == 0) { |
|
426 |
- this.hiddenState = true; |
|
427 |
- } |
|
428 |
- |
|
429 |
- this.$route.query; |
|
430 |
- // 드래그 가능한 요소에 드래그 시작 및 종료 이벤트 추가 |
|
431 |
- document.querySelectorAll(".draggable").forEach((button) => { |
|
432 |
- button.addEventListener("dragstart", this.handleDragStart); |
|
433 |
- button.addEventListener("dragend", this.handleDragEnd); |
|
434 |
- }); |
|
435 |
- |
|
436 |
- // 드롭 가능한 영역에 드래그 오버 및 드롭 이벤트 추가 |
|
437 |
- document.querySelectorAll(".dropzone").forEach((zone) => { |
|
438 |
- zone.addEventListener("dragover", this.handleDragOver); |
|
439 |
- zone.addEventListener("drop", this.handleDrop); |
|
440 |
- }); |
|
441 |
- }, |
|
442 | 399 |
}; |
443 | 400 |
</script> |
444 | 401 |
|
445 | 402 |
<style scoped> |
446 | 403 |
.draggable { |
447 |
- cursor: grab; |
|
404 |
+ cursor: grab; |
|
448 | 405 |
} |
449 | 406 |
|
450 | 407 |
.draggable:active { |
451 |
- cursor: grabbing; |
|
408 |
+ cursor: grabbing; |
|
452 | 409 |
} |
453 | 410 |
|
454 | 411 |
.dropzone img { |
455 |
- display: block; |
|
456 |
- /* 이미지가 항상 보이도록 설정 */ |
|
412 |
+ display: block; |
|
413 |
+ /* 이미지가 항상 보이도록 설정 */ |
|
457 | 414 |
} |
458 | 415 |
|
459 | 416 |
.completeBtn { |
460 |
- margin-right: 100px; |
|
461 |
- background-color: #ffba08; |
|
462 |
- padding: 10px 30px; |
|
463 |
- border-radius: 10px; |
|
464 |
- font-size: 28px; |
|
465 |
- font-family: "ONEMobilePOPOTF"; |
|
417 |
+ margin-right: 100px; |
|
418 |
+ background-color: #ffba08; |
|
419 |
+ padding: 10px 30px; |
|
420 |
+ border-radius: 10px; |
|
421 |
+ font-size: 28px; |
|
422 |
+ font-family: 'ONEMobilePOPOTF'; |
|
466 | 423 |
} |
467 | 424 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_9.vue
+++ client/views/pages/main/Chapter/Chapter2_9.vue
... | ... | @@ -1,435 +1,372 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div |
|
22 |
- class="pre-btn" |
|
23 |
- :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" |
|
24 |
- @click="goToPrevPage" |
|
25 |
- > |
|
26 |
- <img src="../../../../resources/img/left.png" alt="" /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- <div style="display: flex; justify-content: space-between"> |
|
30 |
- <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
31 |
- <button |
|
32 |
- id="returnButton" |
|
33 |
- @click="returnPage" |
|
34 |
- style="margin: 4rem 4rem 0 2rem" |
|
35 |
- > |
|
36 |
- <img |
|
37 |
- src="../../../../resources/img/new_img/content_ink/return_v2.png" |
|
38 |
- alt="" |
|
39 |
- /> |
|
40 |
- <p>되돌리기</p> |
|
41 |
- </button> |
|
42 |
- </div> |
|
43 |
- <div class="flex align-center mb30"> |
|
44 |
- <p class="subtitle2 mr20"> |
|
45 |
- 앗! 잉크가 쏟아졌어! 지우개로 잉크를 지워줘! |
|
46 |
- </p> |
|
47 |
- </div> |
|
48 |
- |
|
49 |
- <div class="text-ct"> |
|
50 |
- <div class="dropGroup flex align-center justify-center"> |
|
51 |
- <div style="position: relative"> |
|
52 |
- <img |
|
53 |
- src="../../../../resources/img/new_img/content_ink/background.png" |
|
54 |
- alt="" |
|
55 |
- style="width: 138rem; height: 49rem" |
|
56 |
- /> |
|
57 |
- <div class="vocaGroup"> |
|
58 |
- <div |
|
59 |
- v-for="word in wordList" |
|
60 |
- :key="word.wdId" |
|
61 |
- class="flex justify-between mb80 word-item" |
|
62 |
- > |
|
63 |
- <article class="flex align-center"> |
|
64 |
- <div class="imgGroup mr30"> |
|
65 |
- <img |
|
66 |
- :src="word.fileRpath" |
|
67 |
- data-num="1" |
|
68 |
- class="ink" |
|
69 |
- style="width: 150px" |
|
70 |
- /> |
|
71 |
- </div> |
|
72 |
- <div class="flex align-start"> |
|
73 |
- <div> |
|
74 |
- <h3>{{ word.wdNm }}</h3> |
|
75 |
- <div class="flex align-center mt10"> |
|
76 |
- <span class="title1">{{ word.wdMnng }}</span> |
|
77 |
- </div> |
|
78 |
- </div> |
|
79 |
- </div> |
|
80 |
- </article> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
81 | 7 |
</div> |
82 |
- </div> |
|
83 |
- <div class="textbox"> |
|
84 |
- <button |
|
85 |
- id="eraser1" |
|
86 |
- class="dropzone" |
|
87 |
- style="left: 97px; top: 125px; position: fixed" |
|
88 |
- > |
|
89 |
- <img |
|
90 |
- src="../../../../resources/img/new_img/content_ink/ink_1.png" |
|
91 |
- alt="" |
|
92 |
- style="position: relative; z-index: 1" |
|
93 |
- /> |
|
94 |
- <img |
|
95 |
- src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
96 |
- alt="" |
|
97 |
- style=" |
|
98 |
- position: absolute; |
|
99 |
- z-index: 2; |
|
100 |
- height: 56px; |
|
101 |
- right: 69px; |
|
102 |
- " |
|
103 |
- /> |
|
104 |
- </button> |
|
105 |
- <button |
|
106 |
- id="eraser2" |
|
107 |
- class="dropzone" |
|
108 |
- style="left: 87px; bottom: 38px; position: fixed" |
|
109 |
- > |
|
110 |
- <img |
|
111 |
- src="../../../../resources/img/new_img/content_ink/ink_2.png" |
|
112 |
- alt="" |
|
113 |
- style="position: relative; z-index: 1" |
|
114 |
- /> |
|
115 |
- <img |
|
116 |
- src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
117 |
- alt="" |
|
118 |
- style=" |
|
119 |
- position: absolute; |
|
120 |
- z-index: 2; |
|
121 |
- height: 56px; |
|
122 |
- right: 139px; |
|
123 |
- " |
|
124 |
- /> |
|
125 |
- </button> |
|
126 |
- <button |
|
127 |
- id="eraser3" |
|
128 |
- class="dropzone" |
|
129 |
- style="right: 207px; top: 133px; position: fixed" |
|
130 |
- > |
|
131 |
- <img |
|
132 |
- src="../../../../resources/img/new_img/content_ink/ink_3.png" |
|
133 |
- alt="" |
|
134 |
- style="position: relative; z-index: 1" |
|
135 |
- /> |
|
136 |
- <img |
|
137 |
- src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
138 |
- alt="" |
|
139 |
- style=" |
|
140 |
- position: absolute; |
|
141 |
- z-index: 2; |
|
142 |
- height: 56px; |
|
143 |
- right: 109px; |
|
144 |
- " |
|
145 |
- /> |
|
146 |
- </button> |
|
147 |
- <button |
|
148 |
- id="eraser4" |
|
149 |
- class="dropzone" |
|
150 |
- style="right: 206px; bottom: 51px; position: fixed" |
|
151 |
- > |
|
152 |
- <img |
|
153 |
- src="../../../../resources/img/new_img/content_ink/ink_4.png" |
|
154 |
- alt="" |
|
155 |
- style="position: relative; z-index: 1" |
|
156 |
- /> |
|
157 |
- <img |
|
158 |
- src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
159 |
- alt="" |
|
160 |
- style=" |
|
161 |
- position: absolute; |
|
162 |
- z-index: 2; |
|
163 |
- height: 56px; |
|
164 |
- right: 115px; |
|
165 |
- " |
|
166 |
- /> |
|
167 |
- </button> |
|
168 |
- </div> |
|
169 |
- </div> |
|
170 |
- </div> |
|
171 |
- <div class="dragGroup"> |
|
172 |
- <div> |
|
173 |
- <article style="left: 83px; top: 69%"> |
|
174 |
- <button |
|
175 |
- id="eraser" |
|
176 |
- draggable="true" |
|
177 |
- @dragstart="handleDragStart" |
|
178 |
- > |
|
179 |
- <img src="../../../../resources/img/img73_41s.png" alt="" /> |
|
180 |
- </button> |
|
181 |
- </article> |
|
182 |
- </div> |
|
183 |
- </div> |
|
8 |
+ </router-link> |
|
184 | 9 |
</div> |
185 |
- </div> |
|
186 |
- <div class="next-btn" @click="goToNextPage"> |
|
187 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
188 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" :style="{ visibility: hiddenState ? 'hidden' : 'visible' }" @click="goToPrevPage"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ <div style="display: flex; justify-content: space-between"> |
|
20 |
+ <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
21 |
+ <button id="returnButton" @click="returnPage" style="margin: 4rem 4rem 0 2rem"> |
|
22 |
+ <img src="../../../../resources/img/new_img/content_ink/return_v2.png" alt="" /> |
|
23 |
+ <p>되돌리기</p> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ <div class="flex align-center mb30"> |
|
27 |
+ <p class="subtitle2 mr20">앗! 잉크가 쏟아졌어! 지우개로 잉크를 지워줘!</p> |
|
28 |
+ </div> |
|
29 |
+ |
|
30 |
+ <div class="text-ct"> |
|
31 |
+ <div class="dropGroup flex align-center justify-center"> |
|
32 |
+ <div style="position: relative"> |
|
33 |
+ <img |
|
34 |
+ src="../../../../resources/img/new_img/content_ink/background.png" |
|
35 |
+ alt="" |
|
36 |
+ style="width: 138rem; height: 49rem" |
|
37 |
+ /> |
|
38 |
+ <div class="vocaGroup"> |
|
39 |
+ <div |
|
40 |
+ v-for="word in wordList" |
|
41 |
+ :key="word.wdId" |
|
42 |
+ class="flex justify-between mb80 word-item" |
|
43 |
+ > |
|
44 |
+ <article class="flex align-center"> |
|
45 |
+ <div class="imgGroup mr30"> |
|
46 |
+ <img :src="word.fileRpath" data-num="1" class="ink" style="width: 150px" /> |
|
47 |
+ </div> |
|
48 |
+ <div class="flex align-start"> |
|
49 |
+ <div> |
|
50 |
+ <h3>{{ word.wdNm }}</h3> |
|
51 |
+ <div class="flex align-center mt10"> |
|
52 |
+ <span class="title1">{{ word.wdMnng }}</span> |
|
53 |
+ </div> |
|
54 |
+ </div> |
|
55 |
+ </div> |
|
56 |
+ </article> |
|
57 |
+ </div> |
|
58 |
+ </div> |
|
59 |
+ <div class="textbox"> |
|
60 |
+ <button id="eraser1" class="dropzone" style="left: 97px; top: 125px; position: fixed"> |
|
61 |
+ <img |
|
62 |
+ src="../../../../resources/img/new_img/content_ink/ink_1.png" |
|
63 |
+ alt="" |
|
64 |
+ style="position: relative; z-index: 1" |
|
65 |
+ /> |
|
66 |
+ <img |
|
67 |
+ src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
68 |
+ alt="" |
|
69 |
+ style="position: absolute; z-index: 2; height: 56px; right: 69px" |
|
70 |
+ /> |
|
71 |
+ </button> |
|
72 |
+ <button id="eraser2" class="dropzone" style="left: 87px; bottom: 38px; position: fixed"> |
|
73 |
+ <img |
|
74 |
+ src="../../../../resources/img/new_img/content_ink/ink_2.png" |
|
75 |
+ alt="" |
|
76 |
+ style="position: relative; z-index: 1" |
|
77 |
+ /> |
|
78 |
+ <img |
|
79 |
+ src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
80 |
+ alt="" |
|
81 |
+ style="position: absolute; z-index: 2; height: 56px; right: 139px" |
|
82 |
+ /> |
|
83 |
+ </button> |
|
84 |
+ <button id="eraser3" class="dropzone" style="right: 207px; top: 133px; position: fixed"> |
|
85 |
+ <img |
|
86 |
+ src="../../../../resources/img/new_img/content_ink/ink_3.png" |
|
87 |
+ alt="" |
|
88 |
+ style="position: relative; z-index: 1" |
|
89 |
+ /> |
|
90 |
+ <img |
|
91 |
+ src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
92 |
+ alt="" |
|
93 |
+ style="position: absolute; z-index: 2; height: 56px; right: 109px" |
|
94 |
+ /> |
|
95 |
+ </button> |
|
96 |
+ <button |
|
97 |
+ id="eraser4" |
|
98 |
+ class="dropzone" |
|
99 |
+ style="right: 206px; bottom: 51px; position: fixed" |
|
100 |
+ > |
|
101 |
+ <img |
|
102 |
+ src="../../../../resources/img/new_img/content_ink/ink_4.png" |
|
103 |
+ alt="" |
|
104 |
+ style="position: relative; z-index: 1" |
|
105 |
+ /> |
|
106 |
+ <img |
|
107 |
+ src="../../../../resources/img/new_img/content_ink/click_btn.png" |
|
108 |
+ alt="" |
|
109 |
+ style="position: absolute; z-index: 2; height: 56px; right: 115px" |
|
110 |
+ /> |
|
111 |
+ </button> |
|
112 |
+ </div> |
|
113 |
+ </div> |
|
114 |
+ </div> |
|
115 |
+ <div class="dragGroup"> |
|
116 |
+ <div> |
|
117 |
+ <article style="left: 83px; top: 69%"> |
|
118 |
+ <button id="eraser" draggable="true" @dragstart="handleDragStart"> |
|
119 |
+ <img src="../../../../resources/img/img73_41s.png" alt="" /> |
|
120 |
+ </button> |
|
121 |
+ </article> |
|
122 |
+ </div> |
|
123 |
+ </div> |
|
124 |
+ </div> |
|
125 |
+ </div> |
|
126 |
+ <div class="next-btn" @click="goToNextPage"> |
|
127 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
128 |
+ </div> |
|
129 |
+ </div> |
|
189 | 130 |
</div> |
190 |
- </div> |
|
191 | 131 |
</template> |
192 | 132 |
|
193 | 133 |
<script> |
194 |
-import axios from "axios"; |
|
195 |
- |
|
134 |
+import axios from 'axios'; |
|
135 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
196 | 136 |
export default { |
197 |
- data() { |
|
198 |
- return { |
|
199 |
- draggedElementId: null, // 드래그한 요소의 ID를 저장 |
|
200 |
- wordList: [], |
|
137 |
+ data() { |
|
138 |
+ return { |
|
139 |
+ draggedElementId: null, // 드래그한 요소의 ID를 저장 |
|
140 |
+ wordList: [], |
|
201 | 141 |
|
202 |
- wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
203 |
- wdBookId: "", // 현재 단어장 id |
|
204 |
- currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
205 |
- wdBookTypeIdState: "", // 이동할 페이지 타입 id |
|
206 |
- wordBookType: "", // 이동할 페이지 |
|
142 |
+ wdBookIdList: [], // 단어 컨텐츠의 단어장 id 리스트 |
|
143 |
+ wdBookId: '', // 현재 단어장 id |
|
144 |
+ currentWdBkIndex: 0, // 현재 단어장 인덱스 |
|
145 |
+ wdBookTypeIdState: '', // 이동할 페이지 타입 id |
|
146 |
+ wordBookType: '', // 이동할 페이지 |
|
207 | 147 |
|
208 |
- seq: this.$store.getters.seqNum, |
|
148 |
+ seq: this.$store.getters.seqNum, |
|
209 | 149 |
|
210 |
- hiddenState: false, |
|
211 |
- }; |
|
212 |
- }, |
|
213 |
- methods: { |
|
214 |
- pageSetting() { |
|
215 |
- this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
216 |
- this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
217 |
- this.wdBookId = |
|
218 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
219 |
- |
|
220 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
221 |
- this.hiddenState = true; |
|
222 |
- } |
|
223 |
- |
|
224 |
- this.fetchWordList(); |
|
150 |
+ hiddenState: false, |
|
151 |
+ }; |
|
225 | 152 |
}, |
153 |
+ methods: { |
|
154 |
+ pageSetting() { |
|
155 |
+ this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; // 현재 단어장 인덱스 |
|
156 |
+ this.wdBookIdList = this.$store.getters.getWdBookIdList; // 단어컨텐츠의 단어장 id 리스트 |
|
157 |
+ this.wdBookId = this.$store.getters.getWdBookIdList[this.currentWdBkIndex]; // 현재 단어장 콘텐츠 인덱스에 대한 단어장 id |
|
226 | 158 |
|
227 |
- async fetchWordList() { |
|
228 |
- try { |
|
229 |
- const response = await axios.post("/word/getWordsByBookId.json", { |
|
230 |
- wdBookId: this.wdBookId, |
|
159 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
160 |
+ this.hiddenState = true; |
|
161 |
+ } |
|
162 |
+ |
|
163 |
+ this.fetchWordList(); |
|
164 |
+ }, |
|
165 |
+ |
|
166 |
+ async fetchWordList() { |
|
167 |
+ try { |
|
168 |
+ const response = await axios.post('/word/getWordsByBookId.json', { |
|
169 |
+ wdBookId: this.wdBookId, |
|
170 |
+ }); |
|
171 |
+ |
|
172 |
+ const wordList = response.data; |
|
173 |
+ |
|
174 |
+ // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
175 |
+ const requests = wordList.map(async (word) => { |
|
176 |
+ const fileResponse = await axios.post('/file/find.json', { |
|
177 |
+ file_mng_id: word.fileMngId, |
|
178 |
+ }); |
|
179 |
+ |
|
180 |
+ const fileRpath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileRpath : null; |
|
181 |
+ console.log('각 단어의 fileRpath: ', fileRpath); |
|
182 |
+ |
|
183 |
+ word.fileRpath = 'http://165.229.169.113:9080/' + fileRpath; // fileRpath 값을 해당 객체에 추가 |
|
184 |
+ }); |
|
185 |
+ |
|
186 |
+ // 모든 요청이 완료될 때까지 대기 |
|
187 |
+ await Promise.all(requests); |
|
188 |
+ |
|
189 |
+ // 최종적으로 wordList를 설정 |
|
190 |
+ this.wordList = wordList; |
|
191 |
+ console.log('단어 리스트 -> ', this.wordList); |
|
192 |
+ } catch (error) { |
|
193 |
+ console.error('단어 목록을 불러오는 중 오류 발생:', error); |
|
194 |
+ } |
|
195 |
+ }, |
|
196 |
+ |
|
197 |
+ async goToPrevPage() { |
|
198 |
+ if (this.currentWdBkIndex - 1 < 0) { |
|
199 |
+ alert('단어장 첫번째 페이지 입니다'); |
|
200 |
+ } else { |
|
201 |
+ this.currentWdBkIndex--; |
|
202 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
203 |
+ |
|
204 |
+ try { |
|
205 |
+ const response = await axios.post('/wordbook/find.json', { |
|
206 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
207 |
+ }); |
|
208 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
209 |
+ console.log('이전 단어장 타입 id: ', this.wdBookTypeIdState); |
|
210 |
+ |
|
211 |
+ switch (this.wdBookTypeIdState) { |
|
212 |
+ case '1': |
|
213 |
+ this.wordBookType = 'Chapter2'; |
|
214 |
+ break; |
|
215 |
+ case '2': |
|
216 |
+ this.wordBookType = 'Chapter2_3'; |
|
217 |
+ break; |
|
218 |
+ case '3': |
|
219 |
+ this.wordBookType = 'Chapter2_2'; |
|
220 |
+ break; |
|
221 |
+ case '4': |
|
222 |
+ this.wordBookType = 'Chapter2_9'; |
|
223 |
+ break; |
|
224 |
+ case '5': |
|
225 |
+ this.wordBookType = 'Chapter2_4'; |
|
226 |
+ break; |
|
227 |
+ default: |
|
228 |
+ this.wordBookType = null; |
|
229 |
+ } |
|
230 |
+ |
|
231 |
+ this.goToPage(this.wordBookType); |
|
232 |
+ } catch (error) { |
|
233 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
234 |
+ } |
|
235 |
+ } |
|
236 |
+ }, |
|
237 |
+ |
|
238 |
+ async goToNextPage() { |
|
239 |
+ if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
240 |
+ alert('단어장 마지막 페이지 입니다'); |
|
241 |
+ this.complete(); |
|
242 |
+ } else { |
|
243 |
+ this.currentWdBkIndex++; |
|
244 |
+ this.$store.dispatch('updateCurrentWdBkIndex', this.currentWdBkIndex); |
|
245 |
+ |
|
246 |
+ try { |
|
247 |
+ const response = await axios.post('/wordbook/find.json', { |
|
248 |
+ wdBookId: this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
249 |
+ }); |
|
250 |
+ this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
251 |
+ console.log('다음 단어장 타입 id: ', this.wdBookTypeIdState); |
|
252 |
+ |
|
253 |
+ switch (this.wdBookTypeIdState) { |
|
254 |
+ case '1': |
|
255 |
+ this.wordBookType = 'Chapter2'; |
|
256 |
+ break; |
|
257 |
+ case '2': |
|
258 |
+ this.wordBookType = 'Chapter2_3'; |
|
259 |
+ break; |
|
260 |
+ case '3': |
|
261 |
+ this.wordBookType = 'Chapter2_2'; |
|
262 |
+ break; |
|
263 |
+ case '4': |
|
264 |
+ this.wordBookType = 'Chapter2_9'; |
|
265 |
+ break; |
|
266 |
+ case '5': |
|
267 |
+ this.wordBookType = 'Chapter2_4'; |
|
268 |
+ break; |
|
269 |
+ default: |
|
270 |
+ this.wordBookType = null; |
|
271 |
+ } |
|
272 |
+ |
|
273 |
+ this.goToPage(this.wordBookType); |
|
274 |
+ } catch (error) { |
|
275 |
+ console.error('단어장 정보 불러오는 중 오류 발생:', error); |
|
276 |
+ } |
|
277 |
+ } |
|
278 |
+ }, |
|
279 |
+ |
|
280 |
+ complete() { |
|
281 |
+ const { unit_id, book_id } = this.$route.query; |
|
282 |
+ this.$router.push({ |
|
283 |
+ name: 'Dashboard', |
|
284 |
+ query: { value: this.seq, unit_id, book_id }, |
|
285 |
+ }); |
|
286 |
+ }, |
|
287 |
+ goToPage(page) { |
|
288 |
+ this.$router.push({ name: page }); |
|
289 |
+ }, |
|
290 |
+ handleDragStart(event) { |
|
291 |
+ this.draggedElementId = event.target.id; // 드래그한 요소의 ID를 저장 |
|
292 |
+ event.dataTransfer.setData('text/plain', this.draggedElementId); |
|
293 |
+ }, |
|
294 |
+ handleDragOver(event) { |
|
295 |
+ event.preventDefault(); // 드롭을 허용 |
|
296 |
+ }, |
|
297 |
+ handleDrop(event) { |
|
298 |
+ event.preventDefault(); |
|
299 |
+ |
|
300 |
+ // 드롭된 영역이 버튼인지 확인 |
|
301 |
+ const dropZone = event.target.closest('button.dropzone'); |
|
302 |
+ |
|
303 |
+ if (dropZone) { |
|
304 |
+ // 잉크 이미지를 숨깁니다 |
|
305 |
+ const inkImage = dropZone.querySelector('img:first-child'); |
|
306 |
+ if (inkImage) { |
|
307 |
+ inkImage.style.display = 'none'; |
|
308 |
+ } |
|
309 |
+ |
|
310 |
+ // 클릭포인트 이미지를 숨깁니다 |
|
311 |
+ const clickPointImage = dropZone.querySelector('img:nth-child(2)'); |
|
312 |
+ if (clickPointImage) { |
|
313 |
+ clickPointImage.style.display = 'none'; |
|
314 |
+ } |
|
315 |
+ } |
|
316 |
+ |
|
317 |
+ // 드래그한 요소를 원래 위치로 복원 |
|
318 |
+ const draggedElement = document.getElementById(this.draggedElementId); |
|
319 |
+ if (draggedElement) { |
|
320 |
+ draggedElement.style.visibility = 'visible'; |
|
321 |
+ draggedElement.style.position = ''; |
|
322 |
+ draggedElement.style.top = ''; |
|
323 |
+ draggedElement.style.left = ''; |
|
324 |
+ } |
|
325 |
+ |
|
326 |
+ this.draggedElementId = null; // 드래그 상태 초기화 |
|
327 |
+ }, |
|
328 |
+ returnPage() { |
|
329 |
+ window.location.reload(); |
|
330 |
+ }, |
|
331 |
+ }, |
|
332 |
+ mounted() { |
|
333 |
+ this.pageSetting(); |
|
334 |
+ // 드래그 가능한 영역에 드래그 오버 및 드롭 이벤트를 추가합니다 |
|
335 |
+ document.querySelectorAll('.dropzone').forEach((button) => { |
|
336 |
+ button.addEventListener('dragover', this.handleDragOver); |
|
337 |
+ button.addEventListener('drop', this.handleDrop); |
|
231 | 338 |
}); |
232 |
- |
|
233 |
- const wordList = response.data; |
|
234 |
- |
|
235 |
- // 각 word 객체에 대해 fileRpath를 받아오는 요청 처리 |
|
236 |
- const requests = wordList.map(async (word) => { |
|
237 |
- const fileResponse = await axios.post("/file/find.json", { |
|
238 |
- file_mng_id: word.fileMngId, |
|
239 |
- }); |
|
240 |
- |
|
241 |
- const fileRpath = |
|
242 |
- fileResponse.data.list.length > 0 |
|
243 |
- ? fileResponse.data.list[0].fileRpath |
|
244 |
- : null; |
|
245 |
- console.log("각 단어의 fileRpath: ", fileRpath); |
|
246 |
- |
|
247 |
- word.fileRpath = "http://165.229.169.113:9080/" + fileRpath; // fileRpath 값을 해당 객체에 추가 |
|
248 |
- }); |
|
249 |
- |
|
250 |
- // 모든 요청이 완료될 때까지 대기 |
|
251 |
- await Promise.all(requests); |
|
252 |
- |
|
253 |
- // 최종적으로 wordList를 설정 |
|
254 |
- this.wordList = wordList; |
|
255 |
- console.log("단어 리스트 -> ", this.wordList); |
|
256 |
- } catch (error) { |
|
257 |
- console.error("단어 목록을 불러오는 중 오류 발생:", error); |
|
258 |
- } |
|
259 | 339 |
}, |
260 |
- |
|
261 |
- async goToPrevPage() { |
|
262 |
- if (this.currentWdBkIndex - 1 < 0) { |
|
263 |
- alert("단어장 첫번째 페이지 입니다"); |
|
264 |
- } else { |
|
265 |
- this.currentWdBkIndex--; |
|
266 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
267 |
- |
|
268 |
- try { |
|
269 |
- const response = await axios.post("/wordbook/find.json", { |
|
270 |
- wdBookId: |
|
271 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
272 |
- }); |
|
273 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
274 |
- console.log("이전 단어장 타입 id: ", this.wdBookTypeIdState); |
|
275 |
- |
|
276 |
- switch (this.wdBookTypeIdState) { |
|
277 |
- case "1": |
|
278 |
- this.wordBookType = "Chapter2"; |
|
279 |
- break; |
|
280 |
- case "2": |
|
281 |
- this.wordBookType = "Chapter2_3"; |
|
282 |
- break; |
|
283 |
- case "3": |
|
284 |
- this.wordBookType = "Chapter2_2"; |
|
285 |
- break; |
|
286 |
- case "4": |
|
287 |
- this.wordBookType = "Chapter2_9"; |
|
288 |
- break; |
|
289 |
- case "5": |
|
290 |
- this.wordBookType = "Chapter2_4"; |
|
291 |
- break; |
|
292 |
- default: |
|
293 |
- this.wordBookType = null; |
|
294 |
- } |
|
295 |
- |
|
296 |
- this.goToPage(this.wordBookType); |
|
297 |
- } catch (error) { |
|
298 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
299 |
- } |
|
300 |
- } |
|
340 |
+ components: { |
|
341 |
+ BookInfo: BookInfo, |
|
301 | 342 |
}, |
302 |
- |
|
303 |
- async goToNextPage() { |
|
304 |
- if (this.currentWdBkIndex + 1 >= this.wdBookIdList.length) { |
|
305 |
- alert("단어장 마지막 페이지 입니다"); |
|
306 |
- this.complete(); |
|
307 |
- } else { |
|
308 |
- this.currentWdBkIndex++; |
|
309 |
- this.$store.dispatch("updateCurrentWdBkIndex", this.currentWdBkIndex); |
|
310 |
- |
|
311 |
- try { |
|
312 |
- const response = await axios.post("/wordbook/find.json", { |
|
313 |
- wdBookId: |
|
314 |
- this.$store.getters.getWdBookIdList[this.currentWdBkIndex], |
|
315 |
- }); |
|
316 |
- this.wdBookTypeIdState = response.data.wdBookTypeId; |
|
317 |
- console.log("다음 단어장 타입 id: ", this.wdBookTypeIdState); |
|
318 |
- |
|
319 |
- switch (this.wdBookTypeIdState) { |
|
320 |
- case "1": |
|
321 |
- this.wordBookType = "Chapter2"; |
|
322 |
- break; |
|
323 |
- case "2": |
|
324 |
- this.wordBookType = "Chapter2_3"; |
|
325 |
- break; |
|
326 |
- case "3": |
|
327 |
- this.wordBookType = "Chapter2_2"; |
|
328 |
- break; |
|
329 |
- case "4": |
|
330 |
- this.wordBookType = "Chapter2_9"; |
|
331 |
- break; |
|
332 |
- case "5": |
|
333 |
- this.wordBookType = "Chapter2_4"; |
|
334 |
- break; |
|
335 |
- default: |
|
336 |
- this.wordBookType = null; |
|
337 |
- } |
|
338 |
- |
|
339 |
- this.goToPage(this.wordBookType); |
|
340 |
- } catch (error) { |
|
341 |
- console.error("단어장 정보 불러오는 중 오류 발생:", error); |
|
342 |
- } |
|
343 |
- } |
|
344 |
- }, |
|
345 |
- |
|
346 |
- complete() { |
|
347 |
- const { unit_id, book_id } = this.$route.query; |
|
348 |
- this.$router.push({ |
|
349 |
- name: "Dashboard", |
|
350 |
- query: { value: this.seq, unit_id, book_id }, |
|
351 |
- }); |
|
352 |
- }, |
|
353 |
- goToPage(page) { |
|
354 |
- this.$router.push({ name: page }); |
|
355 |
- }, |
|
356 |
- handleDragStart(event) { |
|
357 |
- this.draggedElementId = event.target.id; // 드래그한 요소의 ID를 저장 |
|
358 |
- event.dataTransfer.setData("text/plain", this.draggedElementId); |
|
359 |
- }, |
|
360 |
- handleDragOver(event) { |
|
361 |
- event.preventDefault(); // 드롭을 허용 |
|
362 |
- }, |
|
363 |
- handleDrop(event) { |
|
364 |
- event.preventDefault(); |
|
365 |
- |
|
366 |
- // 드롭된 영역이 버튼인지 확인 |
|
367 |
- const dropZone = event.target.closest("button.dropzone"); |
|
368 |
- |
|
369 |
- if (dropZone) { |
|
370 |
- // 잉크 이미지를 숨깁니다 |
|
371 |
- const inkImage = dropZone.querySelector("img:first-child"); |
|
372 |
- if (inkImage) { |
|
373 |
- inkImage.style.display = "none"; |
|
374 |
- } |
|
375 |
- |
|
376 |
- // 클릭포인트 이미지를 숨깁니다 |
|
377 |
- const clickPointImage = dropZone.querySelector("img:nth-child(2)"); |
|
378 |
- if (clickPointImage) { |
|
379 |
- clickPointImage.style.display = "none"; |
|
380 |
- } |
|
381 |
- } |
|
382 |
- |
|
383 |
- // 드래그한 요소를 원래 위치로 복원 |
|
384 |
- const draggedElement = document.getElementById(this.draggedElementId); |
|
385 |
- if (draggedElement) { |
|
386 |
- draggedElement.style.visibility = "visible"; |
|
387 |
- draggedElement.style.position = ""; |
|
388 |
- draggedElement.style.top = ""; |
|
389 |
- draggedElement.style.left = ""; |
|
390 |
- } |
|
391 |
- |
|
392 |
- this.draggedElementId = null; // 드래그 상태 초기화 |
|
393 |
- }, |
|
394 |
- returnPage() { |
|
395 |
- window.location.reload(); |
|
396 |
- }, |
|
397 |
- }, |
|
398 |
- mounted() { |
|
399 |
- this.pageSetting(); |
|
400 |
- // 드래그 가능한 영역에 드래그 오버 및 드롭 이벤트를 추가합니다 |
|
401 |
- document.querySelectorAll(".dropzone").forEach((button) => { |
|
402 |
- button.addEventListener("dragover", this.handleDragOver); |
|
403 |
- button.addEventListener("drop", this.handleDrop); |
|
404 |
- }); |
|
405 |
- }, |
|
406 | 343 |
}; |
407 | 344 |
</script> |
408 | 345 |
|
409 | 346 |
<style scoped> |
410 | 347 |
.vocaGroup { |
411 |
- width: 79%; |
|
412 |
- position: absolute; |
|
413 |
- top: 90px; |
|
414 |
- left: 120px; |
|
415 |
- display: flex; |
|
416 |
- flex-wrap: wrap; |
|
348 |
+ width: 79%; |
|
349 |
+ position: absolute; |
|
350 |
+ top: 90px; |
|
351 |
+ left: 120px; |
|
352 |
+ display: flex; |
|
353 |
+ flex-wrap: wrap; |
|
417 | 354 |
} |
418 | 355 |
|
419 | 356 |
.word-item { |
420 |
- width: 49%; |
|
357 |
+ width: 49%; |
|
421 | 358 |
} |
422 | 359 |
|
423 | 360 |
.ink { |
424 |
- cursor: pointer; |
|
361 |
+ cursor: pointer; |
|
425 | 362 |
} |
426 | 363 |
|
427 | 364 |
.completeBtn { |
428 |
- margin-right: 100px; |
|
429 |
- background-color: #ffba08; |
|
430 |
- padding: 10px 30px; |
|
431 |
- border-radius: 10px; |
|
432 |
- font-size: 28px; |
|
433 |
- font-family: "ONEMobilePOPOTF"; |
|
365 |
+ margin-right: 100px; |
|
366 |
+ background-color: #ffba08; |
|
367 |
+ padding: 10px 30px; |
|
368 |
+ border-radius: 10px; |
|
369 |
+ font-size: 28px; |
|
370 |
+ font-family: 'ONEMobilePOPOTF'; |
|
434 | 371 |
} |
435 | 372 |
</style> |
--- client/views/pages/main/Chapter/Chapter3.vue
+++ client/views/pages/main/Chapter/Chapter3.vue
... | ... | @@ -1,399 +1,375 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div |
|
11 |
- class="title-box mb25 flex align-center mt40" |
|
12 |
- style="justify-content: space-between" |
|
13 |
- > |
|
14 |
- <div> |
|
15 |
- <span class="title mr40">1. Hello WORLD</span> |
|
16 |
- <span class="subtitle">my name is dd</span> |
|
17 |
- </div> |
|
18 |
- <button class="completeBtn" @click="complete">학습 종료</button> |
|
19 |
- </div> |
|
20 |
- <div class="flex justify-between align-center"> |
|
21 |
- <div class="pre-btn" @click="previousProblem()"> |
|
22 |
- <img |
|
23 |
- src="../../../../resources/img/left.png" |
|
24 |
- alt="" |
|
25 |
- :class="{ active: currentIndex === 0 }" |
|
26 |
- /> |
|
27 |
- </div> |
|
28 |
- <div class="content title-box"> |
|
29 |
- ,,, |
|
30 |
- <p class="title mt25 title-bg">step3.</p> |
|
31 |
- <div |
|
32 |
- class="flex align-center mb30" |
|
33 |
- style="justify-content: space-between" |
|
34 |
- > |
|
35 |
- <p class="subtitle2 mr20"> |
|
36 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
37 |
- </p> |
|
38 |
- </div> |
|
39 |
- |
|
40 |
- <div |
|
41 |
- class="flex align-center justify-center" |
|
42 |
- style="margin-top: 9rem; gap: 113px" |
|
43 |
- > |
|
44 |
- <div class="time-hint"> |
|
45 |
- <button class="hint-btn">HINT</button> |
|
46 |
- <div class="time-bg mt20"> |
|
47 |
- <div> |
|
48 |
- <div class="time"> |
|
49 |
- <p class="second">{{ timer }}</p> |
|
50 |
- <p class="text">sec</p> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
51 | 7 |
</div> |
52 |
- </div> |
|
53 |
- </div> |
|
54 |
- </div> |
|
55 |
- <div class="imgGroup"> |
|
56 |
- <div class="flex" style="gap: 60px"> |
|
57 |
- <img src="../../../../resources/img/img106_48s.png" alt="" /> |
|
58 |
- </div> |
|
59 |
- </div> |
|
60 |
- <div class="pickGroup"> |
|
61 |
- <article |
|
62 |
- class="flex justify-center mb50" |
|
63 |
- style="gap: 60px" |
|
64 |
- v-for="(item, index) in problemDetail" |
|
65 |
- :key="index" |
|
66 |
- > |
|
67 |
- <div class="flex" @click="handleClick(item.prblmDtlExpln)"> |
|
68 |
- <button> |
|
69 |
- <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
70 |
- <p :class="{ active: selectedButton === item.prblmDtlExpln }"> |
|
71 |
- {{ index + 1 }} |
|
72 |
- </p> |
|
73 |
- </button> |
|
74 |
- <p>{{ item.prblmDtlExpln }}</p> |
|
75 |
- </div> |
|
76 |
- </article> |
|
77 |
- </div> |
|
8 |
+ </router-link> |
|
78 | 9 |
</div> |
79 |
- <button |
|
80 |
- class="submit-button" |
|
81 |
- @click="handleSubmit()" |
|
82 |
- v-if="currentIndex === learningIdsLength - 1" |
|
83 |
- > |
|
84 |
- 제출하기 |
|
85 |
- </button> |
|
86 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
87 |
- 다음 문제로 |
|
88 |
- </button> |
|
89 |
- </div> |
|
90 |
- <div class="next-btn" @click="nextProblem()"> |
|
91 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
92 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40" style="justify-content: space-between"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ <button class="completeBtn" @click="complete">학습 종료</button> |
|
13 |
+ </div> |
|
14 |
+ <div class="flex justify-between align-center"> |
|
15 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
16 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
17 |
+ </div> |
|
18 |
+ <div class="content title-box"> |
|
19 |
+ ,,, |
|
20 |
+ <p class="title mt25 title-bg">step3.</p> |
|
21 |
+ <div class="flex align-center mb30" style="justify-content: space-between"> |
|
22 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
23 |
+ </div> |
|
24 |
+ |
|
25 |
+ <div class="flex align-center justify-center" style="margin-top: 9rem; gap: 113px"> |
|
26 |
+ <div class="time-hint"> |
|
27 |
+ <button class="hint-btn">HINT</button> |
|
28 |
+ <div class="time-bg mt20"> |
|
29 |
+ <div> |
|
30 |
+ <div class="time"> |
|
31 |
+ <p class="second">{{ timer }}</p> |
|
32 |
+ <p class="text">sec</p> |
|
33 |
+ </div> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ <div class="imgGroup"> |
|
38 |
+ <div class="flex" style="gap: 60px"> |
|
39 |
+ <img src="../../../../resources/img/img106_48s.png" alt="" /> |
|
40 |
+ </div> |
|
41 |
+ </div> |
|
42 |
+ <div class="pickGroup"> |
|
43 |
+ <article |
|
44 |
+ class="flex justify-center mb50" |
|
45 |
+ style="gap: 60px" |
|
46 |
+ v-for="(item, index) in problemDetail" |
|
47 |
+ :key="index" |
|
48 |
+ > |
|
49 |
+ <div class="flex" @click="handleClick(item.prblmDtlExpln)"> |
|
50 |
+ <button> |
|
51 |
+ <img src="../../../../resources/img/img136_71s.png" alt="" /> |
|
52 |
+ <p :class="{ active: selectedButton === item.prblmDtlExpln }"> |
|
53 |
+ {{ index + 1 }} |
|
54 |
+ </p> |
|
55 |
+ </button> |
|
56 |
+ <p>{{ item.prblmDtlExpln }}</p> |
|
57 |
+ </div> |
|
58 |
+ </article> |
|
59 |
+ </div> |
|
60 |
+ </div> |
|
61 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
62 |
+ 제출하기 |
|
63 |
+ </button> |
|
64 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
65 |
+ </div> |
|
66 |
+ <div class="next-btn" @click="nextProblem()"> |
|
67 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
68 |
+ </div> |
|
69 |
+ </div> |
|
93 | 70 |
</div> |
94 |
- </div> |
|
95 | 71 |
</template> |
96 | 72 |
|
97 | 73 |
<script> |
98 |
-import axios from "axios"; |
|
74 |
+import axios from 'axios'; |
|
75 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
99 | 76 |
export default { |
100 |
- data() { |
|
101 |
- return { |
|
102 |
- timer: "00", |
|
103 |
- selectedButton: null, // 선택한 버튼 |
|
104 |
- prblm_id: [], |
|
105 |
- unit_id: null, |
|
106 |
- dataList: [], |
|
107 |
- problemDetail: [], |
|
108 |
- currentIndex: null, |
|
109 |
- learningIdsLength: null, |
|
110 |
- }; |
|
111 |
- }, |
|
112 |
- methods: { |
|
113 |
- complete() { |
|
114 |
- const { unit_id, book_id } = this.$route.query; |
|
115 |
- this.$router.push({ |
|
116 |
- name: "Dashboard", |
|
117 |
- query: { value: 8, unit_id, book_id }, |
|
118 |
- }); |
|
77 |
+ data() { |
|
78 |
+ return { |
|
79 |
+ timer: '00', |
|
80 |
+ selectedButton: null, // 선택한 버튼 |
|
81 |
+ prblm_id: [], |
|
82 |
+ unit_id: null, |
|
83 |
+ dataList: [], |
|
84 |
+ problemDetail: [], |
|
85 |
+ currentIndex: null, |
|
86 |
+ learningIdsLength: null, |
|
87 |
+ }; |
|
119 | 88 |
}, |
120 |
- goToPage(page) { |
|
121 |
- this.$router.push({ name: page }); |
|
122 |
- }, |
|
123 |
- startTimer() { |
|
124 |
- if (this.intervalId) { |
|
125 |
- clearInterval(this.intervalId); |
|
126 |
- } |
|
127 |
- this.timer = 5; |
|
128 |
- this.intervalId = setInterval(() => { |
|
129 |
- if (this.timer > 0) { |
|
130 |
- this.timer--; |
|
131 |
- } else { |
|
132 |
- clearInterval(this.intervalId); |
|
133 |
- } |
|
134 |
- }, 1000); |
|
135 |
- }, |
|
136 |
- handleClick(answer) { |
|
137 |
- console.log(answer); |
|
138 |
- this.selectedButton = answer; |
|
139 |
- }, |
|
140 |
- // 제출하기 버튼 |
|
141 |
- handleSubmit() { |
|
142 |
- const problemData = { |
|
143 |
- prblmInfo: this.currentLearningId, |
|
144 |
- prblmNumber: this.currentProblemIndex, |
|
145 |
- prblmAns: this.selectedButton, |
|
146 |
- }; |
|
147 |
- const answerData = { |
|
148 |
- prblmId: this.currentLearningId.prblm_id, |
|
149 |
- prblmAns: this.selectedButton, |
|
150 |
- stdId: this.$store.getters.getStdId, |
|
151 |
- prblmLogAnsCnt: 1, |
|
152 |
- }; |
|
153 |
- this.$store.dispatch("saveProblemData", problemData); |
|
154 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
155 |
- console.log(this.$store.getters.getAllProblems); |
|
156 |
- console.log(this.$store.getters.getAllAnswers); |
|
157 |
- |
|
158 |
- axios({ |
|
159 |
- url: "problemLog/insertProblemLog.json", |
|
160 |
- method: "post", |
|
161 |
- headers: { |
|
162 |
- "Content-Type": "application/json; charset=UTF-8", |
|
89 |
+ methods: { |
|
90 |
+ complete() { |
|
91 |
+ const { unit_id, book_id } = this.$route.query; |
|
92 |
+ this.$router.push({ |
|
93 |
+ name: 'Dashboard', |
|
94 |
+ query: { value: 8, unit_id, book_id }, |
|
95 |
+ }); |
|
163 | 96 |
}, |
164 |
- data: this.$store.getters.getAllAnswers, |
|
165 |
- }) |
|
166 |
- .then(function (res) { |
|
167 |
- console.log("problem - response : ", res.data); |
|
168 |
- }) |
|
169 |
- .catch(function (error) { |
|
170 |
- console.log("problem - error : ", error); |
|
171 |
- }); |
|
172 |
- }, |
|
173 |
- getProblem() { |
|
174 |
- const vm = this; |
|
175 |
- const prblmId = this.currentLearningId.prblm_id; |
|
176 |
- axios({ |
|
177 |
- url: "problem/problemInfo.json", |
|
178 |
- method: "post", |
|
179 |
- headers: { |
|
180 |
- "Content-Type": "application/json; charset=UTF-8", |
|
97 |
+ goToPage(page) { |
|
98 |
+ this.$router.push({ name: page }); |
|
181 | 99 |
}, |
182 |
- data: { |
|
183 |
- prblmId: prblmId, |
|
100 |
+ startTimer() { |
|
101 |
+ if (this.intervalId) { |
|
102 |
+ clearInterval(this.intervalId); |
|
103 |
+ } |
|
104 |
+ this.timer = 5; |
|
105 |
+ this.intervalId = setInterval(() => { |
|
106 |
+ if (this.timer > 0) { |
|
107 |
+ this.timer--; |
|
108 |
+ } else { |
|
109 |
+ clearInterval(this.intervalId); |
|
110 |
+ } |
|
111 |
+ }, 1000); |
|
184 | 112 |
}, |
185 |
- }) |
|
186 |
- .then(function (res) { |
|
187 |
- console.log("problem - response : ", res.data); |
|
188 |
- vm.dataList = res.data.problem; |
|
189 |
- vm.problemDetail = res.data.problemDetail; |
|
190 |
- }) |
|
191 |
- .catch(function (error) { |
|
192 |
- console.log("problem - error : ", error); |
|
193 |
- }); |
|
194 |
- }, |
|
195 |
- nextProblem() { |
|
196 |
- const problemData = { |
|
197 |
- prblmInfo: this.currentLearningId, |
|
198 |
- prblmNumber: this.currentProblemIndex, |
|
199 |
- prblmAns: this.selectedButton, |
|
200 |
- }; |
|
201 |
- const answerData = { |
|
202 |
- prblmId: this.currentLearningId.prblm_id, |
|
203 |
- prblmAns: this.selectedButton, |
|
204 |
- stdId: this.$store.getters.getStdId, |
|
205 |
- prblmLogAnsCnt: 1, |
|
206 |
- }; |
|
207 |
- this.$store.dispatch("saveProblemData", problemData); |
|
208 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
209 |
- console.log(this.$store.getters.getAllProblems); |
|
210 |
- console.log(this.$store.getters.getAllAnswers); |
|
211 |
- if ( |
|
212 |
- this.currentProblemIndex < |
|
213 |
- this.$store.state.currentLearningIds.length - 1 |
|
214 |
- ) { |
|
215 |
- this.$store.dispatch("goToNextProblem"); |
|
216 |
- this.handleProblemDetail(this.currentLearningId); |
|
217 |
- this.goToPage(this.problemType); |
|
218 |
- } |
|
219 |
- }, |
|
220 |
- previousProblem() { |
|
221 |
- if (this.currentProblemIndex > 0) { |
|
222 |
- this.$store.dispatch("goToPreviousProblem"); |
|
223 |
- this.handleProblemDetail(this.currentLearningId); |
|
224 |
- this.goToPage(this.problemType); |
|
225 |
- } |
|
226 |
- }, |
|
113 |
+ handleClick(answer) { |
|
114 |
+ console.log(answer); |
|
115 |
+ this.selectedButton = answer; |
|
116 |
+ }, |
|
117 |
+ // 제출하기 버튼 |
|
118 |
+ handleSubmit() { |
|
119 |
+ const problemData = { |
|
120 |
+ prblmInfo: this.currentLearningId, |
|
121 |
+ prblmNumber: this.currentProblemIndex, |
|
122 |
+ prblmAns: this.selectedButton, |
|
123 |
+ }; |
|
124 |
+ const answerData = { |
|
125 |
+ prblmId: this.currentLearningId.prblm_id, |
|
126 |
+ prblmAns: this.selectedButton, |
|
127 |
+ stdId: this.$store.getters.getStdId, |
|
128 |
+ prblmLogAnsCnt: 1, |
|
129 |
+ }; |
|
130 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
131 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
132 |
+ console.log(this.$store.getters.getAllProblems); |
|
133 |
+ console.log(this.$store.getters.getAllAnswers); |
|
227 | 134 |
|
228 |
- handleProblemDetail(item) { |
|
229 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
230 |
- this.problemType = "Chapter3"; |
|
231 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
232 |
- this.problemType = "Chapter3_1"; |
|
233 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
234 |
- this.problemType = "Chapter3_2"; |
|
235 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
236 |
- this.problemType = "Chapter3_3"; |
|
237 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
238 |
- this.problemType = "Chapter3_3_1"; |
|
239 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
240 |
- this.problemType = "Chapter3_4"; |
|
241 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
242 |
- this.problemType = "Chapter3_5"; |
|
243 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
244 |
- this.problemType = "Chapter3_6"; |
|
245 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
246 |
- this.problemType = "Chapter3_7"; |
|
247 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
248 |
- this.problemType = "Chapter3_8"; |
|
249 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
250 |
- this.problemType = "Chapter3_9"; |
|
251 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
252 |
- this.problemType = "Chapter3_10"; |
|
253 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
254 |
- this.problemType = "Chapter3_11"; |
|
255 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
256 |
- this.problemType = "Chapter3_12"; |
|
257 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
258 |
- this.problemType = "Chapter3_13"; |
|
259 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
260 |
- this.problemType = "Chapter3_14"; |
|
261 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
262 |
- this.problemType = "Chapter3_15"; |
|
263 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
264 |
- this.problemType = "Chapter2_8"; |
|
265 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
266 |
- this.problemType = "Chapter2_7"; |
|
267 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
268 |
- this.problemType = "Chapter2_5"; |
|
269 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
270 |
- this.problemType = "Chapter2_6"; |
|
271 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
272 |
- this.problemType = "Chapter2_10"; |
|
273 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
274 |
- this.problemType = "Chapter2_11"; |
|
275 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
276 |
- this.problemType = "Chapter2_13"; |
|
277 |
- } |
|
278 |
- }, |
|
279 |
- }, |
|
280 |
- watch: {}, |
|
281 |
- computed: { |
|
282 |
- currentLearningId() { |
|
283 |
- return this.$store.getters.currentLearningId; |
|
284 |
- }, |
|
285 |
- currentLabel() { |
|
286 |
- return this.$store.getters.currentLabel; |
|
287 |
- }, |
|
288 |
- currentProblemIndex() { |
|
289 |
- return this.$store.getters.currentProblemIndex; |
|
290 |
- }, |
|
291 |
- isPreviousButtonDisabled() { |
|
292 |
- return this.currentProblemIndex === 0; |
|
293 |
- }, |
|
294 |
- getAllProblems() { |
|
295 |
- return this.$store.getters.getAllProblems; |
|
296 |
- }, |
|
297 |
- getStdId() { |
|
298 |
- return this.$store.getters.getStdId; |
|
299 |
- }, |
|
300 |
- }, |
|
301 |
- created() { |
|
302 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
303 |
- console.log("Current Label:", this.currentLabel); |
|
304 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
135 |
+ axios({ |
|
136 |
+ url: 'problemLog/insertProblemLog.json', |
|
137 |
+ method: 'post', |
|
138 |
+ headers: { |
|
139 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
140 |
+ }, |
|
141 |
+ data: this.$store.getters.getAllAnswers, |
|
142 |
+ }) |
|
143 |
+ .then(function (res) { |
|
144 |
+ console.log('problem - response : ', res.data); |
|
145 |
+ }) |
|
146 |
+ .catch(function (error) { |
|
147 |
+ console.log('problem - error : ', error); |
|
148 |
+ }); |
|
149 |
+ }, |
|
150 |
+ getProblem() { |
|
151 |
+ const vm = this; |
|
152 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
153 |
+ axios({ |
|
154 |
+ url: 'problem/problemInfo.json', |
|
155 |
+ method: 'post', |
|
156 |
+ headers: { |
|
157 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
158 |
+ }, |
|
159 |
+ data: { |
|
160 |
+ prblmId: prblmId, |
|
161 |
+ }, |
|
162 |
+ }) |
|
163 |
+ .then(function (res) { |
|
164 |
+ console.log('problem - response : ', res.data); |
|
165 |
+ vm.dataList = res.data.problem; |
|
166 |
+ vm.problemDetail = res.data.problemDetail; |
|
167 |
+ }) |
|
168 |
+ .catch(function (error) { |
|
169 |
+ console.log('problem - error : ', error); |
|
170 |
+ }); |
|
171 |
+ }, |
|
172 |
+ nextProblem() { |
|
173 |
+ const problemData = { |
|
174 |
+ prblmInfo: this.currentLearningId, |
|
175 |
+ prblmNumber: this.currentProblemIndex, |
|
176 |
+ prblmAns: this.selectedButton, |
|
177 |
+ }; |
|
178 |
+ const answerData = { |
|
179 |
+ prblmId: this.currentLearningId.prblm_id, |
|
180 |
+ prblmAns: this.selectedButton, |
|
181 |
+ stdId: this.$store.getters.getStdId, |
|
182 |
+ prblmLogAnsCnt: 1, |
|
183 |
+ }; |
|
184 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
185 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
186 |
+ console.log(this.$store.getters.getAllProblems); |
|
187 |
+ console.log(this.$store.getters.getAllAnswers); |
|
188 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
189 |
+ this.$store.dispatch('goToNextProblem'); |
|
190 |
+ this.handleProblemDetail(this.currentLearningId); |
|
191 |
+ this.goToPage(this.problemType); |
|
192 |
+ } |
|
193 |
+ }, |
|
194 |
+ previousProblem() { |
|
195 |
+ if (this.currentProblemIndex > 0) { |
|
196 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
197 |
+ this.handleProblemDetail(this.currentLearningId); |
|
198 |
+ this.goToPage(this.problemType); |
|
199 |
+ } |
|
200 |
+ }, |
|
305 | 201 |
|
306 |
- // Fetch or process the current problem based on `currentLearningId` |
|
307 |
- }, |
|
308 |
- components: {}, |
|
309 |
- mounted() { |
|
310 |
- this.getProblem(); |
|
311 |
- }, |
|
202 |
+ handleProblemDetail(item) { |
|
203 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
204 |
+ this.problemType = 'Chapter3'; |
|
205 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
206 |
+ this.problemType = 'Chapter3_1'; |
|
207 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
208 |
+ this.problemType = 'Chapter3_2'; |
|
209 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
210 |
+ this.problemType = 'Chapter3_3'; |
|
211 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
212 |
+ this.problemType = 'Chapter3_3_1'; |
|
213 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
214 |
+ this.problemType = 'Chapter3_4'; |
|
215 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
216 |
+ this.problemType = 'Chapter3_5'; |
|
217 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
218 |
+ this.problemType = 'Chapter3_6'; |
|
219 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
220 |
+ this.problemType = 'Chapter3_7'; |
|
221 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
222 |
+ this.problemType = 'Chapter3_8'; |
|
223 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
224 |
+ this.problemType = 'Chapter3_9'; |
|
225 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
226 |
+ this.problemType = 'Chapter3_10'; |
|
227 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
228 |
+ this.problemType = 'Chapter3_11'; |
|
229 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
230 |
+ this.problemType = 'Chapter3_12'; |
|
231 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
232 |
+ this.problemType = 'Chapter3_13'; |
|
233 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
234 |
+ this.problemType = 'Chapter3_14'; |
|
235 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
236 |
+ this.problemType = 'Chapter3_15'; |
|
237 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
238 |
+ this.problemType = 'Chapter2_8'; |
|
239 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
240 |
+ this.problemType = 'Chapter2_7'; |
|
241 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
242 |
+ this.problemType = 'Chapter2_5'; |
|
243 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
244 |
+ this.problemType = 'Chapter2_6'; |
|
245 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
246 |
+ this.problemType = 'Chapter2_10'; |
|
247 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
248 |
+ this.problemType = 'Chapter2_11'; |
|
249 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
250 |
+ this.problemType = 'Chapter2_13'; |
|
251 |
+ } |
|
252 |
+ }, |
|
253 |
+ }, |
|
254 |
+ watch: {}, |
|
255 |
+ computed: { |
|
256 |
+ currentLearningId() { |
|
257 |
+ return this.$store.getters.currentLearningId; |
|
258 |
+ }, |
|
259 |
+ currentLabel() { |
|
260 |
+ return this.$store.getters.currentLabel; |
|
261 |
+ }, |
|
262 |
+ currentProblemIndex() { |
|
263 |
+ return this.$store.getters.currentProblemIndex; |
|
264 |
+ }, |
|
265 |
+ isPreviousButtonDisabled() { |
|
266 |
+ return this.currentProblemIndex === 0; |
|
267 |
+ }, |
|
268 |
+ getAllProblems() { |
|
269 |
+ return this.$store.getters.getAllProblems; |
|
270 |
+ }, |
|
271 |
+ getStdId() { |
|
272 |
+ return this.$store.getters.getStdId; |
|
273 |
+ }, |
|
274 |
+ }, |
|
275 |
+ created() { |
|
276 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
277 |
+ console.log('Current Label:', this.currentLabel); |
|
278 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
279 |
+ |
|
280 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
281 |
+ }, |
|
282 |
+ components: { |
|
283 |
+ BookInfo: BookInfo, |
|
284 |
+ }, |
|
285 |
+ mounted() { |
|
286 |
+ this.getProblem(); |
|
287 |
+ }, |
|
312 | 288 |
}; |
313 | 289 |
</script> |
314 | 290 |
<style scoped> |
315 | 291 |
.imgGroup { |
316 |
- width: fit-content; |
|
292 |
+ width: fit-content; |
|
317 | 293 |
} |
318 | 294 |
|
319 | 295 |
.imgGroup button { |
320 |
- position: relative; |
|
296 |
+ position: relative; |
|
321 | 297 |
} |
322 | 298 |
|
323 | 299 |
.imgGroup button p, |
324 | 300 |
.textbox p { |
325 |
- position: absolute; |
|
326 |
- top: 50%; |
|
327 |
- left: 50%; |
|
328 |
- transform: translate(-50%, -50%); |
|
329 |
- width: fit-content; |
|
330 |
- height: fit-content; |
|
331 |
- background: #ffffffb8; |
|
332 |
- border-radius: 5px; |
|
333 |
- padding: 10px; |
|
334 |
- font-size: 48px; |
|
335 |
- font-family: "ONEMobilePOP"; |
|
301 |
+ position: absolute; |
|
302 |
+ top: 50%; |
|
303 |
+ left: 50%; |
|
304 |
+ transform: translate(-50%, -50%); |
|
305 |
+ width: fit-content; |
|
306 |
+ height: fit-content; |
|
307 |
+ background: #ffffffb8; |
|
308 |
+ border-radius: 5px; |
|
309 |
+ padding: 10px; |
|
310 |
+ font-size: 48px; |
|
311 |
+ font-family: 'ONEMobilePOP'; |
|
336 | 312 |
} |
337 | 313 |
|
338 | 314 |
.pickGroup { |
339 |
- display: flex; |
|
340 |
- flex-direction: column; |
|
341 |
- align-items: flex-start; |
|
315 |
+ display: flex; |
|
316 |
+ flex-direction: column; |
|
317 |
+ align-items: flex-start; |
|
342 | 318 |
} |
343 | 319 |
|
344 | 320 |
.pickGroup button { |
345 |
- position: relative; |
|
346 |
- margin-right: 30px; |
|
321 |
+ position: relative; |
|
322 |
+ margin-right: 30px; |
|
347 | 323 |
} |
348 | 324 |
|
349 | 325 |
.pickGroup button p { |
350 |
- font-size: 34px; |
|
351 |
- color: #c6c6c6; |
|
352 |
- position: absolute; |
|
353 |
- top: 50%; |
|
354 |
- left: 50%; |
|
355 |
- transform: translate(-50%, -50%); |
|
326 |
+ font-size: 34px; |
|
327 |
+ color: #c6c6c6; |
|
328 |
+ position: absolute; |
|
329 |
+ top: 50%; |
|
330 |
+ left: 50%; |
|
331 |
+ transform: translate(-50%, -50%); |
|
356 | 332 |
} |
357 | 333 |
|
358 | 334 |
.pickGroup article img { |
359 |
- object-fit: contain; |
|
360 |
- width: -webkit-fill-available; |
|
335 |
+ object-fit: contain; |
|
336 |
+ width: -webkit-fill-available; |
|
361 | 337 |
} |
362 | 338 |
|
363 | 339 |
.pickGroup article > div > p { |
364 |
- font-size: 64px; |
|
340 |
+ font-size: 64px; |
|
365 | 341 |
} |
366 | 342 |
|
367 | 343 |
.pre-btn img.active { |
368 |
- visibility: hidden; |
|
344 |
+ visibility: hidden; |
|
369 | 345 |
} |
370 | 346 |
|
371 | 347 |
.pre-btn img.active { |
372 |
- visibility: hidden; |
|
348 |
+ visibility: hidden; |
|
373 | 349 |
} |
374 | 350 |
|
375 | 351 |
.pickGroup button p.active { |
376 |
- color: #000; |
|
377 |
- /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
352 |
+ color: #000; |
|
353 |
+ /* 선택된 버튼의 숫자 색을 더 진하게 */ |
|
378 | 354 |
} |
379 | 355 |
|
380 | 356 |
.completeBtn { |
381 |
- margin-right: 100px; |
|
382 |
- background-color: #ffba08; |
|
383 |
- padding: 10px 30px; |
|
384 |
- border-radius: 10px; |
|
385 |
- font-size: 28px; |
|
386 |
- font-family: "ONEMobilePOPOTF"; |
|
357 |
+ margin-right: 100px; |
|
358 |
+ background-color: #ffba08; |
|
359 |
+ padding: 10px 30px; |
|
360 |
+ border-radius: 10px; |
|
361 |
+ font-size: 28px; |
|
362 |
+ font-family: 'ONEMobilePOPOTF'; |
|
387 | 363 |
} |
388 | 364 |
|
389 | 365 |
.submit-button { |
390 |
- position: absolute; |
|
391 |
- background-color: #ffba08; |
|
392 |
- padding: 10px 30px; |
|
393 |
- border-radius: 10px; |
|
394 |
- font-size: 28px; |
|
395 |
- font-family: "ONEMobilePOPOTF"; |
|
396 |
- right: 5rem; |
|
397 |
- bottom: 3rem; |
|
366 |
+ position: absolute; |
|
367 |
+ background-color: #ffba08; |
|
368 |
+ padding: 10px 30px; |
|
369 |
+ border-radius: 10px; |
|
370 |
+ font-size: 28px; |
|
371 |
+ font-family: 'ONEMobilePOPOTF'; |
|
372 |
+ right: 5rem; |
|
373 |
+ bottom: 3rem; |
|
398 | 374 |
} |
399 | 375 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_1.vue
+++ client/views/pages/main/Chapter/Chapter3_1.vue
... | ... | @@ -1,364 +1,341 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3.</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <button> |
|
29 |
- <img src="../../../../resources/img/btn10_s.png" alt="" /> |
|
30 |
- </button> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
31 | 12 |
</div> |
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3.</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <button> |
|
22 |
+ <img src="../../../../resources/img/btn10_s.png" alt="" /> |
|
23 |
+ </button> |
|
24 |
+ </div> |
|
32 | 25 |
|
33 |
- <div class="flex align-center justify-center" style="gap: 113px"> |
|
34 |
- <div class="time-hint"> |
|
35 |
- <button class="hint-btn">HINT</button> |
|
36 |
- <div class="time-bg mt20"> |
|
37 |
- <div> |
|
38 |
- <div class="time"> |
|
39 |
- <p class="second">{{ timer }}</p> |
|
40 |
- <p class="text">sec</p> |
|
26 |
+ <div class="flex align-center justify-center" style="gap: 113px"> |
|
27 |
+ <div class="time-hint"> |
|
28 |
+ <button class="hint-btn">HINT</button> |
|
29 |
+ <div class="time-bg mt20"> |
|
30 |
+ <div> |
|
31 |
+ <div class="time"> |
|
32 |
+ <p class="second">{{ timer }}</p> |
|
33 |
+ <p class="text">sec</p> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ </div> |
|
38 |
+ <div class="pickGroup"> |
|
39 |
+ <div class="flex" style="gap: 250px"> |
|
40 |
+ <article class="text-ct" @click="handleClick('A')"> |
|
41 |
+ <div class="mb30"> |
|
42 |
+ <img src="../../../../resources/img/img107_50s.png" alt="" /> |
|
43 |
+ </div> |
|
44 |
+ <button class="popTxt"> |
|
45 |
+ <img :src="selectedButton === 'A' ? selectedbuttonImg : buttonImg" alt="" /> |
|
46 |
+ </button> |
|
47 |
+ </article> |
|
48 |
+ <article class="text-ct" @click="handleClick('B')"> |
|
49 |
+ <div class="mb30"> |
|
50 |
+ <img src="../../../../resources/img/img108_50s.png" alt="" /> |
|
51 |
+ </div> |
|
52 |
+ <button class="popTxt"> |
|
53 |
+ <img :src="selectedButton === 'B' ? selectedbuttonImg : buttonImg" alt="" /> |
|
54 |
+ </button> |
|
55 |
+ </article> |
|
56 |
+ </div> |
|
57 |
+ </div> |
|
41 | 58 |
</div> |
42 |
- </div> |
|
43 |
- </div> |
|
44 |
- </div> |
|
45 |
- <div class="pickGroup"> |
|
46 |
- <div class="flex" style="gap: 250px"> |
|
47 |
- <article class="text-ct" @click="handleClick('A')"> |
|
48 |
- <div class="mb30"> |
|
49 |
- <img src="../../../../resources/img/img107_50s.png" alt="" /> |
|
50 |
- </div> |
|
51 |
- <button class="popTxt"> |
|
52 |
- <img |
|
53 |
- :src=" |
|
54 |
- selectedButton === 'A' ? selectedbuttonImg : buttonImg |
|
55 |
- " |
|
56 |
- alt="" |
|
57 |
- /> |
|
59 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
60 |
+ 제출하기 |
|
58 | 61 |
</button> |
59 |
- </article> |
|
60 |
- <article class="text-ct" @click="handleClick('B')"> |
|
61 |
- <div class="mb30"> |
|
62 |
- <img src="../../../../resources/img/img108_50s.png" alt="" /> |
|
63 |
- </div> |
|
64 |
- <button class="popTxt"> |
|
65 |
- <img |
|
66 |
- :src=" |
|
67 |
- selectedButton === 'B' ? selectedbuttonImg : buttonImg |
|
68 |
- " |
|
69 |
- alt="" |
|
70 |
- /> |
|
71 |
- </button> |
|
72 |
- </article> |
|
62 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
73 | 63 |
</div> |
74 |
- </div> |
|
64 |
+ <div class="next-btn" @click="nextProblem()"> |
|
65 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
66 |
+ </div> |
|
75 | 67 |
</div> |
76 |
- <button |
|
77 |
- class="submit-button" |
|
78 |
- @click="handleSubmit()" |
|
79 |
- v-if="currentIndex === learningIdsLength - 1" |
|
80 |
- > |
|
81 |
- 제출하기 |
|
82 |
- </button> |
|
83 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
84 |
- 다음 문제로 |
|
85 |
- </button> |
|
86 |
- </div> |
|
87 |
- <div class="next-btn" @click="nextProblem()"> |
|
88 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
89 |
- </div> |
|
90 | 68 |
</div> |
91 |
- </div> |
|
92 | 69 |
</template> |
93 | 70 |
|
94 | 71 |
<script> |
95 |
-import axios from "axios"; |
|
72 |
+import axios from 'axios'; |
|
73 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
96 | 74 |
export default { |
97 |
- data() { |
|
98 |
- return { |
|
99 |
- timer: "00", |
|
100 |
- selectedButton: null, |
|
101 |
- buttonImg: "client/resources/img/img136_71s.png", |
|
102 |
- selectedbuttonImg: "client/resources/img/img137_71s.png", |
|
103 |
- dataList: [], |
|
104 |
- problemDetail: [], |
|
105 |
- currentIndex: null, |
|
106 |
- learningIdsLength: null, |
|
107 |
- }; |
|
108 |
- }, |
|
109 |
- methods: { |
|
110 |
- goToPage(page) { |
|
111 |
- this.$router.push({ name: page }); |
|
112 |
- }, |
|
113 |
- startTimer() { |
|
114 |
- if (this.intervalId) { |
|
115 |
- clearInterval(this.intervalId); |
|
116 |
- } |
|
117 |
- this.timer = 5; |
|
118 |
- this.intervalId = setInterval(() => { |
|
119 |
- if (this.timer > 0) { |
|
120 |
- this.timer--; |
|
121 |
- } else { |
|
122 |
- clearInterval(this.intervalId); |
|
123 |
- } |
|
124 |
- }, 1000); |
|
125 |
- }, |
|
126 |
- handleClick(number) { |
|
127 |
- this.selectedButton = number; |
|
128 |
- }, |
|
129 |
- // 제출하기 버튼 |
|
130 |
- handleSubmit() { |
|
131 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
132 |
- if (userConfirmed) { |
|
133 |
- const problemData = { |
|
134 |
- prblmInfo: this.currentLearningId, |
|
135 |
- prblmNumber: this.currentProblemIndex, |
|
136 |
- prblmAns: this.selectedButton, |
|
75 |
+ data() { |
|
76 |
+ return { |
|
77 |
+ timer: '00', |
|
78 |
+ selectedButton: null, |
|
79 |
+ buttonImg: 'client/resources/img/img136_71s.png', |
|
80 |
+ selectedbuttonImg: 'client/resources/img/img137_71s.png', |
|
81 |
+ dataList: [], |
|
82 |
+ problemDetail: [], |
|
83 |
+ currentIndex: null, |
|
84 |
+ learningIdsLength: null, |
|
137 | 85 |
}; |
138 |
- |
|
139 |
- const answerData = { |
|
140 |
- prblmId: this.currentLearningId.prblm_id, |
|
141 |
- prblmAns: this.selectedButton, |
|
142 |
- stdId: this.$store.getters.getStdId, |
|
143 |
- prblmLogAnsCnt: 1, |
|
144 |
- }; |
|
145 |
- |
|
146 |
- this.$store.dispatch("saveProblemData", problemData); |
|
147 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
148 |
- |
|
149 |
- console.log(this.$store.getters.getAllProblems); |
|
150 |
- console.log(this.$store.getters.getAllAnswers); |
|
151 |
- |
|
152 |
- axios({ |
|
153 |
- url: "problemLog/insertProblemLog.json", |
|
154 |
- method: "post", |
|
155 |
- headers: { |
|
156 |
- "Content-Type": "application/json; charset=UTF-8", |
|
157 |
- }, |
|
158 |
- data: this.$store.getters.getAllAnswers, |
|
159 |
- }) |
|
160 |
- .then((res) => { |
|
161 |
- console.log("problem - response : ", res.data); |
|
162 |
- this.goToPage("Chapter4"); |
|
163 |
- }) |
|
164 |
- .catch(function (error) { |
|
165 |
- console.log("problem - error : ", error); |
|
166 |
- }); |
|
167 |
- } else { |
|
168 |
- console.log("Submission canceled by the user."); |
|
169 |
- } |
|
170 | 86 |
}, |
171 |
- |
|
172 |
- getProblem() { |
|
173 |
- const vm = this; |
|
174 |
- const prblmId = this.currentLearningId.prblm_id; |
|
175 |
- axios({ |
|
176 |
- url: "problem/problemInfo.json", |
|
177 |
- method: "post", |
|
178 |
- headers: { |
|
179 |
- "Content-Type": "application/json; charset=UTF-8", |
|
87 |
+ methods: { |
|
88 |
+ goToPage(page) { |
|
89 |
+ this.$router.push({ name: page }); |
|
180 | 90 |
}, |
181 |
- data: { |
|
182 |
- prblmId: prblmId, |
|
91 |
+ startTimer() { |
|
92 |
+ if (this.intervalId) { |
|
93 |
+ clearInterval(this.intervalId); |
|
94 |
+ } |
|
95 |
+ this.timer = 5; |
|
96 |
+ this.intervalId = setInterval(() => { |
|
97 |
+ if (this.timer > 0) { |
|
98 |
+ this.timer--; |
|
99 |
+ } else { |
|
100 |
+ clearInterval(this.intervalId); |
|
101 |
+ } |
|
102 |
+ }, 1000); |
|
183 | 103 |
}, |
184 |
- }) |
|
185 |
- .then(function (res) { |
|
186 |
- console.log("problem - response : ", res.data); |
|
187 |
- vm.dataList = res.data.problem; |
|
188 |
- vm.problemDetail = res.data.problemDetail; |
|
189 |
- }) |
|
190 |
- .catch(function (error) { |
|
191 |
- console.log("problem - error : ", error); |
|
192 |
- }); |
|
193 |
- }, |
|
194 |
- nextProblem() { |
|
195 |
- const problemData = { |
|
196 |
- prblmInfo: this.currentLearningId, |
|
197 |
- prblmNumber: this.currentProblemIndex, |
|
198 |
- prblmAns: this.selectedButton, |
|
199 |
- }; |
|
200 |
- const answerData = { |
|
201 |
- prblmId: this.currentLearningId.prblm_id, |
|
202 |
- prblmAns: this.selectedButton, |
|
203 |
- stdId: this.$store.getters.getStdId, |
|
204 |
- prblmLogAnsCnt: 1, |
|
205 |
- }; |
|
206 |
- this.$store.dispatch("saveProblemData", problemData); |
|
207 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
208 |
- console.log(this.$store.getters.getAllProblems); |
|
209 |
- console.log(this.$store.getters.getAllAnswers); |
|
210 |
- if ( |
|
211 |
- this.currentProblemIndex < |
|
212 |
- this.$store.state.currentLearningIds.length - 1 |
|
213 |
- ) { |
|
214 |
- this.$store.dispatch("goToNextProblem"); |
|
215 |
- this.handleProblemDetail(this.currentLearningId); |
|
216 |
- this.goToPage(this.problemType); |
|
217 |
- } |
|
218 |
- }, |
|
219 |
- previousProblem() { |
|
220 |
- if (this.currentProblemIndex > 0) { |
|
221 |
- this.$store.dispatch("goToPreviousProblem"); |
|
222 |
- this.handleProblemDetail(this.currentLearningId); |
|
223 |
- this.goToPage(this.problemType); |
|
224 |
- } |
|
225 |
- }, |
|
104 |
+ handleClick(number) { |
|
105 |
+ this.selectedButton = number; |
|
106 |
+ }, |
|
107 |
+ // 제출하기 버튼 |
|
108 |
+ handleSubmit() { |
|
109 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
110 |
+ if (userConfirmed) { |
|
111 |
+ const problemData = { |
|
112 |
+ prblmInfo: this.currentLearningId, |
|
113 |
+ prblmNumber: this.currentProblemIndex, |
|
114 |
+ prblmAns: this.selectedButton, |
|
115 |
+ }; |
|
226 | 116 |
|
227 |
- handleProblemDetail(item) { |
|
228 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
229 |
- this.problemType = "Chapter3"; |
|
230 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
231 |
- this.problemType = "Chapter3_1"; |
|
232 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
233 |
- this.problemType = "Chapter3_2"; |
|
234 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
235 |
- this.problemType = "Chapter3_3"; |
|
236 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
237 |
- this.problemType = "Chapter3_3_1"; |
|
238 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
239 |
- this.problemType = "Chapter3_4"; |
|
240 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
241 |
- this.problemType = "Chapter3_5"; |
|
242 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
243 |
- this.problemType = "Chapter3_6"; |
|
244 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
245 |
- this.problemType = "Chapter3_7"; |
|
246 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
247 |
- this.problemType = "Chapter3_8"; |
|
248 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
249 |
- this.problemType = "Chapter3_9"; |
|
250 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
251 |
- this.problemType = "Chapter3_10"; |
|
252 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
253 |
- this.problemType = "Chapter3_11"; |
|
254 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
255 |
- this.problemType = "Chapter3_12"; |
|
256 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
257 |
- this.problemType = "Chapter3_13"; |
|
258 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
259 |
- this.problemType = "Chapter3_14"; |
|
260 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
261 |
- this.problemType = "Chapter3_15"; |
|
262 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
263 |
- this.problemType = "Chapter2_8"; |
|
264 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
265 |
- this.problemType = "Chapter2_7"; |
|
266 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
267 |
- this.problemType = "Chapter2_5"; |
|
268 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
269 |
- this.problemType = "Chapter2_6"; |
|
270 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
271 |
- this.problemType = "Chapter2_10"; |
|
272 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
273 |
- this.problemType = "Chapter2_11"; |
|
274 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
275 |
- this.problemType = "Chapter2_13"; |
|
276 |
- } |
|
277 |
- }, |
|
278 |
- }, |
|
279 |
- watch: {}, |
|
280 |
- computed: { |
|
281 |
- currentLearningId() { |
|
282 |
- return this.$store.getters.currentLearningId; |
|
283 |
- }, |
|
284 |
- currentLabel() { |
|
285 |
- return this.$store.getters.currentLabel; |
|
286 |
- }, |
|
287 |
- currentProblemIndex() { |
|
288 |
- return this.$store.getters.currentProblemIndex; |
|
289 |
- }, |
|
290 |
- isPreviousButtonDisabled() { |
|
291 |
- return this.currentProblemIndex === 0; |
|
292 |
- }, |
|
293 |
- }, |
|
294 |
- created() { |
|
295 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
296 |
- console.log("Current Label:", this.currentLabel); |
|
297 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
298 |
- this.currentIndex = this.currentProblemIndex; |
|
299 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
117 |
+ const answerData = { |
|
118 |
+ prblmId: this.currentLearningId.prblm_id, |
|
119 |
+ prblmAns: this.selectedButton, |
|
120 |
+ stdId: this.$store.getters.getStdId, |
|
121 |
+ prblmLogAnsCnt: 1, |
|
122 |
+ }; |
|
300 | 123 |
|
301 |
- // Fetch or process the current problem based on `currentLearningId` |
|
302 |
- }, |
|
303 |
- components: {}, |
|
304 |
- mounted() { |
|
305 |
- this.getProblem(); |
|
306 |
- }, |
|
124 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
125 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
126 |
+ |
|
127 |
+ console.log(this.$store.getters.getAllProblems); |
|
128 |
+ console.log(this.$store.getters.getAllAnswers); |
|
129 |
+ |
|
130 |
+ axios({ |
|
131 |
+ url: 'problemLog/insertProblemLog.json', |
|
132 |
+ method: 'post', |
|
133 |
+ headers: { |
|
134 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
135 |
+ }, |
|
136 |
+ data: this.$store.getters.getAllAnswers, |
|
137 |
+ }) |
|
138 |
+ .then((res) => { |
|
139 |
+ console.log('problem - response : ', res.data); |
|
140 |
+ this.goToPage('Chapter4'); |
|
141 |
+ }) |
|
142 |
+ .catch(function (error) { |
|
143 |
+ console.log('problem - error : ', error); |
|
144 |
+ }); |
|
145 |
+ } else { |
|
146 |
+ console.log('Submission canceled by the user.'); |
|
147 |
+ } |
|
148 |
+ }, |
|
149 |
+ |
|
150 |
+ getProblem() { |
|
151 |
+ const vm = this; |
|
152 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
153 |
+ axios({ |
|
154 |
+ url: 'problem/problemInfo.json', |
|
155 |
+ method: 'post', |
|
156 |
+ headers: { |
|
157 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
158 |
+ }, |
|
159 |
+ data: { |
|
160 |
+ prblmId: prblmId, |
|
161 |
+ }, |
|
162 |
+ }) |
|
163 |
+ .then(function (res) { |
|
164 |
+ console.log('problem - response : ', res.data); |
|
165 |
+ vm.dataList = res.data.problem; |
|
166 |
+ vm.problemDetail = res.data.problemDetail; |
|
167 |
+ }) |
|
168 |
+ .catch(function (error) { |
|
169 |
+ console.log('problem - error : ', error); |
|
170 |
+ }); |
|
171 |
+ }, |
|
172 |
+ nextProblem() { |
|
173 |
+ const problemData = { |
|
174 |
+ prblmInfo: this.currentLearningId, |
|
175 |
+ prblmNumber: this.currentProblemIndex, |
|
176 |
+ prblmAns: this.selectedButton, |
|
177 |
+ }; |
|
178 |
+ const answerData = { |
|
179 |
+ prblmId: this.currentLearningId.prblm_id, |
|
180 |
+ prblmAns: this.selectedButton, |
|
181 |
+ stdId: this.$store.getters.getStdId, |
|
182 |
+ prblmLogAnsCnt: 1, |
|
183 |
+ }; |
|
184 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
185 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
186 |
+ console.log(this.$store.getters.getAllProblems); |
|
187 |
+ console.log(this.$store.getters.getAllAnswers); |
|
188 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
189 |
+ this.$store.dispatch('goToNextProblem'); |
|
190 |
+ this.handleProblemDetail(this.currentLearningId); |
|
191 |
+ this.goToPage(this.problemType); |
|
192 |
+ } |
|
193 |
+ }, |
|
194 |
+ previousProblem() { |
|
195 |
+ if (this.currentProblemIndex > 0) { |
|
196 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
197 |
+ this.handleProblemDetail(this.currentLearningId); |
|
198 |
+ this.goToPage(this.problemType); |
|
199 |
+ } |
|
200 |
+ }, |
|
201 |
+ |
|
202 |
+ handleProblemDetail(item) { |
|
203 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
204 |
+ this.problemType = 'Chapter3'; |
|
205 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
206 |
+ this.problemType = 'Chapter3_1'; |
|
207 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
208 |
+ this.problemType = 'Chapter3_2'; |
|
209 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
210 |
+ this.problemType = 'Chapter3_3'; |
|
211 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
212 |
+ this.problemType = 'Chapter3_3_1'; |
|
213 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
214 |
+ this.problemType = 'Chapter3_4'; |
|
215 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
216 |
+ this.problemType = 'Chapter3_5'; |
|
217 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
218 |
+ this.problemType = 'Chapter3_6'; |
|
219 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
220 |
+ this.problemType = 'Chapter3_7'; |
|
221 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
222 |
+ this.problemType = 'Chapter3_8'; |
|
223 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
224 |
+ this.problemType = 'Chapter3_9'; |
|
225 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
226 |
+ this.problemType = 'Chapter3_10'; |
|
227 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
228 |
+ this.problemType = 'Chapter3_11'; |
|
229 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
230 |
+ this.problemType = 'Chapter3_12'; |
|
231 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
232 |
+ this.problemType = 'Chapter3_13'; |
|
233 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
234 |
+ this.problemType = 'Chapter3_14'; |
|
235 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
236 |
+ this.problemType = 'Chapter3_15'; |
|
237 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
238 |
+ this.problemType = 'Chapter2_8'; |
|
239 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
240 |
+ this.problemType = 'Chapter2_7'; |
|
241 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
242 |
+ this.problemType = 'Chapter2_5'; |
|
243 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
244 |
+ this.problemType = 'Chapter2_6'; |
|
245 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
246 |
+ this.problemType = 'Chapter2_10'; |
|
247 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
248 |
+ this.problemType = 'Chapter2_11'; |
|
249 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
250 |
+ this.problemType = 'Chapter2_13'; |
|
251 |
+ } |
|
252 |
+ }, |
|
253 |
+ }, |
|
254 |
+ watch: {}, |
|
255 |
+ computed: { |
|
256 |
+ currentLearningId() { |
|
257 |
+ return this.$store.getters.currentLearningId; |
|
258 |
+ }, |
|
259 |
+ currentLabel() { |
|
260 |
+ return this.$store.getters.currentLabel; |
|
261 |
+ }, |
|
262 |
+ currentProblemIndex() { |
|
263 |
+ return this.$store.getters.currentProblemIndex; |
|
264 |
+ }, |
|
265 |
+ isPreviousButtonDisabled() { |
|
266 |
+ return this.currentProblemIndex === 0; |
|
267 |
+ }, |
|
268 |
+ }, |
|
269 |
+ created() { |
|
270 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
271 |
+ console.log('Current Label:', this.currentLabel); |
|
272 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
273 |
+ this.currentIndex = this.currentProblemIndex; |
|
274 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
275 |
+ |
|
276 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
277 |
+ }, |
|
278 |
+ components: { |
|
279 |
+ BookInfo: BookInfo, |
|
280 |
+ }, |
|
281 |
+ mounted() { |
|
282 |
+ this.getProblem(); |
|
283 |
+ }, |
|
307 | 284 |
}; |
308 | 285 |
</script> |
309 | 286 |
<style scoped> |
310 | 287 |
.imgGroup { |
311 |
- width: fit-content; |
|
288 |
+ width: fit-content; |
|
312 | 289 |
} |
313 | 290 |
|
314 | 291 |
.imgGroup button { |
315 |
- position: relative; |
|
292 |
+ position: relative; |
|
316 | 293 |
} |
317 | 294 |
|
318 | 295 |
.imgGroup button p, |
319 | 296 |
.textbox p { |
320 |
- position: absolute; |
|
321 |
- top: 50%; |
|
322 |
- left: 50%; |
|
323 |
- transform: translate(-50%, -50%); |
|
324 |
- width: fit-content; |
|
325 |
- height: fit-content; |
|
326 |
- background: #ffffffb8; |
|
327 |
- border-radius: 5px; |
|
328 |
- padding: 10px; |
|
329 |
- font-size: 48px; |
|
330 |
- font-family: "ONEMobilePOP"; |
|
297 |
+ position: absolute; |
|
298 |
+ top: 50%; |
|
299 |
+ left: 50%; |
|
300 |
+ transform: translate(-50%, -50%); |
|
301 |
+ width: fit-content; |
|
302 |
+ height: fit-content; |
|
303 |
+ background: #ffffffb8; |
|
304 |
+ border-radius: 5px; |
|
305 |
+ padding: 10px; |
|
306 |
+ font-size: 48px; |
|
307 |
+ font-family: 'ONEMobilePOP'; |
|
331 | 308 |
} |
332 | 309 |
|
333 | 310 |
.pickGroup button { |
334 |
- position: relative; |
|
311 |
+ position: relative; |
|
335 | 312 |
} |
336 | 313 |
|
337 | 314 |
.pickGroup button p { |
338 |
- font-size: 34px; |
|
339 |
- color: #c6c6c6; |
|
340 |
- position: absolute; |
|
341 |
- top: 50%; |
|
342 |
- left: 50%; |
|
343 |
- transform: translate(-50%, -50%); |
|
315 |
+ font-size: 34px; |
|
316 |
+ color: #c6c6c6; |
|
317 |
+ position: absolute; |
|
318 |
+ top: 50%; |
|
319 |
+ left: 50%; |
|
320 |
+ transform: translate(-50%, -50%); |
|
344 | 321 |
} |
345 | 322 |
|
346 | 323 |
.pre-btn img.active { |
347 |
- visibility: hidden; |
|
324 |
+ visibility: hidden; |
|
348 | 325 |
} |
349 | 326 |
|
350 | 327 |
.pre-btn img.active { |
351 |
- visibility: hidden; |
|
328 |
+ visibility: hidden; |
|
352 | 329 |
} |
353 | 330 |
|
354 | 331 |
.submit-button { |
355 |
- position: absolute; |
|
356 |
- background-color: #ffba08; |
|
357 |
- padding: 10px 30px; |
|
358 |
- border-radius: 10px; |
|
359 |
- font-size: 28px; |
|
360 |
- font-family: "ONEMobilePOPOTF"; |
|
361 |
- right: 5rem; |
|
362 |
- bottom: 3rem; |
|
332 |
+ position: absolute; |
|
333 |
+ background-color: #ffba08; |
|
334 |
+ padding: 10px 30px; |
|
335 |
+ border-radius: 10px; |
|
336 |
+ font-size: 28px; |
|
337 |
+ font-family: 'ONEMobilePOPOTF'; |
|
338 |
+ right: 5rem; |
|
339 |
+ bottom: 3rem; |
|
363 | 340 |
} |
364 | 341 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_10.vue
+++ client/views/pages/main/Chapter/Chapter3_10.vue
... | ... | @@ -1,339 +1,316 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3.</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <button @click="playAudio"> |
|
29 |
- <img src="../../../../resources/img/btn10_s.png" alt="" /> |
|
30 |
- <audio |
|
31 |
- id="audio-player" |
|
32 |
- src="client/resources/audio/bank.wav" |
|
33 |
- preload="auto" |
|
34 |
- ></audio> |
|
35 |
- </button> |
|
36 |
- </div> |
|
37 |
- |
|
38 |
- <div class="text-ct"> |
|
39 |
- <div class="time-hint"> |
|
40 |
- <button class="hint-btn">HINT</button> |
|
41 |
- <div class="time-bg mt20"> |
|
42 |
- <div> |
|
43 |
- <div class="time"> |
|
44 |
- <p class="second">{{ timer }}</p> |
|
45 |
- <p class="text">sec</p> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
46 | 7 |
</div> |
47 |
- </div> |
|
48 |
- </div> |
|
49 |
- </div> |
|
50 |
- <div class="imgGroup mt20"> |
|
51 |
- <img src="../../../../resources/img/img116_59s.png" alt="" /> |
|
52 |
- <p class="title1 mt10" style="width: auto"> |
|
53 |
- <strong>진수가 거절한 제안</strong>은 무엇인지 우리말로 쓰세요. |
|
54 |
- </p> |
|
55 |
- <div class="mt20"> |
|
56 |
- <input |
|
57 |
- class="yellow-bd" |
|
58 |
- v-model="answer" |
|
59 |
- type="text" |
|
60 |
- placeholder="답을 입력하세요." |
|
61 |
- /> |
|
62 |
- </div> |
|
63 |
- </div> |
|
8 |
+ </router-link> |
|
64 | 9 |
</div> |
65 |
- <button |
|
66 |
- class="submit-button" |
|
67 |
- @click="handleSubmit()" |
|
68 |
- v-if="currentIndex === learningIdsLength - 1" |
|
69 |
- > |
|
70 |
- 제출하기 |
|
71 |
- </button> |
|
72 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
73 |
- 다음 문제로 |
|
74 |
- </button> |
|
75 |
- </div> |
|
76 |
- <div class="next-btn" @click="nextProblem()"> |
|
77 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
78 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3.</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <button @click="playAudio"> |
|
22 |
+ <img src="../../../../resources/img/btn10_s.png" alt="" /> |
|
23 |
+ <audio id="audio-player" src="client/resources/audio/bank.wav" preload="auto"></audio> |
|
24 |
+ </button> |
|
25 |
+ </div> |
|
26 |
+ |
|
27 |
+ <div class="text-ct"> |
|
28 |
+ <div class="time-hint"> |
|
29 |
+ <button class="hint-btn">HINT</button> |
|
30 |
+ <div class="time-bg mt20"> |
|
31 |
+ <div> |
|
32 |
+ <div class="time"> |
|
33 |
+ <p class="second">{{ timer }}</p> |
|
34 |
+ <p class="text">sec</p> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ </div> |
|
38 |
+ </div> |
|
39 |
+ <div class="imgGroup mt20"> |
|
40 |
+ <img src="../../../../resources/img/img116_59s.png" alt="" /> |
|
41 |
+ <p class="title1 mt10" style="width: auto"> |
|
42 |
+ <strong>진수가 거절한 제안</strong>은 무엇인지 우리말로 쓰세요. |
|
43 |
+ </p> |
|
44 |
+ <div class="mt20"> |
|
45 |
+ <input class="yellow-bd" v-model="answer" type="text" placeholder="답을 입력하세요." /> |
|
46 |
+ </div> |
|
47 |
+ </div> |
|
48 |
+ </div> |
|
49 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
50 |
+ 제출하기 |
|
51 |
+ </button> |
|
52 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
53 |
+ </div> |
|
54 |
+ <div class="next-btn" @click="nextProblem()"> |
|
55 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
56 |
+ </div> |
|
57 |
+ </div> |
|
79 | 58 |
</div> |
80 |
- </div> |
|
81 | 59 |
</template> |
82 | 60 |
|
83 | 61 |
<script> |
84 |
-import axios from "axios"; |
|
85 |
- |
|
62 |
+import axios from 'axios'; |
|
63 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
86 | 64 |
export default { |
87 |
- data() { |
|
88 |
- return { |
|
89 |
- timer: "00", |
|
90 |
- answer: null, |
|
91 |
- dataList: [], |
|
92 |
- problemDetail: [], |
|
93 |
- currentIndex: null, |
|
94 |
- learningIdsLength: null, |
|
95 |
- }; |
|
96 |
- }, |
|
97 |
- methods: { |
|
98 |
- goToPage(page) { |
|
99 |
- this.$router.push({ name: page }); |
|
100 |
- }, |
|
101 |
- startTimer() { |
|
102 |
- if (this.intervalId) { |
|
103 |
- clearInterval(this.intervalId); |
|
104 |
- } |
|
105 |
- this.timer = 5; |
|
106 |
- this.intervalId = setInterval(() => { |
|
107 |
- if (this.timer > 0) { |
|
108 |
- this.timer--; |
|
109 |
- } else { |
|
110 |
- clearInterval(this.intervalId); |
|
111 |
- } |
|
112 |
- }, 1000); |
|
113 |
- }, |
|
114 |
- playAudio() { |
|
115 |
- const audio = document.getElementById("audio-player"); |
|
116 |
- audio.play(); |
|
117 |
- console.log("playing"); |
|
118 |
- }, |
|
119 |
- handleSubmit() { |
|
120 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
121 |
- if (userConfirmed) { |
|
122 |
- const problemData = { |
|
123 |
- prblmInfo: this.currentLearningId, |
|
124 |
- prblmNumber: this.currentProblemIndex, |
|
125 |
- prblmAns: this.selectedButton, |
|
65 |
+ data() { |
|
66 |
+ return { |
|
67 |
+ timer: '00', |
|
68 |
+ answer: null, |
|
69 |
+ dataList: [], |
|
70 |
+ problemDetail: [], |
|
71 |
+ currentIndex: null, |
|
72 |
+ learningIdsLength: null, |
|
126 | 73 |
}; |
127 |
- |
|
128 |
- const answerData = { |
|
129 |
- prblmId: this.currentLearningId.prblm_id, |
|
130 |
- prblmAns: this.selectedButton, |
|
131 |
- stdId: this.$store.getters.getStdId, |
|
132 |
- prblmLogAnsCnt: 1, |
|
133 |
- }; |
|
134 |
- |
|
135 |
- this.$store.dispatch("saveProblemData", problemData); |
|
136 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
137 |
- |
|
138 |
- console.log(this.$store.getters.getAllProblems); |
|
139 |
- console.log(this.$store.getters.getAllAnswers); |
|
140 |
- |
|
141 |
- axios({ |
|
142 |
- url: "problemLog/insertProblemLog.json", |
|
143 |
- method: "post", |
|
144 |
- headers: { |
|
145 |
- "Content-Type": "application/json; charset=UTF-8", |
|
146 |
- }, |
|
147 |
- data: this.$store.getters.getAllAnswers, |
|
148 |
- }) |
|
149 |
- .then(function (res) { |
|
150 |
- console.log("problem - response : ", res.data); |
|
151 |
- this.goToPage("Chapter4"); |
|
152 |
- }) |
|
153 |
- .catch(function (error) { |
|
154 |
- console.log("problem - error : ", error); |
|
155 |
- }); |
|
156 |
- } else { |
|
157 |
- console.log("Submission canceled by the user."); |
|
158 |
- } |
|
159 | 74 |
}, |
160 |
- getProblem() { |
|
161 |
- const vm = this; |
|
162 |
- const prblmId = this.currentLearningId.prblm_id; |
|
163 |
- axios({ |
|
164 |
- url: "problem/problemInfo.json", |
|
165 |
- method: "post", |
|
166 |
- headers: { |
|
167 |
- "Content-Type": "application/json; charset=UTF-8", |
|
75 |
+ methods: { |
|
76 |
+ goToPage(page) { |
|
77 |
+ this.$router.push({ name: page }); |
|
168 | 78 |
}, |
169 |
- data: { |
|
170 |
- prblmId: prblmId, |
|
79 |
+ startTimer() { |
|
80 |
+ if (this.intervalId) { |
|
81 |
+ clearInterval(this.intervalId); |
|
82 |
+ } |
|
83 |
+ this.timer = 5; |
|
84 |
+ this.intervalId = setInterval(() => { |
|
85 |
+ if (this.timer > 0) { |
|
86 |
+ this.timer--; |
|
87 |
+ } else { |
|
88 |
+ clearInterval(this.intervalId); |
|
89 |
+ } |
|
90 |
+ }, 1000); |
|
171 | 91 |
}, |
172 |
- }) |
|
173 |
- .then(function (res) { |
|
174 |
- console.log("problem - response : ", res.data); |
|
175 |
- vm.dataList = res.data.problem; |
|
176 |
- vm.problemDetail = res.data.problemDetail; |
|
177 |
- }) |
|
178 |
- .catch(function (error) { |
|
179 |
- console.log("problem - error : ", error); |
|
180 |
- }); |
|
181 |
- }, |
|
182 |
- nextProblem() { |
|
183 |
- const problemData = { |
|
184 |
- prblmInfo: this.currentLearningId, |
|
185 |
- prblmNumber: this.currentProblemIndex, |
|
186 |
- prblmAns: this.selectedButton, |
|
187 |
- }; |
|
188 |
- const answerData = { |
|
189 |
- prblmId: this.currentLearningId.prblm_id, |
|
190 |
- prblmAns: this.selectedButton, |
|
191 |
- stdId: this.$store.getters.getStdId, |
|
192 |
- prblmLogAnsCnt: 1, |
|
193 |
- }; |
|
194 |
- this.$store.dispatch("saveProblemData", problemData); |
|
195 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
196 |
- console.log(this.$store.getters.getAllProblems); |
|
197 |
- console.log(this.$store.getters.getAllAnswers); |
|
198 |
- if ( |
|
199 |
- this.currentProblemIndex < |
|
200 |
- this.$store.state.currentLearningIds.length - 1 |
|
201 |
- ) { |
|
202 |
- this.$store.dispatch("goToNextProblem"); |
|
203 |
- this.handleProblemDetail(this.currentLearningId); |
|
204 |
- this.goToPage(this.problemType); |
|
205 |
- } |
|
206 |
- }, |
|
207 |
- previousProblem() { |
|
208 |
- if (this.currentProblemIndex > 0) { |
|
209 |
- this.$store.dispatch("goToPreviousProblem"); |
|
210 |
- this.handleProblemDetail(this.currentLearningId); |
|
211 |
- this.goToPage(this.problemType); |
|
212 |
- } |
|
213 |
- }, |
|
92 |
+ playAudio() { |
|
93 |
+ const audio = document.getElementById('audio-player'); |
|
94 |
+ audio.play(); |
|
95 |
+ console.log('playing'); |
|
96 |
+ }, |
|
97 |
+ handleSubmit() { |
|
98 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
99 |
+ if (userConfirmed) { |
|
100 |
+ const problemData = { |
|
101 |
+ prblmInfo: this.currentLearningId, |
|
102 |
+ prblmNumber: this.currentProblemIndex, |
|
103 |
+ prblmAns: this.selectedButton, |
|
104 |
+ }; |
|
214 | 105 |
|
215 |
- handleProblemDetail(item) { |
|
216 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
217 |
- this.problemType = "Chapter3"; |
|
218 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
219 |
- this.problemType = "Chapter3_1"; |
|
220 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
221 |
- this.problemType = "Chapter3_2"; |
|
222 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
223 |
- this.problemType = "Chapter3_3"; |
|
224 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
225 |
- this.problemType = "Chapter3_3_1"; |
|
226 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
227 |
- this.problemType = "Chapter3_4"; |
|
228 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
229 |
- this.problemType = "Chapter3_5"; |
|
230 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
231 |
- this.problemType = "Chapter3_6"; |
|
232 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
233 |
- this.problemType = "Chapter3_7"; |
|
234 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
235 |
- this.problemType = "Chapter3_8"; |
|
236 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
237 |
- this.problemType = "Chapter3_9"; |
|
238 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
239 |
- this.problemType = "Chapter3_10"; |
|
240 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
241 |
- this.problemType = "Chapter3_11"; |
|
242 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
243 |
- this.problemType = "Chapter3_12"; |
|
244 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
245 |
- this.problemType = "Chapter3_13"; |
|
246 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
247 |
- this.problemType = "Chapter3_14"; |
|
248 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
249 |
- this.problemType = "Chapter3_15"; |
|
250 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
251 |
- this.problemType = "Chapter2_8"; |
|
252 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
253 |
- this.problemType = "Chapter2_7"; |
|
254 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
255 |
- this.problemType = "Chapter2_5"; |
|
256 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
257 |
- this.problemType = "Chapter2_6"; |
|
258 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
259 |
- this.problemType = "Chapter2_10"; |
|
260 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
261 |
- this.problemType = "Chapter2_11"; |
|
262 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
263 |
- this.problemType = "Chapter2_13"; |
|
264 |
- } |
|
265 |
- }, |
|
266 |
- }, |
|
267 |
- watch: {}, |
|
268 |
- computed: { |
|
269 |
- currentLearningId() { |
|
270 |
- return this.$store.getters.currentLearningId; |
|
271 |
- }, |
|
272 |
- currentLabel() { |
|
273 |
- return this.$store.getters.currentLabel; |
|
274 |
- }, |
|
275 |
- currentProblemIndex() { |
|
276 |
- return this.$store.getters.currentProblemIndex; |
|
277 |
- }, |
|
278 |
- isPreviousButtonDisabled() { |
|
279 |
- return this.currentProblemIndex === 0; |
|
280 |
- }, |
|
281 |
- }, |
|
282 |
- created() { |
|
283 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
284 |
- console.log("Current Label:", this.currentLabel); |
|
285 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
286 |
- this.currentIndex = this.currentProblemIndex; |
|
287 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
106 |
+ const answerData = { |
|
107 |
+ prblmId: this.currentLearningId.prblm_id, |
|
108 |
+ prblmAns: this.selectedButton, |
|
109 |
+ stdId: this.$store.getters.getStdId, |
|
110 |
+ prblmLogAnsCnt: 1, |
|
111 |
+ }; |
|
288 | 112 |
|
289 |
- // Fetch or process the current problem based on `currentLearningId` |
|
290 |
- }, |
|
291 |
- components: {}, |
|
292 |
- mounted() { |
|
293 |
- this.getProblem(); |
|
294 |
- }, |
|
113 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
114 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
115 |
+ |
|
116 |
+ console.log(this.$store.getters.getAllProblems); |
|
117 |
+ console.log(this.$store.getters.getAllAnswers); |
|
118 |
+ |
|
119 |
+ axios({ |
|
120 |
+ url: 'problemLog/insertProblemLog.json', |
|
121 |
+ method: 'post', |
|
122 |
+ headers: { |
|
123 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
124 |
+ }, |
|
125 |
+ data: this.$store.getters.getAllAnswers, |
|
126 |
+ }) |
|
127 |
+ .then(function (res) { |
|
128 |
+ console.log('problem - response : ', res.data); |
|
129 |
+ this.goToPage('Chapter4'); |
|
130 |
+ }) |
|
131 |
+ .catch(function (error) { |
|
132 |
+ console.log('problem - error : ', error); |
|
133 |
+ }); |
|
134 |
+ } else { |
|
135 |
+ console.log('Submission canceled by the user.'); |
|
136 |
+ } |
|
137 |
+ }, |
|
138 |
+ getProblem() { |
|
139 |
+ const vm = this; |
|
140 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
141 |
+ axios({ |
|
142 |
+ url: 'problem/problemInfo.json', |
|
143 |
+ method: 'post', |
|
144 |
+ headers: { |
|
145 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
146 |
+ }, |
|
147 |
+ data: { |
|
148 |
+ prblmId: prblmId, |
|
149 |
+ }, |
|
150 |
+ }) |
|
151 |
+ .then(function (res) { |
|
152 |
+ console.log('problem - response : ', res.data); |
|
153 |
+ vm.dataList = res.data.problem; |
|
154 |
+ vm.problemDetail = res.data.problemDetail; |
|
155 |
+ }) |
|
156 |
+ .catch(function (error) { |
|
157 |
+ console.log('problem - error : ', error); |
|
158 |
+ }); |
|
159 |
+ }, |
|
160 |
+ nextProblem() { |
|
161 |
+ const problemData = { |
|
162 |
+ prblmInfo: this.currentLearningId, |
|
163 |
+ prblmNumber: this.currentProblemIndex, |
|
164 |
+ prblmAns: this.selectedButton, |
|
165 |
+ }; |
|
166 |
+ const answerData = { |
|
167 |
+ prblmId: this.currentLearningId.prblm_id, |
|
168 |
+ prblmAns: this.selectedButton, |
|
169 |
+ stdId: this.$store.getters.getStdId, |
|
170 |
+ prblmLogAnsCnt: 1, |
|
171 |
+ }; |
|
172 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
173 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
174 |
+ console.log(this.$store.getters.getAllProblems); |
|
175 |
+ console.log(this.$store.getters.getAllAnswers); |
|
176 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
177 |
+ this.$store.dispatch('goToNextProblem'); |
|
178 |
+ this.handleProblemDetail(this.currentLearningId); |
|
179 |
+ this.goToPage(this.problemType); |
|
180 |
+ } |
|
181 |
+ }, |
|
182 |
+ previousProblem() { |
|
183 |
+ if (this.currentProblemIndex > 0) { |
|
184 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
185 |
+ this.handleProblemDetail(this.currentLearningId); |
|
186 |
+ this.goToPage(this.problemType); |
|
187 |
+ } |
|
188 |
+ }, |
|
189 |
+ |
|
190 |
+ handleProblemDetail(item) { |
|
191 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
192 |
+ this.problemType = 'Chapter3'; |
|
193 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
194 |
+ this.problemType = 'Chapter3_1'; |
|
195 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
196 |
+ this.problemType = 'Chapter3_2'; |
|
197 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
198 |
+ this.problemType = 'Chapter3_3'; |
|
199 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
200 |
+ this.problemType = 'Chapter3_3_1'; |
|
201 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
202 |
+ this.problemType = 'Chapter3_4'; |
|
203 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
204 |
+ this.problemType = 'Chapter3_5'; |
|
205 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
206 |
+ this.problemType = 'Chapter3_6'; |
|
207 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
208 |
+ this.problemType = 'Chapter3_7'; |
|
209 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
210 |
+ this.problemType = 'Chapter3_8'; |
|
211 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
212 |
+ this.problemType = 'Chapter3_9'; |
|
213 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
214 |
+ this.problemType = 'Chapter3_10'; |
|
215 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
216 |
+ this.problemType = 'Chapter3_11'; |
|
217 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
218 |
+ this.problemType = 'Chapter3_12'; |
|
219 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
220 |
+ this.problemType = 'Chapter3_13'; |
|
221 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
222 |
+ this.problemType = 'Chapter3_14'; |
|
223 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
224 |
+ this.problemType = 'Chapter3_15'; |
|
225 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
226 |
+ this.problemType = 'Chapter2_8'; |
|
227 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
228 |
+ this.problemType = 'Chapter2_7'; |
|
229 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
230 |
+ this.problemType = 'Chapter2_5'; |
|
231 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
232 |
+ this.problemType = 'Chapter2_6'; |
|
233 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
234 |
+ this.problemType = 'Chapter2_10'; |
|
235 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
236 |
+ this.problemType = 'Chapter2_11'; |
|
237 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
238 |
+ this.problemType = 'Chapter2_13'; |
|
239 |
+ } |
|
240 |
+ }, |
|
241 |
+ }, |
|
242 |
+ watch: {}, |
|
243 |
+ computed: { |
|
244 |
+ currentLearningId() { |
|
245 |
+ return this.$store.getters.currentLearningId; |
|
246 |
+ }, |
|
247 |
+ currentLabel() { |
|
248 |
+ return this.$store.getters.currentLabel; |
|
249 |
+ }, |
|
250 |
+ currentProblemIndex() { |
|
251 |
+ return this.$store.getters.currentProblemIndex; |
|
252 |
+ }, |
|
253 |
+ isPreviousButtonDisabled() { |
|
254 |
+ return this.currentProblemIndex === 0; |
|
255 |
+ }, |
|
256 |
+ }, |
|
257 |
+ created() { |
|
258 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
259 |
+ console.log('Current Label:', this.currentLabel); |
|
260 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
261 |
+ this.currentIndex = this.currentProblemIndex; |
|
262 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
263 |
+ |
|
264 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
265 |
+ }, |
|
266 |
+ components: { |
|
267 |
+ BookInfo: BookInfo, |
|
268 |
+ }, |
|
269 |
+ mounted() { |
|
270 |
+ this.getProblem(); |
|
271 |
+ }, |
|
295 | 272 |
}; |
296 | 273 |
</script> |
297 | 274 |
<style scoped> |
298 | 275 |
input.yellow-bd { |
299 |
- width: 30%; |
|
276 |
+ width: 30%; |
|
300 | 277 |
} |
301 | 278 |
|
302 | 279 |
.dropGroup button { |
303 |
- position: relative; |
|
280 |
+ position: relative; |
|
304 | 281 |
} |
305 | 282 |
|
306 | 283 |
.dropGroup button p { |
307 |
- font-size: 48px; |
|
284 |
+ font-size: 48px; |
|
308 | 285 |
} |
309 | 286 |
|
310 | 287 |
.dragGroup { |
311 |
- background-color: #f2f4f8; |
|
312 |
- padding: 30px 50px; |
|
313 |
- width: max-content; |
|
314 |
- border-radius: 20px; |
|
288 |
+ background-color: #f2f4f8; |
|
289 |
+ padding: 30px 50px; |
|
290 |
+ width: max-content; |
|
291 |
+ border-radius: 20px; |
|
315 | 292 |
} |
316 | 293 |
|
317 | 294 |
.dragGroup button p { |
318 |
- font-size: 48px; |
|
295 |
+ font-size: 48px; |
|
319 | 296 |
} |
320 | 297 |
|
321 | 298 |
.pre-btn img.active { |
322 |
- visibility: hidden; |
|
299 |
+ visibility: hidden; |
|
323 | 300 |
} |
324 | 301 |
|
325 | 302 |
.pre-btn img.active { |
326 |
- visibility: hidden; |
|
303 |
+ visibility: hidden; |
|
327 | 304 |
} |
328 | 305 |
|
329 | 306 |
.submit-button { |
330 |
- position: absolute; |
|
331 |
- background-color: #ffba08; |
|
332 |
- padding: 10px 30px; |
|
333 |
- border-radius: 10px; |
|
334 |
- font-size: 28px; |
|
335 |
- font-family: "ONEMobilePOPOTF"; |
|
336 |
- right: 5rem; |
|
337 |
- bottom: 3rem; |
|
307 |
+ position: absolute; |
|
308 |
+ background-color: #ffba08; |
|
309 |
+ padding: 10px 30px; |
|
310 |
+ border-radius: 10px; |
|
311 |
+ font-size: 28px; |
|
312 |
+ font-family: 'ONEMobilePOPOTF'; |
|
313 |
+ right: 5rem; |
|
314 |
+ bottom: 3rem; |
|
338 | 315 |
} |
339 | 316 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_11.vue
+++ client/views/pages/main/Chapter/Chapter3_11.vue
... | ... | @@ -1,324 +1,311 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3.</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
29 |
- </button> --> |
|
30 |
- </div> |
|
31 |
- |
|
32 |
- <div class="text-ct"> |
|
33 |
- <div class="time-hint"> |
|
34 |
- <button class="hint-btn">HINT</button> |
|
35 |
- <div class="time-bg mt20"> |
|
36 |
- <div> |
|
37 |
- <div class="time"> |
|
38 |
- <p class="second">{{ timer }}</p> |
|
39 |
- <p class="text">sec</p> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
40 | 7 |
</div> |
41 |
- </div> |
|
42 |
- </div> |
|
43 |
- </div> |
|
44 |
- <div class="imgGroup mt20"> |
|
45 |
- <img src="../../../../resources/img/img115_58s.png" alt="" /> |
|
46 |
- <!-- <p class="title1 mt10"><strong>진수가 거절한 제안</strong>은 무엇인지 우리말로 쓰세요.</p> --> |
|
47 |
- <div class="mt50 flex justify-center" style="gap: 50px"> |
|
48 |
- <input class="yellow-bd" type="text" v-model="answer1" /> |
|
49 |
- <p class="title3">e</p> |
|
50 |
- <input class="yellow-bd" type="text" v-model="answer2" /> |
|
51 |
- </div> |
|
52 |
- </div> |
|
8 |
+ </router-link> |
|
53 | 9 |
</div> |
54 |
- <button |
|
55 |
- class="submit-button" |
|
56 |
- @click="handleSubmit()" |
|
57 |
- v-if="currentIndex === learningIdsLength - 1" |
|
58 |
- > |
|
59 |
- 제출하기 |
|
60 |
- </button> |
|
61 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
62 |
- 다음 문제로 |
|
63 |
- </button> |
|
64 |
- </div> |
|
65 |
- <div class="next-btn" @click="nextProblem()"> |
|
66 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
67 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3.</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
22 |
+ </button> --> |
|
23 |
+ </div> |
|
24 |
+ |
|
25 |
+ <div class="text-ct"> |
|
26 |
+ <div class="time-hint"> |
|
27 |
+ <button class="hint-btn">HINT</button> |
|
28 |
+ <div class="time-bg mt20"> |
|
29 |
+ <div> |
|
30 |
+ <div class="time"> |
|
31 |
+ <p class="second">{{ timer }}</p> |
|
32 |
+ <p class="text">sec</p> |
|
33 |
+ </div> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ <div class="imgGroup mt20"> |
|
38 |
+ <img src="../../../../resources/img/img115_58s.png" alt="" /> |
|
39 |
+ <!-- <p class="title1 mt10"><strong>진수가 거절한 제안</strong>은 무엇인지 우리말로 쓰세요.</p> --> |
|
40 |
+ <div class="mt50 flex justify-center" style="gap: 50px"> |
|
41 |
+ <input class="yellow-bd" type="text" v-model="answer1" /> |
|
42 |
+ <p class="title3">e</p> |
|
43 |
+ <input class="yellow-bd" type="text" v-model="answer2" /> |
|
44 |
+ </div> |
|
45 |
+ </div> |
|
46 |
+ </div> |
|
47 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
48 |
+ 제출하기 |
|
49 |
+ </button> |
|
50 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
51 |
+ </div> |
|
52 |
+ <div class="next-btn" @click="nextProblem()"> |
|
53 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
54 |
+ </div> |
|
55 |
+ </div> |
|
68 | 56 |
</div> |
69 |
- </div> |
|
70 | 57 |
</template> |
71 | 58 |
|
72 | 59 |
<script> |
73 |
-import axios from "axios"; |
|
60 |
+import axios from 'axios'; |
|
61 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
74 | 62 |
export default { |
75 |
- data() { |
|
76 |
- return { |
|
77 |
- timer: "00", |
|
78 |
- answer1: null, |
|
79 |
- answer2: null, |
|
80 |
- text: "e", |
|
81 |
- dataList: [], |
|
82 |
- problemDetail: [], |
|
83 |
- currentIndex: null, |
|
84 |
- learningIdsLength: null, |
|
85 |
- }; |
|
86 |
- }, |
|
87 |
- methods: { |
|
88 |
- goToPage(page) { |
|
89 |
- this.$router.push({ name: page }); |
|
90 |
- }, |
|
91 |
- startTimer() { |
|
92 |
- if (this.intervalId) { |
|
93 |
- clearInterval(this.intervalId); |
|
94 |
- } |
|
95 |
- this.timer = 5; |
|
96 |
- this.intervalId = setInterval(() => { |
|
97 |
- if (this.timer > 0) { |
|
98 |
- this.timer--; |
|
99 |
- } else { |
|
100 |
- clearInterval(this.intervalId); |
|
101 |
- } |
|
102 |
- }, 1000); |
|
103 |
- }, |
|
104 |
- handleSubmit() { |
|
105 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
106 |
- if (userConfirmed) { |
|
107 |
- const problemData = { |
|
108 |
- prblmInfo: this.currentLearningId, |
|
109 |
- prblmNumber: this.currentProblemIndex, |
|
110 |
- prblmAns: this.selectedButton, |
|
63 |
+ data() { |
|
64 |
+ return { |
|
65 |
+ timer: '00', |
|
66 |
+ answer1: null, |
|
67 |
+ answer2: null, |
|
68 |
+ text: 'e', |
|
69 |
+ dataList: [], |
|
70 |
+ problemDetail: [], |
|
71 |
+ currentIndex: null, |
|
72 |
+ learningIdsLength: null, |
|
111 | 73 |
}; |
112 |
- |
|
113 |
- const answerData = { |
|
114 |
- prblmId: this.currentLearningId.prblm_id, |
|
115 |
- prblmAns: this.selectedButton, |
|
116 |
- stdId: this.$store.getters.getStdId, |
|
117 |
- prblmLogAnsCnt: 1, |
|
118 |
- }; |
|
119 |
- |
|
120 |
- this.$store.dispatch("saveProblemData", problemData); |
|
121 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
122 |
- |
|
123 |
- console.log(this.$store.getters.getAllProblems); |
|
124 |
- console.log(this.$store.getters.getAllAnswers); |
|
125 |
- |
|
126 |
- axios({ |
|
127 |
- url: "problemLog/insertProblemLog.json", |
|
128 |
- method: "post", |
|
129 |
- headers: { |
|
130 |
- "Content-Type": "application/json; charset=UTF-8", |
|
131 |
- }, |
|
132 |
- data: this.$store.getters.getAllAnswers, |
|
133 |
- }) |
|
134 |
- .then(function (res) { |
|
135 |
- console.log("problem - response : ", res.data); |
|
136 |
- this.goToPage("Chapter4"); |
|
137 |
- }) |
|
138 |
- .catch(function (error) { |
|
139 |
- console.log("problem - error : ", error); |
|
140 |
- }); |
|
141 |
- } else { |
|
142 |
- console.log("Submission canceled by the user."); |
|
143 |
- } |
|
144 | 74 |
}, |
145 |
- getProblem() { |
|
146 |
- const vm = this; |
|
147 |
- const prblmId = this.currentLearningId.prblm_id; |
|
148 |
- axios({ |
|
149 |
- url: "problem/problemInfo.json", |
|
150 |
- method: "post", |
|
151 |
- headers: { |
|
152 |
- "Content-Type": "application/json; charset=UTF-8", |
|
75 |
+ methods: { |
|
76 |
+ goToPage(page) { |
|
77 |
+ this.$router.push({ name: page }); |
|
153 | 78 |
}, |
154 |
- data: { |
|
155 |
- prblmId: prblmId, |
|
79 |
+ startTimer() { |
|
80 |
+ if (this.intervalId) { |
|
81 |
+ clearInterval(this.intervalId); |
|
82 |
+ } |
|
83 |
+ this.timer = 5; |
|
84 |
+ this.intervalId = setInterval(() => { |
|
85 |
+ if (this.timer > 0) { |
|
86 |
+ this.timer--; |
|
87 |
+ } else { |
|
88 |
+ clearInterval(this.intervalId); |
|
89 |
+ } |
|
90 |
+ }, 1000); |
|
156 | 91 |
}, |
157 |
- }) |
|
158 |
- .then(function (res) { |
|
159 |
- console.log("problem - response : ", res.data); |
|
160 |
- vm.dataList = res.data.problem; |
|
161 |
- vm.problemDetail = res.data.problemDetail; |
|
162 |
- }) |
|
163 |
- .catch(function (error) { |
|
164 |
- console.log("problem - error : ", error); |
|
165 |
- }); |
|
166 |
- }, |
|
167 |
- nextProblem() { |
|
168 |
- const problemData = { |
|
169 |
- prblmInfo: this.currentLearningId, |
|
170 |
- prblmNumber: this.currentProblemIndex, |
|
171 |
- prblmAns: this.selectedButton, |
|
172 |
- }; |
|
173 |
- const answerData = { |
|
174 |
- prblmId: this.currentLearningId.prblm_id, |
|
175 |
- prblmAns: this.selectedButton, |
|
176 |
- stdId: this.$store.getters.getStdId, |
|
177 |
- prblmLogAnsCnt: 1, |
|
178 |
- }; |
|
179 |
- this.$store.dispatch("saveProblemData", problemData); |
|
180 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
181 |
- console.log(this.$store.getters.getAllProblems); |
|
182 |
- console.log(this.$store.getters.getAllAnswers); |
|
183 |
- if ( |
|
184 |
- this.currentProblemIndex < |
|
185 |
- this.$store.state.currentLearningIds.length - 1 |
|
186 |
- ) { |
|
187 |
- this.$store.dispatch("goToNextProblem"); |
|
188 |
- this.handleProblemDetail(this.currentLearningId); |
|
189 |
- this.goToPage(this.problemType); |
|
190 |
- } |
|
191 |
- }, |
|
192 |
- previousProblem() { |
|
193 |
- if (this.currentProblemIndex > 0) { |
|
194 |
- this.$store.dispatch("goToPreviousProblem"); |
|
195 |
- this.handleProblemDetail(this.currentLearningId); |
|
196 |
- this.goToPage(this.problemType); |
|
197 |
- } |
|
198 |
- }, |
|
92 |
+ handleSubmit() { |
|
93 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
94 |
+ if (userConfirmed) { |
|
95 |
+ const problemData = { |
|
96 |
+ prblmInfo: this.currentLearningId, |
|
97 |
+ prblmNumber: this.currentProblemIndex, |
|
98 |
+ prblmAns: this.selectedButton, |
|
99 |
+ }; |
|
199 | 100 |
|
200 |
- handleProblemDetail(item) { |
|
201 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
202 |
- this.problemType = "Chapter3"; |
|
203 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
204 |
- this.problemType = "Chapter3_1"; |
|
205 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
206 |
- this.problemType = "Chapter3_2"; |
|
207 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
208 |
- this.problemType = "Chapter3_3"; |
|
209 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
210 |
- this.problemType = "Chapter3_3_1"; |
|
211 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
212 |
- this.problemType = "Chapter3_4"; |
|
213 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
214 |
- this.problemType = "Chapter3_5"; |
|
215 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
216 |
- this.problemType = "Chapter3_6"; |
|
217 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
218 |
- this.problemType = "Chapter3_7"; |
|
219 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
220 |
- this.problemType = "Chapter3_8"; |
|
221 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
222 |
- this.problemType = "Chapter3_9"; |
|
223 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
224 |
- this.problemType = "Chapter3_10"; |
|
225 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
226 |
- this.problemType = "Chapter3_11"; |
|
227 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
228 |
- this.problemType = "Chapter3_12"; |
|
229 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
230 |
- this.problemType = "Chapter3_13"; |
|
231 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
232 |
- this.problemType = "Chapter3_14"; |
|
233 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
234 |
- this.problemType = "Chapter3_15"; |
|
235 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
236 |
- this.problemType = "Chapter2_8"; |
|
237 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
238 |
- this.problemType = "Chapter2_7"; |
|
239 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
240 |
- this.problemType = "Chapter2_5"; |
|
241 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
242 |
- this.problemType = "Chapter2_6"; |
|
243 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
244 |
- this.problemType = "Chapter2_10"; |
|
245 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
246 |
- this.problemType = "Chapter2_11"; |
|
247 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
248 |
- this.problemType = "Chapter2_13"; |
|
249 |
- } |
|
250 |
- }, |
|
251 |
- }, |
|
252 |
- watch: {}, |
|
253 |
- computed: { |
|
254 |
- currentLearningId() { |
|
255 |
- return this.$store.getters.currentLearningId; |
|
256 |
- }, |
|
257 |
- currentLabel() { |
|
258 |
- return this.$store.getters.currentLabel; |
|
259 |
- }, |
|
260 |
- currentProblemIndex() { |
|
261 |
- return this.$store.getters.currentProblemIndex; |
|
262 |
- }, |
|
263 |
- isPreviousButtonDisabled() { |
|
264 |
- return this.currentProblemIndex === 0; |
|
265 |
- }, |
|
266 |
- }, |
|
267 |
- created() { |
|
268 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
269 |
- console.log("Current Label:", this.currentLabel); |
|
270 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
271 |
- this.currentIndex = this.currentProblemIndex; |
|
272 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
101 |
+ const answerData = { |
|
102 |
+ prblmId: this.currentLearningId.prblm_id, |
|
103 |
+ prblmAns: this.selectedButton, |
|
104 |
+ stdId: this.$store.getters.getStdId, |
|
105 |
+ prblmLogAnsCnt: 1, |
|
106 |
+ }; |
|
273 | 107 |
|
274 |
- // Fetch or process the current problem based on `currentLearningId` |
|
275 |
- }, |
|
276 |
- components: {}, |
|
277 |
- mounted() { |
|
278 |
- this.getProblem(); |
|
279 |
- }, |
|
108 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
109 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
110 |
+ |
|
111 |
+ console.log(this.$store.getters.getAllProblems); |
|
112 |
+ console.log(this.$store.getters.getAllAnswers); |
|
113 |
+ |
|
114 |
+ axios({ |
|
115 |
+ url: 'problemLog/insertProblemLog.json', |
|
116 |
+ method: 'post', |
|
117 |
+ headers: { |
|
118 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
119 |
+ }, |
|
120 |
+ data: this.$store.getters.getAllAnswers, |
|
121 |
+ }) |
|
122 |
+ .then(function (res) { |
|
123 |
+ console.log('problem - response : ', res.data); |
|
124 |
+ this.goToPage('Chapter4'); |
|
125 |
+ }) |
|
126 |
+ .catch(function (error) { |
|
127 |
+ console.log('problem - error : ', error); |
|
128 |
+ }); |
|
129 |
+ } else { |
|
130 |
+ console.log('Submission canceled by the user.'); |
|
131 |
+ } |
|
132 |
+ }, |
|
133 |
+ getProblem() { |
|
134 |
+ const vm = this; |
|
135 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
136 |
+ axios({ |
|
137 |
+ url: 'problem/problemInfo.json', |
|
138 |
+ method: 'post', |
|
139 |
+ headers: { |
|
140 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
141 |
+ }, |
|
142 |
+ data: { |
|
143 |
+ prblmId: prblmId, |
|
144 |
+ }, |
|
145 |
+ }) |
|
146 |
+ .then(function (res) { |
|
147 |
+ console.log('problem - response : ', res.data); |
|
148 |
+ vm.dataList = res.data.problem; |
|
149 |
+ vm.problemDetail = res.data.problemDetail; |
|
150 |
+ }) |
|
151 |
+ .catch(function (error) { |
|
152 |
+ console.log('problem - error : ', error); |
|
153 |
+ }); |
|
154 |
+ }, |
|
155 |
+ nextProblem() { |
|
156 |
+ const problemData = { |
|
157 |
+ prblmInfo: this.currentLearningId, |
|
158 |
+ prblmNumber: this.currentProblemIndex, |
|
159 |
+ prblmAns: this.selectedButton, |
|
160 |
+ }; |
|
161 |
+ const answerData = { |
|
162 |
+ prblmId: this.currentLearningId.prblm_id, |
|
163 |
+ prblmAns: this.selectedButton, |
|
164 |
+ stdId: this.$store.getters.getStdId, |
|
165 |
+ prblmLogAnsCnt: 1, |
|
166 |
+ }; |
|
167 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
168 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
169 |
+ console.log(this.$store.getters.getAllProblems); |
|
170 |
+ console.log(this.$store.getters.getAllAnswers); |
|
171 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
172 |
+ this.$store.dispatch('goToNextProblem'); |
|
173 |
+ this.handleProblemDetail(this.currentLearningId); |
|
174 |
+ this.goToPage(this.problemType); |
|
175 |
+ } |
|
176 |
+ }, |
|
177 |
+ previousProblem() { |
|
178 |
+ if (this.currentProblemIndex > 0) { |
|
179 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
180 |
+ this.handleProblemDetail(this.currentLearningId); |
|
181 |
+ this.goToPage(this.problemType); |
|
182 |
+ } |
|
183 |
+ }, |
|
184 |
+ |
|
185 |
+ handleProblemDetail(item) { |
|
186 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
187 |
+ this.problemType = 'Chapter3'; |
|
188 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
189 |
+ this.problemType = 'Chapter3_1'; |
|
190 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
191 |
+ this.problemType = 'Chapter3_2'; |
|
192 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
193 |
+ this.problemType = 'Chapter3_3'; |
|
194 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
195 |
+ this.problemType = 'Chapter3_3_1'; |
|
196 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
197 |
+ this.problemType = 'Chapter3_4'; |
|
198 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
199 |
+ this.problemType = 'Chapter3_5'; |
|
200 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
201 |
+ this.problemType = 'Chapter3_6'; |
|
202 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
203 |
+ this.problemType = 'Chapter3_7'; |
|
204 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
205 |
+ this.problemType = 'Chapter3_8'; |
|
206 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
207 |
+ this.problemType = 'Chapter3_9'; |
|
208 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
209 |
+ this.problemType = 'Chapter3_10'; |
|
210 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
211 |
+ this.problemType = 'Chapter3_11'; |
|
212 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
213 |
+ this.problemType = 'Chapter3_12'; |
|
214 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
215 |
+ this.problemType = 'Chapter3_13'; |
|
216 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
217 |
+ this.problemType = 'Chapter3_14'; |
|
218 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
219 |
+ this.problemType = 'Chapter3_15'; |
|
220 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
221 |
+ this.problemType = 'Chapter2_8'; |
|
222 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
223 |
+ this.problemType = 'Chapter2_7'; |
|
224 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
225 |
+ this.problemType = 'Chapter2_5'; |
|
226 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
227 |
+ this.problemType = 'Chapter2_6'; |
|
228 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
229 |
+ this.problemType = 'Chapter2_10'; |
|
230 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
231 |
+ this.problemType = 'Chapter2_11'; |
|
232 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
233 |
+ this.problemType = 'Chapter2_13'; |
|
234 |
+ } |
|
235 |
+ }, |
|
236 |
+ }, |
|
237 |
+ watch: {}, |
|
238 |
+ computed: { |
|
239 |
+ currentLearningId() { |
|
240 |
+ return this.$store.getters.currentLearningId; |
|
241 |
+ }, |
|
242 |
+ currentLabel() { |
|
243 |
+ return this.$store.getters.currentLabel; |
|
244 |
+ }, |
|
245 |
+ currentProblemIndex() { |
|
246 |
+ return this.$store.getters.currentProblemIndex; |
|
247 |
+ }, |
|
248 |
+ isPreviousButtonDisabled() { |
|
249 |
+ return this.currentProblemIndex === 0; |
|
250 |
+ }, |
|
251 |
+ }, |
|
252 |
+ created() { |
|
253 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
254 |
+ console.log('Current Label:', this.currentLabel); |
|
255 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
256 |
+ this.currentIndex = this.currentProblemIndex; |
|
257 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
258 |
+ |
|
259 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
260 |
+ }, |
|
261 |
+ components: { |
|
262 |
+ BookInfo: BookInfo, |
|
263 |
+ }, |
|
264 |
+ mounted() { |
|
265 |
+ this.getProblem(); |
|
266 |
+ }, |
|
280 | 267 |
}; |
281 | 268 |
</script> |
282 | 269 |
<style scoped> |
283 | 270 |
input.yellow-bd { |
284 |
- width: 76px; |
|
271 |
+ width: 76px; |
|
285 | 272 |
} |
286 | 273 |
|
287 | 274 |
.dropGroup button { |
288 |
- position: relative; |
|
275 |
+ position: relative; |
|
289 | 276 |
} |
290 | 277 |
|
291 | 278 |
.dropGroup button p { |
292 |
- font-size: 48px; |
|
279 |
+ font-size: 48px; |
|
293 | 280 |
} |
294 | 281 |
|
295 | 282 |
.dragGroup { |
296 |
- background-color: #f2f4f8; |
|
297 |
- padding: 30px 50px; |
|
298 |
- width: max-content; |
|
299 |
- border-radius: 20px; |
|
283 |
+ background-color: #f2f4f8; |
|
284 |
+ padding: 30px 50px; |
|
285 |
+ width: max-content; |
|
286 |
+ border-radius: 20px; |
|
300 | 287 |
} |
301 | 288 |
|
302 | 289 |
.dragGroup button p { |
303 |
- font-size: 48px; |
|
290 |
+ font-size: 48px; |
|
304 | 291 |
} |
305 | 292 |
|
306 | 293 |
.pre-btn img.active { |
307 |
- visibility: hidden; |
|
294 |
+ visibility: hidden; |
|
308 | 295 |
} |
309 | 296 |
|
310 | 297 |
.pre-btn img.active { |
311 |
- visibility: hidden; |
|
298 |
+ visibility: hidden; |
|
312 | 299 |
} |
313 | 300 |
|
314 | 301 |
.submit-button { |
315 |
- position: absolute; |
|
316 |
- background-color: #ffba08; |
|
317 |
- padding: 10px 30px; |
|
318 |
- border-radius: 10px; |
|
319 |
- font-size: 28px; |
|
320 |
- font-family: "ONEMobilePOPOTF"; |
|
321 |
- right: 5rem; |
|
322 |
- bottom: 3rem; |
|
302 |
+ position: absolute; |
|
303 |
+ background-color: #ffba08; |
|
304 |
+ padding: 10px 30px; |
|
305 |
+ border-radius: 10px; |
|
306 |
+ font-size: 28px; |
|
307 |
+ font-family: 'ONEMobilePOPOTF'; |
|
308 |
+ right: 5rem; |
|
309 |
+ bottom: 3rem; |
|
323 | 310 |
} |
324 | 311 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_12.vue
+++ client/views/pages/main/Chapter/Chapter3_12.vue
... | ... | @@ -1,402 +1,386 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
29 | 22 |
</button> --> |
30 |
- </div> |
|
23 |
+ </div> |
|
31 | 24 |
|
32 |
- <div class="text-ct"> |
|
33 |
- <div class="time-hint"> |
|
34 |
- <button class="hint-btn">HINT</button> |
|
35 |
- <div class="time-bg mt20"> |
|
36 |
- <div> |
|
37 |
- <div class="time"> |
|
38 |
- <p class="second">{{ timer }}</p> |
|
39 |
- <p class="text">sec</p> |
|
25 |
+ <div class="text-ct"> |
|
26 |
+ <div class="time-hint"> |
|
27 |
+ <button class="hint-btn">HINT</button> |
|
28 |
+ <div class="time-bg mt20"> |
|
29 |
+ <div> |
|
30 |
+ <div class="time"> |
|
31 |
+ <p class="second">{{ timer }}</p> |
|
32 |
+ <p class="text">sec</p> |
|
33 |
+ </div> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ <div class="dragGroup mt40"> |
|
38 |
+ <div class="flex justify-center" style="gap: 20px"> |
|
39 |
+ <div class="dropContainer" id="sourceContainer"> |
|
40 |
+ <button |
|
41 |
+ v-for="(word, index) in question" |
|
42 |
+ :key="index" |
|
43 |
+ draggable="true" |
|
44 |
+ @dragstart="onDragStart($event, word, index)" |
|
45 |
+ > |
|
46 |
+ <p>{{ word }}</p> |
|
47 |
+ </button> |
|
48 |
+ </div> |
|
49 |
+ </div> |
|
50 |
+ </div> |
|
51 |
+ <div class="dropContainer flex align-center justify-center mt30" id="targetContainer"> |
|
52 |
+ <div |
|
53 |
+ class="dropSlot" |
|
54 |
+ v-for="(slot, index) in questionLength" |
|
55 |
+ :key="index" |
|
56 |
+ @dragover.prevent |
|
57 |
+ @drop="onDrop($event, index)" |
|
58 |
+ > |
|
59 |
+ <div |
|
60 |
+ class="dropSlot-inner" |
|
61 |
+ draggable="true" |
|
62 |
+ @dragstart="onDragStart($event, userAnswer[index], index)" |
|
63 |
+ > |
|
64 |
+ <div class="dropSlot-inner"> |
|
65 |
+ <div v-if="userAnswer[index]" class="dropped-char"> |
|
66 |
+ {{ userAnswer[index] }} |
|
67 |
+ </div> |
|
68 |
+ </div> |
|
69 |
+ </div> |
|
70 |
+ </div> |
|
71 |
+ </div> |
|
40 | 72 |
</div> |
41 |
- </div> |
|
42 |
- </div> |
|
43 |
- </div> |
|
44 |
- <div class="dragGroup mt40"> |
|
45 |
- <div class="flex justify-center" style="gap: 20px"> |
|
46 |
- <div class="dropContainer" id="sourceContainer"> |
|
47 |
- <button |
|
48 |
- v-for="(word, index) in question" |
|
49 |
- :key="index" |
|
50 |
- draggable="true" |
|
51 |
- @dragstart="onDragStart($event, word, index)" |
|
52 |
- > |
|
53 |
- <p>{{ word }}</p> |
|
73 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
74 |
+ 제출하기 |
|
54 | 75 |
</button> |
55 |
- </div> |
|
76 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
56 | 77 |
</div> |
57 |
- </div> |
|
58 |
- <div |
|
59 |
- class="dropContainer flex align-center justify-center mt30" |
|
60 |
- id="targetContainer" |
|
61 |
- > |
|
62 |
- <div |
|
63 |
- class="dropSlot" |
|
64 |
- v-for="(slot, index) in questionLength" |
|
65 |
- :key="index" |
|
66 |
- @dragover.prevent |
|
67 |
- @drop="onDrop($event, index)" |
|
68 |
- > |
|
69 |
- <div |
|
70 |
- class="dropSlot-inner" |
|
71 |
- draggable="true" |
|
72 |
- @dragstart="onDragStart($event, userAnswer[index], index)" |
|
73 |
- > |
|
74 |
- <div class="dropSlot-inner"> |
|
75 |
- <div v-if="userAnswer[index]" class="dropped-char"> |
|
76 |
- {{ userAnswer[index] }} |
|
77 |
- </div> |
|
78 |
- </div> |
|
79 |
- </div> |
|
78 |
+ <div class="next-btn" @click="nextProblem()"> |
|
79 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
80 | 80 |
</div> |
81 |
- </div> |
|
82 | 81 |
</div> |
83 |
- <button |
|
84 |
- class="submit-button" |
|
85 |
- @click="handleSubmit()" |
|
86 |
- v-if="currentIndex === learningIdsLength - 1" |
|
87 |
- > |
|
88 |
- 제출하기 |
|
89 |
- </button> |
|
90 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
91 |
- 다음 문제로 |
|
92 |
- </button> |
|
93 |
- </div> |
|
94 |
- <div class="next-btn" @click="nextProblem()"> |
|
95 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
96 |
- </div> |
|
97 | 82 |
</div> |
98 |
- </div> |
|
99 | 83 |
</template> |
100 | 84 |
|
101 | 85 |
<script> |
102 |
-import axios from "axios"; |
|
86 |
+import axios from 'axios'; |
|
87 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
103 | 88 |
export default { |
104 |
- data() { |
|
105 |
- return { |
|
106 |
- timer: "00", |
|
107 |
- question: [`don't`, "banana", "i", "like"], |
|
108 |
- questionLength: null, |
|
109 |
- answer: null, |
|
89 |
+ data() { |
|
90 |
+ return { |
|
91 |
+ timer: '00', |
|
92 |
+ question: [`don't`, 'banana', 'i', 'like'], |
|
93 |
+ questionLength: null, |
|
94 |
+ answer: null, |
|
110 | 95 |
|
111 |
- userAnswer: [], // 초기화 시 빈 배열로 설정 |
|
112 |
- draggedChar: null, // 드래그한 문자를 임시로 저장 |
|
113 |
- draggedCharIndex: null, // 드래그한 문자의 인덱스 저장 |
|
114 |
- dataList: [], |
|
115 |
- problemDetail: [], |
|
116 |
- currentIndex: null, |
|
117 |
- learningIdsLength: null, |
|
118 |
- }; |
|
119 |
- }, |
|
120 |
- methods: { |
|
121 |
- goToPage(page) { |
|
122 |
- this.$router.push({ name: page }); |
|
123 |
- }, |
|
124 |
- startTimer() { |
|
125 |
- if (this.intervalId) { |
|
126 |
- clearInterval(this.intervalId); |
|
127 |
- } |
|
128 |
- this.timer = 5; |
|
129 |
- this.intervalId = setInterval(() => { |
|
130 |
- if (this.timer > 0) { |
|
131 |
- this.timer--; |
|
132 |
- } else { |
|
133 |
- clearInterval(this.intervalId); |
|
134 |
- } |
|
135 |
- }, 1000); |
|
136 |
- }, |
|
137 |
- initializeAnswer() { |
|
138 |
- this.questionLength = this.question.length; |
|
139 |
- this.userAnswer = new Array(this.questionLength).fill(null); // userAnswer 배열을 question 길이만큼 초기화 |
|
140 |
- }, |
|
141 |
- // 드래그 시작 시 호출 |
|
142 |
- onDragStart(event, char, index) { |
|
143 |
- this.draggedChar = char; |
|
144 |
- this.draggedCharIndex = index; |
|
145 |
- }, |
|
146 |
- // 드롭 시 호출 |
|
147 |
- onDrop(event, index) { |
|
148 |
- if (!this.userAnswer[index]) { |
|
149 |
- // 해당 슬롯이 비어있는 경우에만 드롭 |
|
150 |
- this.userAnswer.splice(index, 1, this.draggedChar); // userAnswer에 드래그한 문자 추가 |
|
151 |
- this.draggedChar = null; |
|
152 |
- this.draggedCharIndex = null; |
|
153 |
- } |
|
154 |
- }, |
|
155 |
- handleSubmit() { |
|
156 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
157 |
- if (userConfirmed) { |
|
158 |
- const problemData = { |
|
159 |
- prblmInfo: this.currentLearningId, |
|
160 |
- prblmNumber: this.currentProblemIndex, |
|
161 |
- prblmAns: this.selectedButton, |
|
96 |
+ userAnswer: [], // 초기화 시 빈 배열로 설정 |
|
97 |
+ draggedChar: null, // 드래그한 문자를 임시로 저장 |
|
98 |
+ draggedCharIndex: null, // 드래그한 문자의 인덱스 저장 |
|
99 |
+ dataList: [], |
|
100 |
+ problemDetail: [], |
|
101 |
+ currentIndex: null, |
|
102 |
+ learningIdsLength: null, |
|
162 | 103 |
}; |
163 |
- |
|
164 |
- const answerData = { |
|
165 |
- prblmId: this.currentLearningId.prblm_id, |
|
166 |
- prblmAns: this.selectedButton, |
|
167 |
- stdId: this.$store.getters.getStdId, |
|
168 |
- prblmLogAnsCnt: 1, |
|
169 |
- }; |
|
170 |
- |
|
171 |
- this.$store.dispatch("saveProblemData", problemData); |
|
172 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
173 |
- |
|
174 |
- console.log(this.$store.getters.getAllProblems); |
|
175 |
- console.log(this.$store.getters.getAllAnswers); |
|
176 |
- |
|
177 |
- axios({ |
|
178 |
- url: "problemLog/insertProblemLog.json", |
|
179 |
- method: "post", |
|
180 |
- headers: { |
|
181 |
- "Content-Type": "application/json; charset=UTF-8", |
|
182 |
- }, |
|
183 |
- data: this.$store.getters.getAllAnswers, |
|
184 |
- }) |
|
185 |
- .then(function (res) { |
|
186 |
- console.log("problem - response : ", res.data); |
|
187 |
- this.goToPage("Chapter4"); |
|
188 |
- }) |
|
189 |
- .catch(function (error) { |
|
190 |
- console.log("problem - error : ", error); |
|
191 |
- }); |
|
192 |
- } else { |
|
193 |
- console.log("Submission canceled by the user."); |
|
194 |
- } |
|
195 | 104 |
}, |
196 |
- getProblem() { |
|
197 |
- const vm = this; |
|
198 |
- const prblmId = this.currentLearningId.prblm_id; |
|
199 |
- axios({ |
|
200 |
- url: "problem/problemInfo.json", |
|
201 |
- method: "post", |
|
202 |
- headers: { |
|
203 |
- "Content-Type": "application/json; charset=UTF-8", |
|
105 |
+ methods: { |
|
106 |
+ goToPage(page) { |
|
107 |
+ this.$router.push({ name: page }); |
|
204 | 108 |
}, |
205 |
- data: { |
|
206 |
- prblmId: prblmId, |
|
109 |
+ startTimer() { |
|
110 |
+ if (this.intervalId) { |
|
111 |
+ clearInterval(this.intervalId); |
|
112 |
+ } |
|
113 |
+ this.timer = 5; |
|
114 |
+ this.intervalId = setInterval(() => { |
|
115 |
+ if (this.timer > 0) { |
|
116 |
+ this.timer--; |
|
117 |
+ } else { |
|
118 |
+ clearInterval(this.intervalId); |
|
119 |
+ } |
|
120 |
+ }, 1000); |
|
207 | 121 |
}, |
208 |
- }) |
|
209 |
- .then(function (res) { |
|
210 |
- console.log("problem - response : ", res.data); |
|
211 |
- vm.dataList = res.data.problem; |
|
212 |
- vm.problemDetail = res.data.problemDetail; |
|
213 |
- }) |
|
214 |
- .catch(function (error) { |
|
215 |
- console.log("problem - error : ", error); |
|
216 |
- }); |
|
217 |
- }, |
|
218 |
- nextProblem() { |
|
219 |
- const problemData = { |
|
220 |
- prblmInfo: this.currentLearningId, |
|
221 |
- prblmNumber: this.currentProblemIndex, |
|
222 |
- prblmAns: this.selectedButton, |
|
223 |
- }; |
|
224 |
- const answerData = { |
|
225 |
- prblmId: this.currentLearningId.prblm_id, |
|
226 |
- prblmAns: this.selectedButton, |
|
227 |
- stdId: this.$store.getters.getStdId, |
|
228 |
- prblmLogAnsCnt: 1, |
|
229 |
- }; |
|
230 |
- this.$store.dispatch("saveProblemData", problemData); |
|
231 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
232 |
- console.log(this.$store.getters.getAllProblems); |
|
233 |
- console.log(this.$store.getters.getAllAnswers); |
|
234 |
- if ( |
|
235 |
- this.currentProblemIndex < |
|
236 |
- this.$store.state.currentLearningIds.length - 1 |
|
237 |
- ) { |
|
238 |
- this.$store.dispatch("goToNextProblem"); |
|
239 |
- this.handleProblemDetail(this.currentLearningId); |
|
240 |
- this.goToPage(this.problemType); |
|
241 |
- } |
|
242 |
- }, |
|
243 |
- previousProblem() { |
|
244 |
- if (this.currentProblemIndex > 0) { |
|
245 |
- this.$store.dispatch("goToPreviousProblem"); |
|
246 |
- this.handleProblemDetail(this.currentLearningId); |
|
247 |
- this.goToPage(this.problemType); |
|
248 |
- } |
|
249 |
- }, |
|
122 |
+ initializeAnswer() { |
|
123 |
+ this.questionLength = this.question.length; |
|
124 |
+ this.userAnswer = new Array(this.questionLength).fill(null); // userAnswer 배열을 question 길이만큼 초기화 |
|
125 |
+ }, |
|
126 |
+ // 드래그 시작 시 호출 |
|
127 |
+ onDragStart(event, char, index) { |
|
128 |
+ this.draggedChar = char; |
|
129 |
+ this.draggedCharIndex = index; |
|
130 |
+ }, |
|
131 |
+ // 드롭 시 호출 |
|
132 |
+ onDrop(event, index) { |
|
133 |
+ if (!this.userAnswer[index]) { |
|
134 |
+ // 해당 슬롯이 비어있는 경우에만 드롭 |
|
135 |
+ this.userAnswer.splice(index, 1, this.draggedChar); // userAnswer에 드래그한 문자 추가 |
|
136 |
+ this.draggedChar = null; |
|
137 |
+ this.draggedCharIndex = null; |
|
138 |
+ } |
|
139 |
+ }, |
|
140 |
+ handleSubmit() { |
|
141 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
142 |
+ if (userConfirmed) { |
|
143 |
+ const problemData = { |
|
144 |
+ prblmInfo: this.currentLearningId, |
|
145 |
+ prblmNumber: this.currentProblemIndex, |
|
146 |
+ prblmAns: this.selectedButton, |
|
147 |
+ }; |
|
250 | 148 |
|
251 |
- handleProblemDetail(item) { |
|
252 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
253 |
- this.problemType = "Chapter3"; |
|
254 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
255 |
- this.problemType = "Chapter3_1"; |
|
256 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
257 |
- this.problemType = "Chapter3_2"; |
|
258 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
259 |
- this.problemType = "Chapter3_3"; |
|
260 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
261 |
- this.problemType = "Chapter3_3_1"; |
|
262 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
263 |
- this.problemType = "Chapter3_4"; |
|
264 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
265 |
- this.problemType = "Chapter3_5"; |
|
266 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
267 |
- this.problemType = "Chapter3_6"; |
|
268 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
269 |
- this.problemType = "Chapter3_7"; |
|
270 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
271 |
- this.problemType = "Chapter3_8"; |
|
272 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
273 |
- this.problemType = "Chapter3_9"; |
|
274 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
275 |
- this.problemType = "Chapter3_10"; |
|
276 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
277 |
- this.problemType = "Chapter3_11"; |
|
278 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
279 |
- this.problemType = "Chapter3_12"; |
|
280 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
281 |
- this.problemType = "Chapter3_13"; |
|
282 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
283 |
- this.problemType = "Chapter3_14"; |
|
284 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
285 |
- this.problemType = "Chapter3_15"; |
|
286 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
287 |
- this.problemType = "Chapter2_8"; |
|
288 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
289 |
- this.problemType = "Chapter2_7"; |
|
290 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
291 |
- this.problemType = "Chapter2_5"; |
|
292 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
293 |
- this.problemType = "Chapter2_6"; |
|
294 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
295 |
- this.problemType = "Chapter2_10"; |
|
296 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
297 |
- this.problemType = "Chapter2_11"; |
|
298 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
299 |
- this.problemType = "Chapter2_13"; |
|
300 |
- } |
|
301 |
- }, |
|
302 |
- }, |
|
303 |
- watch: {}, |
|
304 |
- computed: { |
|
305 |
- currentLearningId() { |
|
306 |
- return this.$store.getters.currentLearningId; |
|
307 |
- }, |
|
308 |
- currentLabel() { |
|
309 |
- return this.$store.getters.currentLabel; |
|
310 |
- }, |
|
311 |
- currentProblemIndex() { |
|
312 |
- return this.$store.getters.currentProblemIndex; |
|
313 |
- }, |
|
314 |
- isPreviousButtonDisabled() { |
|
315 |
- return this.currentProblemIndex === 0; |
|
316 |
- }, |
|
317 |
- }, |
|
318 |
- created() { |
|
319 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
320 |
- console.log("Current Label:", this.currentLabel); |
|
321 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
322 |
- this.currentIndex = this.currentProblemIndex; |
|
323 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
149 |
+ const answerData = { |
|
150 |
+ prblmId: this.currentLearningId.prblm_id, |
|
151 |
+ prblmAns: this.selectedButton, |
|
152 |
+ stdId: this.$store.getters.getStdId, |
|
153 |
+ prblmLogAnsCnt: 1, |
|
154 |
+ }; |
|
324 | 155 |
|
325 |
- // Fetch or process the current problem based on `currentLearningId` |
|
326 |
- }, |
|
327 |
- components: {}, |
|
328 |
- mounted() { |
|
329 |
- this.getProblem(); |
|
330 |
- this.initializeAnswer(); |
|
331 |
- }, |
|
156 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
157 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
158 |
+ |
|
159 |
+ console.log(this.$store.getters.getAllProblems); |
|
160 |
+ console.log(this.$store.getters.getAllAnswers); |
|
161 |
+ |
|
162 |
+ axios({ |
|
163 |
+ url: 'problemLog/insertProblemLog.json', |
|
164 |
+ method: 'post', |
|
165 |
+ headers: { |
|
166 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
167 |
+ }, |
|
168 |
+ data: this.$store.getters.getAllAnswers, |
|
169 |
+ }) |
|
170 |
+ .then(function (res) { |
|
171 |
+ console.log('problem - response : ', res.data); |
|
172 |
+ this.goToPage('Chapter4'); |
|
173 |
+ }) |
|
174 |
+ .catch(function (error) { |
|
175 |
+ console.log('problem - error : ', error); |
|
176 |
+ }); |
|
177 |
+ } else { |
|
178 |
+ console.log('Submission canceled by the user.'); |
|
179 |
+ } |
|
180 |
+ }, |
|
181 |
+ getProblem() { |
|
182 |
+ const vm = this; |
|
183 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
184 |
+ axios({ |
|
185 |
+ url: 'problem/problemInfo.json', |
|
186 |
+ method: 'post', |
|
187 |
+ headers: { |
|
188 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
189 |
+ }, |
|
190 |
+ data: { |
|
191 |
+ prblmId: prblmId, |
|
192 |
+ }, |
|
193 |
+ }) |
|
194 |
+ .then(function (res) { |
|
195 |
+ console.log('problem - response : ', res.data); |
|
196 |
+ vm.dataList = res.data.problem; |
|
197 |
+ vm.problemDetail = res.data.problemDetail; |
|
198 |
+ }) |
|
199 |
+ .catch(function (error) { |
|
200 |
+ console.log('problem - error : ', error); |
|
201 |
+ }); |
|
202 |
+ }, |
|
203 |
+ nextProblem() { |
|
204 |
+ const problemData = { |
|
205 |
+ prblmInfo: this.currentLearningId, |
|
206 |
+ prblmNumber: this.currentProblemIndex, |
|
207 |
+ prblmAns: this.selectedButton, |
|
208 |
+ }; |
|
209 |
+ const answerData = { |
|
210 |
+ prblmId: this.currentLearningId.prblm_id, |
|
211 |
+ prblmAns: this.selectedButton, |
|
212 |
+ stdId: this.$store.getters.getStdId, |
|
213 |
+ prblmLogAnsCnt: 1, |
|
214 |
+ }; |
|
215 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
216 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
217 |
+ console.log(this.$store.getters.getAllProblems); |
|
218 |
+ console.log(this.$store.getters.getAllAnswers); |
|
219 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
220 |
+ this.$store.dispatch('goToNextProblem'); |
|
221 |
+ this.handleProblemDetail(this.currentLearningId); |
|
222 |
+ this.goToPage(this.problemType); |
|
223 |
+ } |
|
224 |
+ }, |
|
225 |
+ previousProblem() { |
|
226 |
+ if (this.currentProblemIndex > 0) { |
|
227 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
228 |
+ this.handleProblemDetail(this.currentLearningId); |
|
229 |
+ this.goToPage(this.problemType); |
|
230 |
+ } |
|
231 |
+ }, |
|
232 |
+ |
|
233 |
+ handleProblemDetail(item) { |
|
234 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
235 |
+ this.problemType = 'Chapter3'; |
|
236 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
237 |
+ this.problemType = 'Chapter3_1'; |
|
238 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
239 |
+ this.problemType = 'Chapter3_2'; |
|
240 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
241 |
+ this.problemType = 'Chapter3_3'; |
|
242 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
243 |
+ this.problemType = 'Chapter3_3_1'; |
|
244 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
245 |
+ this.problemType = 'Chapter3_4'; |
|
246 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
247 |
+ this.problemType = 'Chapter3_5'; |
|
248 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
249 |
+ this.problemType = 'Chapter3_6'; |
|
250 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
251 |
+ this.problemType = 'Chapter3_7'; |
|
252 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
253 |
+ this.problemType = 'Chapter3_8'; |
|
254 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
255 |
+ this.problemType = 'Chapter3_9'; |
|
256 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
257 |
+ this.problemType = 'Chapter3_10'; |
|
258 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
259 |
+ this.problemType = 'Chapter3_11'; |
|
260 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
261 |
+ this.problemType = 'Chapter3_12'; |
|
262 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
263 |
+ this.problemType = 'Chapter3_13'; |
|
264 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
265 |
+ this.problemType = 'Chapter3_14'; |
|
266 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
267 |
+ this.problemType = 'Chapter3_15'; |
|
268 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
269 |
+ this.problemType = 'Chapter2_8'; |
|
270 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
271 |
+ this.problemType = 'Chapter2_7'; |
|
272 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
273 |
+ this.problemType = 'Chapter2_5'; |
|
274 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
275 |
+ this.problemType = 'Chapter2_6'; |
|
276 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
277 |
+ this.problemType = 'Chapter2_10'; |
|
278 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
279 |
+ this.problemType = 'Chapter2_11'; |
|
280 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
281 |
+ this.problemType = 'Chapter2_13'; |
|
282 |
+ } |
|
283 |
+ }, |
|
284 |
+ }, |
|
285 |
+ watch: {}, |
|
286 |
+ computed: { |
|
287 |
+ currentLearningId() { |
|
288 |
+ return this.$store.getters.currentLearningId; |
|
289 |
+ }, |
|
290 |
+ currentLabel() { |
|
291 |
+ return this.$store.getters.currentLabel; |
|
292 |
+ }, |
|
293 |
+ currentProblemIndex() { |
|
294 |
+ return this.$store.getters.currentProblemIndex; |
|
295 |
+ }, |
|
296 |
+ isPreviousButtonDisabled() { |
|
297 |
+ return this.currentProblemIndex === 0; |
|
298 |
+ }, |
|
299 |
+ }, |
|
300 |
+ created() { |
|
301 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
302 |
+ console.log('Current Label:', this.currentLabel); |
|
303 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
304 |
+ this.currentIndex = this.currentProblemIndex; |
|
305 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
306 |
+ |
|
307 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
308 |
+ }, |
|
309 |
+ components: { |
|
310 |
+ BookInfo: BookInfo, |
|
311 |
+ }, |
|
312 |
+ mounted() { |
|
313 |
+ this.getProblem(); |
|
314 |
+ this.initializeAnswer(); |
|
315 |
+ }, |
|
332 | 316 |
}; |
333 | 317 |
</script> |
334 | 318 |
<style scoped> |
335 | 319 |
.textbox { |
336 |
- height: 60px; |
|
320 |
+ height: 60px; |
|
337 | 321 |
} |
338 | 322 |
|
339 | 323 |
.textbox p { |
340 |
- font-size: 28px; |
|
341 |
- font-weight: bold; |
|
342 |
- line-height: 65px; |
|
324 |
+ font-size: 28px; |
|
325 |
+ font-weight: bold; |
|
326 |
+ line-height: 65px; |
|
343 | 327 |
} |
344 | 328 |
|
345 | 329 |
.dropGroup button { |
346 |
- position: relative; |
|
330 |
+ position: relative; |
|
347 | 331 |
} |
348 | 332 |
|
349 | 333 |
.dropGroup button p { |
350 |
- font-size: 48px; |
|
334 |
+ font-size: 48px; |
|
351 | 335 |
} |
352 | 336 |
|
353 | 337 |
.dragGroup button p { |
354 |
- font-size: 48px; |
|
338 |
+ font-size: 48px; |
|
355 | 339 |
} |
356 | 340 |
|
357 | 341 |
#sourceContainer { |
358 |
- margin-top: 100px; |
|
359 |
- display: flex; |
|
360 |
- flex-direction: row; |
|
361 |
- gap: 230px; |
|
342 |
+ margin-top: 100px; |
|
343 |
+ display: flex; |
|
344 |
+ flex-direction: row; |
|
345 |
+ gap: 230px; |
|
362 | 346 |
} |
363 | 347 |
|
364 | 348 |
#targetContainer { |
365 |
- margin-top: 15rem; |
|
366 |
- height: 100px; |
|
367 |
- display: flex; |
|
368 |
- flex-direction: row; |
|
369 |
- gap: 80px; |
|
349 |
+ margin-top: 15rem; |
|
350 |
+ height: 100px; |
|
351 |
+ display: flex; |
|
352 |
+ flex-direction: row; |
|
353 |
+ gap: 80px; |
|
370 | 354 |
} |
371 | 355 |
|
372 | 356 |
#targetContainer .dropSlot { |
373 |
- width: 250px; |
|
374 |
- height: 70px; |
|
375 |
- padding: 10px; |
|
376 |
- border-bottom: 8px solid #ffba08; |
|
357 |
+ width: 250px; |
|
358 |
+ height: 70px; |
|
359 |
+ padding: 10px; |
|
360 |
+ border-bottom: 8px solid #ffba08; |
|
377 | 361 |
} |
378 | 362 |
|
379 | 363 |
#targetContainer .dropSlot .dropped-char { |
380 |
- font-size: 48px; |
|
381 |
- font-family: "ONEMobilePOPOTF"; |
|
364 |
+ font-size: 48px; |
|
365 |
+ font-family: 'ONEMobilePOPOTF'; |
|
382 | 366 |
} |
383 | 367 |
|
384 | 368 |
.pre-btn img.active { |
385 |
- visibility: hidden; |
|
369 |
+ visibility: hidden; |
|
386 | 370 |
} |
387 | 371 |
|
388 | 372 |
.pre-btn img.active { |
389 |
- visibility: hidden; |
|
373 |
+ visibility: hidden; |
|
390 | 374 |
} |
391 | 375 |
|
392 | 376 |
.submit-button { |
393 |
- position: absolute; |
|
394 |
- background-color: #ffba08; |
|
395 |
- padding: 10px 30px; |
|
396 |
- border-radius: 10px; |
|
397 |
- font-size: 28px; |
|
398 |
- font-family: "ONEMobilePOPOTF"; |
|
399 |
- right: 5rem; |
|
400 |
- bottom: 3rem; |
|
377 |
+ position: absolute; |
|
378 |
+ background-color: #ffba08; |
|
379 |
+ padding: 10px 30px; |
|
380 |
+ border-radius: 10px; |
|
381 |
+ font-size: 28px; |
|
382 |
+ font-family: 'ONEMobilePOPOTF'; |
|
383 |
+ right: 5rem; |
|
384 |
+ bottom: 3rem; |
|
401 | 385 |
} |
402 | 386 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_13.vue
+++ client/views/pages/main/Chapter/Chapter3_13.vue
... | ... | @@ -1,451 +1,432 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
+ </div> |
|
8 |
+ </router-link> |
|
7 | 9 |
</div> |
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
29 | 22 |
</button> --> |
30 |
- </div> |
|
31 |
- |
|
32 |
- <div class="text-ct"> |
|
33 |
- <div class="time-hint"> |
|
34 |
- <button class="hint-btn">HINT</button> |
|
35 |
- <div class="time-bg mt20"> |
|
36 |
- <div> |
|
37 |
- <div class="time"> |
|
38 |
- <p class="second">{{ timer }}</p> |
|
39 |
- <p class="text">sec</p> |
|
40 | 23 |
</div> |
41 |
- </div> |
|
42 |
- </div> |
|
43 |
- </div> |
|
44 |
- <div class="flex justify-center"> |
|
45 |
- <div class="flex justify-between align-center" style="width: 50%"> |
|
46 |
- <!-- SVG Container for Drawing Lines --> |
|
47 |
- <svg |
|
48 |
- class="line-container" |
|
49 |
- xmlns="http://www.w3.org/2000/svg" |
|
50 |
- :style="{ width: svgWidth, height: svgHeight }" |
|
51 |
- > |
|
52 |
- <line |
|
53 |
- v-for="(pair, index) in pairs" |
|
54 |
- :key="'line-' + index" |
|
55 |
- :x1="pair.leftPos.x" |
|
56 |
- :y1="pair.leftPos.y" |
|
57 |
- :x2="pair.rightPos.x" |
|
58 |
- :y2="pair.rightPos.y" |
|
59 |
- stroke="blue" |
|
60 |
- stroke-width="2" |
|
61 |
- /> |
|
62 |
- </svg> |
|
63 | 24 |
|
64 |
- <div class="pickGroup left"> |
|
65 |
- <div> |
|
66 |
- <article |
|
67 |
- class="flex align-center justify-between mb20" |
|
68 |
- style="gap: 60px" |
|
69 |
- v-for="(image, index) in images" |
|
70 |
- :key="'left-' + index" |
|
71 |
- > |
|
72 |
- <img :src="image.src" :alt="image.alt" /> |
|
73 |
- <div> |
|
74 |
- <button |
|
75 |
- class="blue-c" |
|
76 |
- @click="selectLeft(index, $event)" |
|
77 |
- ></button> |
|
25 |
+ <div class="text-ct"> |
|
26 |
+ <div class="time-hint"> |
|
27 |
+ <button class="hint-btn">HINT</button> |
|
28 |
+ <div class="time-bg mt20"> |
|
29 |
+ <div> |
|
30 |
+ <div class="time"> |
|
31 |
+ <p class="second">{{ timer }}</p> |
|
32 |
+ <p class="text">sec</p> |
|
33 |
+ </div> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
78 | 36 |
</div> |
79 |
- </article> |
|
80 |
- </div> |
|
81 |
- </div> |
|
37 |
+ <div class="flex justify-center"> |
|
38 |
+ <div class="flex justify-between align-center" style="width: 50%"> |
|
39 |
+ <!-- SVG Container for Drawing Lines --> |
|
40 |
+ <svg |
|
41 |
+ class="line-container" |
|
42 |
+ xmlns="http://www.w3.org/2000/svg" |
|
43 |
+ :style="{ width: svgWidth, height: svgHeight }" |
|
44 |
+ > |
|
45 |
+ <line |
|
46 |
+ v-for="(pair, index) in pairs" |
|
47 |
+ :key="'line-' + index" |
|
48 |
+ :x1="pair.leftPos.x" |
|
49 |
+ :y1="pair.leftPos.y" |
|
50 |
+ :x2="pair.rightPos.x" |
|
51 |
+ :y2="pair.rightPos.y" |
|
52 |
+ stroke="blue" |
|
53 |
+ stroke-width="2" |
|
54 |
+ /> |
|
55 |
+ </svg> |
|
82 | 56 |
|
83 |
- <div class="pickGroup right"> |
|
84 |
- <article |
|
85 |
- v-for="(word, index) in problemDetail" |
|
86 |
- :key="index" |
|
87 |
- class="flex align-center justify-start mb20" |
|
88 |
- style="gap: 30px" |
|
89 |
- > |
|
90 |
- <button |
|
91 |
- class="blue-c" |
|
92 |
- @click="selectRight(index, $event)" |
|
93 |
- ></button> |
|
94 |
- <p class="word">{{ word.prblmDtlExpln }}</p> |
|
95 |
- </article> |
|
96 |
- </div> |
|
57 |
+ <div class="pickGroup left"> |
|
58 |
+ <div> |
|
59 |
+ <article |
|
60 |
+ class="flex align-center justify-between mb20" |
|
61 |
+ style="gap: 60px" |
|
62 |
+ v-for="(image, index) in images" |
|
63 |
+ :key="'left-' + index" |
|
64 |
+ > |
|
65 |
+ <img :src="image.src" :alt="image.alt" /> |
|
66 |
+ <div> |
|
67 |
+ <button class="blue-c" @click="selectLeft(index, $event)"></button> |
|
68 |
+ </div> |
|
69 |
+ </article> |
|
70 |
+ </div> |
|
71 |
+ </div> |
|
72 |
+ |
|
73 |
+ <div class="pickGroup right"> |
|
74 |
+ <article |
|
75 |
+ v-for="(word, index) in problemDetail" |
|
76 |
+ :key="index" |
|
77 |
+ class="flex align-center justify-start mb20" |
|
78 |
+ style="gap: 30px" |
|
79 |
+ > |
|
80 |
+ <button class="blue-c" @click="selectRight(index, $event)"></button> |
|
81 |
+ <p class="word">{{ word.prblmDtlExpln }}</p> |
|
82 |
+ </article> |
|
83 |
+ </div> |
|
84 |
+ </div> |
|
85 |
+ </div> |
|
86 |
+ </div> |
|
87 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
88 |
+ 제출하기 |
|
89 |
+ </button> |
|
90 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
97 | 91 |
</div> |
98 |
- </div> |
|
92 |
+ <div class="next-btn" @click="nextProblem()"> |
|
93 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
94 |
+ </div> |
|
99 | 95 |
</div> |
100 |
- <button |
|
101 |
- class="submit-button" |
|
102 |
- @click="handleSubmit()" |
|
103 |
- v-if="currentIndex === learningIdsLength - 1" |
|
104 |
- > |
|
105 |
- 제출하기 |
|
106 |
- </button> |
|
107 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
108 |
- 다음 문제로 |
|
109 |
- </button> |
|
110 |
- </div> |
|
111 |
- <div class="next-btn" @click="nextProblem()"> |
|
112 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
113 |
- </div> |
|
114 | 96 |
</div> |
115 |
- </div> |
|
116 | 97 |
</template> |
117 | 98 |
|
118 | 99 |
<script> |
119 |
-import axios from "axios"; |
|
100 |
+import axios from 'axios'; |
|
101 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
120 | 102 |
export default { |
121 |
- data() { |
|
122 |
- return { |
|
123 |
- timer: "00", |
|
124 |
- question: ["Australia", "Brazil", "China"], |
|
125 |
- images: [ |
|
126 |
- { src: "client/resources/img/img121_62s.png", alt: "Australia" }, |
|
127 |
- { src: "client/resources/img/img122_62s.png", alt: "Brazil" }, |
|
128 |
- { src: "client/resources/img/img123_62s.png", alt: "China" }, |
|
129 |
- ], |
|
103 |
+ data() { |
|
104 |
+ return { |
|
105 |
+ timer: '00', |
|
106 |
+ question: ['Australia', 'Brazil', 'China'], |
|
107 |
+ images: [ |
|
108 |
+ { src: 'client/resources/img/img121_62s.png', alt: 'Australia' }, |
|
109 |
+ { src: 'client/resources/img/img122_62s.png', alt: 'Brazil' }, |
|
110 |
+ { src: 'client/resources/img/img123_62s.png', alt: 'China' }, |
|
111 |
+ ], |
|
130 | 112 |
|
131 |
- selectedLeft: null, // 왼쪽에서 선택된 인덱스 저장 |
|
132 |
- selectedRight: null, // 오른쪽에서 선택된 인덱스 저장 |
|
133 |
- pairs: [], // 매칭된 쌍을 저장 |
|
134 |
- svgWidth: "100%", // SVG의 너비 |
|
135 |
- svgHeight: "100%", // SVG의 높이 |
|
136 |
- dataList: [], |
|
137 |
- problemDetail: [], |
|
138 |
- currentIndex: null, |
|
139 |
- learningIdsLength: null, |
|
140 |
- }; |
|
141 |
- }, |
|
142 |
- methods: { |
|
143 |
- goToPage(page) { |
|
144 |
- this.$router.push({ name: page }); |
|
145 |
- }, |
|
146 |
- startTimer() { |
|
147 |
- if (this.intervalId) { |
|
148 |
- clearInterval(this.intervalId); |
|
149 |
- } |
|
150 |
- this.timer = 5; |
|
151 |
- this.intervalId = setInterval(() => { |
|
152 |
- if (this.timer > 0) { |
|
153 |
- this.timer--; |
|
154 |
- } else { |
|
155 |
- clearInterval(this.intervalId); |
|
156 |
- } |
|
157 |
- }, 1000); |
|
158 |
- }, |
|
159 |
- |
|
160 |
- selectLeft(index, event) { |
|
161 |
- this.selectedLeft = { index, element: event.target }; |
|
162 |
- this.checkMatch(); // 매칭을 시도 |
|
163 |
- }, |
|
164 |
- selectRight(index, event) { |
|
165 |
- this.selectedRight = { index, element: event.target }; |
|
166 |
- this.checkMatch(); // 매칭을 시도 |
|
167 |
- }, |
|
168 |
- checkMatch() { |
|
169 |
- if (this.selectedLeft !== null && this.selectedRight !== null) { |
|
170 |
- // 매칭 성공 시 좌표를 계산하여 저장 |
|
171 |
- const leftPos = this.getElementPosition(this.selectedLeft.element); |
|
172 |
- const rightPos = this.getElementPosition(this.selectedRight.element); |
|
173 |
- |
|
174 |
- this.pairs.push({ |
|
175 |
- left: this.selectedLeft.index, |
|
176 |
- right: this.selectedRight.index, |
|
177 |
- leftPos, |
|
178 |
- rightPos, |
|
179 |
- }); |
|
180 |
- |
|
181 |
- // 매칭이 된 후 선택 해제 |
|
182 |
- this.selectedLeft = null; |
|
183 |
- this.selectedRight = null; |
|
184 |
- } |
|
185 |
- }, |
|
186 |
- getElementPosition(element) { |
|
187 |
- const rect = element.getBoundingClientRect(); |
|
188 |
- return { |
|
189 |
- x: rect.left + rect.width / 2, |
|
190 |
- y: rect.top + rect.height / 2, |
|
191 |
- }; |
|
192 |
- }, |
|
193 |
- handleSubmit() { |
|
194 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
195 |
- if (userConfirmed) { |
|
196 |
- const problemData = { |
|
197 |
- prblmInfo: this.currentLearningId, |
|
198 |
- prblmNumber: this.currentProblemIndex, |
|
199 |
- prblmAns: this.selectedButton, |
|
113 |
+ selectedLeft: null, // 왼쪽에서 선택된 인덱스 저장 |
|
114 |
+ selectedRight: null, // 오른쪽에서 선택된 인덱스 저장 |
|
115 |
+ pairs: [], // 매칭된 쌍을 저장 |
|
116 |
+ svgWidth: '100%', // SVG의 너비 |
|
117 |
+ svgHeight: '100%', // SVG의 높이 |
|
118 |
+ dataList: [], |
|
119 |
+ problemDetail: [], |
|
120 |
+ currentIndex: null, |
|
121 |
+ learningIdsLength: null, |
|
200 | 122 |
}; |
201 |
- |
|
202 |
- const answerData = { |
|
203 |
- prblmId: this.currentLearningId.prblm_id, |
|
204 |
- prblmAns: this.selectedButton, |
|
205 |
- stdId: this.$store.getters.getStdId, |
|
206 |
- prblmLogAnsCnt: 1, |
|
207 |
- }; |
|
208 |
- |
|
209 |
- this.$store.dispatch("saveProblemData", problemData); |
|
210 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
211 |
- |
|
212 |
- console.log(this.$store.getters.getAllProblems); |
|
213 |
- console.log(this.$store.getters.getAllAnswers); |
|
214 |
- |
|
215 |
- axios({ |
|
216 |
- url: "problemLog/insertProblemLog.json", |
|
217 |
- method: "post", |
|
218 |
- headers: { |
|
219 |
- "Content-Type": "application/json; charset=UTF-8", |
|
220 |
- }, |
|
221 |
- data: this.$store.getters.getAllAnswers, |
|
222 |
- }) |
|
223 |
- .then(function (res) { |
|
224 |
- console.log("problem - response : ", res.data); |
|
225 |
- this.goToPage("Chapter4"); |
|
226 |
- }) |
|
227 |
- .catch(function (error) { |
|
228 |
- console.log("problem - error : ", error); |
|
229 |
- }); |
|
230 |
- } else { |
|
231 |
- console.log("Submission canceled by the user."); |
|
232 |
- } |
|
233 | 123 |
}, |
234 |
- updateSVGSize() { |
|
235 |
- const container = document.querySelector(".position-relative"); |
|
236 |
- if (container) { |
|
237 |
- this.svgWidth = `${container.clientWidth}px`; |
|
238 |
- this.svgHeight = `${container.clientHeight}px`; |
|
239 |
- } |
|
240 |
- }, |
|
241 |
- getProblem() { |
|
242 |
- const vm = this; |
|
243 |
- const prblmId = this.currentLearningId.prblm_id; |
|
244 |
- axios({ |
|
245 |
- url: "problem/problemInfo.json", |
|
246 |
- method: "post", |
|
247 |
- headers: { |
|
248 |
- "Content-Type": "application/json; charset=UTF-8", |
|
124 |
+ methods: { |
|
125 |
+ goToPage(page) { |
|
126 |
+ this.$router.push({ name: page }); |
|
249 | 127 |
}, |
250 |
- data: { |
|
251 |
- prblmId: prblmId, |
|
128 |
+ startTimer() { |
|
129 |
+ if (this.intervalId) { |
|
130 |
+ clearInterval(this.intervalId); |
|
131 |
+ } |
|
132 |
+ this.timer = 5; |
|
133 |
+ this.intervalId = setInterval(() => { |
|
134 |
+ if (this.timer > 0) { |
|
135 |
+ this.timer--; |
|
136 |
+ } else { |
|
137 |
+ clearInterval(this.intervalId); |
|
138 |
+ } |
|
139 |
+ }, 1000); |
|
252 | 140 |
}, |
253 |
- }) |
|
254 |
- .then(function (res) { |
|
255 |
- console.log("problem - response : ", res.data); |
|
256 |
- vm.dataList = res.data.problem; |
|
257 |
- vm.problemDetail = res.data.problemDetail; |
|
258 |
- }) |
|
259 |
- .catch(function (error) { |
|
260 |
- console.log("problem - error : ", error); |
|
261 |
- }); |
|
262 |
- }, |
|
263 |
- nextProblem() { |
|
264 |
- const problemData = { |
|
265 |
- prblmInfo: this.currentLearningId, |
|
266 |
- prblmNumber: this.currentProblemIndex, |
|
267 |
- prblmAns: this.selectedButton, |
|
268 |
- }; |
|
269 |
- const answerData = { |
|
270 |
- prblmId: this.currentLearningId.prblm_id, |
|
271 |
- prblmAns: this.selectedButton, |
|
272 |
- stdId: this.$store.getters.getStdId, |
|
273 |
- prblmLogAnsCnt: 1, |
|
274 |
- }; |
|
275 |
- this.$store.dispatch("saveProblemData", problemData); |
|
276 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
277 |
- console.log(this.$store.getters.getAllProblems); |
|
278 |
- console.log(this.$store.getters.getAllAnswers); |
|
279 |
- if ( |
|
280 |
- this.currentProblemIndex < |
|
281 |
- this.$store.state.currentLearningIds.length - 1 |
|
282 |
- ) { |
|
283 |
- this.$store.dispatch("goToNextProblem"); |
|
284 |
- this.handleProblemDetail(this.currentLearningId); |
|
285 |
- this.goToPage(this.problemType); |
|
286 |
- } |
|
287 |
- }, |
|
288 |
- previousProblem() { |
|
289 |
- if (this.currentProblemIndex > 0) { |
|
290 |
- this.$store.dispatch("goToPreviousProblem"); |
|
291 |
- this.handleProblemDetail(this.currentLearningId); |
|
292 |
- this.goToPage(this.problemType); |
|
293 |
- } |
|
294 |
- }, |
|
295 | 141 |
|
296 |
- handleProblemDetail(item) { |
|
297 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
298 |
- this.problemType = "Chapter3"; |
|
299 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
300 |
- this.problemType = "Chapter3_1"; |
|
301 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
302 |
- this.problemType = "Chapter3_2"; |
|
303 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
304 |
- this.problemType = "Chapter3_3"; |
|
305 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
306 |
- this.problemType = "Chapter3_3_1"; |
|
307 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
308 |
- this.problemType = "Chapter3_4"; |
|
309 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
310 |
- this.problemType = "Chapter3_5"; |
|
311 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
312 |
- this.problemType = "Chapter3_6"; |
|
313 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
314 |
- this.problemType = "Chapter3_7"; |
|
315 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
316 |
- this.problemType = "Chapter3_8"; |
|
317 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
318 |
- this.problemType = "Chapter3_9"; |
|
319 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
320 |
- this.problemType = "Chapter3_10"; |
|
321 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
322 |
- this.problemType = "Chapter3_11"; |
|
323 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
324 |
- this.problemType = "Chapter3_12"; |
|
325 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
326 |
- this.problemType = "Chapter3_13"; |
|
327 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
328 |
- this.problemType = "Chapter3_14"; |
|
329 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
330 |
- this.problemType = "Chapter3_15"; |
|
331 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
332 |
- this.problemType = "Chapter2_8"; |
|
333 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
334 |
- this.problemType = "Chapter2_7"; |
|
335 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
336 |
- this.problemType = "Chapter2_5"; |
|
337 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
338 |
- this.problemType = "Chapter2_6"; |
|
339 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
340 |
- this.problemType = "Chapter2_10"; |
|
341 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
342 |
- this.problemType = "Chapter2_11"; |
|
343 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
344 |
- this.problemType = "Chapter2_13"; |
|
345 |
- } |
|
346 |
- }, |
|
347 |
- }, |
|
348 |
- watch: {}, |
|
349 |
- computed: { |
|
350 |
- currentLearningId() { |
|
351 |
- return this.$store.getters.currentLearningId; |
|
352 |
- }, |
|
353 |
- currentLabel() { |
|
354 |
- return this.$store.getters.currentLabel; |
|
355 |
- }, |
|
356 |
- currentProblemIndex() { |
|
357 |
- return this.$store.getters.currentProblemIndex; |
|
358 |
- }, |
|
359 |
- isPreviousButtonDisabled() { |
|
360 |
- return this.currentProblemIndex === 0; |
|
361 |
- }, |
|
362 |
- }, |
|
363 |
- created() { |
|
364 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
365 |
- console.log("Current Label:", this.currentLabel); |
|
366 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
367 |
- this.currentIndex = this.currentProblemIndex; |
|
368 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
142 |
+ selectLeft(index, event) { |
|
143 |
+ this.selectedLeft = { index, element: event.target }; |
|
144 |
+ this.checkMatch(); // 매칭을 시도 |
|
145 |
+ }, |
|
146 |
+ selectRight(index, event) { |
|
147 |
+ this.selectedRight = { index, element: event.target }; |
|
148 |
+ this.checkMatch(); // 매칭을 시도 |
|
149 |
+ }, |
|
150 |
+ checkMatch() { |
|
151 |
+ if (this.selectedLeft !== null && this.selectedRight !== null) { |
|
152 |
+ // 매칭 성공 시 좌표를 계산하여 저장 |
|
153 |
+ const leftPos = this.getElementPosition(this.selectedLeft.element); |
|
154 |
+ const rightPos = this.getElementPosition(this.selectedRight.element); |
|
369 | 155 |
|
370 |
- // Fetch or process the current problem based on `currentLearningId` |
|
371 |
- }, |
|
372 |
- components: {}, |
|
373 |
- mounted() { |
|
374 |
- this.getProblem(); |
|
375 |
- this.updateSVGSize(); |
|
376 |
- window.addEventListener("resize", this.updateSVGSize); |
|
377 |
- }, |
|
378 |
- beforeDestroy() { |
|
379 |
- window.removeEventListener("resize", this.updateSVGSize); |
|
380 |
- }, |
|
156 |
+ this.pairs.push({ |
|
157 |
+ left: this.selectedLeft.index, |
|
158 |
+ right: this.selectedRight.index, |
|
159 |
+ leftPos, |
|
160 |
+ rightPos, |
|
161 |
+ }); |
|
162 |
+ |
|
163 |
+ // 매칭이 된 후 선택 해제 |
|
164 |
+ this.selectedLeft = null; |
|
165 |
+ this.selectedRight = null; |
|
166 |
+ } |
|
167 |
+ }, |
|
168 |
+ getElementPosition(element) { |
|
169 |
+ const rect = element.getBoundingClientRect(); |
|
170 |
+ return { |
|
171 |
+ x: rect.left + rect.width / 2, |
|
172 |
+ y: rect.top + rect.height / 2, |
|
173 |
+ }; |
|
174 |
+ }, |
|
175 |
+ handleSubmit() { |
|
176 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
177 |
+ if (userConfirmed) { |
|
178 |
+ const problemData = { |
|
179 |
+ prblmInfo: this.currentLearningId, |
|
180 |
+ prblmNumber: this.currentProblemIndex, |
|
181 |
+ prblmAns: this.selectedButton, |
|
182 |
+ }; |
|
183 |
+ |
|
184 |
+ const answerData = { |
|
185 |
+ prblmId: this.currentLearningId.prblm_id, |
|
186 |
+ prblmAns: this.selectedButton, |
|
187 |
+ stdId: this.$store.getters.getStdId, |
|
188 |
+ prblmLogAnsCnt: 1, |
|
189 |
+ }; |
|
190 |
+ |
|
191 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
192 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
193 |
+ |
|
194 |
+ console.log(this.$store.getters.getAllProblems); |
|
195 |
+ console.log(this.$store.getters.getAllAnswers); |
|
196 |
+ |
|
197 |
+ axios({ |
|
198 |
+ url: 'problemLog/insertProblemLog.json', |
|
199 |
+ method: 'post', |
|
200 |
+ headers: { |
|
201 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
202 |
+ }, |
|
203 |
+ data: this.$store.getters.getAllAnswers, |
|
204 |
+ }) |
|
205 |
+ .then(function (res) { |
|
206 |
+ console.log('problem - response : ', res.data); |
|
207 |
+ this.goToPage('Chapter4'); |
|
208 |
+ }) |
|
209 |
+ .catch(function (error) { |
|
210 |
+ console.log('problem - error : ', error); |
|
211 |
+ }); |
|
212 |
+ } else { |
|
213 |
+ console.log('Submission canceled by the user.'); |
|
214 |
+ } |
|
215 |
+ }, |
|
216 |
+ updateSVGSize() { |
|
217 |
+ const container = document.querySelector('.position-relative'); |
|
218 |
+ if (container) { |
|
219 |
+ this.svgWidth = `${container.clientWidth}px`; |
|
220 |
+ this.svgHeight = `${container.clientHeight}px`; |
|
221 |
+ } |
|
222 |
+ }, |
|
223 |
+ getProblem() { |
|
224 |
+ const vm = this; |
|
225 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
226 |
+ axios({ |
|
227 |
+ url: 'problem/problemInfo.json', |
|
228 |
+ method: 'post', |
|
229 |
+ headers: { |
|
230 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
231 |
+ }, |
|
232 |
+ data: { |
|
233 |
+ prblmId: prblmId, |
|
234 |
+ }, |
|
235 |
+ }) |
|
236 |
+ .then(function (res) { |
|
237 |
+ console.log('problem - response : ', res.data); |
|
238 |
+ vm.dataList = res.data.problem; |
|
239 |
+ vm.problemDetail = res.data.problemDetail; |
|
240 |
+ }) |
|
241 |
+ .catch(function (error) { |
|
242 |
+ console.log('problem - error : ', error); |
|
243 |
+ }); |
|
244 |
+ }, |
|
245 |
+ nextProblem() { |
|
246 |
+ const problemData = { |
|
247 |
+ prblmInfo: this.currentLearningId, |
|
248 |
+ prblmNumber: this.currentProblemIndex, |
|
249 |
+ prblmAns: this.selectedButton, |
|
250 |
+ }; |
|
251 |
+ const answerData = { |
|
252 |
+ prblmId: this.currentLearningId.prblm_id, |
|
253 |
+ prblmAns: this.selectedButton, |
|
254 |
+ stdId: this.$store.getters.getStdId, |
|
255 |
+ prblmLogAnsCnt: 1, |
|
256 |
+ }; |
|
257 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
258 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
259 |
+ console.log(this.$store.getters.getAllProblems); |
|
260 |
+ console.log(this.$store.getters.getAllAnswers); |
|
261 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
262 |
+ this.$store.dispatch('goToNextProblem'); |
|
263 |
+ this.handleProblemDetail(this.currentLearningId); |
|
264 |
+ this.goToPage(this.problemType); |
|
265 |
+ } |
|
266 |
+ }, |
|
267 |
+ previousProblem() { |
|
268 |
+ if (this.currentProblemIndex > 0) { |
|
269 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
270 |
+ this.handleProblemDetail(this.currentLearningId); |
|
271 |
+ this.goToPage(this.problemType); |
|
272 |
+ } |
|
273 |
+ }, |
|
274 |
+ |
|
275 |
+ handleProblemDetail(item) { |
|
276 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
277 |
+ this.problemType = 'Chapter3'; |
|
278 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
279 |
+ this.problemType = 'Chapter3_1'; |
|
280 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
281 |
+ this.problemType = 'Chapter3_2'; |
|
282 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
283 |
+ this.problemType = 'Chapter3_3'; |
|
284 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
285 |
+ this.problemType = 'Chapter3_3_1'; |
|
286 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
287 |
+ this.problemType = 'Chapter3_4'; |
|
288 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
289 |
+ this.problemType = 'Chapter3_5'; |
|
290 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
291 |
+ this.problemType = 'Chapter3_6'; |
|
292 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
293 |
+ this.problemType = 'Chapter3_7'; |
|
294 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
295 |
+ this.problemType = 'Chapter3_8'; |
|
296 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
297 |
+ this.problemType = 'Chapter3_9'; |
|
298 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
299 |
+ this.problemType = 'Chapter3_10'; |
|
300 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
301 |
+ this.problemType = 'Chapter3_11'; |
|
302 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
303 |
+ this.problemType = 'Chapter3_12'; |
|
304 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
305 |
+ this.problemType = 'Chapter3_13'; |
|
306 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
307 |
+ this.problemType = 'Chapter3_14'; |
|
308 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
309 |
+ this.problemType = 'Chapter3_15'; |
|
310 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
311 |
+ this.problemType = 'Chapter2_8'; |
|
312 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
313 |
+ this.problemType = 'Chapter2_7'; |
|
314 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
315 |
+ this.problemType = 'Chapter2_5'; |
|
316 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
317 |
+ this.problemType = 'Chapter2_6'; |
|
318 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
319 |
+ this.problemType = 'Chapter2_10'; |
|
320 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
321 |
+ this.problemType = 'Chapter2_11'; |
|
322 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
323 |
+ this.problemType = 'Chapter2_13'; |
|
324 |
+ } |
|
325 |
+ }, |
|
326 |
+ }, |
|
327 |
+ watch: {}, |
|
328 |
+ computed: { |
|
329 |
+ currentLearningId() { |
|
330 |
+ return this.$store.getters.currentLearningId; |
|
331 |
+ }, |
|
332 |
+ currentLabel() { |
|
333 |
+ return this.$store.getters.currentLabel; |
|
334 |
+ }, |
|
335 |
+ currentProblemIndex() { |
|
336 |
+ return this.$store.getters.currentProblemIndex; |
|
337 |
+ }, |
|
338 |
+ isPreviousButtonDisabled() { |
|
339 |
+ return this.currentProblemIndex === 0; |
|
340 |
+ }, |
|
341 |
+ }, |
|
342 |
+ created() { |
|
343 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
344 |
+ console.log('Current Label:', this.currentLabel); |
|
345 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
346 |
+ this.currentIndex = this.currentProblemIndex; |
|
347 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
348 |
+ |
|
349 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
350 |
+ }, |
|
351 |
+ components: { |
|
352 |
+ BookInfo: BookInfo, |
|
353 |
+ }, |
|
354 |
+ mounted() { |
|
355 |
+ this.getProblem(); |
|
356 |
+ this.updateSVGSize(); |
|
357 |
+ window.addEventListener('resize', this.updateSVGSize); |
|
358 |
+ }, |
|
359 |
+ beforeDestroy() { |
|
360 |
+ window.removeEventListener('resize', this.updateSVGSize); |
|
361 |
+ }, |
|
381 | 362 |
}; |
382 | 363 |
</script> |
383 | 364 |
<style scoped> |
384 | 365 |
.textbox { |
385 |
- height: 60px; |
|
366 |
+ height: 60px; |
|
386 | 367 |
} |
387 | 368 |
|
388 | 369 |
.textbox p { |
389 |
- font-size: 28px; |
|
390 |
- font-weight: bold; |
|
391 |
- line-height: 65px; |
|
370 |
+ font-size: 28px; |
|
371 |
+ font-weight: bold; |
|
372 |
+ line-height: 65px; |
|
392 | 373 |
} |
393 | 374 |
|
394 | 375 |
.dropGroup button { |
395 |
- position: relative; |
|
376 |
+ position: relative; |
|
396 | 377 |
} |
397 | 378 |
|
398 | 379 |
.pickGroup { |
399 |
- display: flex; |
|
400 |
- flex-direction: column; |
|
401 |
- gap: 60px; |
|
380 |
+ display: flex; |
|
381 |
+ flex-direction: column; |
|
382 |
+ gap: 60px; |
|
402 | 383 |
} |
403 | 384 |
|
404 | 385 |
.pickGroup .word { |
405 |
- font-size: 48px; |
|
406 |
- font-family: "ONEMobilePOPOTF"; |
|
386 |
+ font-size: 48px; |
|
387 |
+ font-family: 'ONEMobilePOPOTF'; |
|
407 | 388 |
} |
408 | 389 |
|
409 | 390 |
.dragGroup button p { |
410 |
- font-size: 48px; |
|
391 |
+ font-size: 48px; |
|
411 | 392 |
} |
412 | 393 |
|
413 | 394 |
.submit-button { |
414 |
- position: absolute; |
|
415 |
- background-color: #ffba08; |
|
416 |
- padding: 10px 30px; |
|
417 |
- border-radius: 10px; |
|
418 |
- font-size: 28px; |
|
419 |
- font-family: "ONEMobilePOPOTF"; |
|
420 |
- right: 5rem; |
|
421 |
- bottom: 3rem; |
|
395 |
+ position: absolute; |
|
396 |
+ background-color: #ffba08; |
|
397 |
+ padding: 10px 30px; |
|
398 |
+ border-radius: 10px; |
|
399 |
+ font-size: 28px; |
|
400 |
+ font-family: 'ONEMobilePOPOTF'; |
|
401 |
+ right: 5rem; |
|
402 |
+ bottom: 3rem; |
|
422 | 403 |
} |
423 | 404 |
|
424 | 405 |
.position-relative { |
425 |
- position: relative; |
|
406 |
+ position: relative; |
|
426 | 407 |
} |
427 | 408 |
|
428 | 409 |
.line-container { |
429 |
- position: absolute; |
|
430 |
- bottom: 215px; |
|
431 |
- right: 125px; |
|
432 |
- pointer-events: none; |
|
410 |
+ position: absolute; |
|
411 |
+ bottom: 215px; |
|
412 |
+ right: 125px; |
|
413 |
+ pointer-events: none; |
|
433 | 414 |
} |
434 | 415 |
|
435 | 416 |
.pre-btn img.active { |
436 |
- visibility: hidden; |
|
417 |
+ visibility: hidden; |
|
437 | 418 |
} |
438 | 419 |
|
439 | 420 |
.pre-btn img.active { |
440 |
- visibility: hidden; |
|
421 |
+ visibility: hidden; |
|
441 | 422 |
} |
442 | 423 |
|
443 | 424 |
.blue-c { |
444 |
- width: 20px; |
|
445 |
- height: 20px; |
|
446 |
- background-color: blue; |
|
447 |
- border-radius: 50%; |
|
448 |
- border: none; |
|
449 |
- cursor: pointer; |
|
425 |
+ width: 20px; |
|
426 |
+ height: 20px; |
|
427 |
+ background-color: blue; |
|
428 |
+ border-radius: 50%; |
|
429 |
+ border: none; |
|
430 |
+ cursor: pointer; |
|
450 | 431 |
} |
451 | 432 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_14.vue
+++ client/views/pages/main/Chapter/Chapter3_14.vue
... | ... | @@ -1,336 +1,323 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
29 |
- </button> --> |
|
30 |
- </div> |
|
31 |
- |
|
32 |
- <div class="text-ct"> |
|
33 |
- <div class="time-hint"> |
|
34 |
- <button class="hint-btn">HINT</button> |
|
35 |
- <div class="time-bg mt20"> |
|
36 |
- <div> |
|
37 |
- <div class="time"> |
|
38 |
- <p class="second">{{ timer }}</p> |
|
39 |
- <p class="text">sec</p> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
40 | 7 |
</div> |
41 |
- </div> |
|
42 |
- </div> |
|
43 |
- </div> |
|
44 |
- <div class="imgGroup"> |
|
45 |
- <img src="../../../../resources/img/img124_63s.png" alt="" /> |
|
46 |
- </div> |
|
47 |
- |
|
48 |
- <div class="dropGroup flex align-center justify-center mt30"> |
|
49 |
- <div class="mt50"> |
|
50 |
- <input |
|
51 |
- class="yellow-bd" |
|
52 |
- v-model="answer" |
|
53 |
- type="text" |
|
54 |
- placeholder="답을 입력하세요." |
|
55 |
- style="width: 50rem" |
|
56 |
- /> |
|
57 |
- </div> |
|
58 |
- </div> |
|
8 |
+ </router-link> |
|
59 | 9 |
</div> |
60 |
- <button |
|
61 |
- class="submit-button" |
|
62 |
- @click="handleSubmit()" |
|
63 |
- v-if="currentIndex === learningIdsLength - 1" |
|
64 |
- > |
|
65 |
- 제출하기 |
|
66 |
- </button> |
|
67 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
68 |
- 다음 문제로 |
|
69 |
- </button> |
|
70 |
- </div> |
|
71 |
- <div class="next-btn" @click="nextProblem(answer)"> |
|
72 |
- <img |
|
73 |
- src="../../../../resources/img/right.png" |
|
74 |
- alt="" |
|
75 |
- :class="{ active: currentIndex === learningIdsLength - 1 }" |
|
76 |
- /> |
|
77 |
- </div> |
|
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
22 |
+ </button> --> |
|
23 |
+ </div> |
|
24 |
+ |
|
25 |
+ <div class="text-ct"> |
|
26 |
+ <div class="time-hint"> |
|
27 |
+ <button class="hint-btn">HINT</button> |
|
28 |
+ <div class="time-bg mt20"> |
|
29 |
+ <div> |
|
30 |
+ <div class="time"> |
|
31 |
+ <p class="second">{{ timer }}</p> |
|
32 |
+ <p class="text">sec</p> |
|
33 |
+ </div> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ <div class="imgGroup"> |
|
38 |
+ <img src="../../../../resources/img/img124_63s.png" alt="" /> |
|
39 |
+ </div> |
|
40 |
+ |
|
41 |
+ <div class="dropGroup flex align-center justify-center mt30"> |
|
42 |
+ <div class="mt50"> |
|
43 |
+ <input |
|
44 |
+ class="yellow-bd" |
|
45 |
+ v-model="answer" |
|
46 |
+ type="text" |
|
47 |
+ placeholder="답을 입력하세요." |
|
48 |
+ style="width: 50rem" |
|
49 |
+ /> |
|
50 |
+ </div> |
|
51 |
+ </div> |
|
52 |
+ </div> |
|
53 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
54 |
+ 제출하기 |
|
55 |
+ </button> |
|
56 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
57 |
+ </div> |
|
58 |
+ <div class="next-btn" @click="nextProblem(answer)"> |
|
59 |
+ <img |
|
60 |
+ src="../../../../resources/img/right.png" |
|
61 |
+ alt="" |
|
62 |
+ :class="{ active: currentIndex === learningIdsLength - 1 }" |
|
63 |
+ /> |
|
64 |
+ </div> |
|
65 |
+ </div> |
|
78 | 66 |
</div> |
79 |
- </div> |
|
80 | 67 |
</template> |
81 | 68 |
|
82 | 69 |
<script> |
83 |
-import axios from "axios"; |
|
70 |
+import axios from 'axios'; |
|
71 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
84 | 72 |
export default { |
85 |
- data() { |
|
86 |
- return { |
|
87 |
- timer: "00", |
|
88 |
- answer: null, |
|
89 |
- dataList: [], |
|
90 |
- problemDetail: [], |
|
91 |
- currentIndex: null, |
|
92 |
- learningIdsLength: null, |
|
93 |
- stdId: null, |
|
94 |
- }; |
|
95 |
- }, |
|
96 |
- methods: { |
|
97 |
- goToPage(page) { |
|
98 |
- this.$router.push({ name: page }); |
|
99 |
- }, |
|
100 |
- startTimer() { |
|
101 |
- if (this.intervalId) { |
|
102 |
- clearInterval(this.intervalId); |
|
103 |
- } |
|
104 |
- this.timer = 5; |
|
105 |
- this.intervalId = setInterval(() => { |
|
106 |
- if (this.timer > 0) { |
|
107 |
- this.timer--; |
|
108 |
- } else { |
|
109 |
- clearInterval(this.intervalId); |
|
110 |
- } |
|
111 |
- }, 1000); |
|
112 |
- }, |
|
113 |
- handleSubmit() { |
|
114 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
115 |
- if (userConfirmed) { |
|
116 |
- const problemData = { |
|
117 |
- prblmInfo: this.currentLearningId, |
|
118 |
- prblmNumber: this.currentProblemIndex, |
|
119 |
- prblmAns: this.selectedButton, |
|
73 |
+ data() { |
|
74 |
+ return { |
|
75 |
+ timer: '00', |
|
76 |
+ answer: null, |
|
77 |
+ dataList: [], |
|
78 |
+ problemDetail: [], |
|
79 |
+ currentIndex: null, |
|
80 |
+ learningIdsLength: null, |
|
81 |
+ stdId: null, |
|
120 | 82 |
}; |
121 |
- |
|
122 |
- const answerData = { |
|
123 |
- prblmId: this.currentLearningId.prblm_id, |
|
124 |
- prblmAns: this.selectedButton, |
|
125 |
- stdId: this.$store.getters.getStdId, |
|
126 |
- prblmLogAnsCnt: 1, |
|
127 |
- }; |
|
128 |
- |
|
129 |
- this.$store.dispatch("saveProblemData", problemData); |
|
130 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
131 |
- |
|
132 |
- console.log(this.$store.getters.getAllProblems); |
|
133 |
- console.log(this.$store.getters.getAllAnswers); |
|
134 |
- |
|
135 |
- axios({ |
|
136 |
- url: "problemLog/insertProblemLog.json", |
|
137 |
- method: "post", |
|
138 |
- headers: { |
|
139 |
- "Content-Type": "application/json; charset=UTF-8", |
|
140 |
- }, |
|
141 |
- data: this.$store.getters.getAllAnswers, |
|
142 |
- }) |
|
143 |
- .then(function (res) { |
|
144 |
- console.log("problem - response : ", res.data); |
|
145 |
- this.goToPage("Chapter4"); |
|
146 |
- }) |
|
147 |
- .catch(function (error) { |
|
148 |
- console.log("problem - error : ", error); |
|
149 |
- }); |
|
150 |
- } else { |
|
151 |
- console.log("Submission canceled by the user."); |
|
152 |
- } |
|
153 | 83 |
}, |
154 |
- |
|
155 |
- getProblem() { |
|
156 |
- const vm = this; |
|
157 |
- const prblmId = this.currentLearningId.prblm_id; |
|
158 |
- axios({ |
|
159 |
- url: "problem/problemInfo.json", |
|
160 |
- method: "post", |
|
161 |
- headers: { |
|
162 |
- "Content-Type": "application/json; charset=UTF-8", |
|
84 |
+ methods: { |
|
85 |
+ goToPage(page) { |
|
86 |
+ this.$router.push({ name: page }); |
|
163 | 87 |
}, |
164 |
- data: { |
|
165 |
- prblmId: prblmId, |
|
88 |
+ startTimer() { |
|
89 |
+ if (this.intervalId) { |
|
90 |
+ clearInterval(this.intervalId); |
|
91 |
+ } |
|
92 |
+ this.timer = 5; |
|
93 |
+ this.intervalId = setInterval(() => { |
|
94 |
+ if (this.timer > 0) { |
|
95 |
+ this.timer--; |
|
96 |
+ } else { |
|
97 |
+ clearInterval(this.intervalId); |
|
98 |
+ } |
|
99 |
+ }, 1000); |
|
166 | 100 |
}, |
167 |
- }) |
|
168 |
- .then(function (res) { |
|
169 |
- console.log("problem - response : ", res.data); |
|
170 |
- vm.dataList = res.data.problem; |
|
171 |
- vm.problemDetail = res.data.problemDetail; |
|
172 |
- }) |
|
173 |
- .catch(function (error) { |
|
174 |
- console.log("problem - error : ", error); |
|
175 |
- }); |
|
176 |
- }, |
|
177 |
- nextProblem(answer) { |
|
178 |
- const problemData = { |
|
179 |
- prblmInfo: this.currentLearningId, |
|
180 |
- prblmNumber: this.currentProblemIndex, |
|
181 |
- prblmAns: answer, |
|
182 |
- }; |
|
183 |
- const answerData = { |
|
184 |
- prblmId: this.currentLearningId.prblm_id, |
|
185 |
- prblmAns: answer, |
|
186 |
- stdId: this.$store.getters.getStdId, |
|
187 |
- prblmLogAnsCnt: 1, |
|
188 |
- }; |
|
189 |
- this.$store.dispatch("saveProblemData", problemData); |
|
190 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
191 |
- console.log(this.$store.getters.getAllProblems); |
|
192 |
- console.log(this.$store.getters.getAllAnswers); |
|
193 |
- if ( |
|
194 |
- this.currentProblemIndex < |
|
195 |
- this.$store.state.currentLearningIds.length - 1 |
|
196 |
- ) { |
|
197 |
- this.$store.dispatch("goToNextProblem"); |
|
198 |
- this.handleProblemDetail(this.currentLearningId); |
|
199 |
- this.goToPage(this.problemType); |
|
200 |
- } |
|
201 |
- }, |
|
202 |
- previousProblem() { |
|
203 |
- if (this.currentProblemIndex > 0) { |
|
204 |
- this.$store.dispatch("goToPreviousProblem"); |
|
205 |
- this.handleProblemDetail(this.currentLearningId); |
|
206 |
- this.goToPage(this.problemType); |
|
207 |
- } |
|
208 |
- }, |
|
101 |
+ handleSubmit() { |
|
102 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
103 |
+ if (userConfirmed) { |
|
104 |
+ const problemData = { |
|
105 |
+ prblmInfo: this.currentLearningId, |
|
106 |
+ prblmNumber: this.currentProblemIndex, |
|
107 |
+ prblmAns: this.selectedButton, |
|
108 |
+ }; |
|
209 | 109 |
|
210 |
- handleProblemDetail(item) { |
|
211 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
212 |
- this.problemType = "Chapter3"; |
|
213 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
214 |
- this.problemType = "Chapter3_1"; |
|
215 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
216 |
- this.problemType = "Chapter3_2"; |
|
217 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
218 |
- this.problemType = "Chapter3_3"; |
|
219 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
220 |
- this.problemType = "Chapter3_3_1"; |
|
221 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
222 |
- this.problemType = "Chapter3_4"; |
|
223 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
224 |
- this.problemType = "Chapter3_5"; |
|
225 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
226 |
- this.problemType = "Chapter3_6"; |
|
227 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
228 |
- this.problemType = "Chapter3_7"; |
|
229 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
230 |
- this.problemType = "Chapter3_8"; |
|
231 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
232 |
- this.problemType = "Chapter3_9"; |
|
233 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
234 |
- this.problemType = "Chapter3_10"; |
|
235 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
236 |
- this.problemType = "Chapter3_11"; |
|
237 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
238 |
- this.problemType = "Chapter3_12"; |
|
239 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
240 |
- this.problemType = "Chapter3_13"; |
|
241 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
242 |
- this.problemType = "Chapter3_14"; |
|
243 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
244 |
- this.problemType = "Chapter3_15"; |
|
245 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
246 |
- this.problemType = "Chapter2_8"; |
|
247 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
248 |
- this.problemType = "Chapter2_7"; |
|
249 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
250 |
- this.problemType = "Chapter2_5"; |
|
251 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
252 |
- this.problemType = "Chapter2_6"; |
|
253 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
254 |
- this.problemType = "Chapter2_10"; |
|
255 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
256 |
- this.problemType = "Chapter2_11"; |
|
257 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
258 |
- this.problemType = "Chapter2_13"; |
|
259 |
- } |
|
260 |
- }, |
|
261 |
- }, |
|
262 |
- watch: {}, |
|
263 |
- computed: { |
|
264 |
- currentLearningId() { |
|
265 |
- return this.$store.getters.currentLearningId; |
|
266 |
- }, |
|
267 |
- currentLabel() { |
|
268 |
- return this.$store.getters.currentLabel; |
|
269 |
- }, |
|
270 |
- currentProblemIndex() { |
|
271 |
- return this.$store.getters.currentProblemIndex; |
|
272 |
- }, |
|
273 |
- getAllAnswers() { |
|
274 |
- return this.$store.getters.getAllAnswers; |
|
275 |
- }, |
|
276 |
- isPreviousButtonDisabled() { |
|
277 |
- return this.currentProblemIndex === 0; |
|
278 |
- }, |
|
279 |
- }, |
|
280 |
- created() { |
|
281 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
282 |
- console.log("Current Label:", this.currentLabel); |
|
283 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
284 |
- this.currentIndex = this.currentProblemIndex; |
|
285 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
110 |
+ const answerData = { |
|
111 |
+ prblmId: this.currentLearningId.prblm_id, |
|
112 |
+ prblmAns: this.selectedButton, |
|
113 |
+ stdId: this.$store.getters.getStdId, |
|
114 |
+ prblmLogAnsCnt: 1, |
|
115 |
+ }; |
|
286 | 116 |
|
287 |
- // Fetch or process the current problem based on `currentLearningId` |
|
288 |
- }, |
|
289 |
- components: {}, |
|
290 |
- mounted() { |
|
291 |
- this.getProblem(); |
|
292 |
- }, |
|
117 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
118 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
119 |
+ |
|
120 |
+ console.log(this.$store.getters.getAllProblems); |
|
121 |
+ console.log(this.$store.getters.getAllAnswers); |
|
122 |
+ |
|
123 |
+ axios({ |
|
124 |
+ url: 'problemLog/insertProblemLog.json', |
|
125 |
+ method: 'post', |
|
126 |
+ headers: { |
|
127 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
128 |
+ }, |
|
129 |
+ data: this.$store.getters.getAllAnswers, |
|
130 |
+ }) |
|
131 |
+ .then(function (res) { |
|
132 |
+ console.log('problem - response : ', res.data); |
|
133 |
+ this.goToPage('Chapter4'); |
|
134 |
+ }) |
|
135 |
+ .catch(function (error) { |
|
136 |
+ console.log('problem - error : ', error); |
|
137 |
+ }); |
|
138 |
+ } else { |
|
139 |
+ console.log('Submission canceled by the user.'); |
|
140 |
+ } |
|
141 |
+ }, |
|
142 |
+ |
|
143 |
+ getProblem() { |
|
144 |
+ const vm = this; |
|
145 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
146 |
+ axios({ |
|
147 |
+ url: 'problem/problemInfo.json', |
|
148 |
+ method: 'post', |
|
149 |
+ headers: { |
|
150 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
151 |
+ }, |
|
152 |
+ data: { |
|
153 |
+ prblmId: prblmId, |
|
154 |
+ }, |
|
155 |
+ }) |
|
156 |
+ .then(function (res) { |
|
157 |
+ console.log('problem - response : ', res.data); |
|
158 |
+ vm.dataList = res.data.problem; |
|
159 |
+ vm.problemDetail = res.data.problemDetail; |
|
160 |
+ }) |
|
161 |
+ .catch(function (error) { |
|
162 |
+ console.log('problem - error : ', error); |
|
163 |
+ }); |
|
164 |
+ }, |
|
165 |
+ nextProblem(answer) { |
|
166 |
+ const problemData = { |
|
167 |
+ prblmInfo: this.currentLearningId, |
|
168 |
+ prblmNumber: this.currentProblemIndex, |
|
169 |
+ prblmAns: answer, |
|
170 |
+ }; |
|
171 |
+ const answerData = { |
|
172 |
+ prblmId: this.currentLearningId.prblm_id, |
|
173 |
+ prblmAns: answer, |
|
174 |
+ stdId: this.$store.getters.getStdId, |
|
175 |
+ prblmLogAnsCnt: 1, |
|
176 |
+ }; |
|
177 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
178 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
179 |
+ console.log(this.$store.getters.getAllProblems); |
|
180 |
+ console.log(this.$store.getters.getAllAnswers); |
|
181 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
182 |
+ this.$store.dispatch('goToNextProblem'); |
|
183 |
+ this.handleProblemDetail(this.currentLearningId); |
|
184 |
+ this.goToPage(this.problemType); |
|
185 |
+ } |
|
186 |
+ }, |
|
187 |
+ previousProblem() { |
|
188 |
+ if (this.currentProblemIndex > 0) { |
|
189 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
190 |
+ this.handleProblemDetail(this.currentLearningId); |
|
191 |
+ this.goToPage(this.problemType); |
|
192 |
+ } |
|
193 |
+ }, |
|
194 |
+ |
|
195 |
+ handleProblemDetail(item) { |
|
196 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
197 |
+ this.problemType = 'Chapter3'; |
|
198 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
199 |
+ this.problemType = 'Chapter3_1'; |
|
200 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
201 |
+ this.problemType = 'Chapter3_2'; |
|
202 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
203 |
+ this.problemType = 'Chapter3_3'; |
|
204 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
205 |
+ this.problemType = 'Chapter3_3_1'; |
|
206 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
207 |
+ this.problemType = 'Chapter3_4'; |
|
208 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
209 |
+ this.problemType = 'Chapter3_5'; |
|
210 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
211 |
+ this.problemType = 'Chapter3_6'; |
|
212 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
213 |
+ this.problemType = 'Chapter3_7'; |
|
214 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
215 |
+ this.problemType = 'Chapter3_8'; |
|
216 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
217 |
+ this.problemType = 'Chapter3_9'; |
|
218 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
219 |
+ this.problemType = 'Chapter3_10'; |
|
220 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
221 |
+ this.problemType = 'Chapter3_11'; |
|
222 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
223 |
+ this.problemType = 'Chapter3_12'; |
|
224 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
225 |
+ this.problemType = 'Chapter3_13'; |
|
226 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
227 |
+ this.problemType = 'Chapter3_14'; |
|
228 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
229 |
+ this.problemType = 'Chapter3_15'; |
|
230 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
231 |
+ this.problemType = 'Chapter2_8'; |
|
232 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
233 |
+ this.problemType = 'Chapter2_7'; |
|
234 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
235 |
+ this.problemType = 'Chapter2_5'; |
|
236 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
237 |
+ this.problemType = 'Chapter2_6'; |
|
238 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
239 |
+ this.problemType = 'Chapter2_10'; |
|
240 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
241 |
+ this.problemType = 'Chapter2_11'; |
|
242 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
243 |
+ this.problemType = 'Chapter2_13'; |
|
244 |
+ } |
|
245 |
+ }, |
|
246 |
+ }, |
|
247 |
+ watch: {}, |
|
248 |
+ computed: { |
|
249 |
+ currentLearningId() { |
|
250 |
+ return this.$store.getters.currentLearningId; |
|
251 |
+ }, |
|
252 |
+ currentLabel() { |
|
253 |
+ return this.$store.getters.currentLabel; |
|
254 |
+ }, |
|
255 |
+ currentProblemIndex() { |
|
256 |
+ return this.$store.getters.currentProblemIndex; |
|
257 |
+ }, |
|
258 |
+ getAllAnswers() { |
|
259 |
+ return this.$store.getters.getAllAnswers; |
|
260 |
+ }, |
|
261 |
+ isPreviousButtonDisabled() { |
|
262 |
+ return this.currentProblemIndex === 0; |
|
263 |
+ }, |
|
264 |
+ }, |
|
265 |
+ created() { |
|
266 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
267 |
+ console.log('Current Label:', this.currentLabel); |
|
268 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
269 |
+ this.currentIndex = this.currentProblemIndex; |
|
270 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
271 |
+ |
|
272 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
273 |
+ }, |
|
274 |
+ components: { |
|
275 |
+ BookInfo: BookInfo, |
|
276 |
+ }, |
|
277 |
+ mounted() { |
|
278 |
+ this.getProblem(); |
|
279 |
+ }, |
|
293 | 280 |
}; |
294 | 281 |
</script> |
295 | 282 |
<style scoped> |
296 | 283 |
.textbox { |
297 |
- height: 60px; |
|
284 |
+ height: 60px; |
|
298 | 285 |
} |
299 | 286 |
|
300 | 287 |
.textbox p { |
301 |
- font-size: 28px; |
|
302 |
- font-weight: bold; |
|
303 |
- line-height: 65px; |
|
288 |
+ font-size: 28px; |
|
289 |
+ font-weight: bold; |
|
290 |
+ line-height: 65px; |
|
304 | 291 |
} |
305 | 292 |
|
306 | 293 |
.dropGroup button { |
307 |
- position: relative; |
|
294 |
+ position: relative; |
|
308 | 295 |
} |
309 | 296 |
|
310 | 297 |
.dropGroup button p { |
311 |
- font-size: 48px; |
|
298 |
+ font-size: 48px; |
|
312 | 299 |
} |
313 | 300 |
|
314 | 301 |
.dragGroup button p { |
315 |
- font-size: 48px; |
|
302 |
+ font-size: 48px; |
|
316 | 303 |
} |
317 | 304 |
|
318 | 305 |
.pre-btn img.active { |
319 |
- visibility: hidden; |
|
306 |
+ visibility: hidden; |
|
320 | 307 |
} |
321 | 308 |
|
322 | 309 |
.pre-btn img.active { |
323 |
- visibility: hidden; |
|
310 |
+ visibility: hidden; |
|
324 | 311 |
} |
325 | 312 |
|
326 | 313 |
.submit-button { |
327 |
- position: absolute; |
|
328 |
- background-color: #ffba08; |
|
329 |
- padding: 10px 30px; |
|
330 |
- border-radius: 10px; |
|
331 |
- font-size: 28px; |
|
332 |
- font-family: "ONEMobilePOPOTF"; |
|
333 |
- right: 5rem; |
|
334 |
- bottom: 3rem; |
|
314 |
+ position: absolute; |
|
315 |
+ background-color: #ffba08; |
|
316 |
+ padding: 10px 30px; |
|
317 |
+ border-radius: 10px; |
|
318 |
+ font-size: 28px; |
|
319 |
+ font-family: 'ONEMobilePOPOTF'; |
|
320 |
+ right: 5rem; |
|
321 |
+ bottom: 3rem; |
|
335 | 322 |
} |
336 | 323 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_15.vue
+++ client/views/pages/main/Chapter/Chapter3_15.vue
... | ... | @@ -1,321 +1,308 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter1_1" class="content-wrap"> |
|
3 |
- <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"> |
|
6 |
- <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
7 |
- </div> |
|
8 |
- </router-link> |
|
9 |
- </div> |
|
10 |
- <div class="title-box mb25 flex align-center mt40"> |
|
11 |
- <span class="title mr40">1. Hello WORLD</span> |
|
12 |
- <span class="subtitle">my name is dd</span> |
|
13 |
- </div> |
|
14 |
- <div class="flex justify-between align-center"> |
|
15 |
- <div class="pre-btn" @click="previousProblem()"> |
|
16 |
- <img |
|
17 |
- src="../../../../resources/img/left.png" |
|
18 |
- alt="" |
|
19 |
- :class="{ active: currentIndex === 0 }" |
|
20 |
- /> |
|
21 |
- </div> |
|
22 |
- <div class="content title-box"> |
|
23 |
- <p class="title mt25 title-bg">step3</p> |
|
24 |
- <div class="flex align-center mb30"> |
|
25 |
- <p class="subtitle2 mr20"> |
|
26 |
- {{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }} |
|
27 |
- </p> |
|
28 |
- <button> |
|
29 |
- <img src="../../../../resources/img/btn10_s.png" alt="" /> |
|
30 |
- </button> |
|
31 |
- </div> |
|
32 |
- |
|
33 |
- <div class="text-ct"> |
|
34 |
- <div class="time-hint"> |
|
35 |
- <button class="hint-btn">HINT</button> |
|
36 |
- <div class="time-bg mt20"> |
|
37 |
- <div> |
|
38 |
- <div class="time"> |
|
39 |
- <p class="second">{{ timer }}</p> |
|
40 |
- <p class="text">sec</p> |
|
2 |
+ <div id="Chapter1_1" class="content-wrap"> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"> |
|
6 |
+ <img src="../../../../resources/img/new_img/logo_v2.png" alt="" /> |
|
41 | 7 |
</div> |
42 |
- </div> |
|
43 |
- </div> |
|
44 |
- </div> |
|
45 |
- <div class="imgGroup"> |
|
46 |
- <img src="../../../../resources/img/img125_64s.png" alt="" /> |
|
47 |
- </div> |
|
48 |
- |
|
49 |
- <div class="dropGroup flex align-center justify-center mt70"> |
|
50 |
- <img src="../../../../resources/img/btn18_64s_normal.png" alt="" /> |
|
51 |
- </div> |
|
8 |
+ </router-link> |
|
52 | 9 |
</div> |
10 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
11 |
+ <BookInfo /> |
|
12 |
+ </div> |
|
13 |
+ <div class="flex justify-between align-center"> |
|
14 |
+ <div class="pre-btn" @click="previousProblem()"> |
|
15 |
+ <img src="../../../../resources/img/left.png" alt="" :class="{ active: currentIndex === 0 }" /> |
|
16 |
+ </div> |
|
17 |
+ <div class="content title-box"> |
|
18 |
+ <p class="title mt25 title-bg">step3</p> |
|
19 |
+ <div class="flex align-center mb30"> |
|
20 |
+ <p class="subtitle2 mr20">{{ currentProblemIndex + 1 }}. {{ dataList.prblmExpln }}</p> |
|
21 |
+ <button> |
|
22 |
+ <img src="../../../../resources/img/btn10_s.png" alt="" /> |
|
23 |
+ </button> |
|
24 |
+ </div> |
|
53 | 25 |
|
54 |
- <button |
|
55 |
- class="submit-button" |
|
56 |
- @click="handleSubmit()" |
|
57 |
- v-if="currentIndex === learningIdsLength - 1" |
|
58 |
- > |
|
59 |
- 제출하기 |
|
60 |
- </button> |
|
61 |
- <button class="submit-button" @click="nextProblem()" v-else> |
|
62 |
- 다음 문제로 |
|
63 |
- </button> |
|
64 |
- </div> |
|
65 |
- <div class="next-btn" @click="nextProblem()"> |
|
66 |
- <img src="../../../../resources/img/right.png" alt="" /> |
|
67 |
- </div> |
|
26 |
+ <div class="text-ct"> |
|
27 |
+ <div class="time-hint"> |
|
28 |
+ <button class="hint-btn">HINT</button> |
|
29 |
+ <div class="time-bg mt20"> |
|
30 |
+ <div> |
|
31 |
+ <div class="time"> |
|
32 |
+ <p class="second">{{ timer }}</p> |
|
33 |
+ <p class="text">sec</p> |
|
34 |
+ </div> |
|
35 |
+ </div> |
|
36 |
+ </div> |
|
37 |
+ </div> |
|
38 |
+ <div class="imgGroup"> |
|
39 |
+ <img src="../../../../resources/img/img125_64s.png" alt="" /> |
|
40 |
+ </div> |
|
41 |
+ |
|
42 |
+ <div class="dropGroup flex align-center justify-center mt70"> |
|
43 |
+ <img src="../../../../resources/img/btn18_64s_normal.png" alt="" /> |
|
44 |
+ </div> |
|
45 |
+ </div> |
|
46 |
+ |
|
47 |
+ <button class="submit-button" @click="handleSubmit()" v-if="currentIndex === learningIdsLength - 1"> |
|
48 |
+ 제출하기 |
|
49 |
+ </button> |
|
50 |
+ <button class="submit-button" @click="nextProblem()" v-else>다음 문제로</button> |
|
51 |
+ </div> |
|
52 |
+ <div class="next-btn" @click="nextProblem()"> |
|
53 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
54 |
+ </div> |
|
55 |
+ </div> |
|
68 | 56 |
</div> |
69 |
- </div> |
|
70 | 57 |
</template> |
71 | 58 |
|
72 | 59 |
<script> |
73 |
-import axios from "axios"; |
|
60 |
+import axios from 'axios'; |
|
61 |
+import BookInfo from '../../../component/BookInfo.vue'; |
|
74 | 62 |
export default { |
75 |
- data() { |
|
76 |
- return { |
|
77 |
- timer: "00", |
|
78 |
- dataList: [], |
|
79 |
- problemDetail: [], |
|
80 |
- currentIndex: null, |
|
81 |
- learningIdsLength: null, |
|
82 |
- }; |
|
83 |
- }, |
|
84 |
- methods: { |
|
85 |
- goToPage(page) { |
|
86 |
- this.$router.push({ name: page }); |
|
87 |
- }, |
|
88 |
- startTimer() { |
|
89 |
- if (this.intervalId) { |
|
90 |
- clearInterval(this.intervalId); |
|
91 |
- } |
|
92 |
- this.timer = 5; |
|
93 |
- this.intervalId = setInterval(() => { |
|
94 |
- if (this.timer > 0) { |
|
95 |
- this.timer--; |
|
96 |
- } else { |
|
97 |
- clearInterval(this.intervalId); |
|
98 |
- } |
|
99 |
- }, 1000); |
|
100 |
- }, |
|
101 |
- |
|
102 |
- handleSubmit() { |
|
103 |
- const userConfirmed = window.confirm("제출 하시겠습니까?"); |
|
104 |
- if (userConfirmed) { |
|
105 |
- const problemData = { |
|
106 |
- prblmInfo: this.currentLearningId, |
|
107 |
- prblmNumber: this.currentProblemIndex, |
|
108 |
- prblmAns: this.selectedButton, |
|
63 |
+ data() { |
|
64 |
+ return { |
|
65 |
+ timer: '00', |
|
66 |
+ dataList: [], |
|
67 |
+ problemDetail: [], |
|
68 |
+ currentIndex: null, |
|
69 |
+ learningIdsLength: null, |
|
109 | 70 |
}; |
110 |
- |
|
111 |
- const answerData = { |
|
112 |
- prblmId: this.currentLearningId.prblm_id, |
|
113 |
- prblmAns: this.selectedButton, |
|
114 |
- stdId: this.$store.getters.getStdId, |
|
115 |
- prblmLogAnsCnt: 1, |
|
116 |
- }; |
|
117 |
- |
|
118 |
- this.$store.dispatch("saveProblemData", problemData); |
|
119 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
120 |
- |
|
121 |
- console.log(this.$store.getters.getAllProblems); |
|
122 |
- console.log(this.$store.getters.getAllAnswers); |
|
123 |
- |
|
124 |
- axios({ |
|
125 |
- url: "problemLog/insertProblemLog.json", |
|
126 |
- method: "post", |
|
127 |
- headers: { |
|
128 |
- "Content-Type": "application/json; charset=UTF-8", |
|
129 |
- }, |
|
130 |
- data: this.$store.getters.getAllAnswers, |
|
131 |
- }) |
|
132 |
- .then(function (res) { |
|
133 |
- console.log("problem - response : ", res.data); |
|
134 |
- this.goToPage("Chapter4"); |
|
135 |
- }) |
|
136 |
- .catch(function (error) { |
|
137 |
- console.log("problem - error : ", error); |
|
138 |
- }); |
|
139 |
- } else { |
|
140 |
- console.log("Submission canceled by the user."); |
|
141 |
- } |
|
142 | 71 |
}, |
143 |
- getProblem() { |
|
144 |
- const vm = this; |
|
145 |
- const prblmId = this.currentLearningId.prblm_id; |
|
146 |
- axios({ |
|
147 |
- url: "problem/problemInfo.json", |
|
148 |
- method: "post", |
|
149 |
- headers: { |
|
150 |
- "Content-Type": "application/json; charset=UTF-8", |
|
72 |
+ methods: { |
|
73 |
+ goToPage(page) { |
|
74 |
+ this.$router.push({ name: page }); |
|
151 | 75 |
}, |
152 |
- data: { |
|
153 |
- prblmId: prblmId, |
|
76 |
+ startTimer() { |
|
77 |
+ if (this.intervalId) { |
|
78 |
+ clearInterval(this.intervalId); |
|
79 |
+ } |
|
80 |
+ this.timer = 5; |
|
81 |
+ this.intervalId = setInterval(() => { |
|
82 |
+ if (this.timer > 0) { |
|
83 |
+ this.timer--; |
|
84 |
+ } else { |
|
85 |
+ clearInterval(this.intervalId); |
|
86 |
+ } |
|
87 |
+ }, 1000); |
|
154 | 88 |
}, |
155 |
- }) |
|
156 |
- .then(function (res) { |
|
157 |
- console.log("problem - response : ", res.data); |
|
158 |
- vm.dataList = res.data.problem; |
|
159 |
- vm.problemDetail = res.data.problemDetail; |
|
160 |
- }) |
|
161 |
- .catch(function (error) { |
|
162 |
- console.log("problem - error : ", error); |
|
163 |
- }); |
|
164 |
- }, |
|
165 |
- nextProblem() { |
|
166 |
- const problemData = { |
|
167 |
- prblmInfo: this.currentLearningId, |
|
168 |
- prblmNumber: this.currentProblemIndex, |
|
169 |
- prblmAns: this.selectedButton, |
|
170 |
- }; |
|
171 |
- const answerData = { |
|
172 |
- prblmId: this.currentLearningId.prblm_id, |
|
173 |
- prblmAns: this.selectedButton, |
|
174 |
- stdId: this.$store.getters.getStdId, |
|
175 |
- prblmLogAnsCnt: 1, |
|
176 |
- }; |
|
177 |
- this.$store.dispatch("saveProblemData", problemData); |
|
178 |
- this.$store.dispatch("saveProblemAttempt", answerData); |
|
179 |
- console.log(this.$store.getters.getAllProblems); |
|
180 |
- console.log(this.$store.getters.getAllAnswers); |
|
181 |
- if ( |
|
182 |
- this.currentProblemIndex < |
|
183 |
- this.$store.state.currentLearningIds.length - 1 |
|
184 |
- ) { |
|
185 |
- this.$store.dispatch("goToNextProblem"); |
|
186 |
- this.handleProblemDetail(this.currentLearningId); |
|
187 |
- this.goToPage(this.problemType); |
|
188 |
- } |
|
189 |
- }, |
|
190 |
- previousProblem() { |
|
191 |
- if (this.currentProblemIndex > 0) { |
|
192 |
- this.$store.dispatch("goToPreviousProblem"); |
|
193 |
- this.handleProblemDetail(this.currentLearningId); |
|
194 |
- this.goToPage(this.problemType); |
|
195 |
- } |
|
196 |
- }, |
|
197 | 89 |
|
198 |
- handleProblemDetail(item) { |
|
199 |
- if (item.prblm_type_id === "prblm_type_001") { |
|
200 |
- this.problemType = "Chapter3"; |
|
201 |
- } else if (item.prblm_type_id === "prblm_type_002") { |
|
202 |
- this.problemType = "Chapter3_1"; |
|
203 |
- } else if (item.prblm_type_id === "prblm_type_003") { |
|
204 |
- this.problemType = "Chapter3_2"; |
|
205 |
- } else if (item.prblm_type_id === "prblm_type_004") { |
|
206 |
- this.problemType = "Chapter3_3"; |
|
207 |
- } else if (item.prblm_type_id === "prblm_type_005") { |
|
208 |
- this.problemType = "Chapter3_3_1"; |
|
209 |
- } else if (item.prblm_type_id === "prblm_type_006") { |
|
210 |
- this.problemType = "Chapter3_4"; |
|
211 |
- } else if (item.prblm_type_id === "prblm_type_007") { |
|
212 |
- this.problemType = "Chapter3_5"; |
|
213 |
- } else if (item.prblm_type_id === "prblm_type_008") { |
|
214 |
- this.problemType = "Chapter3_6"; |
|
215 |
- } else if (item.prblm_type_id === "prblm_type_009") { |
|
216 |
- this.problemType = "Chapter3_7"; |
|
217 |
- } else if (item.prblm_type_id === "prblm_type_010") { |
|
218 |
- this.problemType = "Chapter3_8"; |
|
219 |
- } else if (item.prblm_type_id === "prblm_type_011") { |
|
220 |
- this.problemType = "Chapter3_9"; |
|
221 |
- } else if (item.prblm_type_id === "prblm_type_012") { |
|
222 |
- this.problemType = "Chapter3_10"; |
|
223 |
- } else if (item.prblm_type_id === "prblm_type_013") { |
|
224 |
- this.problemType = "Chapter3_11"; |
|
225 |
- } else if (item.prblm_type_id === "prblm_type_014") { |
|
226 |
- this.problemType = "Chapter3_12"; |
|
227 |
- } else if (item.prblm_type_id === "prblm_type_015") { |
|
228 |
- this.problemType = "Chapter3_13"; |
|
229 |
- } else if (item.prblm_type_id === "prblm_type_016") { |
|
230 |
- this.problemType = "Chapter3_14"; |
|
231 |
- } else if (item.prblm_type_id === "prblm_type_017") { |
|
232 |
- this.problemType = "Chapter3_15"; |
|
233 |
- } else if (item.prblm_type_id === "prblm_type_018") { |
|
234 |
- this.problemType = "Chapter2_8"; |
|
235 |
- } else if (item.prblm_type_id === "prblm_type_019") { |
|
236 |
- this.problemType = "Chapter2_7"; |
|
237 |
- } else if (item.prblm_type_id === "prblm_type_020") { |
|
238 |
- this.problemType = "Chapter2_5"; |
|
239 |
- } else if (item.prblm_type_id === "prblm_type_021") { |
|
240 |
- this.problemType = "Chapter2_6"; |
|
241 |
- } else if (item.prblm_type_id === "prblm_type_022") { |
|
242 |
- this.problemType = "Chapter2_10"; |
|
243 |
- } else if (item.prblm_type_id === "prblm_type_023") { |
|
244 |
- this.problemType = "Chapter2_11"; |
|
245 |
- } else if (item.prblm_type_id === "prblm_type_024") { |
|
246 |
- this.problemType = "Chapter2_13"; |
|
247 |
- } |
|
248 |
- }, |
|
249 |
- }, |
|
250 |
- watch: {}, |
|
251 |
- computed: { |
|
252 |
- currentLearningId() { |
|
253 |
- return this.$store.getters.currentLearningId; |
|
254 |
- }, |
|
255 |
- currentLabel() { |
|
256 |
- return this.$store.getters.currentLabel; |
|
257 |
- }, |
|
258 |
- currentProblemIndex() { |
|
259 |
- return this.$store.getters.currentProblemIndex; |
|
260 |
- }, |
|
261 |
- isPreviousButtonDisabled() { |
|
262 |
- return this.currentProblemIndex === 0; |
|
263 |
- }, |
|
264 |
- }, |
|
265 |
- created() { |
|
266 |
- console.log("Current Learning ID:", this.currentLearningId); |
|
267 |
- console.log("Current Label:", this.currentLabel); |
|
268 |
- console.log("Current Problem Index:", this.currentProblemIndex); |
|
269 |
- this.currentIndex = this.currentProblemIndex; |
|
270 |
- this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
90 |
+ handleSubmit() { |
|
91 |
+ const userConfirmed = window.confirm('제출 하시겠습니까?'); |
|
92 |
+ if (userConfirmed) { |
|
93 |
+ const problemData = { |
|
94 |
+ prblmInfo: this.currentLearningId, |
|
95 |
+ prblmNumber: this.currentProblemIndex, |
|
96 |
+ prblmAns: this.selectedButton, |
|
97 |
+ }; |
|
271 | 98 |
|
272 |
- // Fetch or process the current problem based on `currentLearningId` |
|
273 |
- }, |
|
274 |
- components: {}, |
|
275 |
- mounted() { |
|
276 |
- this.getProblem(); |
|
277 |
- }, |
|
99 |
+ const answerData = { |
|
100 |
+ prblmId: this.currentLearningId.prblm_id, |
|
101 |
+ prblmAns: this.selectedButton, |
|
102 |
+ stdId: this.$store.getters.getStdId, |
|
103 |
+ prblmLogAnsCnt: 1, |
|
104 |
+ }; |
|
105 |
+ |
|
106 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
107 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
108 |
+ |
|
109 |
+ console.log(this.$store.getters.getAllProblems); |
|
110 |
+ console.log(this.$store.getters.getAllAnswers); |
|
111 |
+ |
|
112 |
+ axios({ |
|
113 |
+ url: 'problemLog/insertProblemLog.json', |
|
114 |
+ method: 'post', |
|
115 |
+ headers: { |
|
116 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
117 |
+ }, |
|
118 |
+ data: this.$store.getters.getAllAnswers, |
|
119 |
+ }) |
|
120 |
+ .then(function (res) { |
|
121 |
+ console.log('problem - response : ', res.data); |
|
122 |
+ this.goToPage('Chapter4'); |
|
123 |
+ }) |
|
124 |
+ .catch(function (error) { |
|
125 |
+ console.log('problem - error : ', error); |
|
126 |
+ }); |
|
127 |
+ } else { |
|
128 |
+ console.log('Submission canceled by the user.'); |
|
129 |
+ } |
|
130 |
+ }, |
|
131 |
+ getProblem() { |
|
132 |
+ const vm = this; |
|
133 |
+ const prblmId = this.currentLearningId.prblm_id; |
|
134 |
+ axios({ |
|
135 |
+ url: 'problem/problemInfo.json', |
|
136 |
+ method: 'post', |
|
137 |
+ headers: { |
|
138 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
139 |
+ }, |
|
140 |
+ data: { |
|
141 |
+ prblmId: prblmId, |
|
142 |
+ }, |
|
143 |
+ }) |
|
144 |
+ .then(function (res) { |
|
145 |
+ console.log('problem - response : ', res.data); |
|
146 |
+ vm.dataList = res.data.problem; |
|
147 |
+ vm.problemDetail = res.data.problemDetail; |
|
148 |
+ }) |
|
149 |
+ .catch(function (error) { |
|
150 |
+ console.log('problem - error : ', error); |
|
151 |
+ }); |
|
152 |
+ }, |
|
153 |
+ nextProblem() { |
|
154 |
+ const problemData = { |
|
155 |
+ prblmInfo: this.currentLearningId, |
|
156 |
+ prblmNumber: this.currentProblemIndex, |
|
157 |
+ prblmAns: this.selectedButton, |
|
158 |
+ }; |
|
159 |
+ const answerData = { |
|
160 |
+ prblmId: this.currentLearningId.prblm_id, |
|
161 |
+ prblmAns: this.selectedButton, |
|
162 |
+ stdId: this.$store.getters.getStdId, |
|
163 |
+ prblmLogAnsCnt: 1, |
|
164 |
+ }; |
|
165 |
+ this.$store.dispatch('saveProblemData', problemData); |
|
166 |
+ this.$store.dispatch('saveProblemAttempt', answerData); |
|
167 |
+ console.log(this.$store.getters.getAllProblems); |
|
168 |
+ console.log(this.$store.getters.getAllAnswers); |
|
169 |
+ if (this.currentProblemIndex < this.$store.state.currentLearningIds.length - 1) { |
|
170 |
+ this.$store.dispatch('goToNextProblem'); |
|
171 |
+ this.handleProblemDetail(this.currentLearningId); |
|
172 |
+ this.goToPage(this.problemType); |
|
173 |
+ } |
|
174 |
+ }, |
|
175 |
+ previousProblem() { |
|
176 |
+ if (this.currentProblemIndex > 0) { |
|
177 |
+ this.$store.dispatch('goToPreviousProblem'); |
|
178 |
+ this.handleProblemDetail(this.currentLearningId); |
|
179 |
+ this.goToPage(this.problemType); |
|
180 |
+ } |
|
181 |
+ }, |
|
182 |
+ |
|
183 |
+ handleProblemDetail(item) { |
|
184 |
+ if (item.prblm_type_id === 'prblm_type_001') { |
|
185 |
+ this.problemType = 'Chapter3'; |
|
186 |
+ } else if (item.prblm_type_id === 'prblm_type_002') { |
|
187 |
+ this.problemType = 'Chapter3_1'; |
|
188 |
+ } else if (item.prblm_type_id === 'prblm_type_003') { |
|
189 |
+ this.problemType = 'Chapter3_2'; |
|
190 |
+ } else if (item.prblm_type_id === 'prblm_type_004') { |
|
191 |
+ this.problemType = 'Chapter3_3'; |
|
192 |
+ } else if (item.prblm_type_id === 'prblm_type_005') { |
|
193 |
+ this.problemType = 'Chapter3_3_1'; |
|
194 |
+ } else if (item.prblm_type_id === 'prblm_type_006') { |
|
195 |
+ this.problemType = 'Chapter3_4'; |
|
196 |
+ } else if (item.prblm_type_id === 'prblm_type_007') { |
|
197 |
+ this.problemType = 'Chapter3_5'; |
|
198 |
+ } else if (item.prblm_type_id === 'prblm_type_008') { |
|
199 |
+ this.problemType = 'Chapter3_6'; |
|
200 |
+ } else if (item.prblm_type_id === 'prblm_type_009') { |
|
201 |
+ this.problemType = 'Chapter3_7'; |
|
202 |
+ } else if (item.prblm_type_id === 'prblm_type_010') { |
|
203 |
+ this.problemType = 'Chapter3_8'; |
|
204 |
+ } else if (item.prblm_type_id === 'prblm_type_011') { |
|
205 |
+ this.problemType = 'Chapter3_9'; |
|
206 |
+ } else if (item.prblm_type_id === 'prblm_type_012') { |
|
207 |
+ this.problemType = 'Chapter3_10'; |
|
208 |
+ } else if (item.prblm_type_id === 'prblm_type_013') { |
|
209 |
+ this.problemType = 'Chapter3_11'; |
|
210 |
+ } else if (item.prblm_type_id === 'prblm_type_014') { |
|
211 |
+ this.problemType = 'Chapter3_12'; |
|
212 |
+ } else if (item.prblm_type_id === 'prblm_type_015') { |
|
213 |
+ this.problemType = 'Chapter3_13'; |
|
214 |
+ } else if (item.prblm_type_id === 'prblm_type_016') { |
|
215 |
+ this.problemType = 'Chapter3_14'; |
|
216 |
+ } else if (item.prblm_type_id === 'prblm_type_017') { |
|
217 |
+ this.problemType = 'Chapter3_15'; |
|
218 |
+ } else if (item.prblm_type_id === 'prblm_type_018') { |
|
219 |
+ this.problemType = 'Chapter2_8'; |
|
220 |
+ } else if (item.prblm_type_id === 'prblm_type_019') { |
|
221 |
+ this.problemType = 'Chapter2_7'; |
|
222 |
+ } else if (item.prblm_type_id === 'prblm_type_020') { |
|
223 |
+ this.problemType = 'Chapter2_5'; |
|
224 |
+ } else if (item.prblm_type_id === 'prblm_type_021') { |
|
225 |
+ this.problemType = 'Chapter2_6'; |
|
226 |
+ } else if (item.prblm_type_id === 'prblm_type_022') { |
|
227 |
+ this.problemType = 'Chapter2_10'; |
|
228 |
+ } else if (item.prblm_type_id === 'prblm_type_023') { |
|
229 |
+ this.problemType = 'Chapter2_11'; |
|
230 |
+ } else if (item.prblm_type_id === 'prblm_type_024') { |
|
231 |
+ this.problemType = 'Chapter2_13'; |
|
232 |
+ } |
|
233 |
+ }, |
|
234 |
+ }, |
|
235 |
+ watch: {}, |
|
236 |
+ computed: { |
|
237 |
+ currentLearningId() { |
|
238 |
+ return this.$store.getters.currentLearningId; |
|
239 |
+ }, |
|
240 |
+ currentLabel() { |
|
241 |
+ return this.$store.getters.currentLabel; |
|
242 |
+ }, |
|
243 |
+ currentProblemIndex() { |
|
244 |
+ return this.$store.getters.currentProblemIndex; |
|
245 |
+ }, |
|
246 |
+ isPreviousButtonDisabled() { |
|
247 |
+ return this.currentProblemIndex === 0; |
|
248 |
+ }, |
|
249 |
+ }, |
|
250 |
+ created() { |
|
251 |
+ console.log('Current Learning ID:', this.currentLearningId); |
|
252 |
+ console.log('Current Label:', this.currentLabel); |
|
253 |
+ console.log('Current Problem Index:', this.currentProblemIndex); |
|
254 |
+ this.currentIndex = this.currentProblemIndex; |
|
255 |
+ this.learningIdsLength = this.$store.state.currentLearningIds.length; |
|
256 |
+ |
|
257 |
+ // Fetch or process the current problem based on `currentLearningId` |
|
258 |
+ }, |
|
259 |
+ components: { |
|
260 |
+ BookInfo: BookInfo, |
|
261 |
+ }, |
|
262 |
+ mounted() { |
|
263 |
+ this.getProblem(); |
|
264 |
+ }, |
|
278 | 265 |
}; |
279 | 266 |
</script> |
280 | 267 |
<style scoped> |
281 | 268 |
.textbox { |
282 |
- height: 60px; |
|
269 |
+ height: 60px; |
|
283 | 270 |
} |
284 | 271 |
|
285 | 272 |
.textbox p { |
286 |
- font-size: 28px; |
|
287 |
- font-weight: bold; |
|
288 |
- line-height: 65px; |
|
273 |
+ font-size: 28px; |
|
274 |
+ font-weight: bold; |
|
275 |
+ line-height: 65px; |
|
289 | 276 |
} |
290 | 277 |
|
291 | 278 |
.dropGroup button { |
292 |
- position: relative; |
|
279 |
+ position: relative; |
|
293 | 280 |
} |
294 | 281 |
|
295 | 282 |
.dropGroup button p { |
296 |
- font-size: 48px; |
|
283 |
+ font-size: 48px; |
|
297 | 284 |
} |
298 | 285 |
|
299 | 286 |
.dragGroup button p { |
300 |
- font-size: 48px; |
|
287 |
+ font-size: 48px; |
|
301 | 288 |
} |
302 | 289 |
|
303 | 290 |
.pre-btn img.active { |
304 |
- visibility: hidden; |
|
291 |
+ visibility: hidden; |
|
305 | 292 |
} |
306 | 293 |
|
307 | 294 |
.pre-btn img.active { |
308 |
- visibility: hidden; |
|
295 |
+ visibility: hidden; |
|
309 | 296 |
} |
310 | 297 |
|
311 | 298 |
.submit-button { |
312 |
- position: absolute; |
|
313 |
- background-color: #ffba08; |
|
314 |
- padding: 10px 30px; |
|
315 |
- border-radius: 10px; |
|
316 |
- font-size: 28px; |
|
317 |
- font-family: "ONEMobilePOPOTF"; |
|
318 |
- right: 5rem; |
|
319 |
- bottom: 3rem; |
|
299 |
+ position: absolute; |
|
300 |
+ background-color: #ffba08; |
|
301 |
+ padding: 10px 30px; |
|
302 |
+ border-radius: 10px; |
|
303 |
+ font-size: 28px; |
|
304 |
+ font-family: 'ONEMobilePOPOTF'; |
|
305 |
+ right: 5rem; |
|
306 |
+ bottom: 3rem; |
|
320 | 307 |
} |
321 | 308 |
</style> |
--- client/views/pages/main/Chapter/Chapter3_16.vue
+++ client/views/pages/main/Chapter/Chapter3_16.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_2.vue
+++ client/views/pages/main/Chapter/Chapter3_2.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_3.vue
+++ client/views/pages/main/Chapter/Chapter3_3.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_3_1.vue
+++ client/views/pages/main/Chapter/Chapter3_3_1.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_4.vue
+++ client/views/pages/main/Chapter/Chapter3_4.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_5.vue
+++ client/views/pages/main/Chapter/Chapter3_5.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_6.vue
+++ client/views/pages/main/Chapter/Chapter3_6.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_7.vue
+++ client/views/pages/main/Chapter/Chapter3_7.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_8.vue
+++ client/views/pages/main/Chapter/Chapter3_8.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter3_9.vue
+++ client/views/pages/main/Chapter/Chapter3_9.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter4.vue
+++ client/views/pages/main/Chapter/Chapter4.vue
This diff is skipped because there are too many other diffs. |
--- client/views/pages/main/Chapter/Chapter5.vue
+++ client/views/pages/main/Chapter/Chapter5.vue
This diff is skipped because there are too many other diffs. |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?