박현정 박현정 07-30
250730 박현정 프로젝트 수정 로그 기능 추가
@c6c7d6a882584f74d829f5e47ca9226e0520fb84
 
client/resources/api/main.js (added)
+++ client/resources/api/main.js
@@ -0,0 +1,6 @@
+import apiClient from "./index";
+
+// 프로젝트 로그 목록 조회 기능
+export const findAllLogsProc = (data) => {
+    return apiClient.post('/project/findAllLogs.json', data);
+}(파일 끝에 줄바꿈 문자 없음)
client/views/pages/main/Main.vue
--- client/views/pages/main/Main.vue
+++ client/views/pages/main/Main.vue
@@ -58,6 +58,10 @@
 
 <script>
 import { mapGetters } from 'vuex';
+import dayjs from 'dayjs';
+import relativeTime from 'dayjs/plugin/relativeTime';
+import 'dayjs/locale/ko'; // 한국어 locale 불러오기
+import { findAllLogsProc } from '../../../resources/api/main';
 
 export default {
     data() {
@@ -75,15 +79,35 @@
                 { id: 5, project: 'F', count: 7 }
             ],
             activityLogs: [
-                { id: 1, project: '프로젝트A', time: '어제 14:30' },
-                { id: 2, project: '프로젝트B', time: '어제 18:10' },
-                { id: 3, project: '프로젝트C', time: '오늘 09:05' },
-                { id: 4, project: '프로젝트D', time: '오늘 09:05' },
-                { id: 5, project: '프로젝트F', time: '오늘 09:05' }
+                // { id: 1, project: '프로젝트A', time: '어제 14:30' },
+                // { id: 2, project: '프로젝트B', time: '어제 18:10' },
+                // { id: 3, project: '프로젝트C', time: '오늘 09:05' },
+                // { id: 4, project: '프로젝트D', time: '오늘 09:05' },
+                // { id: 5, project: '프로젝트F', time: '오늘 09:05' }
             ]
         };
     },
-    methods: {},
+    methods: {
+        loadLogs() {
+            findAllLogsProc({
+                memberId: this.getMemId
+            })
+            .then(response => {
+                // 프로젝트 수정 로그
+                const editLogList = response.data.result.editLogs;
+
+                this.activityLogs = editLogList.map(log => ({
+                    id: log.projectLogId,
+                    projectGroupId: log.projectGroupId,
+                    project: log.projectName,
+                    time: dayjs(log.createdAt).fromNow()
+                }))
+
+                // 프로젝트 생성 로그
+            })
+            .catch(error => {console.error('로그 목록 조회 실패: ', error);})
+        }
+    },
     watch: {},
     computed: {
     ...mapGetters([
@@ -96,6 +120,7 @@
     created() {},
     mounted() {
         console.log("사용자 아이디: " + this.getMemId + " 사용자 이름: " + this.getMemNm + " 사용자 로그인 아이디: " + this.getMemLoginId);
+        this.loadLogs();
     },
     beforeUnmount() {},
 };
Add a comment
List