박현정 박현정 4 days ago
250806 박현정 프로젝트 즐겨찾기 및 정렬 기능 추가
@d4e2d5934d1b15b7affb0ced405e33e09d526f72
client/resources/api/asset.js
--- client/resources/api/asset.js
+++ client/resources/api/asset.js
@@ -13,4 +13,9 @@
 // 자산(프로젝트) 삭제 기능
 export const deleteProjectProc = (projectGroupId, data) => {
     return apiClient.post(`/project/${projectGroupId}/deleteProject.json`, data);
+}
+
+// 자산(프로젝트) 즐겨찾기 설정 기능
+export const updateProjectFavoriteProc = (projectGroupId, data) => {
+    return apiClient.post(`/project/${projectGroupId}/updateProjectFavorite.json`, data);
 }
(파일 끝에 줄바꿈 문자 없음)
client/views/pages/main/Main.vue
--- client/views/pages/main/Main.vue
+++ client/views/pages/main/Main.vue
@@ -68,11 +68,13 @@
 export default {
     data() {
         return {
+            // 프로젝트 목록
              projects: [
                 // { id: 1, name: '디지털 자산 A', date: '2024-06-01', img: require('../../../resources/img/content/sample1.png') },
                 // { id: 2, name: '디지털 자산 B', date: '2024-06-10', img: require('../../../resources/img/content/sample2.png') },
                 // { id: 3, name: '디지털 자산 C', date: '2024-06-15', img: require('../../../resources/img/content/sample3.png') }
             ],
+            // 미확인 피드백 알림 목록
             alarms: [
                 // { id: 1, project: 'A', count: 2 },
                 // { id: 2, project: 'B', count: 1 },
@@ -80,6 +82,7 @@
                 // { id: 4, project: 'D', count: 3 },
                 // { id: 5, project: 'F', count: 7 }
             ],
+            // 활동 로그(프로젝트 수정/공유) 목록
             activityLogs: [
                 // { id: 1, project: '프로젝트A', time: '어제 14:30' },
                 // { id: 2, project: '프로젝트B', time: '어제 18:10' },
@@ -90,6 +93,7 @@
         };
     },
     methods: {
+        // 활동 로그 가져오기
         loadLogs() {
             findAllLogsProc({
                 memberId: this.getMemId
@@ -105,14 +109,15 @@
                     time: dayjs(log.createdAt).fromNow()
                 }))
 
-                // 프로젝트 생성 로그
+                // 프로젝트 공유 로그
             })
             .catch(error => {console.error('로그 목록 조회 실패: ', error);})
         },
+        // 프로젝트 목록 가져오기(대표 프로젝트만 화면에서 조회)
         loadMainProjects() {
           findAllProjectsProc({
             memberId: this.getMemId,
-            isMain: 'Y' // 대표 프로젝트만 화면 목록에 뜨게 함.
+            isMain: 'Y' // 대표 프로젝트
           })
             .then(response => {
               const projectList = response.data.result.projects;
@@ -124,20 +129,23 @@
                 name: project.projectName,
                 date: project.createdAt,
                 img: require('../../../resources/img/content/sample1.png'), // 백엔드 - 썸네일 기능 추가 후 수정
-                isFavorite: false // 백엔드 - 즐겨찾기 기능 추가 후 수정
               }));
             })
             .catch(error => {console.error('자산 목록 조회 실패: ', error);})
         },
+        // 모델링 페이지로 이동(생성)
         goToModelingCreate() {
           this.$router.push('/modeling.page');
         },
+        // 모델링 페이지로 이동(기존 프로젝트 수정 - 기존 정보 가져옴)
         goToModelingUpdate(project) {
           this.$router.push({ name: 'Modeling', query: {projectId: project.id}});
         },
+        // 피드백 페이지로 이동
         goToFeedback() {
           this.$router.push('/feedback.page');
         },
