jichoi / lms_front star
이은진 이은진 2024-08-21
240821 이은진 사진 상세보기
@d55ce07bb71d08902b32567e8dab33d229593666
client/views/pages/main/AIDashboard.vue
--- client/views/pages/main/AIDashboard.vue
+++ client/views/pages/main/AIDashboard.vue
@@ -139,7 +139,7 @@
                         <div style="width: 100%;">
                             <div id="container" ref="container">
                                 <video v-if="!photoTaken" autoplay="true" ref="modalVideoElement" class="mirrored"
-                                    @canplay="onVideoLoaded" style="position: absolute;">
+                                    @canplay="onVideoLoaded" style="position: absolute; height: 100%;">
                                 </video>
                                 <img src="../../../resources/img/camera-rabbit.png" class="camera-rabbit"
                                     style="position: absolute; ">
@@ -430,7 +430,7 @@
 
 video {
     width: 100%;
-    height: auto;
+    height: 100%;
     background-color: #666;
 }
 
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -171,7 +171,7 @@
             <article v-show="showCameraModal" class="popup-wrap">
                 <div class="popup-box" style="top: 500px; left:500px">
                     <div class="flex mb10 justify-between">
-                        <p class="popup-title">사진 촬영</p>ㄹ
+                        <p class="popup-title">사진 촬영</p>
                         <button type="button" class="popup-close-btn" @click="closeModal">
                             <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
                         </button>
@@ -180,7 +180,7 @@
                         <div style="width: 100%;">
                             <div id="container" ref="container">
                                 <video v-if="!photoTaken" autoplay="true" ref="modalVideoElement" class="mirrored"
-                                    @canplay="onVideoLoaded" style="position: absolute;">
+                                    @canplay="onVideoLoaded" style="position: absolute; height: 100%;">
                                 </video>
                                 <img src="../../../resources/img/camera-rabbit.png" class="camera-rabbit"
                                     style="position: absolute; ">
@@ -217,22 +217,24 @@
             <article class="popup-wrap" v-show="searchOpen">
                 <div class="popup-box ">
                     <div class="flex mb10  justify-between">
-                        <p class="popup-title">알림</p>
                         <button type="button" class="popup-close-btn" @click="closeModal">
                             <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
                         </button>
                     </div>
                     <div class="box">
-                        <div style="width: 910px;"><img src="../../../resources/img/img140_747s.png" alt=""></div>
+                        <div style="width: 910px;">
+                            <img :src="selectedImage.image" alt="Image" @error="onImageError" reloadable="true">
+                        </div>
                     </div>
                     <div class="flex justify-between mt20">
                         <div class="text  flex">
-                            <p class="title2 date ml30">2024-08-06</p>
-                            <span class=" title1 ml30">1단원을 마친 <em class="yellow">가나다</em>친구</span>
+                            <p class="title2 date ml30">{{ selectedImage.date }}</p>
+                            <span class=" title1 ml30">{{ selectedImage.unit }}을 마친 <em class="yellow">{{
+                                selectedImage.name }}</em>친구</span>
                         </div>
                         <div class="title2 flex align-center" style="gap: 10px;"><svg-icon type="mdi" :path="mdiHeart"
                                 style="color: #FFBA08;"></svg-icon>
-                            <p><em class="yellow">1</em></p>
+                            <p><em class="yellow">{{ selectedImage.heart }}</em></p>
                         </div>
                     </div>
                 </div>
@@ -245,6 +247,7 @@
 import SvgIcon from '@jamescoyle/vue-icon';
 import { mdiMagnify, mdiHeart, mdiWindowClose } from '@mdi/js';
 import axios from 'axios';
+import { name } from 'file-loader';
 import { mapGetters } from 'vuex';
 import { mapActions } from "vuex";
 
@@ -295,6 +298,16 @@
             images: [],
             unit_id: "",
             book_id: "",
+
+            selectedImage: [
+                {
+                    image: '',
+                    unit: '',
+                    date: '',
+                    name: '',
+                    heart: ''
+                },
+            ],
         }
     },
     methods: {
@@ -322,6 +335,56 @@
         },
 
         //은진
