jichoi / lms_front star
dajeong 2024-08-22
240822 정다정 그림지문 API 연결
@2643390fde509c07d37e7f2adb6db20219ecef7d
client/views/pages/main/Chapter/Chapter1_3.vue
--- client/views/pages/main/Chapter/Chapter1_3.vue
+++ client/views/pages/main/Chapter/Chapter1_3.vue
@@ -2,74 +2,91 @@
     <div id="Chapter1" 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>
+                <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 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>
+            <button class="completeBtn" @click="complete">학습 종료</button>
         </div>
         <div class="flex justify-between align-center">
-            <div class="pre-btn" @click="goToPage('Chapter1_2')"><img src="../../../../resources/img/left.png" alt="">
-            </div>
+            <div class="pre-btn" @click="goToPage('Chapter1_2')"><img src="../../../../resources/img/left.png" alt="" /></div>
             <div class="content title-box">
                 <div class="listenGroup">
                     <p class="title mt25 title-bg">step1. Hello WORLD</p>
-                    <img class="bg" src="../../../../resources/img/img39_s.png" data-num="1">
-                    <div class="textbox">
-                        <p class="title">The Eiffel Tower and the statue of Lierbty</p>
-                        <p>The Eiffel Tower is a symbol of Paris, France. People call it the "Iron Lady." It was built
-                            for the 1889 World's Fair in Paris. It's 320 meters tall. There are 1,665 steps to the top.
-                            You can walk or take elevators to the top.</p>
-                    </div>
-                    <button class="listen-btn" data-video="1" tabindex="0" aria-label="재생"><img
-                            src="../../../../resources/img/btn09_s.png" data-num="1"></button>
+                    <!--
+                    <img class="bg" src="../../../../resources/img/img39_s.png" data-num="1" />
+                    -->
+                    <img class="bg" :src="img_src" />
                 </div>
             </div>
-            <div class="next-btn" @click="goToPage('Chapter2')"><img src="../../../../resources/img/right.png" alt="">
-            </div>
+            <div class="next-btn" @click="goToPage('Chapter2')"><img src="../../../../resources/img/right.png" alt="" /></div>
         </div>
         <TextToImage />
     </div>
 </template>
 
 <script>
-import TextToImage from '../../../component/TextToImage.vue';
+import TextToImage from "../../../component/TextToImage.vue";
+import axios from "axios";
 export default {
     data() {
         return {
-        }
+            text_id: "TEXT_000000000000049",
+            text_data: null,
+            img_src: null,
+        };
     },
     methods: {
         complete() {
             const { unit_id, book_id } = this.$route.query;
-            this.$router.push({ name: 'Dashboard', query: { value: 1, unit_id, book_id } });
+            this.$router.push({ name: "Dashboard", query: { value: 1, unit_id, book_id } });
         },
         goToPage(page) {
             this.$router.push({ name: page });
-        }
+        },
+        // 지문 API
+        async fetchText() {
+            axios({
+                url: "/text/selectOneText.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    textId: this.text_id,
+                },
+            })
+                .then((response) => {
+                    this.text_data = response.data[0];
+                    console.log("지문 데이터 : ", this.text_data);
+                    this.img_src = this.fetchImage(this.text_data.file_rpath);
+                })
+                .catch((err) => {
+                    console.log("지문 에러 : ", err);
+                });
+        },
+        // 이미지 불러오기
+        fetchImage(fileRpath) {
+            return "http://localhost:9080/" + fileRpath;
+        },
     },
-    watch: {
-
-    },
-    computed: {
-
-    },
+    watch: {},
+    computed: {},
     components: {
-        TextToImage: TextToImage
+        TextToImage: TextToImage,
     },
     mounted() {
-    }
-}
+        this.fetchText();
+    },
+};
 </script>
 <style scoped>
 .listenGroup .textbox {
-    width: 900px
+    width: 900px;
 }
 
 .completeBtn {
@@ -78,6 +95,6 @@
     padding: 10px 30px;
     border-radius: 10px;
     font-size: 28px;
-    font-family: 'ONEMobilePOPOTF';
+    font-family: "ONEMobilePOPOTF";
 }
-</style>
(No newline at end of file)
+</style>
Add a comment
List