+        // 미확인 피드백 알림 목록 가져오기
         loadFeedbackAlarms() {
             findUncheckedFeedbacks({
                 memberId: this.getMemId
client/views/pages/subPage/Asset.vue
--- client/views/pages/subPage/Asset.vue
+++ client/views/pages/subPage/Asset.vue
@@ -8,8 +8,10 @@
           </div>
         </div>
         <div class="layout center justify-end gap10">
-          <select name="" id="" class="form-select sm" style="border: 0; width: 200px;">
-            <option value="">최근 수정순</option>
+          <select v-model="selectedSort" name="" id="" class="form-select sm" style="border: 0; width: 200px;">
+            <option v-for="option in sortOptions" :key="option.value" :value="option.value">
+              {{ option.text }}
+            </option>
           </select>
           <button class="btn sm" style="background-color: #f4d01e;border: #f4d01e;"><img src="../../../resources/img/content/ico_folder.svg" alt="" style="vertical-align: middle;">폴더</button>
         </div>
@@ -84,7 +86,7 @@
 
 <script>
 import { mapGetters } from 'vuex';
-import { deleteProjectProc, findAllProjectsProc, duplicateProjectProc } from '../../../resources/api/asset';
+import { deleteProjectProc, findAllProjectsProc, duplicateProjectProc, updateProjectFavoriteProc } from '../../../resources/api/asset';
 
 export default {
     data() {
@@ -101,12 +103,20 @@
             dropdownDirection: 'right', // 또는 'left'
             // showPopup: false,
             keyword: '', // 검색 키워드
+            selectedSort: 'LATEST', // 프로젝트 목록 정렬 기준 선택 (기본은 '최근 수정순')
+            sortOptions: [ // 프로젝트 목록 정렬 기준
+              { value: 'LATEST', text: '최근 수정순' },
+              { value: 'OLDEST', text: '오래된 순' },
+              { value: 'NAME_ASC', text: '이름순' },
+            ]
 
         };
     },
     methods: {
+       // 즐겨찾기 버튼 클릭
         toggleFavorite(index) {
-            this.projects[index].isFavorite = !this.projects[index].isFavorite;
+            this.projects[index].isFavorite = !this.projects[index].isFavorite; // 즐겨찾기 설정/해제 변경
+            this.updateFavorite(this.projects[index].groupId, this.projects[index].isFavorite); // 즐겨찾기 설정 업데이트 -> 서버로 변경사항 보내기
         },
         toggleMenu(index) {
           if (this.openMenuIndex === index) {
@@ -126,10 +136,12 @@
             this.openMenuIndex = index;
           });
         },
+        // 프로젝트 목록 가져오기(대표 프로젝트만 화면에서 조회)
         loadMainProjects() {
           findAllProjectsProc({
             memberId: this.getMemId,
-            isMain: 'Y' // 대표 프로젝트만 화면 목록에 뜨게 함.
+            isMain: 'Y',
+            sortOption: this.selectedSort, // 정렬 기준
           })
             .then(response => {
               const projectList = response.data.result.projects;
@@ -141,16 +153,17 @@
                 name: project.projectName,
                 date: project.createdAt,
                 img: require('../../../resources/img/content/sample1.png'), // 백엔드 - 썸네일 기능 추가 후 수정
-                isFavorite: false // 백엔드 - 즐겨찾기 기능 추가 후 수정
+                isFavorite: project.isFavorite === 'Y'
               }));
             })
             .catch(error => {console.error('자산 목록 조회 실패: ', error);})
         },
+        // 프로젝트 이름으로 검색
         searchProjects(keyword) {
           findAllProjectsProc({
             memberId: this.getMemId,
             projectName: keyword,
-            isMain: 'Y' // 대표 프로젝트만 화면 목록에 뜨게 함.
+            isMain: 'Y'
           })
             .then(response => {
               const projectList = response.data.result.projects;
@@ -162,15 +175,16 @@
                 name: project.projectName,
                 date: project.createdAt,
                 img: require('../../../resources/img/content/sample1.png'), // 백엔드 - 썸네일 기능 추가 후 수정
-                isFavorite: false // 백엔드 - 즐겨찾기 기능 추가 후 수정
+                isFavorite: project.isFavorite,
               }));
             })
             .catch(error => {console.error('프로젝트 검색 실패: ', error);})
         },
-        loadOldProjects() {
+        // 이전 프로젝트 목록 가져오기
+        loadOldProjects(groupId) {
           findAllProjectsProc({
             memberId: this.getMemId,
-            projectGroupId: '', // 그룹 아이디 넣어야함
+            projectGroupId: groupId,
             isMain: 'N' // 이전 프로젝트만 목록에 뜨게 함.
           })
             .then(response => {
@@ -180,17 +194,19 @@
                 name: project.projectName,
                 date: project.createdAt,
                 img: require('../../../resources/img/content/sample1.png'), // 백엔드 - 썸네일 기능 추가 후 수정
-                isFavorite: false // 백엔드 - 즐겨찾기 기능 추가 후 수정
               }));
             })
             .catch(error => {console.error('자산 목록 조회 실패: ', error);})
         },
+        // 모델링 페이지로 이동(생성)
         goToModelingCreate() {
           this.$router.push('/modeling.page');
         },