+        buttonSearch(image) {
+            this.selectedImage.name = image.stdId;
+            this.selectedImage.image = image.url;
+            this.selectedImage.unit = this.titleUnitName;
+            this.selectedImage.date = image.fileRegDate.split(" ")[0];
+            this.selectedImage.heart = image.likeData;
+            this.searchOpen = true;
+        },
+        fetchImage(unit_id) {
+            axios({
+                url: "/photo/photoUnitList.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    unitId: unit_id,
+                    sclsId: "1"
+                }
+            })
+                .then(response => {
+                    this.file = response.data;
+
+                    const findFilePromises = this.file.map(f =>
+                        this.findFile(f.file_mng_id)
+                    );
+
+                    return Promise.all(findFilePromises);
+                })
+                .then(fileResults => {
+                    // Assuming this.file and fileResults are of the same length
+                    this.images = this.file.map((file, index) => {
+                        const result = fileResults[index];
+                        if (result) {
+                            return {
+                                url: "http://localhost:9080/" + `${result.fileRpath}`,
+                                fileId: result.fileId,
+                                fileNm: result.fileNm,
+                                fileRegDate: result.regDt,
+                                likeData: file.like_data,  // Add like_data from this.file
+                                stdId: file.user_nm         // Add std_id from this.file
+                            };
+                        }
+                        return null;
+                    }).filter(image => image !== null);
+                })
+                .catch(error => {
+                    console.error("Error fetching images:", error);
+                });
+        },
         async findFile(file_mng_id) {
             try {
                 const res = await axios({
@@ -339,45 +402,6 @@
                 console.log("result - error : ", error);
                 return null;
             }
-        },
-        fetchImage(unit_id) {
-            axios({
-                url: "/photo/photoUnitList.json",
-                method: "post",
-                headers: {
-                    "Content-Type": "application/json; charset=UTF-8",
-                },
-                data: {
-                    unitId: unit_id,
-                    sclsId: "1"
-                }
-            })
-                .then(response => {
-                    this.file_mng_id = response.data;
-
-                    const findFilePromises = this.file_mng_id.map(id =>
-                        this.findFile(id.file_mng_id)
-                    );
-
-                    return Promise.all(findFilePromises);
-                })
-                .then(fileResults => {
-                    // Format file results to include image URL
-                    this.images = fileResults.map(file => {
-                        if (file) {
-                            return {
-                                url: "http://localhost:9080/" + `${file.fileRpath}`,
-                                fileId: file.fileId,
-                                fileNm: file.fileNm,
-                                // Add any other properties you need here
-                            };
-                        }
-                        return null;
-                    }).filter(image => image !== null);
-                })
-                .catch(error => {
-                    console.error("Error fetching images:", error);
-                });
         },
         goToPageImg(page) {
             const canvas = document.querySelector('canvas');
@@ -527,6 +551,8 @@
                 })
                 .catch(error => {
                     console.log("error>>>>>>>>", error);
+                    alert("웹캠이 필요한 기능입니다!");
+                    this.closeModal(); // 모달창을 닫음
                 });
         },
         closeModal() {  //웹캠 및 모든 팝업 닫기
@@ -582,11 +608,6 @@
             };
         },
 
-
-
-        buttonSearch() {
-            this.searchOpen = true;
-        },
         buttonSearch2() {
             this.searchOpen2 = true;
         },
client/views/pages/main/PhotoEdit.vue
--- client/views/pages/main/PhotoEdit.vue
+++ client/views/pages/main/PhotoEdit.vue
@@ -3,11 +3,10 @@
     <div class="flex justify-center">
       <div>
         <div class="frame title-box">
-          <div class="photo">
-            <img :src="imageSrc" alt="">
+          <div class="photo" style="height: 100%;">
+            <img :src="imageSrc" alt="" style="height: 100%;">
           </div>
-          <p class="title mt20" style="color: #fff;">2024.07.01 1단원 완료!</p>
-
+          <p class="title mt20" style="color: #fff;">{{ today }} 1단원 완료!</p>
         </div>
         <div class="btn-wrap flex justify-center mt40" style="gap: 40px;">
           <button class="login-btn" @click="recapture()">
@@ -43,11 +42,11 @@
       fileId: '',
       unit_id: '',
       book_id: '',
+      today: '',
     }
   },
   methods: {
     recapture() {
-      // this.$router.push({ name: 'Dashboard', query: { reCapture: 'true', unit_id, book_id } }); 
       this.$router.push({ name: 'Dashboard', query: { reCapture: 'true', unit_id: this.unit_id, book_id: this.book_id } });
     },
     async fetchImageAsFile(imageUrl, filename = "image.jpg") {
@@ -106,7 +105,7 @@
           data: {
             "photoMngId": "PHOTO_MNG_000000000000001", // 사진첩아이디 교체
             "likeData": "0",
-            "unitId": "UNIT_000000000000001", // 유닛아이디 교체
+            "unitId": this.unit_id,
             "stdId": "1", //학생아이디 교체
             "fileMngId": this.fileId
           }
@@ -129,6 +128,13 @@
   computed: {
 
   },
+  created() {
+    const date = new Date();
+    const year = date.getFullYear();
+    const month = String(date.getMonth() + 1).padStart(2, '0'); // 월은 0부터 시작하므로 +1 필요
+    const day = String(date.getDate()).padStart(2, '0');
+    this.today = `${year}.${month}.${day}`;
+  },
   components: {
   },
   mounted() {
Add a comment
List