jichoi / lms_front star
구자현 구자현 2024-08-13
240813 Dashboard 수정(이후 수정 필요)
@30b5a373ea0ba1ba4346e9eb163502b7551cb63a
client/views/pages/AppRouter.js
--- client/views/pages/AppRouter.js
+++ client/views/pages/AppRouter.js
@@ -8,6 +8,7 @@
 import MyPlan2 from './main/MyPlan2.vue';
 import PhotoBook from './main/PhotoBook.vue';
 import Dashboard from './main/Dashboard.vue';
+import Dashboard2 from './main/Dashboard2.vue';
 import Camera from "./main/Camera.vue"
 import PhotoDesign from "./main/PhotoDesign.vue"
 import PhotoEdit from "./main/PhotoEdit.vue"
@@ -110,6 +111,7 @@
         component: Main,
         children: [
             { path: '/Dashboard.page', name: 'Dashboard', component: Dashboard },
+            { path: '/Dashboard2.page', name: 'Dashboard2', component: Dashboard2 },
             { path: '/MyPage.page', name: 'MyPage', component: MyPage },
             { path: '/MyPlan.page', name: 'MyPlan', component: MyPlan },
             { path: '/MyPlan2.page', name: 'MyPlan2', component: MyPlan2 },
client/views/pages/main/Dashboard.vue
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
@@ -1,11 +1,28 @@
 <template>
-    <div class="main">
-        <div class="race-wrap">
-            <div class="title-box">
-                <p class="title">hello world!</p>
-                <p class="subtitle">hi my name is dd!</p>
-            </div>
-            <div class="race-box">
+    <div>
+        <div v-if="roadViewTF">
+            <!-- 1번 템플릿 -->
+            <div class="main">
+                <div class="race-wrap">
+                    <div class="title-box">
+                        <p class="title">hello world!</p>
+                        <p class="subtitle">hi my name is dd!</p>
+                    </div>
+                    <!--
+                    <div class="race-box">
+                        <div class="rabbit-start"><img src="../../../resources/img/img09_s.png" alt=""></div>
+                        <div class="rcon flex justify-between mb5">
+                            <div class="race-btn" v-for="roadmap in roadmapData" :key="roadmap.learning_id" @click="goToPage('Chapter7')">
+                                <button class="popTxt" v-for="(item, index) in items" :key="index" @click="toggleImage(index)" data-num="2">
+                                    <img :src="item.imgSrc1">
+                                    <img :src="item.imgSrc2" :style="{ display: item.isSecondImageVisible ? 'block' : 'none' }">
+                                </button>
+                                <p>{{getNonNullColumn(roadmap)}}</p>
+                            </div>
+                        </div>
+                    </div>
+                -->
+                <div class="race-box">
                 <div class="rabbit-start"><img src="../../../resources/img/img09_s.png" alt=""></div>
                 <div class="rcon flex justify-end mb5">
                     <div class="race-btn" @click="goToPage('Chapter1')">
@@ -94,210 +111,188 @@
                     </div>
 
                     <div class="race-btn">
-                        <button class="popTxt" v-for="(item, index) in items" :key="index"
-                            @click="toggleImageAndShowPopup(index, '11')">
+                        <button class="popTxt" v-for="(item, index) in items" :key="index" @click="toggleImage(index)"
+                        data-num="11">
                             <img :src="item.imgSrc3">
                             <img :src="item.imgSrc4" :style="{ display: item.isSecondImageVisible ? 'block' : 'none' }">
                         </button>
                         <p class="long">최종 평가</p>
                     </div>
-
                 </div>
+                <div class="rabbit-end" @click="ShowPopup"><img src="../../../resources/img/img138_72s.png" alt=""></div>
             </div>
-            <!-- 팝업 -->
-            <div v-show="searchOpen2" class="popup-wrap">
-                <div class="popup-box">
-                    <button type="button" class="popup-close-btn" style="position:absolute; top:10px; right: 10px;"
-                        @click="closeModal">
-                        <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
-                    </button>
-
-                    <div class="mb30 text-ct">
-                        <p class="title1 mb20">1단원이 끝났습니다!</p>
-                        <p class="title1"><em class="yellow">기념사진</em>을 촬영하러 가요</p>
-                    </div>
-                    <div class="flex justify-center">
-                        <button type="button" title="사진촬영" class="new-btn" @click="openCameraModal">
-                            사진 촬영
-                        </button>
-                    </div>
                 </div>
-            </div>
-
-            <!-- 카메라 모달 -->
-            <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>
-                        <button type="button" class="popup-close-btn" @click="closeModal">
+                <!-- 팝업 -->
+                <div v-show="searchOpen2" class="popup-wrap">
+                    <div class="popup-box">
+                        <button type="button" class="popup-close-btn" style="position:absolute; top:10px; right: 10px;"
+                            @click="closeModal">
                             <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
                         </button>
-                    </div>
-                    <div class="box">
-                        <div style="width: 100%;">
-                            <!-- 여기에 카메라 기능을 구현 -->
-                            <!-- <p>카메라 모듈이 여기에 위치합니다.</p> -->
 
-                            <div id="container" ref="container">
-                                <video v-if="!photoTaken" autoplay="true" ref="modalVideoElement" class="mirrored"
-                                    @canplay="onVideoLoaded"></video>
-                            </div>
-
+                        <div class="mb30 text-ct">
+                            <p class="title1 mb20">1단원이 끝났습니다!</p>
+                            <p class="title1"><em class="yellow">기념사진</em>을 촬영하러 가요</p>
+                        </div>
+                        <div class="flex justify-center">
+                            <button type="button" title="사진촬영" class="new-btn" @click="openCameraModal">
+                                사진 촬영
+                            </button>
                         </div>
                     </div>
-                    <div class="flex justify-center mt20">
-                        <button type="button" class="new-btn" v-if="!photoTaken" @click="capturePhoto"
-                            :disabled="!videoReady">
-                            사진 촬영
-                        </button>
-
-                    </div>
                 </div>
-            </article>
 
-            <!-- 사진 모달 -->
-            <article v-show="showPhotoModal" class="popup-wrap">
-                <div class="popup-box" style="top: 500px; left: auto">
-                    <div class="flex mb10 justify-between">
-                        <p class="popup-title">사진 꾸미기</p>
-                        <button type="button" class="popup-close-btn" @click="closePhotoModal">
-                            <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
-                        </button>
+                <!-- 카메라 모달 -->
+                <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>
+                            <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: 100%;">
+                                <div id="container" ref="container">
+                                    <video v-if="!photoTaken" autoplay="true" ref="modalVideoElement" class="mirrored"
+                                        @canplay="onVideoLoaded"></video>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="flex justify-center mt20">
+                            <button type="button" class="new-btn" v-if="!photoTaken" @click="capturePhoto"
+                                :disabled="!videoReady">
+                                사진 촬영
+                            </button>
+                        </div>
                     </div>
-                    <div class="flex justify-between align-center" style="gap: 40px;">
-                        <div class="content" style="padding: 30px; min-width: 401px; min-height: 710px;">
-                            <div class="tool">
-                                <div class="flex justify-center mb20" style="gap: 20px;">
-                                    <button class="popTxt" style="width: 101px;" v-for="(item, index) in items_photo"
-                                        :key="index" @click="updateContent(index)"
-                                        :class="{ active: selectedIndex === index }">
-                                        <img :src="item.imgSrc1" style="display: block;">
-                                        <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;">
+                </article>
+
+                <!-- 사진 모달 -->
+                <article v-show="showPhotoModal" class="popup-wrap">
+                    <div class="popup-box" style="top: 500px; left: auto">
+                        <div class="flex mb10 justify-between">
+                            <p class="popup-title">사진 꾸미기</p>
+                            <button type="button" class="popup-close-btn" @click="closePhotoModal">
+                                <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
+                            </button>
+                        </div>
+                        <div class="flex justify-between align-center" style="gap: 40px;">
+                            <div class="content" style="padding: 30px; min-width: 401px; min-height: 710px;">
+                                <div class="tool">
+                                    <div class="flex justify-center mb20" style="gap: 20px;">
+                                        <button class="popTxt" style="width: 101px;" v-for="(item, index) in items_photo"
+                                            :key="index" @click="updateContent(index)"
+                                            :class="{ active: selectedIndex === index }">
+                                            <img :src="item.imgSrc1" style="display: block;">
+                                            <img :src="item.imgSrc2" v-if="selectedIndex === index" style="display: block;">
+                                        </button>
+                                    </div>
+                                </div>
+
+                                <div class="stickers" v-show="!stickersVisible">
+                                    <div class="toolbar">
+                                        <label for="brushSize" style="font-size: 9px;">펜 굵기</label>
+                                        <input type="color" v-model="color" />
+                                        <input type="range" id="brushSize" min="1" max="10" v-model="brushSize"
+                                            @input="updateBrushSize" style="width: 100px; margin-left: 5px;" />
+                                        <button class="new-btn" style="font-size: 9px;" @click="setTool('draw')">펜</button>
+                                        <button class="new-btn" style="font-size: 9px;" @click="setTool('eraser')">지우개</button>
+                                        <button class="new-btn" style="font-size: 9px;" @click="clearAll">전체 지우개</button>
+                                    </div>
+                                </div>
+
+                                <div class="stickers" v-show="stickersVisible">
+                                    <button><img src="../../../resources/img/img146_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img147_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img148_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img149_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img150_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img151_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img152_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img153_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img154_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img155_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img156_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img157_75s.png" alt=""></button>
+                                    <button><img src="../../../resources/img/img158_75s.png" alt=""></button>
+                                </div>
+                            </div>
+                            <div>
+                                <div class="content" style="height: 549px; 
+                                    position: relative;
+                                    width: 973px; 
+                                    display: flex; 
+                                    justify-content: center; 
+                                    align-items: center;">
+                                    <canvas ref="canvas" style="position: absolute;"></canvas>
+                                </div>
+                                <div class="btn-wrap flex justify-center mt40" style="gap: 40px;">
+                                    <button class="login-btn" @click="openCameraModal">
+                                        <img src="../../../resources/img/btn07_s.png" alt="">
+                                        <p>재촬영</p>
+                                    </button>
+
+                                    <button class="login-btn" type="submit" @click="goToPage('PhotoEdit')">
+                                        <img src="../../../resources/img/btn07_s.png" alt="">
+                                        <p>완성</p>
                                     </button>
                                 </div>
                             </div>
-
-                            <div class="stickers" v-show="!stickersVisible">
-                                <div class="toolbar">
-                                    <label for="brushSize" style="font-size: 9px;">펜 굵기</label>
-                                    <input type="color" v-model="color" />
-                                    <input type="range" id="brushSize" min="1" max="10" v-model="brushSize"
-                                        @input="updateBrushSize" style="width: 100px; margin-left: 5px;" />
-                                    <button class="new-btn" style="font-size: 9px;" @click="setTool('draw')">펜</button>
-                                    <button class="new-btn" style="font-size: 9px;" @click="setTool('eraser')">지우개</button>
-                                    <button class="new-btn" style="font-size: 9px;" @click="clearAll">전체 지우개</button>
+                            <div class="content" style="padding: 30px; min-width: 401px; min-height: 710px;">
+                                <div class="mb20">
+                                    <p class="popup-title" style="font-size: 32px">랜덤 단어</p>
+                                </div>
+                                <div class="flex-column" style="gap: 10px;">
+                                    <button class="login-btn"><img src="../../../resources/img/img141_75s.png" alt="">
+                                        <p class="title">a</p>
+                                    </button>
+                                    <button class="login-btn"><img src="../../../resources/img/img152_75s_01.png" alt="">
+                                        <p class="title">a</p>
+                                    </button>
+                                    <button class="login-btn"><img src="../../../resources/img/img144_75s.png" alt="">
+                                        <p class="title" style="color: #fff;">a</p>
+                                    </button>
+                                    <button class="login-btn"><img src="../../../resources/img/img145_75s.png" alt="">
+                                        <p class="title mt20" style="color: #fff;">a</p>
+                                    </button>
                                 </div>
                             </div>
-
-                            <div class="stickers" v-show="stickersVisible">
-                                <button><img src="../../../resources/img/img146_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img147_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img148_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img149_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img150_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img151_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img152_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img153_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img154_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img155_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img156_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img157_75s.png" alt=""></button>
-                                <button><img src="../../../resources/img/img158_75s.png" alt=""></button>
-                            </div>
-                        </div>
-                        <div>
-                            <div class="content" style="height: 549px; 
-                                position: relative;
-                                width: 973px; 
-                                display: flex; 
-                                justify-content: center; 
-                                align-items: center;">
-                                <canvas ref="canvas" style="position: absolute;"></canvas>
-                            </div>
-                            <div class="btn-wrap flex justify-center mt40" style="gap: 40px;">
-                                <button class="login-btn" @click="openCameraModal">
-                                    <img src="../../../resources/img/btn07_s.png" alt="">
-                                    <p>재촬영</p>
-                                </button>
-
-                                <button class="login-btn" type="submit" @click="goToPage('PhotoEdit')">
-                                    <img src="../../../resources/img/btn07_s.png" alt="">
-                                    <p>완성</p>
-                                </button>
-                            </div>
-                        </div>
-                        <div class="content" style="padding: 30px; min-width: 401px; min-height: 710px;">
-                            <div class="mb20">
-                                <p class="popup-title" style="font-size: 32px">랜덤 단어</p>
-                            </div>
-                            <div class="flex-column" style="gap: 10px;">
-                                <button class="login-btn"><img src="../../../resources/img/img141_75s.png" alt="">
-                                    <p class="title">a</p>
-                                </button>
-                                <button class="login-btn"><img src="../../../resources/img/img152_75s_01.png" alt="">
-                                    <p class="title">a</p>
-                                </button>
-                                <button class="login-btn"><img src="../../../resources/img/img144_75s.png" alt="">
-                                    <p class="title" style="color: #fff;">a</p>
-                                </button>
-                                <button class="login-btn"><img src="../../../resources/img/img145_75s.png" alt="">
-                                    <p class="title mt20" style="color: #fff;">a</p>
-                                </button>
-                            </div>
                         </div>
                     </div>
-                    <!-- <div class="box">
-                        <div style="width: 100%;">
-                            <div id="container">
-                                <canvas ref="canvas"></canvas>
-                            </div>
-                        </div>
-                    </div> -->
-
-                </div>
-            </article>
-
+                </article>
+            </div>
         </div>
-        <div class="complete-wrap mt90 myphoto">
-            <h2 class="mb40">이 단원을 끝낸 친구들</h2>
-            <article class=" flex-column" style="gap: 5px;">
-                <div class="flex" style="gap: 5px;">
-                    <div @click="buttonSearch2" class="photo"><img src="../../../resources/img/img143_75s.png" alt=""></div>
-                    <div @click="buttonSearch" class="photo"><img src="../../../resources/img/img143_75s.png" alt=""></div>
+
+        <div v-else>
+            <!-- 2번 템플릿 -->
+            <div class="myplan">
+                <div class="title-box flex justify-between mb40">
+                    <p class="title">지금은 학습 루트가 등록이 안됐어요 ! 학습 일정에서 학습루트를 등록해볼까요 ?</p>
                 </div>
-            </article>
-            <!-- 팝업 -->
-            <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="closeBtn2">
-                            <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon>
+                <div class="wrap" style="border-radius: 0; min-height: 197px;">
+                   <p class="title1"> 오늘 학습할 내용이 없습니다.</p>
+                </div>
+                <div class="yellow-box mt30">
+                    <div class="title-box flex justify-between align-center">
+                        <div >
+                            <p class="title">오늘 공부를 계획해봅시다.</p>
+                            <p class="title1 mt20"> 스스로 학습 일정을 바꿔볼까요?</p>
+                        </div>
+                        <button type="button" title="바로가기" class="yellow-btn" @click="goToPage('MyPlan2')">
+                            바로가기
                         </button>
                     </div>
-                    <div class="box">
-                        <div style="width: 910px;"><img src="../../../resources/img/img140_747s.png" alt=""></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>
-                        </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>
-                        </div>
-                    </div>
                 </div>
-            </article>
+            </div>
         </div>
-
     </div>
 </template>
 
 <script>
 import SvgIcon from '@jamescoyle/vue-icon';
 import { mdiMagnify, mdiHeart, mdiWindowClose } from '@mdi/js';
+import axios from 'axios';
 
 export default {
     data() {
@@ -321,6 +316,7 @@
                     imgSrc2: 'client/resources/img/btn21_75s_click.png'     //스티커 선택됨
                 },
             ],
+            mdiMagnify: mdiMagnify,
             mdiWindowClose: mdiWindowClose,
             mdiHeart: mdiHeart,
             showModal: false,
@@ -353,18 +349,50 @@
             canvasRect: {
                 topLeft: { x: 0, y: 0 },
                 bottomRight: { x: 0, y: 0 }
-            }
+            },
 
