박기범

add edit file function

1 { 1 {
2 - "accessKeyId": "ASIAXZL2SWFEYG2GUYVJ", 2 + "accessKeyId": "ASIAXZL2SWFE2KIQ3YTL",
3 - "secretAccessKey": "ceYvfLs25iiBDfigO7PbP67kJoKswJdfduqROrJt", 3 + "secretAccessKey": "BqniXH7AqxjndKHjxBWKjRkBOgRmSN8J6mgldm7C",
4 - "sessionToken": "FwoGZXIvYXdzEDMaDGvezwF9kQrAJ+uhfSLDASWFKBk7UNbRzZVEM1eoGJ3E+UI9d4xSpqEDqRYjsOTn5wYIGM3mUCZ8S6/XCnGP5yFz+qv9mBLDf311iP9ajY091OhQ8c2nB6l+JHuRKAz6FhGLrjHtD1AecHtjHOu5dXODU2+9ctvGj7V60KYqjToah5Tvv84EVac/41Les3rtrqcXS/bbmVwv5kDz9K1FJStln4sXZ/foueGHZAkAJQ6LAtIQWg4/reFUcWAi8E0bUjMckmymDQhnVNWcSbgQ+htBYiiPg+P2BTItOqWuZojM5lw32rTv7+PuOaeyHjx3+Vcd4bo3orSJr57P2ZPfmglZNKY7W5aw", 4 + "sessionToken": "FwoGZXIvYXdzEIL//////////wEaDC6uNIWZKpDL9FekbiLDAb7ckeHQwp1tV2wu236TIia7VBtYMFQrLzkEm6sU7GiamzWfzrTCsQOOJXYMKzElNXD7dRckn30aVaw8xfNDgimqWdtk9O3x8jgCOp4gXk4KIUgtIFpN46qdGNxy28gL43voIf4O6n3boJaUum9bmejzmNlR8U4d6NfqMzrtJENs47Nl4fAiK8bIGlsznhr7MC5AUeZbV0d9uK7bkx1rn5zRRpR9WbbwofVIlK+YSEEHfQIJyLeJKDlprBXfqSTynCqkAyj8ovT2BTItQ8+cOmQXWuzPMA/Rbru2naLM3Hd2H8jEW6CMfPXvNAS+leVNDXuCY5r5Ebo9",
5 "region": "us-east-1" 5 "region": "us-east-1"
6 } 6 }
......
1 -asdf
...\ No newline at end of file ...\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 var AWS = require('aws-sdk'); 16 var AWS = require('aws-sdk');
17 AWS.config.update({ region: 'ap-northeast-2' }); 17 AWS.config.update({ region: 'ap-northeast-2' });
18 18
19 -var BUCKET_NAME = 'khuloud'; 19 +var BUCKET_NAME = 'qkrrlqja-test';
20 20
21 var s3 = new AWS.S3(); 21 var s3 = new AWS.S3();
22 var fs = require('fs'); 22 var fs = require('fs');
...@@ -329,7 +329,7 @@ var S3 = { ...@@ -329,7 +329,7 @@ var S3 = {
329 }) 329 })
330 } 330 }
331 }) 331 })
332 - }, 332 + },
333 333
334 renameFile: function(bucketName, userId, sourceFile, modiFile, targetPath, callback){ 334 renameFile: function(bucketName, userId, sourceFile, modiFile, targetPath, callback){
335 // sourceFile = test.txt 335 // sourceFile = test.txt
......
...@@ -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,
...@@ -79,6 +79,25 @@ function downloadFile(fileData) { ...@@ -79,6 +79,25 @@ function downloadFile(fileData) {
79 }, 79 },
80 }); 80 });
81 } 81 }
82 +function accessedList(curData) {
83 + return axios.get(`api/quick`, {
84 + params: {
85 + //현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다.
86 + id: curData.id
87 + },
88 + });
89 +}
90 +function modifyFile(fileData){
91 + return axios.post(`/api/file/modify/${fileName}`, {
92 + params: {
93 + user_id: fileData.id,
94 + cur: fileData.cur,
95 + name: fileData.rename,
96 + content: fileData.content
97 + },
98 + });
99 +}
100 +
82 101
83 export { 102 export {
84 registerUser, 103 registerUser,
...@@ -91,4 +110,7 @@ export { ...@@ -91,4 +110,7 @@ export {
91 uploadFile, 110 uploadFile,
92 deleteFile, 111 deleteFile,
93 downloadFile, 112 downloadFile,
113 + accessedList,
114 + detailFile,
115 + modifyFile
94 }; 116 };
......
1 +<template lang="html">
2 + <v-dialog
3 + v-model="dialog"
4 + max-width="290"
5 + >
6 + <v-card>
7 + <v-card-title class="headline">Use Google's location service?</v-card-title>
8 +
9 + <v-card-text>
10 + Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.
11 + </v-card-text>
12 +
13 + <v-card-actions>
14 + <v-spacer></v-spacer>
15 +
16 + <v-btn
17 + color="green darken-1"
18 + text
19 + @click="dialog = false"
20 + >
21 + Disagree
22 + </v-btn>
23 +
24 + <v-btn
25 + color="green darken-1"
26 + text
27 + @click="dialog = false"
28 + >
29 + Agree
30 + </v-btn>
31 + </v-card-actions>
32 + </v-card>
33 + </v-dialog>
34 +</template>
35 +
36 +<script>
37 +export default {
38 + data(){
39 + return{
40 + dialog: false,
41 + }
42 + },
43 +}
44 +</script>
45 +
46 +<style lang="css" scoped>
47 +</style>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
75 </v-dialog> 75 </v-dialog>
76 <v-divider inset></v-divider> 76 <v-divider inset></v-divider>
77 <v-subheader inset>Files</v-subheader> 77 <v-subheader inset>Files</v-subheader>
78 - <v-list-item v-for="item in this.$store.getters.fileL" :key="item.title"> 78 + <v-list-item v-for="item in this.$store.getters.fileL" :key="item.title" @click.stop="dialog_file = true; file_detail(item)">
79 <v-list-item-avatar> 79 <v-list-item-avatar>
80 <v-icon> mdi-file</v-icon> 80 <v-icon> mdi-file</v-icon>
81 </v-list-item-avatar> 81 </v-list-item-avatar>
...@@ -83,14 +83,35 @@ ...@@ -83,14 +83,35 @@
83 <v-list-item-title v-text="item.file_name"></v-list-item-title> 83 <v-list-item-title v-text="item.file_name"></v-list-item-title>
84 </v-list-item-content> 84 </v-list-item-content>
85 <v-list-item-action> 85 <v-list-item-action>
86 - <v-btn icon @click="download_file(item.file_name)"> 86 + </v-list-item-action>
87 - <v-icon color="grey lighten-1">mdi-download</v-icon> 87 + <v-dialog
88 - </v-btn> 88 + v-model="dialog_file"
89 - <v-btn icon @click="delete_file(item.file_name)"> 89 + max-width="290"
90 - <v-icon color="grey lighten-1">mdi-delete</v-icon> 90 + >
91 - </v-btn> 91 + <v-card>
92 - </v-list-item-action> 92 + <v-card-title class="headline">
93 - </v-list-item> 93 + <v-text-field v-model="current_filename" v-text="current_filename"></v-text-field>
94 + </v-card-title>
95 + <v-card-text v-model="current_filedata" v-text="current_filedata"></v-card-text>
96 + <v-card-actions>
97 + <v-spacer></v-spacer>
98 + <v-btn
99 + color="green darken-1"
100 + text
101 + @click="dialog_file = false; modify_file(item);"
102 + >
103 + save
104 + </v-btn>
105 + </v-card-actions>
106 + </v-card>
107 + </v-dialog>
108 + <v-btn icon @click="download_file(item.file_name)">
109 + <v-icon color="grey lighten-1">mdi-download</v-icon>
110 + </v-btn>
111 + <v-btn icon @click="delete_file(item.file_name)">
112 + <v-icon color="grey lighten-1">mdi-delete</v-icon>
113 + </v-btn>
114 + </v-list-item>
94 </v-list> 115 </v-list>
95 <input 116 <input
96 id="file-selector" 117 id="file-selector"
...@@ -170,9 +191,12 @@ import { ...@@ -170,9 +191,12 @@ import {
170 uploadFile, 191 uploadFile,
171 deleteFile, 192 deleteFile,
172 downloadFile, 193 downloadFile,
194 + detailFile,
195 + modifyFile
173 } from '../api/index'; 196 } from '../api/index';
174 import Axios from 'axios'; 197 import Axios from 'axios';
175 198
199 +
176 export default { 200 export default {
177 data() { 201 data() {
178 return { 202 return {
...@@ -189,6 +213,9 @@ export default { ...@@ -189,6 +213,9 @@ export default {
189 x: 0, 213 x: 0,
190 y: 0, 214 y: 0,
191 dialog2: false, 215 dialog2: false,
216 + dialog_file: false,
217 + current_filename: null,
218 + current_filedata: null,
192 detail: { 219 detail: {
193 dataname: null, 220 dataname: null,
194 date: null, 221 date: null,
...@@ -397,6 +424,45 @@ export default { ...@@ -397,6 +424,45 @@ export default {
397 console.log(error); 424 console.log(error);
398 } 425 }
399 }, 426 },
427 + async file_detail(fileData){
428 + try{
429 + const currentData = {
430 + id: fileData.user_id,
431 + cur: fileData.location,
432 + fileName: fileData.file_name
433 + }
434 + const detailData = await detailFile(currentData)
435 + console.log(detailData)
436 + this.current_filename = detailData.file_name;
437 + this.current_filedata = detailFile.content;
438 + }catch(error){
439 + console.log('에러');
440 + console.log(error);
441 + }
442 + },
443 + async modify_file(fileData){
444 + try{
445 + const modifyData = {
446 + user_id: fileData.user_id,
447 + cur: fileData.location,
448 + name: this.current_filename,
449 + content: this.current_filedata
450 + }
451 +
452 + const result = await modifyFile(modifyData);
453 + const after_data={
454 + id: fileData.user_id,
455 + cur: fileData.location,
456 + fileName: this.current_filename
457 + }
458 + const detailData = await detailFile(after_data)
459 + this.current_filename = detailData.file_name;
460 + this.current_filedata = detailData.content;
461 + }catch(error){
462 + console.log('에러');
463 + console.log(error);
464 + }
465 + }
400 }, 466 },
401 show(folderN, e) { 467 show(folderN, e) {
402 e.preventDefault(); 468 e.preventDefault();
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
24 </template> 24 </template>
25 25
26 <script> 26 <script>
27 - import { accessed_list } from '../api/index'; 27 + import { accessedList } from '../api/index';
28 import Axios from 'axios'; 28 import Axios from 'axios';
29 export default { 29 export default {
30 data() { 30 data() {
31 return { 31 return {
32 - recent_list = [] 32 + recent_list : []
33 } 33 }
34 }, 34 },
35 async created(){ 35 async created(){
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
38 id : this.$store.state.id, 38 id : this.$store.state.id,
39 } 39 }
40 console.log(curData); 40 console.log(curData);
41 - const list_reponse = await accessed_list(curData); 41 + const list_reponse = await accessedList(curData);
42 this.$store.commit('setRecentList', list_reponse.data) 42 this.$store.commit('setRecentList', list_reponse.data)
43 - this.recent_list = this.$stroe.getters.recentL; 43 + this.recent_list = this.$store.getters.recentL;
44 console.log(this.$store.getters.recentL); 44 console.log(this.$store.getters.recentL);
45 } catch (error) { 45 } catch (error) {
46 console.log("에러"); 46 console.log("에러");
......
1 +<template lang="html">
2 + <FileDetail></FileDetail>
3 +</template>
4 +
5 +<script>
6 +import FileDetail from '@/components/FileDetail'
7 +export default {
8 + components:{
9 + FileDetail
10 + }
11 +}
12 +</script>
13 +
14 +<style lang="css" scoped>
15 +</style>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 </v-flex> 21 </v-flex>
22 <v-flex><br><v-divider></v-divider><br></v-flex> 22 <v-flex><br><v-divider></v-divider><br></v-flex>
23 <v-container> 23 <v-container>
24 - 24 + <accessList></accessList>
25 </v-container> 25 </v-container>
26 </v-flex> 26 </v-flex>
27 <v-flex><br><v-divider></v-divider><br></v-flex> 27 <v-flex><br><v-divider></v-divider><br></v-flex>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
55 55
56 56
57 <script> 57 <script>
58 - import Filecard from '@/components/accessList.vue' 58 + import accessList from '@/components/accessList.vue'
59 export default { 59 export default {
60 data () { 60 data () {
61 return { 61 return {
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
27 <v-toolbar-title>빠른 액세스</v-toolbar-title> 27 <v-toolbar-title>빠른 액세스</v-toolbar-title>
28 <v-spacer></v-spacer> 28 <v-spacer></v-spacer>
29 </v-toolbar> 29 </v-toolbar>
30 + <v-container>
31 + <accessList></accessList>
32 + </v-container>
33 + <!--
30 <v-simple-table> 34 <v-simple-table>
31 <template v-slot:default> 35 <template v-slot:default>
32 <thead> 36 <thead>
...@@ -43,6 +47,7 @@ ...@@ -43,6 +47,7 @@
43 </tbody> 47 </tbody>
44 </template> 48 </template>
45 </v-simple-table> 49 </v-simple-table>
50 + -->
46 <v-divider></v-divider> 51 <v-divider></v-divider>
47 </v-flex> 52 </v-flex>
48 </v-layout> 53 </v-layout>
...@@ -52,6 +57,7 @@ ...@@ -52,6 +57,7 @@
52 57
53 58
54 <script> 59 <script>
60 + import accessList from '@/components/accessList.vue'
55 import FileList from '@/components/FileList' 61 import FileList from '@/components/FileList'
56 import Favlist from '@/components/Fav_list' 62 import Favlist from '@/components/Fav_list'
57 import Filecard from '@/components/FileCardlist.vue' 63 import Filecard from '@/components/FileCardlist.vue'
...@@ -59,7 +65,8 @@ ...@@ -59,7 +65,8 @@
59 components:{ 65 components:{
60 FileList, 66 FileList,
61 Favlist, 67 Favlist,
62 - Filecard 68 + Filecard,
69 + accessList
63 }, 70 },
64 data () { 71 data () {
65 return { 72 return {
......