
+++ client/resources/api/main.js
... | ... | @@ -0,0 +1,6 @@ |
1 | +import apiClient from "./index"; | |
2 | + | |
3 | +// 프로젝트 로그 목록 조회 기능 | |
4 | +export const findAllLogsProc = (data) => { | |
5 | + return apiClient.post('/project/findAllLogs.json', data); | |
6 | +}(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/main/Main.vue
+++ client/views/pages/main/Main.vue
... | ... | @@ -58,6 +58,10 @@ |
58 | 58 |
|
59 | 59 |
<script> |
60 | 60 |
import { mapGetters } from 'vuex'; |
61 |
+import dayjs from 'dayjs'; |
|
62 |
+import relativeTime from 'dayjs/plugin/relativeTime'; |
|
63 |
+import 'dayjs/locale/ko'; // 한국어 locale 불러오기 |
|
64 |
+import { findAllLogsProc } from '../../../resources/api/main'; |
|
61 | 65 |
|
62 | 66 |
export default { |
63 | 67 |
data() { |
... | ... | @@ -75,15 +79,35 @@ |
75 | 79 |
{ id: 5, project: 'F', count: 7 } |
76 | 80 |
], |
77 | 81 |
activityLogs: [ |
78 |
- { id: 1, project: '프로젝트A', time: '어제 14:30' }, |
|
79 |
- { id: 2, project: '프로젝트B', time: '어제 18:10' }, |
|
80 |
- { id: 3, project: '프로젝트C', time: '오늘 09:05' }, |
|
81 |
- { id: 4, project: '프로젝트D', time: '오늘 09:05' }, |
|
82 |
- { id: 5, project: '프로젝트F', time: '오늘 09:05' } |
|
82 |
+ // { id: 1, project: '프로젝트A', time: '어제 14:30' }, |
|
83 |
+ // { id: 2, project: '프로젝트B', time: '어제 18:10' }, |
|
84 |
+ // { id: 3, project: '프로젝트C', time: '오늘 09:05' }, |
|
85 |
+ // { id: 4, project: '프로젝트D', time: '오늘 09:05' }, |
|
86 |
+ // { id: 5, project: '프로젝트F', time: '오늘 09:05' } |
|
83 | 87 |
] |
84 | 88 |
}; |
85 | 89 |
}, |
86 |
- methods: {}, |
|
90 |
+ methods: { |
|
91 |
+ loadLogs() { |
|
92 |
+ findAllLogsProc({ |
|
93 |
+ memberId: this.getMemId |
|
94 |
+ }) |
|
95 |
+ .then(response => { |
|
96 |
+ // 프로젝트 수정 로그 |
|
97 |
+ const editLogList = response.data.result.editLogs; |
|
98 |
+ |
|
99 |
+ this.activityLogs = editLogList.map(log => ({ |
|
100 |
+ id: log.projectLogId, |
|
101 |
+ projectGroupId: log.projectGroupId, |
|
102 |
+ project: log.projectName, |
|
103 |
+ time: dayjs(log.createdAt).fromNow() |
|
104 |
+ })) |
|
105 |
+ |
|
106 |
+ // 프로젝트 생성 로그 |
|
107 |
+ }) |
|
108 |
+ .catch(error => {console.error('로그 목록 조회 실패: ', error);}) |
|
109 |
+ } |
|
110 |
+ }, |
|
87 | 111 |
watch: {}, |
88 | 112 |
computed: { |
89 | 113 |
...mapGetters([ |
... | ... | @@ -96,6 +120,7 @@ |
96 | 120 |
created() {}, |
97 | 121 |
mounted() { |
98 | 122 |
console.log("사용자 아이디: " + this.getMemId + " 사용자 이름: " + this.getMemNm + " 사용자 로그인 아이디: " + this.getMemLoginId); |
123 |
+ this.loadLogs(); |
|
99 | 124 |
}, |
100 | 125 |
beforeUnmount() {}, |
101 | 126 |
}; |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?