박기범

add detail and edit api

1 -this is the second test edit
...\ No newline at end of file ...\ No newline at end of file
...@@ -53,7 +53,7 @@ function uploadFile(fileData) { ...@@ -53,7 +53,7 @@ function uploadFile(fileData) {
53 } 53 }
54 54
55 function detailFile(fileData) { 55 function detailFile(fileData) {
56 - return axios.get(`/api/file/${fileData.name}`, { 56 + return axios.get(`/api/file/${fileData.fileName}`, {
57 params: { 57 params: {
58 id: fileData.id, 58 id: fileData.id,
59 cur: fileData.cur, 59 cur: fileData.cur,
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
46 v-for="item in this.$store.getters.fileL" 46 v-for="item in this.$store.getters.fileL"
47 :key="item.title" 47 :key="item.title"
48 @click.right="showF(item, $event)" 48 @click.right="showF(item, $event)"
49 + @dblclick="detailF(item, $event); file_detail(item);"
49 @click="" 50 @click=""
50 > 51 >
51 <v-list-item-avatar> 52 <v-list-item-avatar>
...@@ -65,7 +66,30 @@ ...@@ -65,7 +66,30 @@
65 </v-list-item-action> 66 </v-list-item-action>
66 </v-list-item> 67 </v-list-item>
67 </v-list> 68 </v-list>
68 - 69 + <!--file detial -->
70 + <v-dialog
71 + v-model="showdetailF"
72 + max-width="290"
73 + >
74 + <v-card>
75 + <v-card-title class="headline">
76 + <v-text-field v-model="current_filename" ></v-text-field>
77 + </v-card-title>
78 + <v-card-text>
79 + <v-text-field v-model="current_filedata" ></v-text-field>
80 + </v-card-text>
81 + <v-card-actions>
82 + <v-spacer></v-spacer>
83 + <v-btn
84 + color="green darken-1"
85 + text
86 + @click="showdetailF = false; modify_file();"
87 + >
88 + save
89 + </v-btn>
90 + </v-card-actions>
91 + </v-card>
92 + </v-dialog>
69 <!-- Move Folder --> 93 <!-- Move Folder -->
70 <v-dialog v-model="dialog2" width="500px"> 94 <v-dialog v-model="dialog2" width="500px">
71 <v-card> 95 <v-card>
...@@ -281,6 +305,8 @@ import { ...@@ -281,6 +305,8 @@ import {
281 moveFile, 305 moveFile,
282 delFavoriteFile, 306 delFavoriteFile,
283 addFavoriteFile, 307 addFavoriteFile,
308 + detailFile,
309 + modifyFile
284 } from '../api/index'; 310 } from '../api/index';
285 import Axios from 'axios'; 311 import Axios from 'axios';
286 312
...@@ -295,10 +321,13 @@ export default { ...@@ -295,10 +321,13 @@ export default {
295 files: [], 321 files: [],
296 search: '', 322 search: '',
297 id: '', 323 id: '',
324 + current_filename: null, //파일 상세정보 (이름)
325 + current_filedata: null, //파일 상세정보 (내용)
298 dialog: false, 326 dialog: false,
299 howMenu: false, 327 howMenu: false,
300 showMenu: false, 328 showMenu: false,
301 showMenuF: false, //파일 관련 메뉴 329 showMenuF: false, //파일 관련 메뉴
330 + showdetailF:false, //txt 파일 상세정보 및 수정
302 x: 0, 331 x: 0,
303 y: 0, 332 y: 0,
304 dialog2: false, 333 dialog2: false,
...@@ -587,6 +616,44 @@ export default { ...@@ -587,6 +616,44 @@ export default {
587 this.dialog3 = false; 616 this.dialog3 = false;
588 } 617 }
589 }, 618 },
619 + async file_detail(){
620 + try{
621 + const currentData = {
622 + id: this.cfilename.user_id,
623 + cur: this.cfilename.location,
624 + fileName: this.cfilename.file_name
625 + }
626 + const detailData = await detailFile(currentData)
627 + this.current_filename = detailData.data.file_name;
628 + this.current_filedata = detailData.data.content;
629 + console.log(this.current_filename);
630 + console.log(this.current_filedata);
631 + }catch(error){
632 + console.log('에러');
633 + console.log(error);
634 + }
635 + },
636 + async modify_file(){
637 + try{
638 + const modifyData = {
639 + user_id: cfilename.user_id,
640 + cur: cfilename.location,
641 + name: this.current_filename,
642 + content: this.current_filedata
643 + }
644 +
645 + const result = await modifyFile(modifyData);
646 + const after_data={
647 + id: cfilename.user_id,
648 + cur: cfilename.location,
649 + fileName: this.current_filename
650 + }
651 + const detailData = await detailFile()
652 + }catch(error){
653 + console.log('에러');
654 + console.log(error);
655 + }
656 + },
590 show(folderObj, e) { 657 show(folderObj, e) {
591 e.preventDefault(); 658 e.preventDefault();
592 this.curfName = folderObj; 659 this.curfName = folderObj;
...@@ -607,6 +674,16 @@ export default { ...@@ -607,6 +674,16 @@ export default {
607 this.showMenuF = true; 674 this.showMenuF = true;
608 }); 675 });
609 }, 676 },
677 + detailF(fileObj, e) {
678 + e.preventDefault();
679 + this.cfilename = fileObj;
680 + this.showdetailF = false;
681 + this.x = e.clientX;
682 + this.y = e.clientY;
683 + this.$nextTick(() => {
684 + this.showdetailF = true;
685 + });
686 + },
610 }, 687 },
611 }; 688 };
612 </script> 689 </script>
......