jichoi / lms_front star
File name
Commit message
Commit date
woals 2024-08-22 f61c754 240822 권민수 단어장 Chapter2_3 이미지 파일 경로 설정 DOS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<template>
  <div id="Chapter1_1" class="content-wrap">
    <div style="margin: 30px 0px 50px; width: 20%">
      <router-link to="/MyPlan.page">
        <div class="logo mb25">
          <img src="../../../../resources/img/logo2.png" alt="" />
        </div>
      </router-link>
    </div>
    <div
      class="title-box mb25 flex align-center mt40"
      style="justify-content: space-between"
    >
      <div>
        <span class="title mr40">1. Hello WORLD</span>
        <span class="subtitle">my name is dd</span>
      </div>
      <button class="completeBtn" @click="complete"> </button>
    </div>
    <div class="flex justify-between align-center">
      <div class="pre-btn" @click="goToPage('Chapter1_3')">
        <img src="../../../../resources/img/left.png" alt="" />
      </div>
      <div class="content title-box">
        <p class="title mt25 title-bg">STEP 2 -   </p>
        <div class="flex align-center mb30">
          <p class="subtitle2 mr20"></p>
        </div>
        <div class="flex justify-center">
          <div class="vocaGroup" style="display: flex; flex-wrap: wrap;">
            <div
              v-for="(word) in wordList"
              :key="word.wdId"
              class="flex justify-between mb80"
              style="width: 49%;"
            >
              <article class="flex align-center">
                <div class="imgGroup mr30">
                  <img
                    :src= word.fileApath
                    data-num="1"
                    style="width: 200px"
                  />
                </div>
                <div class="flex align-start">
                  <button
                    class="listen-btn mr30"
                    data-video="1"
                    tabindex="0"
                    aria-label=" "
                  >
                    <img
                      src="../../../../resources/img/btn10_s.png"
                      data-num="1"
                      @click="playAudio('audio-family')"
                    />
                  </button>
                  <audio
                    id="audio-family"
                    src="client/resources/audio/family.wav"
                    preload="auto"
                  ></audio>
                  <div>
                    <h3>{{ word.wdNm }}</h3>
                    <div class="flex align-center mt10">
                      <p class="yellow-box"></p>
                      <span class="title1">{{ word.wdMnng }}</span>
                    </div>
                  </div>
                </div>
              </article>
            </div>
          </div>
        </div>
      </div>
      <div class="next-btn" @click="goToPage('Chapter2_3')">
        <img src="../../../../resources/img/right.png" alt="" />
      </div>
    </div>
  </div>
</template>
<script>
import axios from 'axios';
export default {
  data() {
    return {
      wdBookId: "WORD_BOOK_000000000000042",
      wordList: [],
      wordContentList: [],
      wdContentId: "",
    };
  },
  methods: {
    checkAndNavigate() {
        this.wdContentId = this.$store.getters.getLearningId; // 2. wdContentId 
        console.log("learning_id: ", this.wdContentId);
        axios.post("/wordContent/selectWordContent.json", {
          wordContentId: this.wdContentId,
        })
        .then((response) => {
          // console.log(response.data);
          this.wordContentList = response.data;
          console.log(this.wordContentList[0].wd_book_id); // 3.     id 
        })
        .catch((error) => {
          console.error("      :", error);
        })
    },
    async fetchWordList() {
      try {
        const response = await axios.post("/word/getWordsByBookId.json", {
          wdBookId: this.wdBookId,
        });
        const wordList = response.data;
        //  word   fileApath   
        const requests = wordList.map(async (word) => {
          const fileResponse = await axios.post("/file/find.json", {
            file_mng_id: word.fileMngId,
          });
          const fileApath = fileResponse.data.list.length > 0 ? fileResponse.data.list[0].fileApath : null;
          console.log("  fileApath: ", fileApath);
          word.fileApath = "http://localhost:9080/" + fileApath; // fileApath    
        });
        //     
        await Promise.all(requests);
        //  wordList 
        this.wordList = wordList;
        console.log("  -> ", this.wordList);
      } catch (error) {
        console.error("     :", error);
      }
    },
    goToPage(page) {
      this.$router.push({ name: page });
    },
    playAudio(audioId) {
      const audio = document.getElementById(audioId);
      if (audio) {
        audio.play();
      } else {
        console.error(`Audio element with ID ${audioId} not found.`);
      }
    },
  },
  mounted() {
    console.log("  ");
    // this.storeWdBookId(); // 1.   
    this.fetchWordList();
  },
};
</script>
<style scoped>
.grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.completeBtn {
  margin-right: 100px;
  background-color: #ffba08;
  padding: 10px 30px;
  border-radius: 10px;
  font-size: 28px;
  font-family: "ONEMobilePOPOTF";
}
</style>
X