+
+            roadViewTF : false,
+            roadmapData: [],
         }
     },
     methods: {
+        fetchRoadmapData() {
+            const vm = this;
+            axios({
+                url: "/unitLearning/find.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    unit_id: "UNIT_000000000000001",
+                    book_id: "BOOK_000000000000004"
+                }
+            })
+            .then(response => {
+                    console.log("roadmap - response : ", response.data);
+                    vm.roadmapData = response.data;
+                    vm.roadViewTF = vm.roadmapData.length > 0;
+            })
+            .catch(error => {
+                console.error("Error fetching roadmap data:", error);
+            });
+        },
+        getNonNullColumn(item) {
+            if (item.prblm_id !== null) return '문제';
+            if (item.wd_book_id !== null) return '단어장';
+            if (item.text_id !== null) return '지문';
+            if (item.eval_id !== null) return '평가';
+        return '';
+        },
         toggleImage(index) {
             this.items[index].isSecondImageVisible = !this.items[index].isSecondImageVisible;
         },
         toggleImageAndShowPopup(index, dataNum) {
             this.toggleImage(index);
-            if (dataNum === '11') {  // 최종 평가 버튼 클릭 시
-                this.searchOpen2 = true;  // 모달창 열기
+            if (dataNum === '11') {
+                this.searchOpen2 = true;
             }
         },
         updateContent(index) {
@@ -733,16 +761,34 @@
                 });
             };
         },
+        getNonNullColumn(item) {
+            if (item.prblm_id !== null) return '문제';
+            if (item.wd_book_id !== null) return '단어장';
+            if (item.text_id !== null) return '지문';
+            if (item.eval_id !== null) return '평가';
+            return ''; 
+        },
+        showConfirm(type) {
+            let message = '';
+            if (type === 'cancel') {
+                message = '삭제하시겠습니까?';
+            } else if (type === 'reset') {
+                message = '초기화하시겠습니까?';
+            } else if (type === 'save') {
+                message = '등록하시겠습니까?';
+            }
 
-
+            if (confirm(message)) {
+                this.goBack();
+            }
+        },
     },
     components: {
         SvgIcon,
     },
     mounted() {
         console.log('main mounted');
-
-
+        this.fetchRoadmapData();
     },
     computed() {
 
Add a comment
List