+        // 모델링 페이지로 이동(기존 프로젝트 수정 - 기존 정보 가져옴)
         goToModelingUpdate(project) {
           this.$router.push({ name: 'Modeling', query: {projectId: project.id}});
         },
+        // 프로젝트 복제
         duplicateProject(projectId) {
           const data = {
             memberId : this.getMemId
@@ -198,9 +214,8 @@
 
           duplicateProjectProc(projectId, data)
             .then((response) => {
-              console.log('복제 성공');
-              this.loadMainProjects();
-              this.openMenuIndex = null;
+              this.loadMainProjects(); // 복제 후 목록 조회 새로고침
+              this.openMenuIndex = null; // 메뉴 토글 닫기
             })
             .catch((error) => {
               console.error('복제 실패: ', error);
@@ -210,23 +225,42 @@
         //   console.log("팝업창 열기");
         //   this.showPopup = true;
         // },
+        // 프로젝트 삭제
         deleteProject(projectGroupId) {
           const data = {
             memberId : this.getMemId
           };
           deleteProjectProc(projectGroupId, data)
             .then((response) => {
-              console.log('삭제 성공');
-              this.loadMainProjects();
-              this.openMenuIndex = null;
+              this.loadMainProjects(); // 삭제 후 목록 조회 새로고침
+              this.openMenuIndex = null; // 메뉴 토글 닫기
             })
             .catch((error) => {
               console.error('삭제 실패: ', error);
             })
-        }
+        },
+        // 즐겨찾기 설정
+        updateFavorite(projectGroupId, isFavorite) {
+          const data = {
+            memberId : this.getMemId,
+            isFavorite : isFavorite ? 'Y' : 'N' // 'Y' : 즐겨찾기 설정, 'N' : 즐겨찾기 해제
+          }
+          updateProjectFavoriteProc(projectGroupId, data)
+            .then((response) => {
+              this.loadMainProjects(); // 즐겨찾기 설정 후 목록 새로고침
+            })
+            .catch((error) => {
+              console.error('즐겨찾기 설정 실패: ', error);
+            })
+        },
         
     },
-    watch: {},
+    watch: {
+      // 정렬 기준 변경 감지하여 프로젝트 목록 새로고침
+      selectedSort() {
+        this.loadMainProjects();
+      }
+    },
     computed: {
     ...mapGetters([
       'getMemId',
client/views/pages/subPage/FeedBack.vue
--- client/views/pages/subPage/FeedBack.vue
+++ client/views/pages/subPage/FeedBack.vue
@@ -88,6 +88,7 @@
 export default {
     data() {
         return {
+            // 피드백 목록
             feedbackList: [
                 // {
                 //     id: 1,
@@ -114,6 +115,7 @@
                 //     status: 'confirmed'
                 // }
             ],
+            // 피드백 요약
             feedbackSummary: {
                 // total: 3,
                 // unread: 2,
@@ -121,6 +123,7 @@
             },
             selectedFeedback: null,     // 회신용
             replyingFeedbackId: null,   // 회신 폼 표시용
+            // 피드백 채팅 내용
             feedbackChatList: [
                 // {
                 //     id: 1,
@@ -163,10 +166,12 @@
                 //     status: '확인'
                 // }
                 ],
-
+            // 보낼 메시지
             replyText: '',
+            // 소켓 연결용
             socket: null,
             stompClient: null,
+            // 채팅방 아이디(피드백과 연결됨)
             connectedRoomId: null,
 
         };
@@ -182,6 +187,8 @@
         //     console.error('확인 처리 실패:', err);
         //     }
         // },
+
+        // 메시지 전송(피드백 채팅방)
         async submitReply() {
             // if (!this.replyText.trim()) return;
             // try {
@@ -209,11 +216,13 @@
             });
             this.replyText = '';
         },
-
+        
+        // 피드백 채팅방 선택
         replyTo(feedback) {
             this.selectedFeedback = feedback;
             this.replyingFeedbackId = feedback.id;
         },
+        // 피드백 목록 가져오기
         loadFeedbacks() {
             findAllFeedbacksProc({
                 memberId: this.getMemId
@@ -234,6 +243,7 @@
                 })
                 .catch(error => {console.error('피드백 목록 조회 실패: ', error);})
         },
+        // 피드백 확인
         markAsRead(feedbackId) {
             const data = {
                 memberId : this.getMemId
@@ -247,6 +257,7 @@
                     console.error('피드백 확인 실패: ', error);
                 })
         },
+        // 피드백 채팅 내용 가져오기
         loadFeedbackChatList(chatRoomId, feedback) {
             const data = {
                 memberId : this.getMemId
@@ -270,6 +281,7 @@
                     console.error('채팅 조회 실패: ', error);
                 })
         },
+        // 피드백 채팅방 연결(소켓)
         connectToChatRoom(roomId) {
             if (this.stompClient && this.connectedRoomId === roomId) return;
 
@@ -296,6 +308,7 @@
 
             client.activate();
         },
+        // 피드백 요약 가져오기
         loadFeedbackSummary(){
             findFeedbackSummary({
                 memberId: this.getMemId
client/views/pages/subPage/Modeling.vue
--- client/views/pages/subPage/Modeling.vue
+++ client/views/pages/subPage/Modeling.vue
@@ -363,11 +363,13 @@
             openedToolId: null,
             selectedColor: '#000000',
             activeModalTool : false,
-            commentData: { // 주석 입력 데이터
+            // 주석 입력 데이터
+            commentData: {
                 summary: '',
                 comment: ''
             },
-            localCommentData: { // 주석 입력 데이터 복사본
+            // 주석 입력 데이터 복사본
+            localCommentData: { 
                 summary: '',
                 comment: ''
             },
@@ -426,19 +428,16 @@
         closeModal() {
             this.activeModalTool = null;
         },
+        // 프로젝트 모델링 저장
         submit(){
-            console.log('저장');
             if(this.projectId) {
-                console.log('수정');
                 this.updateProject(this.projectId); // 수정
             } else {
-                console.log('생성');
                 this.createProject(); // 생성
             }
         },
+        // 새로운 프로젝트 저장
         createProject() {
-            console.log('프로젝트(자산) 저장');
-
             const formData = new FormData();
             const fileInput = this.$refs.fileInput; // 업로드 파일 가져오기
             if (!fileInput && this.isReset == true) {
@@ -452,14 +451,12 @@
             formData.append("comment", this.commentData.comment);
             saveProjectProc(formData)
             .then(response => {
-                console.log('프로젝트(자산) 페이지로 이동');
-                this.$router.push('/asset.page');
+                this.$router.push('/asset.page'); // 저장 후 자산 페이지로 이동
             })
             .catch(error => {console.error('자산 생성 실패: ', error);})
         },
+        // 기존 프로젝트 수정 후 저장
         updateProject(projectId) {
-            console.log('프로젝트(자산) 수정');
-
             const formData = new FormData();
             const fileInput = this.$refs.fileInput; // 업로드 파일 가져오기(없으면 기존 이미지 유지: fileInput==null)
             if (!fileInput && this.isReset == true) {
@@ -475,17 +472,17 @@
             formData.append("comment", this.commentData.comment);
             updateProjectProc(projectId, formData)
             .then(response => {
-                console.log('프로젝트(자산) 페이지로 이동');
-                this.$router.push('/asset.page');
+                this.$router.push('/asset.page'); // 저장 후 자산 페이지로 이동
             })
             .catch(error => {console.error('자산 수정 실패: ', error);})
         },
+        // 주석 저장
         saveComment() {
-            this.commentData = {...this.localCommentData}; // 저장 시 반영
+            this.commentData = {...this.localCommentData}; // 복사본 데이터를 옮겨놓고, 프로젝트 저장 시 서버로 보냄
             this.closeModal();
         },
+        // 기존 프로젝트 정보 가져오기(기존 프로젝트 수정 시)
         loadProjectData(projectId) {
-            console.log('기존 프로젝트 정보 불러오기 : ' + projectId);
             const data = {
                 memberId : this.getMemId
             };
@@ -507,11 +504,13 @@
                     
                 })
         },
+        // 이미지 초기화
         resetImage(){
             this.isReset = true;
         },
+        // 피드백 저장
         saveFeedback() {
-            if(this.projectGroupId == null) {
+            if(this.projectGroupId == null) { // 생성된 프로젝트에 한하여 피드백 저장 가능
                 console.error('신규 프로젝트에는 피드백을 남길 수 없습니다.');
                 return;
             }
@@ -548,9 +547,9 @@
     components: {},
     created() {},
     mounted() {
+        // 프로젝트 아이디가 쿼리로 들어올 경우 -> 기존 데이터 불러오기
         const projectId = this.$route.query.projectId;
         if(projectId) {
-            console.log("모델링 페이지 - 프로젝트 아이디: " + projectId);
             this.loadProjectData(projectId);
         }
     },
Add a comment
List