최동원

file share

...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
9 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"> 9 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
10 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"> 10 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
11 <meta name="viewport" content="width=device-width,initial-scale=1.0"> 11 <meta name="viewport" content="width=device-width,initial-scale=1.0">
12 - <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" integrity="본인 api키" crossorigin="anonymous"> 12 + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" integrity="sha384-Bfad6CLCknfcloXFOyFnlgtENryhrpZCe29RTifKEixXQZ38WheV+i/6YWSzkz3V" crossorigin="anonymous">
13 </head> 13 </head>
14 <body> 14 <body>
15 <noscript> 15 <noscript>
......
...@@ -39,7 +39,7 @@ function file(curData) { ...@@ -39,7 +39,7 @@ function file(curData) {
39 return axios.get('/api/file', { 39 return axios.get('/api/file', {
40 params: { 40 params: {
41 id: curData.id, 41 id: curData.id,
42 - folder_id: curData.cur, 42 + cur: curData.cur,
43 }, 43 },
44 }); 44 });
45 } 45 }
...@@ -121,6 +121,10 @@ function getFavoriteList(userId) { ...@@ -121,6 +121,10 @@ function getFavoriteList(userId) {
121 }); 121 });
122 } 122 }
123 123
124 +function shareFile(shareData) {
125 + return axios.post('/api/share', shareData);
126 +}
127 +
124 export { 128 export {
125 registerUser, 129 registerUser,
126 loginUser, 130 loginUser,
...@@ -141,4 +145,5 @@ export { ...@@ -141,4 +145,5 @@ export {
141 detailFile, 145 detailFile,
142 modifyFile, 146 modifyFile,
143 getFavoriteList, 147 getFavoriteList,
148 + shareFile,
144 }; 149 };
......
...@@ -93,6 +93,28 @@ ...@@ -93,6 +93,28 @@
93 </v-card-actions> 93 </v-card-actions>
94 </v-card> 94 </v-card>
95 </v-dialog> 95 </v-dialog>
96 + <!-- file share menu -->
97 + <v-dialog v-model="showShareF">
98 + <v-card>
99 + <v-card-title>
100 + Share File
101 + </v-card-title>
102 + <v-card-text>
103 + <v-text-field v-model="this.cfilename.file_name"></v-text-field>
104 + </v-card-text>
105 + <v-card-text>
106 + <v-text-field
107 + v-model="targetUid"
108 + label="target user id"
109 + ></v-text-field>
110 + </v-card-text>
111 + <v-card-cation>
112 + <v-spacer></v-spacer>
113 + <v-btn @click.prevent="file_share">ok</v-btn>
114 + <v-btn @click="showShareF = false">cancle</v-btn>
115 + </v-card-cation>
116 + </v-card>
117 + </v-dialog>
96 <!-- Move Folder --> 118 <!-- Move Folder -->
97 <v-dialog v-model="dialog2" width="500px"> 119 <v-dialog v-model="dialog2" width="500px">
98 <v-card> 120 <v-card>
...@@ -233,7 +255,7 @@ ...@@ -233,7 +255,7 @@
233 </v-list-item> 255 </v-list-item>
234 <v-list-item 256 <v-list-item
235 v-if="cfilename.favorite === 1" 257 v-if="cfilename.favorite === 1"
236 - @click="delete_favorite_file" 258 + @click.prevent="delete_favorite_file"
237 > 259 >
238 <v-list-item-icon> 260 <v-list-item-icon>
239 <v-icon>mdi-star-outline</v-icon> 261 <v-icon>mdi-star-outline</v-icon>
...@@ -242,7 +264,10 @@ ...@@ -242,7 +264,10 @@
242 <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> 264 <v-list-item-title>즐겨 찾기 삭제</v-list-item-title>
243 </v-list-item-content> 265 </v-list-item-content>
244 </v-list-item> 266 </v-list-item>
245 - <v-list-item v-if="cfilename.favorite === 0" @click="add_favorite_file"> 267 + <v-list-item
268 + v-if="cfilename.favorite === 0"
269 + @click.prevent="add_favorite_file"
270 + >
246 <v-list-item-icon> 271 <v-list-item-icon>
247 <v-icon>mdi-star</v-icon> 272 <v-icon>mdi-star</v-icon>
248 </v-list-item-icon> 273 </v-list-item-icon>
...@@ -250,6 +275,14 @@ ...@@ -250,6 +275,14 @@
250 <v-list-item-title>즐겨 찾기 추가</v-list-item-title> 275 <v-list-item-title>즐겨 찾기 추가</v-list-item-title>
251 </v-list-item-content> 276 </v-list-item-content>
252 </v-list-item> 277 </v-list-item>
278 + <v-list-item @click.prevent="showShareF != showShareF">
279 + <v-list-item-icon>
280 + <v-icon>fas fa-share-alt</v-icon>
281 + </v-list-item-icon>
282 + <v-list-item-content>
283 + <v-list-item-title>공유 하기</v-list-item-title>
284 + </v-list-item-content>
285 + </v-list-item>
253 </v-list> 286 </v-list>
254 </v-menu> 287 </v-menu>
255 <input 288 <input
...@@ -306,6 +339,7 @@ import { ...@@ -306,6 +339,7 @@ import {
306 addFavoriteFile, 339 addFavoriteFile,
307 detailFile, 340 detailFile,
308 modifyFile, 341 modifyFile,
342 + shareFile,
309 } from '../api/index'; 343 } from '../api/index';
310 import Axios from 'axios'; 344 import Axios from 'axios';
311 export default { 345 export default {
...@@ -319,6 +353,9 @@ export default { ...@@ -319,6 +353,9 @@ export default {
319 files: [], 353 files: [],
320 search: '', 354 search: '',
321 id: '', 355 id: '',
356 + share_file_name: '',
357 + showShareF: false,
358 + targetUid: '',
322 current_filename: null, //파일 상세정보 (이름) 359 current_filename: null, //파일 상세정보 (이름)
323 current_filedata: null, //파일 상세정보 (내용) 360 current_filedata: null, //파일 상세정보 (내용)
324 dialog: false, 361 dialog: false,
...@@ -354,11 +391,10 @@ export default { ...@@ -354,11 +391,10 @@ export default {
354 }; 391 };
355 console.log(curData); 392 console.log(curData);
356 const response = await folder(curData); 393 const response = await folder(curData);
357 - const file_response = await file(curData);
358 this.$store.commit('setFolder', response.data.folders); 394 this.$store.commit('setFolder', response.data.folders);
359 this.$store.commit('setCur', response.data.cur); 395 this.$store.commit('setCur', response.data.cur);
360 this.$store.commit('setParent', response.data.parentPath); 396 this.$store.commit('setParent', response.data.parentPath);
361 - this.$store.commit('setFile', file_response.data.files); 397 + this.$store.commit('setFile', response.data.files);
362 this.folders = this.$store.getters.folderL; 398 this.folders = this.$store.getters.folderL;
363 console.log(this.$store.getters.fileL); 399 console.log(this.$store.getters.fileL);
364 this.files = this.$store.getters.fileL; 400 this.files = this.$store.getters.fileL;
...@@ -657,6 +693,25 @@ export default { ...@@ -657,6 +693,25 @@ export default {
657 console.log(error); 693 console.log(error);
658 } 694 }
659 }, 695 },
696 + async file_share() {
697 + try {
698 + const shareData = {
699 + id: this.$store.state.id,
700 + cur: this.$store.state.cur,
701 + file_name: this.cfilename.file_name,
702 + target_id: this.targetUid,
703 + };
704 + const response = await shareFile(shareData);
705 + if (response.status == 200) {
706 + alert('파일 공유 완료');
707 + }
708 + } catch (error) {
709 + console.log('에러');
710 + alert('존재 하지 않은 유저입니다.');
711 + } finally {
712 + this.showShareF = false;
713 + }
714 + },
660 show(folderObj, e) { 715 show(folderObj, e) {
661 e.preventDefault(); 716 e.preventDefault();
662 this.curfName = folderObj; 717 this.curfName = folderObj;
......
...@@ -31,14 +31,6 @@ ...@@ -31,14 +31,6 @@
31 <v-list-item-title>즐겨찾기</v-list-item-title> 31 <v-list-item-title>즐겨찾기</v-list-item-title>
32 </v-list-item-content> 32 </v-list-item-content>
33 </v-list-item> 33 </v-list-item>
34 - <v-list-item router :to="{ name: 'Fav' }" exact>
35 - <v-list-item-action>
36 - <v-icon>fas fa-share-alt</v-icon>
37 - </v-list-item-action>
38 - <v-list-item-content>
39 - <v-list-item-title>공유</v-list-item-title>
40 - </v-list-item-content>
41 - </v-list-item>
42 <v-list-item router :to="{ name: 'Quick' }" exact> 34 <v-list-item router :to="{ name: 'Quick' }" exact>
43 <v-list-item-action> 35 <v-list-item-action>
44 <v-icon>mdi-history</v-icon> 36 <v-icon>mdi-history</v-icon>
......
...@@ -94,6 +94,28 @@ ...@@ -94,6 +94,28 @@
94 </v-card-actions> 94 </v-card-actions>
95 </v-card> 95 </v-card>
96 </v-dialog> 96 </v-dialog>
97 + <!-- file share menu -->
98 + <v-dialog v-model="showShareF">
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-cation>
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-cation>
117 + </v-card>
118 + </v-dialog>
97 <!-- Move Folder --> 119 <!-- Move Folder -->
98 <v-dialog v-model="dialog2" width="500px"> 120 <v-dialog v-model="dialog2" width="500px">
99 <v-card> 121 <v-card>
...@@ -166,6 +188,14 @@ ...@@ -166,6 +188,14 @@
166 <v-list-item-title>즐겨 찾기 추가</v-list-item-title> 188 <v-list-item-title>즐겨 찾기 추가</v-list-item-title>
167 </v-list-item-content> 189 </v-list-item-content>
168 </v-list-item> 190 </v-list-item>
191 + <v-list-item>
192 + <v-list-item-icon>
193 + <v-icon>fas fa-share-alt</v-icon>
194 + </v-list-item-icon>
195 + <v-list-item-content>
196 + <v-list-item-title>공유 하기</v-list-item-title>
197 + </v-list-item-content>
198 + </v-list-item>
169 </v-list> 199 </v-list>
170 </v-menu> 200 </v-menu>
171 <!-- --> 201 <!-- -->
...@@ -251,6 +281,14 @@ ...@@ -251,6 +281,14 @@
251 <v-list-item-title>즐겨 찾기 추가</v-list-item-title> 281 <v-list-item-title>즐겨 찾기 추가</v-list-item-title>
252 </v-list-item-content> 282 </v-list-item-content>
253 </v-list-item> 283 </v-list-item>
284 + <v-list-item @click.prevent="showShareF != showShareF">
285 + <v-list-item-icon>
286 + <v-icon>fas fa-share-alt</v-icon>
287 + </v-list-item-icon>
288 + <v-list-item-content>
289 + <v-list-item-title>공유 하기</v-list-item-title>
290 + </v-list-item-content>
291 + </v-list-item>
254 </v-list> 292 </v-list>
255 </v-menu> 293 </v-menu>
256 <input 294 <input
...@@ -307,6 +345,7 @@ import { ...@@ -307,6 +345,7 @@ import {
307 addFavoriteFile, 345 addFavoriteFile,
308 detailFile, 346 detailFile,
309 modifyFile, 347 modifyFile,
348 + shareFile,
310 } from '../api/index'; 349 } from '../api/index';
311 import Axios from 'axios'; 350 import Axios from 'axios';
312 351
...@@ -325,6 +364,9 @@ export default { ...@@ -325,6 +364,9 @@ export default {
325 files: [], 364 files: [],
326 search: '', 365 search: '',
327 id: '', 366 id: '',
367 + share_file_name: '',
368 + showShareF: false,
369 + targetUid: '',
328 current_filename: null, //파일 상세정보 (이름) 370 current_filename: null, //파일 상세정보 (이름)
329 current_filedata: null, //파일 상세정보 (내용) 371 current_filedata: null, //파일 상세정보 (내용)
330 dialog: false, 372 dialog: false,
...@@ -664,6 +706,25 @@ export default { ...@@ -664,6 +706,25 @@ export default {
664 console.log(error); 706 console.log(error);
665 } 707 }
666 }, 708 },
709 + async file_share() {
710 + try {
711 + const shareData = {
712 + id: this.$store.state.id,
713 + cur: this.$store.state.cur,
714 + file_name: this.cfilename.file_name,
715 + target_id: this.targetUid,
716 + };
717 + const response = await shareFile(shareData);
718 + if (response.status == 200) {
719 + alert('파일 공유 완료');
720 + }
721 + } catch (error) {
722 + console.log('에러');
723 + alert('존재 하지 않은 유저입니다.');
724 + } finally {
725 + this.showShareF = false;
726 + }
727 + },
667 show(folderObj, e) { 728 show(folderObj, e) {
668 e.preventDefault(); 729 e.preventDefault();
669 this.curfName = folderObj; 730 this.curfName = folderObj;
......