
--- client/resources/api/asset.js
+++ client/resources/api/asset.js
... | ... | @@ -1,4 +1,5 @@ |
1 | 1 |
import apiClient from "./index"; |
2 |
+import axios from 'axios'; |
|
2 | 3 |
|
3 | 4 |
// 자산(프로젝트) 목록 조회 기능 |
4 | 5 |
export const findAllProjectsProc = (data) => { |
... | ... | @@ -6,7 +7,14 @@ |
6 | 7 |
} |
7 | 8 |
|
8 | 9 |
// 자산(프로젝트) 생성 기능 |
9 |
-export const saveProjectProc = (data) => { |
|
10 |
- return apiClient.post('/project/saveProject.json', data); |
|
11 |
-} |
|
12 | 10 |
|
11 |
+export const saveProjectProc = (formData) => { |
|
12 |
+ return axios.post('/api/project/saveProject.json', formData, { |
|
13 |
+ withCredentials: true |
|
14 |
+}); |
|
15 |
+}; |
|
16 |
+ |
|
17 |
+// 자산(프로젝트) 복제 기능 |
|
18 |
+export const duplicateProjectProc = (projectId, data) => { |
|
19 |
+ return apiClient.post(`/project/${projectId}/duplicateProject.json`, data); |
|
20 |
+}(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/subPage/Asset.vue
+++ client/views/pages/subPage/Asset.vue
... | ... | @@ -52,9 +52,11 @@ |
52 | 52 |
<!-- 드롭다운 메뉴 표시 --> |
53 | 53 |
<div v-if="openMenuIndex === index" class="dropdown-menu" :class="dropdownDirection"> |
54 | 54 |
<button><img src="../../../resources/img/content/ico_subShare.svg" alt=""> 공유</button> |
55 |
- <button><img src="../../../resources/img/content/ico_subCopy.svg" alt=""> 복사</button> |
|
55 |
+ <button><img src="../../../resources/img/content/ico_subCopy.svg" alt="" @click="duplicateProject(project.projectId)"> 복사</button> |
|
56 | 56 |
<button><img src="../../../resources/img/content/ico_trashcan.svg" alt=""> 삭제</button> |
57 |
- <button><img src="../../../resources/img/content/ico_version.svg" alt=""> 버전기록</button> |
|
57 |
+ <button><img src="../../../resources/img/content/ico_version.svg" alt="" @click="loadOldProjects"> 버전기록</button> |
|
58 |
+ <!-- @click="changeProjectName --> |
|
59 |
+ <button><img src="" alt="" > 이름 변경</button> |
|
58 | 60 |
</div> |
59 | 61 |
</div> |
60 | 62 |
</div> |
... | ... | @@ -62,8 +64,9 @@ |
62 | 64 |
</template> |
63 | 65 |
|
64 | 66 |
<script> |
65 |
-import { findAllProjectsProc } from '../../../resources/api/asset'; |
|
66 | 67 |
import { mapGetters } from 'vuex'; |
68 |
+import { findAllProjectsProc } from '../../../resources/api/asset'; |
|
69 |
+import { duplicateProjectProc } from '../../../resources/api/asset'; |
|
67 | 70 |
|
68 | 71 |
export default { |
69 | 72 |
data() { |
... | ... | @@ -75,7 +78,7 @@ |
75 | 78 |
// { name: '프로젝트D', date: '2025.05.12', img: require('../../../resources/img/content/sample1.png'),isFavorite: true }, |
76 | 79 |
// { name: '프로젝트E', date: '2025.05.12', img: require('../../../resources/img/content/sample1.png'),isFavorite: false }, |
77 | 80 |
], |
78 |
- openMenuIndex: null, |
|
81 |
+ openMenuIndex: null, |
|
79 | 82 |
dropdownDirection: 'right' // 또는 'left' |
80 | 83 |
|
81 | 84 |
}; |
... | ... | @@ -102,10 +105,31 @@ |
102 | 105 |
this.openMenuIndex = index; |
103 | 106 |
}); |
104 | 107 |
}, |
105 |
- loadProjects() { |
|
108 |
+ loadMainProjects() { |
|
106 | 109 |
findAllProjectsProc({ |
107 | 110 |
memberId: this.getMemId, |
108 |
- isMain: "Y" // 대표 프로젝트만 화면 목록에 뜨게 함. |
|
111 |
+ isMain: 'Y' // 대표 프로젝트만 화면 목록에 뜨게 함. |
|
112 |
+ }) |
|
113 |
+ .then(response => { |
|
114 |
+ const projectList = response.data.result.projects; |
|
115 |
+ |
|
116 |
+ this.projects = projectList.map(project => ({ |
|
117 |
+ projectId: project.projectId, |
|
118 |
+ projectGroupId: project.projectGroupId, |
|
119 |
+ isMain: project.isMain, |
|
120 |
+ name: project.projectName, |
|
121 |
+ date: project.createdAt, |
|
122 |
+ img: require('../../../resources/img/content/sample1.png'), // 백엔드 - 썸네일 기능 추가 후 수정 |
|
123 |
+ isFavorite: false // 백엔드 - 즐겨찾기 기능 추가 후 수정 |
|
124 |
+ })); |
|
125 |
+ }) |
|
126 |
+ .catch(error => {console.error('자산 목록 조회 실패: ', error);}) |
|
127 |
+ }, |
|
128 |
+ loadOldProjects() { |
|
129 |
+ findAllProjectsProc({ |
|
130 |
+ memberId: this.getMemId, |
|
131 |
+ projectGroupId: '', |
|
132 |
+ isMain: 'N' // 이전 프로젝트만 목록에 뜨게 함. |
|
109 | 133 |
}) |
110 | 134 |
.then(response => { |
111 | 135 |
const projectList = response.data.result.projects; |
... | ... | @@ -120,9 +144,25 @@ |
120 | 144 |
.catch(error => {console.error('자산 목록 조회 실패: ', error);}) |
121 | 145 |
}, |
122 | 146 |
goToModeling() { |
123 |
- console.log("모델링 페이지로 이동"); |
|
147 |
+ console.log('모델링 페이지로 이동'); |
|
124 | 148 |
this.$router.push('/modeling.page'); |
125 | 149 |
}, |
150 |
+ duplicateProject(projectId) { |
|
151 |
+ const data = { |
|
152 |
+ memberId : this.getMemId |
|
153 |
+ }; |
|
154 |
+ |
|
155 |
+ duplicateProjectProc(projectId, data) |
|
156 |
+ .then((response) => { |
|
157 |
+ console.log('복제 성공'); |
|
158 |
+ this.loadMainProjects(); |
|
159 |
+ this.openMenuIndex = null; |
|
160 |
+ }) |
|
161 |
+ .catch((error) => { |
|
162 |
+ console.error('복제 실패: ', error); |
|
163 |
+ }) |
|
164 |
+ }, |
|
165 |
+ |
|
126 | 166 |
}, |
127 | 167 |
watch: {}, |
128 | 168 |
computed: { |
... | ... | @@ -136,7 +176,7 @@ |
136 | 176 |
created() {}, |
137 | 177 |
mounted() { |
138 | 178 |
console.log("로그인한 사용자:", this.getMemId); |
139 |
- this.loadProjects(); |
|
179 |
+ this.loadMainProjects(); |
|
140 | 180 |
}, |
141 | 181 |
beforeUnmount() {}, |
142 | 182 |
}; |
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?