박기범

add delete api

1 { 1 {
2 - "accessKeyId": "ASIAXZL2SWFEQ3A42BQP", 2 + "accessKeyId": "",
3 - "secretAccessKey": "7VxG6RfekqWejvtLfdgLtZbxpXcUg6NshtTueiUV", 3 + "secretAccessKey": "",
4 - "sessionToken": "FwoGZXIvYXdzEMP//////////wEaDBXRmjIedzbi/hfWTCLDAY+AZ+EfzHvy0eV/zjF53n2JhNPJADGD+T32qA6dsBBNs4EyfXoejbu/9k1Evr2h042JwGLb7rZpnEFk46KoGGqo/mBRr+PLlKExbfnPLE6s3SRT0sdqgXkXS+7gQ/Y4aBB1+WLBySso2GxwftcUEJS/pC2YUdonzEpypIRUGD87aJaaMKIc5i9U7oh8uDht2FXWBEIWjhJAkBd+xuMyrhjq474NYCbQlQtG5annxEz5F5MQuKBKCk4G2yPlkGQ7Z0DmgyiNzIL3BTItePAyPGDb/Mvl+8aUiEgkysdTY0YUMhLaepwCzwlV9nuyfpVV2SH5gMoDmKoD", 4 + "sessionToken": "",
5 - "region": "us-east-1" 5 + "region": ""
6 } 6 }
......
...@@ -109,17 +109,26 @@ function addFavoriteFile(fileData) { ...@@ -109,17 +109,26 @@ function addFavoriteFile(fileData) {
109 return axios.post('api/favorites/addfile', fileData); 109 return axios.post('api/favorites/addfile', fileData);
110 } 110 }
111 function uploadContact(contactData){ 111 function uploadContact(contactData){
112 - return axios.post('/api/contact/contact_upload', contactData,{ 112 + return axios.post('/api/contact/contact_upload', contactData.file,{
113 headers: { 113 headers: {
114 'Content-Type': 'multipart/form-data', 114 'Content-Type': 'multipart/form-data',
115 }, 115 },
116 + params:{
117 + id: contactData.id,
118 + }
116 }); 119 });
117 } 120 }
118 function downloadContact(userID){ 121 function downloadContact(userID){
119 - return axios.post('/api/contact/contact_download', userID); 122 + return axios.post('/api/contact/contact_download', null, {params:{id:userID}});
120 } 123 }
121 function printContact(userID){ 124 function printContact(userID){
122 - return axios.post('/api/contact/contact_list', userID); 125 +
126 + console.log(String(userID));
127 +
128 + return axios.post('api/contact/contact_list', {id:userID}, {params:{id:userID},});
129 +}
130 +function deleteContact(userID){
131 + return axios.post('api/contact/contact_delete', {id:userID}, {params:{id:userID}});
123 } 132 }
124 133
125 export { 134 export {
...@@ -143,5 +152,6 @@ export { ...@@ -143,5 +152,6 @@ export {
143 modifyFile, 152 modifyFile,
144 uploadContact, 153 uploadContact,
145 downloadContact, 154 downloadContact,
146 - printContact 155 + printContact,
156 + deleteContact
147 }; 157 };
......
1 +<template>
2 + <div>
3 + <v-toolbar flat>
4 + <v-toolbar-title>내 드라이브</v-toolbar-title>
5 + <v-spacer></v-spacer>
6 + <v-text-field
7 + v-model="search"
8 + append-icon="mdi-magnify"
9 + label="검색"
10 + single-line
11 + hide-details
12 + ></v-text-field>
13 + </v-toolbar>
14 + <v-list two-line subheader>
15 + <!-- <v-subheader inset>Folders</v-subheader> -->
16 + <!-- Folder view -->
17 + <v-list-item @click="" @dblclick="$router.go(-1)">...</v-list-item>
18 + <v-list-item
19 + v-for="item in this.$store.getters.folderL"
20 + :key="item.folder_id"
21 + :search="search"
22 + @click.right="show(item, $event)"
23 + @click=""
24 + @dblclick="
25 + $router.push({
26 + name: 'Folder',
27 + params: { id: item.folder_id },
28 + })
29 + "
30 + >
31 + <v-list-item-avatar>
32 + <v-icon>mdi-folder</v-icon>
33 + </v-list-item-avatar>
34 + <v-list-item-content>
35 + <v-list-item-title v-text="item.folder_name"></v-list-item-title>
36 + </v-list-item-content>
37 + <v-list-item-action>
38 + <v-icon v-if="item.favorite === 0">
39 + mdi-star-outline
40 + </v-icon>
41 + <v-icon v-else>
42 + mdi-star
43 + </v-icon>
44 + </v-list-item-action>
45 + </v-list-item>
46 + <!-- File view -->
47 + <v-list-item
48 + v-for="item in this.$store.getters.fileL"
49 + :key="item.title"
50 + @click.right="showF(item, $event)"
51 + @dblclick="
52 + detailF(item, $event);
53 + file_detail(item);
54 + "
55 + @click=""
56 + >
57 + <v-list-item-avatar>
58 + <v-icon> mdi-file</v-icon>
59 + </v-list-item-avatar>
60 + <v-list-item-content>
61 + <v-list-item-title v-text="item.file_name"></v-list-item-title>
62 + </v-list-item-content>
63 + <v-list-item-action>
64 + <v-icon v-if="item.favorite === 0">
65 + mdi-star-outline
66 + </v-icon>
67 + <v-icon v-else>
68 + mdi-star
69 + </v-icon>
70 + </v-list-item-action>
71 + </v-list-item>
72 + </v-list>
73 + <!--file detail -->
74 + <v-dialog v-model="showdetailF" max-width="290">
75 + <v-card>
76 + <v-card-title class="headline">
77 + <v-text-field v-model="current_filename"></v-text-field>
78 + </v-card-title>
79 + <v-card-text>
80 + <v-text-field v-model="current_filedata"></v-text-field>
81 + </v-card-text>
82 + <v-card-actions>
83 + <v-spacer></v-spacer>
84 + <v-btn
85 + color="green darken-1"
86 + text
87 + @click="
88 + showdetailF = false;
89 + modify_file();
90 + "
91 + >
92 + save
93 + </v-btn>
94 + </v-card-actions>
95 + </v-card>
96 + </v-dialog>
97 + <!-- file share menu -->
98 + <v-dialog v-model="showShareF" width="500px">
99 + <v-card>
100 + <v-card-title>
101 + Share File
102 + </v-card-title>
103 + <v-card-text>
104 + <v-text-field v-model="this.cfilename.file_name"></v-text-field>
105 + </v-card-text>
106 + <v-card-text>
107 + <v-text-field
108 + v-model="targetUid"
109 + label="target user id"
110 + ></v-text-field>
111 + </v-card-text>
112 + <v-card-actions>
113 + <v-spacer></v-spacer>
114 + <v-btn @click.prevent="file_share">ok</v-btn>
115 + <v-btn @click="showShareF = false">cancle</v-btn>
116 + </v-card-actions>
117 + </v-card>
118 + </v-dialog>
119 + <!-- Move Folder -->
120 + <v-dialog v-model="dialog2" width="500px">
121 + <v-card>
122 + <v-card-title class="grey darken-2">
123 + Move Folder
124 + </v-card-title>
125 + <v-container>
126 + <v-list>
127 + <v-list-item
128 + v-for="item2 in folders"
129 + :key="item2.folder_id"
130 + @click.left="transferF(item2.folder_name)"
131 + v-if="item2.folder_name !== curfName.folder_name"
132 + >
133 + <v-list-item-avatar>
134 + <v-icon>mdi-folder</v-icon>
135 + </v-list-item-avatar>
136 + <v-list-item-content>
137 + <v-list-item-title
138 + v-text="item2.folder_name"
139 + ></v-list-item-title>
140 + </v-list-item-content>
141 + </v-list-item>
142 + </v-list>
143 + </v-container>
144 + <v-card-actions>
145 + <v-spacer></v-spacer>
146 + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn>
147 + </v-card-actions>
148 + </v-card>
149 + </v-dialog>
150 + <!-- sub menu for folder -->
151 + <v-menu
152 + v-model="showMenu"
153 + :position-x="x"
154 + :position-y="y"
155 + absolute
156 + offset-y
157 + >
158 + <v-list dense>
159 + <v-list-item @click.prevent="dialog2 = !dialog2">
160 + <v-list-item-icon>
161 + <v-icon>mdi-send</v-icon>
162 + </v-list-item-icon>
163 + <v-list-item-content>
164 + <v-list-item-title>이동</v-list-item-title>
165 + </v-list-item-content>
166 + </v-list-item>
167 + <v-list-item @click.prevent="deleteF">
168 + <v-list-item-icon>
169 + <v-icon>mdi-delete</v-icon>
170 + </v-list-item-icon>
171 + <v-list-item-content>
172 + <v-list-item-title>삭제</v-list-item-title>
173 + </v-list-item-content>
174 + </v-list-item>
175 + <v-list-item v-if="curfName.favorite === 1" @click="delete_favorite">
176 + <v-list-item-icon>
177 + <v-icon>mdi-star-outline</v-icon>
178 + </v-list-item-icon>
179 + <v-list-item-content>
180 + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title>
181 + </v-list-item-content>
182 + </v-list-item>
183 + <v-list-item v-if="curfName.favorite === 0" @click="add_favorite">
184 + <v-list-item-icon>
185 + <v-icon>mdi-star</v-icon>
186 + </v-list-item-icon>
187 + <v-list-item-content>
188 + <v-list-item-title>즐겨 찾기 추가</v-list-item-title>
189 + </v-list-item-content>
190 + </v-list-item>
191 + </v-list>
192 + </v-menu>
193 + <!-- -->
194 + <!-- Move File -->
195 + <v-dialog v-model="dialog3" width="500px">
196 + <v-card>
197 + <v-card-title class="grey darken-2">
198 + Move File
199 + </v-card-title>
200 + <v-container>
201 + <v-list>
202 + <v-list-item
203 + v-for="item2 in folders"
204 + :key="item2.folder_id"
205 + @click.left="transferFile(item2.folder_name)"
206 + >
207 + <v-list-item-avatar>
208 + <v-icon>mdi-folder</v-icon>
209 + </v-list-item-avatar>
210 + <v-list-item-content>
211 + <v-list-item-title
212 + v-text="item2.folder_name"
213 + ></v-list-item-title>
214 + </v-list-item-content>
215 + </v-list-item>
216 + </v-list>
217 + </v-container>
218 + <v-card-actions>
219 + <v-spacer></v-spacer>
220 + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn>
221 + </v-card-actions>
222 + </v-card>
223 + </v-dialog>
224 + <!-- sub menu for file -->
225 + <v-menu
226 + v-model="showMenuF"
227 + :position-x="x"
228 + :position-y="y"
229 + absolute
230 + offset-y
231 + >
232 + <v-list dense>
233 + <v-list-item @click.prevent="dialog3 = !dialog3">
234 + <v-list-item-icon>
235 + <v-icon>mdi-send</v-icon>
236 + </v-list-item-icon>
237 + <v-list-item-content>
238 + <v-list-item-title>이동</v-list-item-title>
239 + </v-list-item-content>
240 + </v-list-item>
241 + <v-list-item @click.prevent="delete_file">
242 + <v-list-item-icon>
243 + <v-icon>mdi-delete</v-icon>
244 + </v-list-item-icon>
245 + <v-list-item-content>
246 + <v-list-item-title>삭제</v-list-item-title>
247 + </v-list-item-content>
248 + </v-list-item>
249 + <v-list-item @click.prevent="download_file">
250 + <v-list-item-icon>
251 + <v-icon>mdi-download</v-icon>
252 + </v-list-item-icon>
253 + <v-list-item-content>
254 + <v-list-item-title>다운로드</v-list-item-title>
255 + </v-list-item-content>
256 + </v-list-item>
257 + <v-list-item
258 + v-if="cfilename.favorite === 1"
259 + @click="delete_favorite_file"
260 + >
261 + <v-list-item-icon>
262 + <v-icon>mdi-star-outline</v-icon>
263 + </v-list-item-icon>
264 + <v-list-item-content>
265 + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title>
266 + </v-list-item-content>
267 + </v-list-item>
268 + <v-list-item v-if="cfilename.favorite === 0" @click="add_favorite_file">
269 + <v-list-item-icon>
270 + <v-icon>mdi-star</v-icon>
271 + </v-list-item-icon>
272 + <v-list-item-content>
273 + <v-list-item-title>즐겨 찾기 추가</v-list-item-title>
274 + </v-list-item-content>
275 + </v-list-item>
276 + <v-list-item @click.prevent="showShareF = !showShareF">
277 + <v-list-item-icon>
278 + <v-icon>fas fa-share-alt</v-icon>
279 + </v-list-item-icon>
280 + <v-list-item-content>
281 + <v-list-item-title>공유 하기</v-list-item-title>
282 + </v-list-item-content>
283 + </v-list-item>
284 + </v-list>
285 + </v-menu>
286 + <input
287 + id="file-selector"
288 + ref="uploadedfile"
289 + type="file"
290 + v-on:change="handleFileUpload()"
291 + />
292 + <br />
293 + <v-btn color="blue" @click="upload_file">upload</v-btn>
294 + <v-btn bottom color="blue" dark fab fixed right @click="dialog = !dialog">
295 + <v-icon>mdi-plus</v-icon>
296 + </v-btn>
297 + <!-- Create Folder -->
298 + <v-dialog v-model="dialog" width="500px">
299 + <v-card>
300 + <v-card-title class="grey darken-2">
301 + Create Folder
302 + </v-card-title>
303 + <v-container>
304 + <div>
305 + <v-icon>mdi-folder</v-icon>
306 + <v-text-field
307 + placeholder="name"
308 + id="foldername"
309 + type="text"
310 + v-model="foldername"
311 + ></v-text-field>
312 + </div>
313 + </v-container>
314 + <v-card-actions>
315 + <v-spacer></v-spacer>
316 + <v-btn text color="primary" @click="dialog = false">Cancel</v-btn>
317 + <v-btn text @click="makeF">Create</v-btn>
318 + </v-card-actions>
319 + </v-card>
320 + </v-dialog>
321 + </div>
322 +</template>
323 +<script>
324 +import {
325 + folder,
326 + makeFolder,
327 + deleteFolder,
328 + moveFolder,
329 + file,
330 + uploadFile,
331 + deleteFile,
332 + downloadFile,
333 + delFavorite,
334 + addFavorite,
335 + moveFile,
336 + delFavoriteFile,
337 + addFavoriteFile,
338 + detailFile,
339 + modifyFile,
340 + shareFile,
341 +} from '../api/index';
342 +import Axios from 'axios';
343 +
344 +export default {
345 + props: {
346 + folderId: Number,
347 + },
348 + data() {
349 + return {
350 + folder_id: this.$route.params.id,
351 + uploadedfile: null,
352 + foldername: '',
353 + curfName: {},
354 + cfilename: {},
355 + folders: [],
356 + files: [],
357 + search: '',
358 + id: '',
359 + share_file_name: '',
360 + showShareF: false,
361 + targetUid: '',
362 + current_filename: null, //파일 상세정보 (이름)
363 + current_filedata: null, //파일 상세정보 (내용)
364 + dialog: false,
365 + howMenu: false,
366 + showMenu: false,
367 + showMenuF: false, //파일 관련 메뉴
368 + showdetailF: false, //txt 파일 상세정보 및 수정
369 + x: 0,
370 + y: 0,
371 + dialog2: false,
372 + dialog3: false, //파일 관련 메뉴
373 + detail: {
374 + dataname: null,
375 + date: null,
376 + owner_id: null,
377 + datasize: null,
378 + datatype: null,
379 + },
380 + };
381 + },
382 + created() {
383 + this.fetchData();
384 + },
385 + watch: {
386 + $route: 'fetchData',
387 + },
388 + methods: {
389 + async fetchData() {
390 + try {
391 + console.log(this.$route.params.id);
392 + const curData = {
393 + id: this.$store.state.id,
394 + folder_id: this.$route.params.id,
395 + };
396 + console.log(curData);
397 + const response = await folder(curData);
398 + // const file_response = await file(curData);
399 + this.$store.commit('setFolder', response.data.folders);
400 + this.$store.commit('setCur', response.data.cur);
401 + this.$store.commit('setParent', response.data.parentPath);
402 + this.$store.commit('setFile', response.data.files);
403 + this.folders = this.$store.getters.folderL;
404 + console.log(this.$store.getters.fileL);
405 + this.files = this.$store.getters.fileL;
406 + } catch (error) {
407 + console.log('에러');
408 + console.log(error);
409 + }
410 + },
411 + handleFileUpload() {
412 + this.uploadedfile = this.$refs.uploadedfile.files[0];
413 + console.log(this.uploadedfile);
414 + },
415 + initFolderName() {
416 + this.foldername = '';
417 + },
418 + cancelMove() {
419 + this.curfName = {};
420 + this.cfilename = {};
421 + this.dialog2 = false;
422 + this.dialog3 = false;
423 + },
424 + async makeF() {
425 + try {
426 + const folderData = {
427 + user_id: this.$store.state.id,
428 + cur: this.$store.state.cur,
429 + folder_name: this.foldername,
430 + };
431 + const response = await makeFolder(folderData);
432 + console.log(response.data);
433 + console.log('폴더 생성 완료');
434 + this.$store.commit('setFolder', response.data.folders);
435 + this.folders = response.data.folders;
436 + } catch (error) {
437 + console.log('에러');
438 + console.log(error.response.data);
439 + } finally {
440 + this.initFolderName();
441 + this.dialog = false;
442 + }
443 + },
444 + async moveF(move_folder_name) {
445 + try {
446 + const curData = {
447 + id: this.$store.state.id,
448 + cur: this.$store.state.cur + move_folder_name + '/',
449 + };
450 + const response = await folder(curData);
451 + const file_response = await file(curData);
452 + console.log(response.data);
453 + this.$store.commit('setFolder', response.data.folders);
454 + this.$store.commit('setFile', file_response.data.files);
455 + this.$store.commit('setCur', response.data.cur);
456 + this.$store.commit('setParent', response.data.parentPath);
457 + this.folders = this.$store.getters.folderL;
458 + this.files = this.$store.getters.fileL;
459 + } catch (error) {
460 + console.log('에러');
461 + console.log(error.response.data);
462 + }
463 + },
464 + async moveParent() {
465 + try {
466 + const cData = {
467 + id: this.$store.state.id,
468 + cur: this.$store.state.parent,
469 + };
470 + const response = await folder(cData);
471 + const file_response = await file(cData);
472 + console.log(response.data);
473 + this.$store.commit('setFolder', response.data.folders);
474 + this.$store.commit('setFile', file_response.data.files);
475 + this.$store.commit('setCur', response.data.cur);
476 + this.$store.commit('setParent', response.data.parentPath);
477 + this.folders = this.$store.getters.folderL;
478 + this.files = this.$store.getters.fileL;
479 + } catch (error) {
480 + console.log('에러');
481 + console.log(error.response.data);
482 + }
483 + },
484 + async deleteF() {
485 + try {
486 + const cData = {
487 + id: this.$store.state.id,
488 + cur: this.$store.state.cur,
489 + folder_name: this.curfName.folder_name,
490 + };
491 + const response = await deleteFolder(cData);
492 + console.log(response);
493 + this.$store.commit('setFolder', response.data.folders);
494 + this.folders = this.$store.getters.folderL;
495 + } catch (error) {
496 + console.log('에러');
497 + console.log(error.response.data);
498 + } finally {
499 + this.curfName = '';
500 + }
501 + },
502 + async transferF(folderName) {
503 + try {
504 + const cData = {
505 + id: this.$store.state.id,
506 + cur: this.$store.state.cur,
507 + name: this.curfName.folder_name,
508 + isfolder: true,
509 + newPath: this.$store.state.cur + folderName + '/',
510 + };
511 + const response = await moveFolder(cData);
512 + console.log(response);
513 + this.$store.commit('setFolder', response.data.folders);
514 + this.folders = this.$store.getters.folderL;
515 + } catch (error) {
516 + console.log('에러');
517 + console.log(error.response.data);
518 + } finally {
519 + this.curfName = {};
520 + this.dialog2 = false;
521 + }
522 + },
523 + async upload_file() {
524 + try {
525 + const formData = new FormData();
526 + formData.append('file', this.uploadedfile);
527 + formData.append('user_id', this.$store.state.id);
528 + formData.append('cur', this.$store.state.cur);
529 + const currentData = {
530 + id: this.$store.state.id,
531 + cur: this.$store.state.cur,
532 + };
533 + console.log(currentData);
534 + const response = await uploadFile(formData);
535 + const filelist = await file(currentData);
536 + console.log(filelist.data.files);
537 + this.$store.commit('setFile', filelist.data.files);
538 + console.log(this.$store.getters.fileL);
539 + this.files = this.$store.getters.fileL;
540 + } catch (error) {
541 + console.log('에러');
542 + console.log(error);
543 + }
544 + },
545 + async delete_file() {
546 + try {
547 + var itemlist = this.$store.getters.fileL;
548 + const currentData = {
549 + fileName: null,
550 + user_id: null,
551 + cur: this.$store.state.cur,
552 + };
553 + for (var i = 0; i < itemlist.length; i++) {
554 + if (itemlist[i].file_name == this.cfilename.file_name) {
555 + currentData.fileName = itemlist[i].file_name;
556 + currentData.user_id = itemlist[i].user_id;
557 + }
558 + }
559 + const filelistData = {
560 + id: currentData.user_id,
561 + cur: currentData.cur,
562 + };
563 + const response = await deleteFile(currentData);
564 + setTimeout(function() {}, 500);
565 + const filelist = await file(filelistData);
566 + this.$store.commit('setFile', filelist.data.files);
567 + this.files = this.$store.getters.fileL;
568 + } catch (error) {
569 + console.log('에러');
570 + console.log(error);
571 + }
572 + },
573 + async download_file() {
574 + try {
575 + const currentData = {
576 + fileName: this.cfilename.file_name,
577 + id: this.$store.state.id,
578 + cur: this.$store.state.cur,
579 + };
580 + const result = await downloadFile(currentData);
581 + console.log(result);
582 + } catch (error) {
583 + console.log('에러');
584 + console.log(error);
585 + }
586 + },
587 + async delete_favorite() {
588 + try {
589 + const cData = {
590 + id: this.$store.state.id,
591 + cur: this.$store.state.cur,
592 + name: this.curfName.folder_name,
593 + };
594 + console.log(cData);
595 + const response = await delFavorite(cData);
596 + this.$store.commit('setFolder', response.data.folders);
597 + } catch (error) {
598 + console.log('에러');
599 + }
600 + },
601 + async add_favorite() {
602 + try {
603 + const cData = {
604 + id: this.$store.state.id,
605 + cur: this.$store.state.cur,
606 + name: this.curfName.folder_name,
607 + };
608 + console.log(cData);
609 + const response = await addFavorite(cData);
610 + this.$store.commit('setFolder', response.data.folders);
611 + } catch (error) {
612 + console.log('에러');
613 + }
614 + },
615 + async delete_favorite_file() {
616 + try {
617 + const fData = {
618 + id: this.$store.state.id,
619 + cur: this.$store.state.cur,
620 + name: this.cfilename.file_name,
621 + };
622 + console.log(fData);
623 + const response = await delFavoriteFile(fData);
624 + this.$store.commit('setFile', response.data.files);
625 + } catch (error) {
626 + console.log('에러');
627 + }
628 + },
629 + async add_favorite_file() {
630 + try {
631 + const fData = {
632 + id: this.$store.state.id,
633 + cur: this.$store.state.cur,
634 + name: this.cfilename.file_name,
635 + };
636 + console.log(fData);
637 + const response = await addFavoriteFile(fData);
638 + this.$store.commit('setFile', response.data.files);
639 + } catch (error) {
640 + console.log('에러');
641 + }
642 + },
643 + async transferFile(folderName) {
644 + try {
645 + const fData = {
646 + id: this.$store.state.id,
647 + cur: this.$store.state.cur,
648 + name: this.cfilename.file_name,
649 + isfolder: false,
650 + newPath: this.$store.state.cur + folderName + '/',
651 + };
652 + const response = await moveFile(fData);
653 + console.log(response);
654 + this.$store.commit('setFile', response.data.files);
655 + this.files = this.$store.getters.fileL;
656 + } catch (error) {
657 + console.log('에러');
658 + console.log(error.response.data);
659 + } finally {
660 + this.cfilename = {};
661 + this.dialog3 = false;
662 + }
663 + },
664 + async file_detail() {
665 + try {
666 + const currentData = {
667 + id: this.cfilename.user_id,
668 + cur: this.cfilename.location,
669 + fileName: this.cfilename.file_name,
670 + };
671 + const detailData = await detailFile(currentData);
672 + this.current_filename = detailData.data.file_name;
673 + this.current_filedata = detailData.data.content;
674 + console.log(this.current_filename);
675 + console.log(this.current_filedata);
676 + } catch (error) {
677 + console.log('에러');
678 + console.log(error);
679 + }
680 + },
681 + async modify_file() {
682 + try {
683 + const modifyData = {
684 + user_id: this.cfilename.user_id,
685 + cur: this.cfilename.location,
686 + name: this.current_filename,
687 + content: this.current_filedata,
688 + };
689 + const result = await modifyFile(modifyData);
690 + const after_data = {
691 + id: this.cfilename.user_id,
692 + cur: this.cfilename.location,
693 + fileName: this.current_filename,
694 + };
695 + const detailData = await detailFile(after_data);
696 + } catch (error) {
697 + console.log('에러');
698 + console.log(error);
699 + }
700 + },
701 + async file_share() {
702 + try {
703 + const shareData = {
704 + id: this.$store.state.id,
705 + cur: this.$store.state.cur,
706 + file_name: this.cfilename.file_name,
707 + target_id: this.targetUid,
708 + };
709 + const response = await shareFile(shareData);
710 + if (response.status == 200) {
711 + alert('파일 공유 완료');
712 + }
713 + } catch (error) {
714 + console.log('에러');
715 + alert('존재 하지 않은 유저입니다.');
716 + } finally {
717 + this.showShareF = false;
718 + }
719 + },
720 + show(folderObj, e) {
721 + e.preventDefault();
722 + this.curfName = folderObj;
723 + this.showMenu = false;
724 + this.x = e.clientX;
725 + this.y = e.clientY;
726 + this.$nextTick(() => {
727 + this.showMenu = true;
728 + });
729 + },
730 + showF(fileObj, e) {
731 + e.preventDefault();
732 + this.cfilename = fileObj;
733 + this.showMenuF = false;
734 + this.x = e.clientX;
735 + this.y = e.clientY;
736 + this.$nextTick(() => {
737 + this.showMenuF = true;
738 + });
739 + },
740 + detailF(fileObj, e) {
741 + e.preventDefault();
742 + this.cfilename = fileObj;
743 + this.showdetailF = false;
744 + this.x = e.clientX;
745 + this.y = e.clientY;
746 + this.$nextTick(() => {
747 + this.showdetailF = true;
748 + });
749 + },
750 + },
751 +};
752 +</script>
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
8 <th class="text-left">Name</th> 8 <th class="text-left">Name</th>
9 <th class="text-left">Phone</th> 9 <th class="text-left">Phone</th>
10 <th class="text-left">Email</th> 10 <th class="text-left">Email</th>
11 - <th class="text-left">Date</th>
12 </tr> 11 </tr>
13 </thead> 12 </thead>
14 <tbody> 13 <tbody>
...@@ -16,7 +15,6 @@ ...@@ -16,7 +15,6 @@
16 <td>{{ item.name }}</td> 15 <td>{{ item.name }}</td>
17 <td>{{ item.phone}}</td> 16 <td>{{ item.phone}}</td>
18 <td>{{ item.email }}</td> 17 <td>{{ item.email }}</td>
19 - <td>{{ item.added_date}}</td>
20 </tr> 18 </tr>
21 </tbody> 19 </tbody>
22 </template> 20 </template>
...@@ -32,12 +30,13 @@ ...@@ -32,12 +30,13 @@
32 </div> 30 </div>
33 <br /> 31 <br />
34 <v-btn color="blue" @click="upload_contact">upload</v-btn> 32 <v-btn color="blue" @click="upload_contact">upload</v-btn>
35 - <v-btn color="blud" @click = "download_contact">download</v-btn> 33 + <v-btn color="green" @click = "download_contact">download</v-btn>
34 + <v-btn color="gray" @click = "delete_contact">delete</v-btn>
36 </v-flex> 35 </v-flex>
37 </template> 36 </template>
38 37
39 <script> 38 <script>
40 - import { uploadContact, downloadContact, printContact } from '../api/index'; 39 + import { uploadContact, downloadContact, printContact, deleteContact } from '../api/index';
41 import Axios from 'axios'; 40 import Axios from 'axios';
42 export default { 41 export default {
43 data() { 42 data() {
...@@ -51,10 +50,10 @@ ...@@ -51,10 +50,10 @@
51 const curData = { 50 const curData = {
52 id : this.$store.state.id, 51 id : this.$store.state.id,
53 } 52 }
54 - console.log(curData); 53 + const list_reponse = await printContact(curData.id);
55 - const list_reponse = await printContact(curData); 54 + this.$store.commit('setContactList', list_reponse.data.contact_list);
56 - this.$store.commit('setContactList', list_reponse);
57 this.contact_list = this.$store.getters.contact; 55 this.contact_list = this.$store.getters.contact;
56 + console.log(list_reponse);
58 } catch (error) { 57 } catch (error) {
59 console.log("에러"); 58 console.log("에러");
60 console.log(error); 59 console.log(error);
...@@ -74,21 +73,20 @@ ...@@ -74,21 +73,20 @@
74 try { 73 try {
75 const formData = new FormData(); 74 const formData = new FormData();
76 formData.append('file', this.contact_file); 75 formData.append('file', this.contact_file);
77 - formData.append('id', this.$store.state.id);
78 const currentData = { 76 const currentData = {
79 id: this.$store.state.id 77 id: this.$store.state.id
80 }; 78 };
81 const fileData = { 79 const fileData = {
82 id: this.$store.state.id, 80 id: this.$store.state.id,
83 - file: this.contact_file 81 + file: formData
84 } 82 }
85 console.log(fileData); 83 console.log(fileData);
86 - const response = await uploadContact(formData); 84 + const response = await uploadContact(fileData);
87 - const contact_response = await printContact(currentData); 85 + const contact_response = await printContact(currentData.id);
88 console.log(contact_response); 86 console.log(contact_response);
89 - this.$store.commit('setContactList', contact_response); 87 + this.$store.commit('setContactList', contact_response.data.contact_list);
90 console.log(this.$store.getters.contact); 88 console.log(this.$store.getters.contact);
91 - this.contact_list = contact_response; 89 + this.contact_list = this.$store.getters.contact;
92 } catch (error) { 90 } catch (error) {
93 console.log('에러'); 91 console.log('에러');
94 console.log(error); 92 console.log(error);
...@@ -100,12 +98,29 @@ ...@@ -100,12 +98,29 @@
100 id: this.$store.state.id 98 id: this.$store.state.id
101 }; 99 };
102 console.log(curData); 100 console.log(curData);
103 - const response = await downloadContact(curData); 101 + const response = await downloadContact(curData.id);
104 console.log(response); 102 console.log(response);
105 }catch(error){ 103 }catch(error){
106 console.log('에러'); 104 console.log('에러');
107 console.log(error); 105 console.log(error);
108 } 106 }
107 + },
108 + async delete_contact(){
109 + try{
110 + const curData = {
111 + id: this.$store.state.id
112 + };
113 + const response_d = await deleteContact(curData.id);
114 +
115 + const contact_response = await printContact(curData.id);
116 +
117 + this.$store.commit('setContactList', contact_response.data.contact_list);
118 +
119 + this.contact_list = this.$store.getters.contact;
120 + }catch(error){
121 + console.log('에러');
122 + console.log(error);
123 + }
109 } 124 }
110 125
111 } 126 }
......