--- client/views/pages/AppRouter.js
+++ client/views/pages/AppRouter.js
... | ... | @@ -116,6 +116,11 @@ |
116 | 116 |
name: "Dashboard", |
117 | 117 |
component: Dashboard, |
118 | 118 |
}, |
119 |
+ { |
|
120 |
+ path: "/AIDashboard.page", |
|
121 |
+ name: "AIDashboard", |
|
122 |
+ component: AIDashboard, |
|
123 |
+ }, |
|
119 | 124 |
{ path: "/MyPage.page", name: "MyPage", component: MyPage }, |
120 | 125 |
{ path: "/MyPlan.page", name: "MyPlan", component: MyPlan }, |
121 | 126 |
{ path: "/MyPlan2.page", name: "MyPlan2", component: MyPlan2 }, |
--- client/views/pages/main/Chapter/Chapter2.vue
+++ client/views/pages/main/Chapter/Chapter2.vue
... | ... | @@ -1,115 +1,109 @@ |
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"><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('Chapter1_3')"><img src="../../../../resources/img/left.png" alt=""></div> |
|
14 |
- <div class="content title-box"> |
|
15 |
- <p class="title mt25 title-bg">step2</p> |
|
16 |
- <div class="flex align-center mb30"> |
|
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"><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('Chapter1_3')"><img src="../../../../resources/img/left.png" alt=""></div> |
|
14 |
+ <div class="content title-box"> |
|
15 |
+ <p class="title mt25 title-bg">단어로 공부하는 영어</p> |
|
16 |
+ <div class="flex align-center mb30"> |
|
17 | 17 |
<p class="subtitle2 mr20"></p> |
18 | 18 |
<!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
19 | 19 |
</button> --> |
20 | 20 |
</div> |
21 |
- |
|
22 |
- <div class="flex justify-center"> |
|
23 |
- <div class="vocaGroup"> |
|
24 |
- <div class="flex justify-between mb80"> |
|
25 |
- <article class="flex align-center"> |
|
26 |
- <div class="imgGroup mr30"><img src="../../../../resources/img/img40_s.png" data-num="1"></div> |
|
27 |
- <div class="flex align-start"> |
|
28 |
- <button class="listen-btn mr30" data-video="1" tabindex="0" aria-label="음성 재생"><img src="../../../../resources/img/btn10_s.png" |
|
29 |
- data-num="1"></button> |
|
30 |
- <div> |
|
31 |
- <h3>sidewalk</h3> |
|
32 |
- <div class="flex align-center mt10"> |
|
33 |
- <p class="yellow-box">명</p> |
|
34 |
- <span class="title1">보도</span> |
|
35 |
- </div> |
|
36 |
- </div> |
|
37 |
- </div> |
|
38 |
- </article> |
|
39 |
- <article class="flex align-center"> |
|
40 |
- <div class="imgGroup mr30"><img src="../../../../resources/img/31img40_s.png" data-num="1"></div> |
|
41 |
- <div class="flex align-start"> |
|
42 |
- <button class="listen-btn mr30" data-video="1" tabindex="0" aria-label="음성 재생"><img src="../../../../resources/img/btn10_s.png" |
|
43 |
- data-num="1"></button> |
|
44 |
- <div> |
|
45 |
- <h3>sidewalk</h3> |
|
46 |
- <div class="flex align-center mt10"> |
|
47 |
- <p class="yellow-box">명</p> |
|
48 |
- <span class="title1">보도</span> |
|
49 |
- </div> |
|
50 |
- </div> |
|
51 |
- </div> |
|
52 |
- </article> |
|
53 |
- </div> |
|
54 |
- <div class="flex justify-between"> |
|
55 |
- <article class="flex align-center"> |
|
56 |
- <div class="imgGroup mr30"><img src="../../../../resources/img/img41_s.png" data-num="1"></div> |
|
57 |
- <div class="flex align-start"> |
|
58 |
- <button class="listen-btn mr30" data-video="1" tabindex="0" aria-label="음성 재생"><img src="../../../../resources/img/btn10_s.png" |
|
59 |
- data-num="1"></button> |
|
60 |
- <div> |
|
61 |
- <h3>sidewalk</h3> |
|
62 |
- <div class="flex align-center mt10"> |
|
63 |
- <p class="yellow-box">명</p> |
|
64 |
- <span class="title1">보도</span> |
|
65 |
- </div> |
|
66 |
- </div> |
|
67 |
- </div> |
|
68 |
- </article> |
|
69 |
- <article class="flex align-center"> |
|
70 |
- <div class="imgGroup mr30"><img src="../../../../resources/img/img40_s.png" data-num="1"></div> |
|
71 |
- <div class="flex align-start"> |
|
72 |
- <button class="listen-btn mr30" data-video="1" tabindex="0" aria-label="음성 재생"><img src="../../../../resources/img/btn10_s.png" |
|
73 |
- data-num="1"></button> |
|
74 |
- <div> |
|
75 |
- <h3>sidewalk</h3> |
|
76 |
- <div class="flex align-center mt10"> |
|
77 |
- <p class="yellow-box">명</p> |
|
78 |
- <span class="title1">보도</span> |
|
79 |
- </div> |
|
80 |
- </div> |
|
81 |
- </div> |
|
82 |
- </article> |
|
83 |
- </div> |
|
21 |
+ |
|
22 |
+ <div class="flex justify-center"> |
|
23 |
+ <div class="vocaGroup"> |
|
24 |
+ <div class="grid-container"> |
|
25 |
+ <div v-for="(item, index) in word" :key="index" class="grid-item"> |
|
26 |
+ <article class="flex align-center"> |
|
27 |
+ <div class="imgGroup mr30"> |
|
28 |
+ <img :src="item.pic" :alt="item.eng" /> |
|
29 |
+ </div> |
|
30 |
+ <div class="flex align-start"> |
|
31 |
+ <button class="listen-btn mr30" tabindex="0" aria-label="음성 재생"> |
|
32 |
+ <img :src="item.sound" :alt="'Sound for ' + item.eng" /> |
|
33 |
+ </button> |
|
34 |
+ <div> |
|
35 |
+ <h3>{{ item.eng }}</h3> |
|
36 |
+ <div class="flex align-center mt10"> |
|
37 |
+ <p class="yellow-box">명</p> |
|
38 |
+ <span class="title1">{{ item.kor }}</span> |
|
39 |
+ </div> |
|
40 |
+ </div> |
|
41 |
+ </div> |
|
42 |
+ </article> |
|
84 | 43 |
</div> |
44 |
+ </div> |
|
85 | 45 |
</div> |
86 | 46 |
</div> |
87 |
- <div class="next-btn" @click="goToPage('Chapter2_3')"><img src="../../../../resources/img/right.png" alt=""></div> |
|
88 | 47 |
</div> |
48 |
+ <div class="next-btn" @click="goToPage('Chapter2_3')"><img src="../../../../resources/img/right.png" alt=""></div> |
|
89 | 49 |
</div> |
90 |
- </template> |
|
91 |
- |
|
92 |
- <script> |
|
93 |
- export default { |
|
94 |
- data() { |
|
95 |
- return { |
|
96 |
- } |
|
97 |
- }, |
|
98 |
- methods: { |
|
99 |
- goToPage(page) { |
|
100 |
- this.$router.push({ name: page }); |
|
101 |
- } |
|
102 |
- }, |
|
103 |
- watch: { |
|
104 |
- |
|
105 |
- }, |
|
106 |
- computed: { |
|
107 |
- |
|
108 |
- }, |
|
109 |
- components: { |
|
110 |
- }, |
|
111 |
- mounted() { |
|
112 |
- |
|
50 |
+ </div> |
|
51 |
+</template> |
|
52 |
+ |
|
53 |
+<script> |
|
54 |
+export default { |
|
55 |
+ data() { |
|
56 |
+ return { |
|
57 |
+ word: [ |
|
58 |
+ { |
|
59 |
+ eng: "apple", |
|
60 |
+ kor: "사과", |
|
61 |
+ pic: require("../../../../resources/img/img40_s.png").default, |
|
62 |
+ sound: require("../../../../resources/img/btn10_s.png").default |
|
63 |
+ }, |
|
64 |
+ { |
|
65 |
+ eng: "cloud", |
|
66 |
+ kor: "구름", |
|
67 |
+ pic: require("../../../../resources/img/img42_31s.png").default, |
|
68 |
+ sound: require("../../../../resources/img/btn10_s.png").default |
|
69 |
+ }, |
|
70 |
+ { |
|
71 |
+ eng: "log", |
|
72 |
+ kor: "통나무", |
|
73 |
+ pic: require("../../../../resources/img/31img40_s.png").default, |
|
74 |
+ sound: require("../../../../resources/img/btn10_s.png").default |
|
75 |
+ }, |
|
76 |
+ { |
|
77 |
+ eng: "guitar", |
|
78 |
+ kor: "기타", |
|
79 |
+ pic: require("../../../../resources/img/img41_s.png").default, |
|
80 |
+ sound: require("../../../../resources/img/btn10_s.png").default |
|
81 |
+ } |
|
82 |
+ ] |
|
113 | 83 |
} |
84 |
+ }, |
|
85 |
+ methods: { |
|
86 |
+ goToPage(page) { |
|
87 |
+ this.$router.push({ name: page }); |
|
88 |
+ } |
|
89 |
+ }, |
|
90 |
+ watch: { |
|
91 |
+ |
|
92 |
+ }, |
|
93 |
+ computed: { |
|
94 |
+ |
|
95 |
+ }, |
|
96 |
+ components: { |
|
97 |
+ }, |
|
98 |
+ mounted() { |
|
99 |
+ |
|
114 | 100 |
} |
115 |
- </script>(파일 끝에 줄바꿈 문자 없음) |
|
101 |
+} |
|
102 |
+</script> |
|
103 |
+<style scoped> |
|
104 |
+.grid-container { |
|
105 |
+ display: grid; |
|
106 |
+ grid-template-columns: repeat(2, 1fr); |
|
107 |
+ gap: 20px; |
|
108 |
+} |
|
109 |
+</style>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/main/Chapter/Chapter2_2.vue
+++ client/views/pages/main/Chapter/Chapter2_2.vue
... | ... | @@ -13,11 +13,17 @@ |
13 | 13 |
<div class="pre-btn" @click="goToPage('Chapter2_3')"><img src="../../../../resources/img/left.png" alt=""> |
14 | 14 |
</div> |
15 | 15 |
<div class="content title-box"> |
16 |
- <p class="title mt25 title-bg">step2</p> |
|
16 |
+ <p class="title mt25 title-bg">단어로 공부하는 영어</p> |
|
17 | 17 |
<div class="flex align-center mb30"> |
18 | 18 |
<p class="subtitle2 mr20">카드를 뒤집어 보세요.</p> |
19 | 19 |
<!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
20 |
- </button> --> |
|
20 |
+ </button> --></div><div class="time-bg"> |
|
21 |
+ <div> |
|
22 |
+ <div class="time"> |
|
23 |
+ <p class="second">{{timer}}</p> |
|
24 |
+ <p class="text">sec</p> |
|
25 |
+ </div> |
|
26 |
+ </div> |
|
21 | 27 |
</div> |
22 | 28 |
|
23 | 29 |
<div class="imgGroup"> |
... | ... | @@ -36,7 +42,7 @@ |
36 | 42 |
</div> |
37 | 43 |
</div> |
38 | 44 |
</div> |
39 |
- <div class="next-btn" @click="goToPage('Chapter2_1')"><img src="../../../../resources/img/right.png" alt=""> |
|
45 |
+ <div class="next-btn" @click="goToPage('Chapter2_9')"><img src="../../../../resources/img/right.png" alt=""> |
|
40 | 46 |
</div> |
41 | 47 |
</div> |
42 | 48 |
</div> |
--- client/views/pages/main/Chapter/Chapter2_3.vue
+++ client/views/pages/main/Chapter/Chapter2_3.vue
... | ... | @@ -1,71 +1,106 @@ |
1 | 1 |
<template> |
2 |
- <div id="Chapter2_2" class="content-wrap"> |
|
2 |
+ <div id="Chapter2_2" class="content-wrap"> |
|
3 | 3 |
<div style="margin: 30px 0px 50px"> |
4 | 4 |
<router-link to="/MyPlan.page"> |
5 | 5 |
<div class="logo mb25"><img src="../../../../resources/img/logo2.png" alt=""></div> |
6 | 6 |
</router-link> |
7 | 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><p class="title mt25 title-bg">step2</p> |
|
16 |
- <div class="flex align-center mb30"> |
|
17 |
- <p class="subtitle2 mr20">다음을 듣고 따라 말하세요.</p> |
|
18 |
- <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
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">단어로 공부하는 영어</p> |
|
17 |
+ <div class="flex align-center mb30"> |
|
18 |
+ <p class="subtitle2 mr20">다음을 듣고 따라 말하세요.</p> |
|
19 |
+ <!-- <button><img src="../../../../resources/img/btn10_s.png" alt=""> |
|
19 | 20 |
</button> --> |
20 |
- </div><div class="time-bg"> |
|
21 |
- <div> |
|
22 |
- <div class="time"> |
|
23 |
- <p class="second">{{timer}}</p> |
|
24 |
- <p class="text">sec</p> |
|
25 |
- </div> |
|
26 | 21 |
</div> |
27 |
- </div> |
|
28 | 22 |
|
29 |
- <div class="imgGroup"> |
|
30 |
- <div class="con"> |
|
31 |
- <img :src="currentCon.imgSrc" alt=""> |
|
32 |
- <p class="title3"><em class="yellow">{{ currentCon.titleEm }}</em>{{ currentCon.title }}</p> |
|
33 |
- <div class="flex align-center justify-center mt10"> |
|
34 |
- <p class="yellow-box-big">{{ currentCon.boxText }}</p> |
|
35 |
- <span class="subtitle3">{{ currentCon.subtitle }}</span> |
|
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> |
|
31 |
+ </div> |
|
32 |
+ |
|
33 |
+ |
|
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" |
|
46 |
+ >위의 버튼을 누른 후 오늘 배운 단어를 말해보세요!</span |
|
47 |
+ > |
|
48 |
+ <span v-else-if="!transcription || transcription.trim() === ''" |
|
49 |
+ >다시 말해보세요!</span |
|
50 |
+ > |
|
51 |
+ <span v-else>{{ transcription }}</span> |
|
52 |
+ </p> |
|
53 |
+ <p class="read-ai"> |
|
54 |
+ <img style="margin-top: -5px" src="../../../../resources/img/img43_s.png" alt="" /> |
|
55 |
+ </p> |
|
56 |
+ </article> |
|
57 |
+ </section> |
|
58 |
+ </div> |
|
59 |
+ </div> |
|
60 |
+ <div class="flex justify-center"> |
|
61 |
+ <div class="btnGroup mt50 flex justify-between"> |
|
62 |
+ <button class="popTxt" v-for="(item, index) in items" :key="index" @click="updateContent(index)" |
|
63 |
+ :class="{ active: selectedIndex === index }"> |
|
64 |
+ <img :src="item.imgSrc1"> |
|
65 |
+ <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;"> |
|
66 |
+ </button> |
|
67 |
+ </div> |
|
36 | 68 |
</div> |
37 | 69 |
</div> |
38 |
- |
|
39 |
- <div class="flex justify-center"> |
|
40 |
- <div class="btnGroup mt50 flex justify-between"> |
|
41 |
- <button class="popTxt" v-for="(item, index) in items" :key="index" @click="updateContent(index)" :class="{ active: selectedIndex === index }"> |
|
42 |
- <img :src="item.imgSrc1" > |
|
43 |
- <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;"> |
|
44 |
- </button> |
|
45 |
- </div> |
|
46 |
- </div> |
|
47 |
- </div> |
|
48 |
- </div> |
|
49 |
- <div class="next-btn" @click="goToPage('Chapter2_2')"><img src="../../../../resources/img/right.png" alt=""></div> |
|
50 |
- </div> |
|
51 |
- </div> |
|
70 |
+ </div> |
|
71 |
+ <div class="next-btn" @click="goToPage('Chapter2_2')"><img src="../../../../resources/img/right.png" alt=""> |
|
72 |
+ </div> |
|
73 |
+ </div> |
|
74 |
+ </div> |
|
52 | 75 |
</template> |
53 | 76 |
|
54 | 77 |
<script> |
78 |
+import axios from 'axios'; |
|
79 |
+import { mdiStop } from '@mdi/js'; |
|
55 | 80 |
export default { |
56 | 81 |
data() { |
57 | 82 |
return { |
58 | 83 |
items: [ |
59 | 84 |
{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: '구름' } }, |
60 |
- {imgSrc1: 'client/resources/img/img53_7_35s.png', imgSrc2: 'client/resources/img/img53_2_35s.png', con: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 's', title: 'un', boxText: '명', subtitle: '태양' } }, |
|
61 |
- {imgSrc1: 'client/resources/img/img53_8_35s.png', imgSrc2: 'client/resources/img/img53_3_35s.png', con: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 'r', title: 'ain', boxText: '명', subtitle: '비' } }, |
|
62 |
- {imgSrc1: 'client/resources/img/img53_9_35s.png', imgSrc2: 'client/resources/img/img53_4_35s.png', con: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 's', title: 'now', boxText: '명', subtitle: '눈' } }, |
|
63 |
- {imgSrc1: 'client/resources/img/img53_10_35s.png', imgSrc2: 'client/resources/img/img53_5_35s.png', con: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 'w', title: 'ind', boxText: '명', subtitle: '바람' } } |
|
85 |
+ {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: '사과' } }, |
|
86 |
+ {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: '통나무' } }, |
|
87 |
+ {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: '기타' } }, |
|
88 |
+ {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: '수박' } } |
|
64 | 89 |
], |
65 | 90 |
currentCon: { imgSrc: 'client/resources/img/img54_s.png', titleEm: 'c', title: 'loud', boxText: '명', subtitle: '구름' }, |
66 | 91 |
selectedIndex: 0, |
67 | 92 |
timer: "00", |
68 | 93 |
intervalId: null, |
94 |
+ |
|
95 |
+ |
|
96 |
+ isRecording: false, // 녹음 중 여부 |
|
97 |
+ mediaRecorder: null, |
|
98 |
+ audioChunks: [], // 녹음된 오디오 데이터 |
|
99 |
+ audioBlob: null, // 오디오 Blob 객체 |
|
100 |
+ transcription: null, // 서버에서 받아온 텍스트 결과 |
|
101 |
+ stream: null, // MediaStream 객체 |
|
102 |
+ |
|
103 |
+ path: mdiStop, |
|
69 | 104 |
}; |
70 | 105 |
}, |
71 | 106 |
methods: { |
... | ... | @@ -89,7 +124,67 @@ |
89 | 124 |
clearInterval(this.intervalId); |
90 | 125 |
} |
91 | 126 |
}, 1000); |
92 |
- } |
|
127 |
+ }, |
|
128 |
+ // 녹음 시작/중지 토글 |
|
129 |
+ async toggleRecording() { |
|
130 |
+ if (this.isRecording) { |
|
131 |
+ console.log('녹음 그만!'); |
|
132 |
+ this.stopRecording(); // 녹음 중이면 중지 |
|
133 |
+ } else { |
|
134 |
+ console.log('녹음 시작!'); |
|
135 |
+ await this.startRecording(); // 녹음 중이 아니면 녹음 시작 |
|
136 |
+ } |
|
137 |
+ }, |
|
138 |
+ // 녹음 시작 |
|
139 |
+ async startRecording() { |
|
140 |
+ this.audioChunks = []; // 오디오 초기화 |
|
141 |
+ this.stream = await navigator.mediaDevices.getUserMedia({ audio: true }); |
|
142 |
+ this.mediaRecorder = new MediaRecorder(this.stream); |
|
143 |
+ this.mediaRecorder.ondataavailable = (event) => { |
|
144 |
+ this.audioChunks.push(event.data); // 녹음 데이터 저장 |
|
145 |
+ }; |
|
146 |
+ this.mediaRecorder.onstop = () => { |
|
147 |
+ this.audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' }); |
|
148 |
+ |
|
149 |
+ /******************************/ |
|
150 |
+ // this.audioURL = URL.createObjectURL(this.audioBlob); // 오디오 URL 생성 |
|
151 |
+ // console.log('Audio URL:', this.audioURL); |
|
152 |
+ /******************************/ |
|
153 |
+ |
|
154 |
+ console.log('Recorded Audio Blob:', this.audioBlob); // 콘솔에 Blob 확인 |
|
155 |
+ this.sendAudioToServer(); // 서버로 오디오 전송 |
|
156 |
+ }; |
|
157 |
+ this.mediaRecorder.start(); // 녹음 시작 |
|
158 |
+ this.isRecording = true; // 녹음 상태 변경 |
|
159 |
+ }, |
|
160 |
+ |
|
161 |
+ // 녹음 중지 |
|
162 |
+ stopRecording() { |
|
163 |
+ this.mediaRecorder.stop(); // 녹음 중단 |
|
164 |
+ |
|
165 |
+ if (this.stream) { |
|
166 |
+ this.stream.getTracks().forEach((track) => track.stop()); // 스트림의 모든 트랙 중지 |
|
167 |
+ } |
|
168 |
+ |
|
169 |
+ this.isRecording = false; // 녹음 상태 변경 |
|
170 |
+ }, |
|
171 |
+ |
|
172 |
+ // 오디오 전송 |
|
173 |
+ async sendAudioToServer() { |
|
174 |
+ const formData = new FormData(); |
|
175 |
+ formData.append('file', this.audioBlob, 'recording.wav'); |
|
176 |
+ try { |
|
177 |
+ const resposne = await axios.post('/api/speechToText.json', formData, { |
|
178 |
+ headers: { |
|
179 |
+ 'Content-Type': 'multipart/form-data', |
|
180 |
+ }, |
|
181 |
+ }); |
|
182 |
+ this.transcription = resposne.data; |
|
183 |
+ console.log(`받은 데이터 : ${this.transcription}`); |
|
184 |
+ } catch (error) { |
|
185 |
+ console.log('파일 전송 실패 : ', error); |
|
186 |
+ } |
|
187 |
+ }, |
|
93 | 188 |
}, |
94 | 189 |
beforeDestroy() { |
95 | 190 |
if (this.intervalId) { |
--- client/views/pages/main/Chapter/Chapter2_4.vue
+++ client/views/pages/main/Chapter/Chapter2_4.vue
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 |
<span class="subtitle">my name is dd</span> |
11 | 11 |
</div> |
12 | 12 |
<div class="flex justify-between align-center"> |
13 |
- <div class="pre-btn" @click="goToPage('Chapter2_1')"><img src="../../../../resources/img/left.png" alt=""> |
|
13 |
+ <div class="pre-btn" @click="goToPage('Chapter2_9')"><img src="../../../../resources/img/left.png" alt=""> |
|
14 | 14 |
</div> |
15 | 15 |
<div class="content title-box"> |
16 | 16 |
<p class="title mt25 title-bg">step2</p> |
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 |
<div class="look-text"> <button ><img src="../../../../resources/img/btn08_s.png" alt=""><p>정답확인</p></button></div> |
43 | 43 |
</div> |
44 | 44 |
</div> |
45 |
- <div class="next-btn" @click="goToPage('Chapter2_9')"><img src="../../../../resources/img/right.png" alt=""> |
|
45 |
+ <div class="next-btn" @click="goToPage('Chapter2_8')"><img src="../../../../resources/img/right.png" alt=""> |
|
46 | 46 |
</div> |
47 | 47 |
</div> |
48 | 48 |
</div> |
--- client/views/pages/main/Chapter/Chapter2_9.vue
+++ client/views/pages/main/Chapter/Chapter2_9.vue
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 |
<span class="subtitle">my name is dd</span> |
11 | 11 |
</div> |
12 | 12 |
<div class="flex justify-between align-center"> |
13 |
- <div class="pre-btn" @click="goToPage('Chapter2_4')"><img src="../../../../resources/img/left.png" alt=""></div> |
|
13 |
+ <div class="pre-btn" @click="goToPage('Chapter2_2')"><img src="../../../../resources/img/left.png" alt=""></div> |
|
14 | 14 |
<div class="content title-box"> |
15 | 15 |
<p class="title mt25 title-bg">step2</p> |
16 | 16 |
<div class="flex align-center mb30"> |
... | ... | @@ -106,7 +106,7 @@ |
106 | 106 |
</div> |
107 | 107 |
</div> |
108 | 108 |
</div> |
109 |
- <div class="next-btn" @click="goToPage('Chapter2_8')"><img src="../../../../resources/img/right.png" alt=""></div> |
|
109 |
+ <div class="next-btn" @click="goToPage('Chapter2_4')"><img src="../../../../resources/img/right.png" alt=""></div> |
|
110 | 110 |
</div> |
111 | 111 |
</div> |
112 | 112 |
</template> |
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?