+++ client/resources/audio/bank.wav
Binary file is not shown |
+++ client/resources/img/img2_4.png
Binary file is not shown |
--- client/views/pages/main/Chapter/Chapter2_2.vue
+++ client/views/pages/main/Chapter/Chapter2_2.vue
... | ... | @@ -12,14 +12,11 @@ |
12 | 12 |
<div class="flex justify-between align-center"> |
13 | 13 |
<div class="pre-btn" @click="goToPage('Chapter2_3')"><img src="../../../../resources/img/left.png" alt=""> |
14 | 14 |
</div> |
15 |
- <div class="content title-box"> |
|
15 |
+ <div class="content title-box" > |
|
16 | 16 |
<p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
17 |
- <div class="flex align-center mb30"> |
|
17 |
+ <div class="flex align-center mb30" style="justify-content: space-between;margin-right: 9em;"> |
|
18 | 18 |
<p class="subtitle2 mr20">카드를 뒤집어 보세요.</p> |
19 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
20 |
- </button> --> |
|
21 |
- </div> |
|
22 |
- <div class="time-bg"> |
|
19 |
+ <div class="time-bg"> |
|
23 | 20 |
<div> |
24 | 21 |
<div class="time"> |
25 | 22 |
<p class="second">{{ timer }}</p> |
... | ... | @@ -27,6 +24,10 @@ |
27 | 24 |
</div> |
28 | 25 |
</div> |
29 | 26 |
</div> |
27 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
28 |
+ </button> --> |
|
29 |
+ </div> |
|
30 |
+ |
|
30 | 31 |
|
31 | 32 |
<div class="imgGroup"> |
32 | 33 |
<div class="flex justify-center" style="gap: 90px;"> |
... | ... | @@ -91,7 +92,7 @@ |
91 | 92 |
this.intervalId = setInterval(() => { |
92 | 93 |
if (this.currentIndex == this.items.length) |
93 | 94 |
return; |
94 |
- if (this.timer < 5) { |
|
95 |
+ if (this.timer < 3) { |
|
95 | 96 |
this.timer++; |
96 | 97 |
} else { |
97 | 98 |
// 타이머가 끝났을 때, 다음 타이머 설정 |
... | ... | @@ -133,4 +134,8 @@ |
133 | 134 |
top: 50%; |
134 | 135 |
left: 50%; |
135 | 136 |
} |
137 |
+.questionBox { |
|
138 |
+ justify-content: space-between; |
|
139 |
+ align-items: flex-start; |
|
140 |
+} |
|
136 | 141 |
</style>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/main/Chapter/Chapter2_3.vue
+++ client/views/pages/main/Chapter/Chapter2_3.vue
... | ... | @@ -1,69 +1,76 @@ |
1 | 1 |
<template> |
2 | 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"><img src="../../../../resources/img/logo2.png" alt=""></div> |
|
6 |
- </router-link> |
|
7 |
- </div> |
|
8 |
- <div class="title-box mb25 flex align-center mt40"> |
|
9 |
- <span class="title mr40">1. Hello WORLD</span> |
|
10 |
- <span class="subtitle">my name is dd</span> |
|
11 |
- </div> |
|
12 |
- <div class="flex justify-between align-center"> |
|
13 |
- <div class="pre-btn" @click="goToPage('Chapter2')"><img src="../../../../resources/img/left.png" alt=""></div> |
|
14 |
- <div class="content title-box"> |
|
15 |
- <p class="subtitle2 "></p> |
|
16 |
- <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
|
17 |
- <div class="flex align-center mb30"> |
|
18 |
- <p class="subtitle2 mr20">다음을 듣고 따라 말하세요.</p> |
|
19 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
20 |
- </button> --> |
|
21 |
- </div> |
|
22 |
- |
|
23 |
- <div class="imgGroup"> |
|
24 |
- <div class="con"> |
|
25 |
- <img :src="currentCon.imgSrc" alt=""> |
|
26 |
- <p class="title3"><em class="yellow">{{ currentCon.titleEm }}</em>{{ currentCon.title }}</p> |
|
27 |
- <div class="flex align-center justify-center mt10"> |
|
28 |
- <p class="yellow-box-big">{{ currentCon.boxText }}</p> |
|
29 |
- <span class="subtitle3">{{ currentCon.subtitle }}</span> |
|
30 |
- </div> |
|
3 |
+ <div style="margin: 30px 0px 50px; width: 20%"> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"><img src="../../../../resources/img/logo2.png" alt="" /></div> |
|
6 |
+ </router-link> |
|
7 |
+ </div> |
|
8 |
+ <div class="title-box mb25 flex align-center mt40"> |
|
9 |
+ <span class="title mr40">1. Hello WORLD</span> |
|
10 |
+ <span class="subtitle">my name is dd</span> |
|
11 |
+ </div> |
|
12 |
+ <div class="flex justify-between align-center"> |
|
13 |
+ <div class="pre-btn" @click="goToPage('Chapter2')"> |
|
14 |
+ <img src="../../../../resources/img/left.png" alt="" /> |
|
15 |
+ </div> |
|
16 |
+ <div class="content title-box"> |
|
17 |
+ <p class="subtitle2"></p> |
|
18 |
+ <p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</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> --> |
|
31 | 23 |
</div> |
32 | 24 |
|
25 |
+ <div class="imgGroup box23"> |
|
26 |
+ <div class="con"> |
|
27 |
+ <img :src="currentCon.imgSrc" alt="" /> |
|
28 |
+ <p class="title3"> |
|
29 |
+ <em class="yellow">{{ currentCon.titleEm }}</em |
|
30 |
+ >{{ currentCon.title }} |
|
31 |
+ </p> |
|
32 |
+ <div class="flex align-center justify-center mt10"> |
|
33 |
+ <p class="yellow-box-big">{{ currentCon.boxText }}</p> |
|
34 |
+ <span class="subtitle3">{{ currentCon.subtitle }}</span> |
|
35 |
+ </div> |
|
36 |
+ <div class="flex justify-center"> |
|
37 |
+ <div class="btnGroup mt50 flex justify-between"> |
|
38 |
+ <button |
|
39 |
+ class="popTxt" |
|
40 |
+ v-for="(item, index) in items" |
|
41 |
+ :key="index" |
|
42 |
+ @click="updateContent(index)" |
|
43 |
+ :class="{ active: selectedIndex === index }" |
|
44 |
+ > |
|
45 |
+ <img :src="item.imgSrc1" /> |
|
46 |
+ <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block" /> |
|
47 |
+ </button> |
|
48 |
+ </div> |
|
49 |
+ </div> |
|
50 |
+ </div> |
|
33 | 51 |
|
34 |
- <div class="flex justify-center"> |
|
35 |
- <div class="readGroup"> |
|
36 |
- <section> |
|
37 |
- <div class="imgGroup flex justify-center"> |
|
38 |
- <!-- 녹음 버튼 --> |
|
39 |
- <div :class="['mic-btn', { notRecording: !isRecording }]" @click="toggleRecording"> |
|
40 |
- <img src="../../../../resources/img/btn11_s.png" alt="" /> |
|
41 |
- </div> |
|
42 |
- </div> |
|
43 |
- <article> |
|
44 |
- <p class="speakText mb25"> |
|
45 |
- <span v-if="transcription === null">위의 버튼을 누른 후 단어를 말해보세요!</span> |
|
46 |
- <span v-else-if="transcription === nowWord">다시 말해보세요!</span> |
|
47 |
- <span v-else>정답입니다! 잘했어요</span> |
|
48 |
- </p> |
|
49 |
- </article> |
|
50 |
- </section> |
|
51 |
- </div> |
|
52 |
+ <div class="flex justify-center"> |
|
53 |
+ <div class="readGroup"> |
|
54 |
+ <section> |
|
55 |
+ <div class="imgGroup flex justify-center"> |
|
56 |
+ <!-- 녹음 버튼 --> |
|
57 |
+ <div :class="['mic-btn', { notRecording: !isRecording }]" @click="toggleRecording"> |
|
58 |
+ <img src="../../../../resources/img/btn11_s.png" alt="" /> |
|
59 |
+ </div> |
|
60 |
+ </div> |
|
61 |
+ <article> |
|
62 |
+ <p ref="speakText" class="speakText mb25">위의 버튼을 누른 후 단어를 말해보세요!</p> |
|
63 |
+ </article> |
|
64 |
+ </section> |
|
65 |
+ </div> |
|
66 |
+ </div> |
|
67 |
+ |
|
52 | 68 |
</div> |
53 |
- <div class="flex justify-center"> |
|
54 |
- <div class="btnGroup mt50 flex justify-between"> |
|
55 |
- <button class="popTxt" v-for="(item, index) in items" :key="index" @click="updateContent(index)" |
|
56 |
- :class="{ active: selectedIndex === index }"> |
|
57 |
- <img :src="item.imgSrc1"> |
|
58 |
- <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;"> |
|
59 |
- </button> |
|
60 |
- </div> |
|
61 |
- </div> |
|
62 |
- </div> |
|
63 |
- </div> |
|
64 |
- <div class="next-btn" @click="goToPage('Chapter2_2')"><img src="../../../../resources/img/right.png" alt=""> |
|
65 |
- </div> |
|
66 |
- </div> |
|
69 |
+ </div> |
|
70 |
+ <div class="next-btn" @click="goToPage('Chapter2_2')"> |
|
71 |
+ <img src="../../../../resources/img/right.png" alt="" /> |
|
72 |
+ </div> |
|
73 |
+ </div> |
|
67 | 74 |
</div> |
68 | 75 |
</template> |
69 | 76 |
|
... | ... | @@ -72,131 +79,194 @@ |
72 | 79 |
import { mdiStop } from '@mdi/js'; |
73 | 80 |
export default { |
74 | 81 |
data() { |
75 |
- return { |
|
76 |
- items: [ |
|
77 |
- { imgSrc1: 'client/resources/img/img53_6_35s.png', imgSrc2: 'client/resources/img/img53_1_35s.png', con: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 'c', title: 'loud', boxText: '명', subtitle: '구름' } }, |
|
78 |
- { imgSrc1: 'client/resources/img/img53_7_35s.png', imgSrc2: 'client/resources/img/img53_2_35s.png', con: { imgSrc: 'client/resources/img/img40_s.png', titleEm: 'a', title: 'pple', boxText: '명', subtitle: '사과' } }, |
|
79 |
- { imgSrc1: 'client/resources/img/img53_8_35s.png', imgSrc2: 'client/resources/img/img53_3_35s.png', con: { imgSrc: 'client/resources/img/31img40_s.png', titleEm: 'l', title: 'og', boxText: '명', subtitle: '통나무' } }, |
|
80 |
- { imgSrc1: 'client/resources/img/img53_9_35s.png', imgSrc2: 'client/resources/img/img53_4_35s.png', con: { imgSrc: 'client/resources/img/img41_s.png', titleEm: 'g', title: 'uitar', boxText: '명', subtitle: '기타' } }, |
|
81 |
- { imgSrc1: 'client/resources/img/img53_10_35s.png', imgSrc2: 'client/resources/img/img53_5_35s.png', con: { imgSrc: 'client/resources/img/img76_41s.png', titleEm: 'w', title: 'ater melon', boxText: '명', subtitle: '수박' } } |
|
82 |
- ], |
|
83 |
- currentCon: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 'c', title: 'loud', boxText: '명', subtitle: '구름' }, |
|
84 |
- selectedIndex: 0, |
|
85 |
- timer: "00", |
|
86 |
- intervalId: null, |
|
82 |
+ return { |
|
83 |
+ items: [ |
|
84 |
+ { |
|
85 |
+ imgSrc1: 'client/resources/img/img53_6_35s.png', |
|
86 |
+ imgSrc2: 'client/resources/img/img53_1_35s.png', |
|
87 |
+ con: { |
|
88 |
+ imgSrc: 'client/resources/img/img54_s.png', |
|
89 |
+ titleEm: 'c', |
|
90 |
+ title: 'loud', |
|
91 |
+ boxText: '명', |
|
92 |
+ subtitle: '구름', |
|
93 |
+ }, |
|
94 |
+ }, |
|
95 |
+ { |
|
96 |
+ imgSrc1: 'client/resources/img/img53_7_35s.png', |
|
97 |
+ imgSrc2: 'client/resources/img/img53_2_35s.png', |
|
98 |
+ con: { |
|
99 |
+ imgSrc: 'client/resources/img/img40_s.png', |
|
100 |
+ titleEm: 'a', |
|
101 |
+ title: 'pple', |
|
102 |
+ boxText: '명', |
|
103 |
+ subtitle: '사과', |
|
104 |
+ }, |
|
105 |
+ }, |
|
106 |
+ { |
|
107 |
+ imgSrc1: 'client/resources/img/img53_8_35s.png', |
|
108 |
+ imgSrc2: 'client/resources/img/img53_3_35s.png', |
|
109 |
+ con: { |
|
110 |
+ imgSrc: 'client/resources/img/31img40_s.png', |
|
111 |
+ titleEm: 'l', |
|
112 |
+ title: 'og', |
|
113 |
+ boxText: '명', |
|
114 |
+ subtitle: '통나무', |
|
115 |
+ }, |
|
116 |
+ }, |
|
117 |
+ { |
|
118 |
+ imgSrc1: 'client/resources/img/img53_9_35s.png', |
|
119 |
+ imgSrc2: 'client/resources/img/img53_4_35s.png', |
|
120 |
+ con: { |
|
121 |
+ imgSrc: 'client/resources/img/img41_s.png', |
|
122 |
+ titleEm: 'g', |
|
123 |
+ title: 'uitar', |
|
124 |
+ boxText: '명', |
|
125 |
+ subtitle: '기타', |
|
126 |
+ }, |
|
127 |
+ }, |
|
128 |
+ { |
|
129 |
+ imgSrc1: 'client/resources/img/img53_10_35s.png', |
|
130 |
+ imgSrc2: 'client/resources/img/img53_5_35s.png', |
|
131 |
+ con: { |
|
132 |
+ imgSrc: 'client/resources/img/img76_41s.png', |
|
133 |
+ titleEm: 'w', |
|
134 |
+ title: 'ater melon', |
|
135 |
+ boxText: '명', |
|
136 |
+ subtitle: '수박', |
|
137 |
+ }, |
|
138 |
+ }, |
|
139 |
+ ], |
|
140 |
+ currentCon: { |
|
141 |
+ imgSrc: 'client/resources/img/img54_s.png', |
|
142 |
+ titleEm: 'c', |
|
143 |
+ title: 'loud', |
|
144 |
+ boxText: '명', |
|
145 |
+ subtitle: '구름', |
|
146 |
+ }, |
|
147 |
+ selectedIndex: 0, |
|
148 |
+ timer: '00', |
|
149 |
+ intervalId: null, |
|
87 | 150 |
|
151 |
+ isRecording: false, // 녹음 중 여부 |
|
152 |
+ mediaRecorder: null, |
|
153 |
+ audioChunks: [], // 녹음된 오디오 데이터 |
|
154 |
+ audioBlob: null, // 오디오 Blob 객체 |
|
155 |
+ stream: null, // MediaStream 객체 |
|
88 | 156 |
|
89 |
- isRecording: false, // 녹음 중 여부 |
|
90 |
- mediaRecorder: null, |
|
91 |
- audioChunks: [], // 녹음된 오디오 데이터 |
|
92 |
- audioBlob: null, // 오디오 Blob 객체 |
|
93 |
- transcription: null, // 서버에서 받아온 텍스트 결과 |
|
94 |
- stream: null, // MediaStream 객체 |
|
95 |
- |
|
96 |
- path: mdiStop, |
|
97 |
- nowWord: "cloud", |
|
98 |
- }; |
|
157 |
+ path: mdiStop, |
|
158 |
+ nowWord: 'cloud', |
|
159 |
+ }; |
|
99 | 160 |
}, |
100 | 161 |
methods: { |
101 |
- goToPage(page) { |
|
102 |
- this.$router.push({ name: page }); |
|
103 |
- }, |
|
104 |
- updateContent(index) { |
|
105 |
- this.selectedIndex = index; |
|
106 |
- this.currentCon = this.items[index].con; |
|
107 |
- this.startTimer(); |
|
108 |
- }, |
|
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 { |
|
162 |
+ goToPage(page) { |
|
163 |
+ this.$router.push({ name: page }); |
|
164 |
+ }, |
|
165 |
+ updateContent(index) { |
|
166 |
+ this.selectedIndex = index; |
|
167 |
+ this.currentCon = this.items[index].con; |
|
168 |
+ this.startTimer(); |
|
169 |
+ }, |
|
170 |
+ startTimer() { |
|
171 |
+ if (this.intervalId) { |
|
118 | 172 |
clearInterval(this.intervalId); |
119 |
- } |
|
120 |
- }, 1000); |
|
121 |
- }, |
|
122 |
- // 녹음 시작/중지 토글 |
|
123 |
- async toggleRecording() { |
|
124 |
- if (this.isRecording) { |
|
125 |
- console.log('녹음 그만!'); |
|
126 |
- this.stopRecording(); // 녹음 중이면 중지 |
|
127 |
- } else { |
|
128 |
- console.log('녹음 시작!'); |
|
129 |
- await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
130 |
- } |
|
131 |
- }, |
|
132 |
- // 녹음 시작 |
|
133 |
- async startRecording() { |
|
134 |
- this.audioChunks = []; // 오디오 초기화 |
|
135 |
- this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
136 |
- this.mediaRecorder = new MediaRecorder(this.stream); |
|
137 |
- this.mediaRecorder.ondataavailable = (event) => { |
|
138 |
- this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
139 |
- }; |
|
140 |
- this.mediaRecorder.onstop = () => { |
|
141 |
- this.audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' }); |
|
173 |
+ } |
|
174 |
+ this.timer = 5; |
|
175 |
+ this.intervalId = setInterval(() => { |
|
176 |
+ if (this.timer > 0) { |
|
177 |
+ this.timer--; |
|
178 |
+ } else { |
|
179 |
+ clearInterval(this.intervalId); |
|
180 |
+ } |
|
181 |
+ }, 1000); |
|
182 |
+ }, |
|
183 |
+ // 녹음 시작/중지 토글 |
|
184 |
+ async toggleRecording() { |
|
185 |
+ if (this.isRecording) { |
|
186 |
+ console.log('녹음 그만!'); |
|
187 |
+ this.stopRecording(); // 녹음 중이면 중지 |
|
188 |
+ } else { |
|
189 |
+ console.log('녹음 시작!'); |
|
190 |
+ await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
191 |
+ } |
|
192 |
+ }, |
|
193 |
+ // 녹음 시작 |
|
194 |
+ async startRecording() { |
|
195 |
+ this.audioChunks = []; // 오디오 초기화 |
|
196 |
+ this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
197 |
+ this.mediaRecorder = new MediaRecorder(this.stream); |
|
198 |
+ this.mediaRecorder.ondataavailable = (event) => { |
|
199 |
+ this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
200 |
+ }; |
|
201 |
+ this.mediaRecorder.onstop = () => { |
|
202 |
+ this.audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' }); |
|
142 | 203 |
|
143 |
- /******************************/ |
|
144 |
- // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
145 |
- // console.log('Audio URL:', this.audioURL); |
|
146 |
- /******************************/ |
|
204 |
+ /******************************/ |
|
205 |
+ // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
206 |
+ // console.log('Audio URL:', this.audioURL); |
|
207 |
+ /******************************/ |
|
147 | 208 |
|
148 |
- console.log('Recorded Audio Blob:', this.audioBlob); // 콘솔에 Blob 확인 |
|
149 |
- this.sendAudioToServer(); // 서버로 오디오 전송 |
|
150 |
- }; |
|
151 |
- this.mediaRecorder.start(); // 녹음 시작 |
|
152 |
- this.isRecording = true; // 녹음 상태 변경 |
|
153 |
- }, |
|
209 |
+ console.log('Recorded Audio Blob:', this.audioBlob); // 콘솔에 Blob 확인 |
|
210 |
+ this.sendAudioToServer(); // 서버로 오디오 전송 |
|
211 |
+ }; |
|
212 |
+ this.mediaRecorder.start(); // 녹음 시작 |
|
213 |
+ this.isRecording = true; // 녹음 상태 변경 |
|
214 |
+ }, |
|
154 | 215 |
|
155 |
- // 녹음 중지 |
|
156 |
- stopRecording() { |
|
157 |
- this.mediaRecorder.stop(); // 녹음 중단 |
|
216 |
+ // 녹음 중지 |
|
217 |
+ stopRecording() { |
|
218 |
+ this.mediaRecorder.stop(); // 녹음 중단 |
|
158 | 219 |
|
159 |
- if (this.stream) { |
|
160 |
- this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
161 |
- } |
|
220 |
+ if (this.stream) { |
|
221 |
+ this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
222 |
+ } |
|
162 | 223 |
|
163 |
- this.isRecording = false; // 녹음 상태 변경 |
|
164 |
- }, |
|
224 |
+ this.isRecording = false; // 녹음 상태 변경 |
|
225 |
+ }, |
|
165 | 226 |
|
166 |
- // 오디오 전송 |
|
167 |
- async sendAudioToServer() { |
|
168 |
- const formData = new FormData(); |
|
169 |
- formData.append('file', this.audioBlob, 'recording.wav'); |
|
170 |
- try { |
|
171 |
- const resposne = await axios.post('/api/speechToText.json', formData, { |
|
172 |
- headers: { |
|
173 |
- 'Content-Type': 'multipart/form-data', |
|
174 |
- }, |
|
175 |
- }); |
|
176 |
- this.transcription = resposne.data; |
|
177 |
- console.log(`받은 데이터 : ${this.transcription}`); |
|
178 |
- } catch (error) { |
|
179 |
- console.log('파일 전송 실패 : ', error); |
|
180 |
- } |
|
181 |
- }, |
|
227 |
+ // 오디오 전송 |
|
228 |
+ async sendAudioToServer() { |
|
229 |
+ const formData = new FormData(); |
|
230 |
+ formData.append('file', this.audioBlob, 'recording.wav'); |
|
231 |
+ try { |
|
232 |
+ const response = await axios.post('/api/speechToText.json', formData, { |
|
233 |
+ headers: { |
|
234 |
+ 'Content-Type': 'multipart/form-data', |
|
235 |
+ }, |
|
236 |
+ }); |
|
237 |
+ |
|
238 |
+ this.transcription = response.data.trim().toLowerCase(); |
|
239 |
+ this.nowWord = this.nowWord.toLowerCase(); |
|
240 |
+ |
|
241 |
+ console.log('지금 단어: ', this.nowWord); |
|
242 |
+ console.log('녹음 결과: ', this.transcription); |
|
243 |
+ |
|
244 |
+ if (this.transcription === this.nowWord) { |
|
245 |
+ this.$refs.speakText.innerText = '정답입니다! 잘했어요'; |
|
246 |
+ } else { |
|
247 |
+ this.$refs.speakText.innerText = '다시 말해보세요!'; |
|
248 |
+ } |
|
249 |
+ } catch (error) { |
|
250 |
+ console.log('파일 전송 실패: ', error); |
|
251 |
+ } |
|
252 |
+ }, |
|
182 | 253 |
}, |
183 | 254 |
watch: { |
184 |
- currentCon: { |
|
185 |
- handler(newValue) { |
|
186 |
- // Update nowWord when currentCon changes |
|
187 |
- this.nowWord = newValue.titleEm + newValue.title; |
|
188 |
- console.log('지금단어: ',this.nowWord) |
|
189 |
- console.log('녹음결과: ',this.transcription) |
|
190 |
- }, |
|
191 |
- deep: true // Watch for deep changes in currentCon |
|
192 |
- } |
|
255 |
+ transcription: null, // 서버에서 받아온 텍스트 결과 |
|
256 |
+ currentCon: { |
|
257 |
+ handler(newValue) { |
|
258 |
+ // Update nowWord when currentCon changes |
|
259 |
+ this.nowWord = newValue.titleEm + newValue.title; |
|
260 |
+ }, |
|
261 |
+ deep: true, // Watch for deep changes in currentCon |
|
262 |
+ }, |
|
193 | 263 |
}, |
194 | 264 |
beforeDestroy() { |
195 |
- if (this.intervalId) { |
|
196 |
- clearInterval(this.intervalId); |
|
197 |
- } |
|
265 |
+ if (this.intervalId) { |
|
266 |
+ clearInterval(this.intervalId); |
|
267 |
+ } |
|
198 | 268 |
}, |
199 |
-} |
|
269 |
+}; |
|
200 | 270 |
</script> |
201 | 271 |
|
202 | 272 |
<style scoped> |
... | ... | @@ -205,4 +275,10 @@ |
205 | 275 |
top: 0; |
206 | 276 |
left: 0; |
207 | 277 |
} |
278 |
+.box23{ |
|
279 |
+ display: flex; |
|
280 |
+ align-items: center; |
|
281 |
+ gap: 80px; |
|
282 |
+ justify-content: center; |
|
283 |
+} |
|
208 | 284 |
</style> |
--- client/views/pages/main/Chapter/Chapter2_4.vue
+++ client/views/pages/main/Chapter/Chapter2_4.vue
... | ... | @@ -1,10 +1,10 @@ |
1 | 1 |
<template> |
2 | 2 |
<div id="Chapter2_2" class="content-wrap"> |
3 | 3 |
<div style="margin: 30px 0px 50px; width: 20%"> |
4 |
- <router-link to="/MyPlan.page"> |
|
5 |
- <div class="logo mb25"><img src="../../../../resources/img/logo2.png" alt=""></div> |
|
6 |
- </router-link> |
|
7 |
- </div> |
|
4 |
+ <router-link to="/MyPlan.page"> |
|
5 |
+ <div class="logo mb25"><img src="../../../../resources/img/logo2.png" alt=""></div> |
|
6 |
+ </router-link> |
|
7 |
+ </div> |
|
8 | 8 |
<div class="title-box mb25 flex align-center mt40"> |
9 | 9 |
<span class="title mr40">1. Hello WORLD</span> |
10 | 10 |
<span class="subtitle">my name is dd</span> |
... | ... | @@ -14,12 +14,12 @@ |
14 | 14 |
</div> |
15 | 15 |
<div class="content title-box"> |
16 | 16 |
<p class="title mt25 title-bg">STEP 2 - 단어로 공부하는 영어</p> |
17 |
- <div class="flex align-center mb30"> |
|
18 |
- <p class="subtitle2 mr20">다음을 듣고 맞는 단어를 선택하세요.</p> |
|
19 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
17 |
+ <div class="flex align-center mb30"> |
|
18 |
+ <p class="subtitle2 mr20">다음을 듣고 맞는 단어를 선택하세요.</p> |
|
19 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
20 | 20 |
</button> --> |
21 |
- </div> |
|
22 |
- |
|
21 |
+ </div> |
|
22 |
+ |
|
23 | 23 |
|
24 | 24 |
<div class="imgGroup"> |
25 | 25 |
|
... | ... | @@ -30,16 +30,17 @@ |
30 | 30 |
<img :src="item.imgSrc1"> |
31 | 31 |
<img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;"> |
32 | 32 |
<div class="textbox"> |
33 |
- <div style="height: 80%; line-height: 200px;"> <img :src="item.imgSrc" alt=""></div> |
|
33 |
+ <div style="height: 80%; line-height: 200px;"> <img :src="item.imgSrc" alt=""></div> |
|
34 | 34 |
<p class="subtitle3" style="height: 20%;">{{ item.title }}</p> |
35 | 35 |
</div> |
36 | 36 |
</button> |
37 | 37 |
</div> |
38 | 38 |
</div> |
39 |
- <div class="listen-btn"> |
|
40 |
- <img src="client/resources/img/img60_36s.png" alt=""> |
|
39 |
+ <div class="listen-btn mt50"> |
|
40 |
+ <img src="client/resources/img/btn10_s.png" alt="Listen" @click="playAudio"> |
|
41 | 41 |
</div> |
42 |
- <div class="look-text"> <button ><img src="../../../../resources/img/btn08_s.png" alt=""><p>정답확인</p></button></div> |
|
42 |
+ |
|
43 |
+ <audio id="audio-player" src="client/resources/audio/bank.wav" preload="auto"></audio> |
|
43 | 44 |
</div> |
44 | 45 |
</div> |
45 | 46 |
<div class="next-btn" @click="goToPage('Chapter2_8')"><img src="../../../../resources/img/right.png" alt=""> |
... | ... | @@ -48,18 +49,17 @@ |
48 | 49 |
</div> |
49 | 50 |
</template> |
50 | 51 |
<script> |
52 |
+import SvgIcon from '@jamescoyle/vue-icon'; |
|
51 | 53 |
export default { |
52 | 54 |
data() { |
53 | 55 |
return { |
54 | 56 |
items: [ |
55 | 57 |
{ imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img59_36s.png', title: 'apple' }, |
56 |
- { imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img58_36s.png', title: 'cloud'}, |
|
58 |
+ { imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img2_4.png', title: 'bank' }, |
|
57 | 59 |
{ imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img57_36s.png', title: 'car' }, |
58 | 60 |
{ imgSrc1: 'client/resources/img/img61_36s.png', imgSrc2: 'client/resources/img/img62_36s.png', imgSrc: 'client/resources/img/img56_36s.png', title: 'guitar' }, |
59 | 61 |
], |
60 | 62 |
selectedIndex: 0, |
61 |
- timer: "00", |
|
62 |
- intervalId: null, |
|
63 | 63 |
}; |
64 | 64 |
}, |
65 | 65 |
methods: { |
... | ... | @@ -69,27 +69,59 @@ |
69 | 69 |
updateContent(index) { |
70 | 70 |
this.selectedIndex = index; |
71 | 71 |
this.currentCon = this.items[index].con; |
72 |
- this.startTimer(); |
|
73 |
- }, |
|
72 |
+ setTimeout(() => { |
|
73 |
+ if(index==1){ |
|
74 |
+ alert("정답입니다!") |
|
75 |
+ }else{ |
|
76 |
+ alert("오답입니다!") |
|
77 |
+ } |
|
78 |
+ },0) |
|
79 |
+ |
|
80 |
+ }, playAudio() { |
|
81 |
+ const audio = document.getElementById('audio-player'); |
|
82 |
+ audio.play(); |
|
83 |
+ console.log("playing") |
|
84 |
+ } |
|
74 | 85 |
|
75 |
- |
|
76 |
- |
|
86 |
+ |
|
87 |
+ |
|
88 |
+ }, |
|
89 |
+ components: { |
|
90 |
+ SvgIcon |
|
77 | 91 |
}, |
78 | 92 |
} |
79 | 93 |
</script> |
80 | 94 |
|
81 | 95 |
<style scoped> |
82 |
-.listenGroup{height: 305px;} |
|
83 |
-.listenGroup button{position: relative;} |
|
84 |
-.listenGroup .textbox { |
|
96 |
+.listenGroup { |
|
97 |
+ height: 305px; |
|
98 |
+} |
|
99 |
+ |
|
100 |
+.listenGroup button { |
|
101 |
+ position: relative; |
|
102 |
+} |
|
103 |
+ |
|
104 |
+.listenGroup .textbox { |
|
85 | 105 |
width: 184px; |
86 |
- height: 206px; |
|
87 |
- left: 46%; |
|
88 |
- top: 43%;} |
|
89 |
-.look-text{bottom: 50px;} |
|
90 |
-.btnGroup{width: 1060px; height: 340px;} |
|
91 |
-.popTxt{width: 216px; } |
|
92 |
-.popTxt > img { |
|
106 |
+ height: 206px; |
|
107 |
+ left: 46%; |
|
108 |
+ top: 43%; |
|
109 |
+} |
|
110 |
+ |
|
111 |
+.look-text { |
|
112 |
+ bottom: 50px; |
|
113 |
+} |
|
114 |
+ |
|
115 |
+.btnGroup { |
|
116 |
+ width: 1060px; |
|
117 |
+ height: 340px; |
|
118 |
+} |
|
119 |
+ |
|
120 |
+.popTxt { |
|
121 |
+ width: 216px; |
|
122 |
+} |
|
123 |
+ |
|
124 |
+.popTxt>img { |
|
93 | 125 |
position: absolute; |
94 | 126 |
top: 0; |
95 | 127 |
left: 0; |
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?