박기범

add edit file function

{
"accessKeyId": "ASIAXZL2SWFEYG2GUYVJ",
"secretAccessKey": "ceYvfLs25iiBDfigO7PbP67kJoKswJdfduqROrJt",
"sessionToken": "FwoGZXIvYXdzEDMaDGvezwF9kQrAJ+uhfSLDASWFKBk7UNbRzZVEM1eoGJ3E+UI9d4xSpqEDqRYjsOTn5wYIGM3mUCZ8S6/XCnGP5yFz+qv9mBLDf311iP9ajY091OhQ8c2nB6l+JHuRKAz6FhGLrjHtD1AecHtjHOu5dXODU2+9ctvGj7V60KYqjToah5Tvv84EVac/41Les3rtrqcXS/bbmVwv5kDz9K1FJStln4sXZ/foueGHZAkAJQ6LAtIQWg4/reFUcWAi8E0bUjMckmymDQhnVNWcSbgQ+htBYiiPg+P2BTItOqWuZojM5lw32rTv7+PuOaeyHjx3+Vcd4bo3orSJr57P2ZPfmglZNKY7W5aw",
"accessKeyId": "ASIAXZL2SWFE2KIQ3YTL",
"secretAccessKey": "BqniXH7AqxjndKHjxBWKjRkBOgRmSN8J6mgldm7C",
"sessionToken": "FwoGZXIvYXdzEIL//////////wEaDC6uNIWZKpDL9FekbiLDAb7ckeHQwp1tV2wu236TIia7VBtYMFQrLzkEm6sU7GiamzWfzrTCsQOOJXYMKzElNXD7dRckn30aVaw8xfNDgimqWdtk9O3x8jgCOp4gXk4KIUgtIFpN46qdGNxy28gL43voIf4O6n3boJaUum9bmejzmNlR8U4d6NfqMzrtJENs47Nl4fAiK8bIGlsznhr7MC5AUeZbV0d9uK7bkx1rn5zRRpR9WbbwofVIlK+YSEEHfQIJyLeJKDlprBXfqSTynCqkAyj8ovT2BTItQ8+cOmQXWuzPMA/Rbru2naLM3Hd2H8jEW6CMfPXvNAS+leVNDXuCY5r5Ebo9",
"region": "us-east-1"
}
......
......@@ -16,7 +16,7 @@
var AWS = require('aws-sdk');
AWS.config.update({ region: 'ap-northeast-2' });
var BUCKET_NAME = 'khuloud';
var BUCKET_NAME = 'qkrrlqja-test';
var s3 = new AWS.S3();
var fs = require('fs');
......@@ -329,7 +329,7 @@ var S3 = {
})
}
})
},
},
renameFile: function(bucketName, userId, sourceFile, modiFile, targetPath, callback){
// sourceFile = test.txt
......
......@@ -53,7 +53,7 @@ function uploadFile(fileData) {
}
function detailFile(fileData) {
return axios.get(`/api/file/${fileData.name}`, {
return axios.get(`/api/file/${fileData.fileName}`, {
params: {
id: fileData.id,
cur: fileData.cur,
......@@ -79,6 +79,25 @@ function downloadFile(fileData) {
},
});
}
function accessedList(curData) {
return axios.get(`api/quick`, {
params: {
//현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다.
id: curData.id
},
});
}
function modifyFile(fileData){
return axios.post(`/api/file/modify/${fileName}`, {
params: {
user_id: fileData.id,
cur: fileData.cur,
name: fileData.rename,
content: fileData.content
},
});
}
export {
registerUser,
......@@ -91,4 +110,7 @@ export {
uploadFile,
deleteFile,
downloadFile,
accessedList,
detailFile,
modifyFile
};
......
<template lang="html">
<v-dialog
v-model="dialog"
max-width="290"
>
<v-card>
<v-card-title class="headline">Use Google's location service?</v-card-title>
<v-card-text>
Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="green darken-1"
text
@click="dialog = false"
>
Disagree
</v-btn>
<v-btn
color="green darken-1"
text
@click="dialog = false"
>
Agree
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
export default {
data(){
return{
dialog: false,
}
},
}
</script>
<style lang="css" scoped>
</style>
......@@ -75,7 +75,7 @@
</v-dialog>
<v-divider inset></v-divider>
<v-subheader inset>Files</v-subheader>
<v-list-item v-for="item in this.$store.getters.fileL" :key="item.title">
<v-list-item v-for="item in this.$store.getters.fileL" :key="item.title" @click.stop="dialog_file = true; file_detail(item)">
<v-list-item-avatar>
<v-icon> mdi-file</v-icon>
</v-list-item-avatar>
......@@ -83,14 +83,35 @@
<v-list-item-title v-text="item.file_name"></v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click="download_file(item.file_name)">
<v-icon color="grey lighten-1">mdi-download</v-icon>
</v-btn>
<v-btn icon @click="delete_file(item.file_name)">
<v-icon color="grey lighten-1">mdi-delete</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list-item-action>
<v-dialog
v-model="dialog_file"
max-width="290"
>
<v-card>
<v-card-title class="headline">
<v-text-field v-model="current_filename" v-text="current_filename"></v-text-field>
</v-card-title>
<v-card-text v-model="current_filedata" v-text="current_filedata"></v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="green darken-1"
text
@click="dialog_file = false; modify_file(item);"
>
save
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-btn icon @click="download_file(item.file_name)">
<v-icon color="grey lighten-1">mdi-download</v-icon>
</v-btn>
<v-btn icon @click="delete_file(item.file_name)">
<v-icon color="grey lighten-1">mdi-delete</v-icon>
</v-btn>
</v-list-item>
</v-list>
<input
id="file-selector"
......@@ -170,9 +191,12 @@ import {
uploadFile,
deleteFile,
downloadFile,
detailFile,
modifyFile
} from '../api/index';
import Axios from 'axios';
export default {
data() {
return {
......@@ -189,6 +213,9 @@ export default {
x: 0,
y: 0,
dialog2: false,
dialog_file: false,
current_filename: null,
current_filedata: null,
detail: {
dataname: null,
date: null,
......@@ -397,6 +424,45 @@ export default {
console.log(error);
}
},
async file_detail(fileData){
try{
const currentData = {
id: fileData.user_id,
cur: fileData.location,
fileName: fileData.file_name
}
const detailData = await detailFile(currentData)
console.log(detailData)
this.current_filename = detailData.file_name;
this.current_filedata = detailFile.content;
}catch(error){
console.log('에러');
console.log(error);
}
},
async modify_file(fileData){
try{
const modifyData = {
user_id: fileData.user_id,
cur: fileData.location,
name: this.current_filename,
content: this.current_filedata
}
const result = await modifyFile(modifyData);
const after_data={
id: fileData.user_id,
cur: fileData.location,
fileName: this.current_filename
}
const detailData = await detailFile(after_data)
this.current_filename = detailData.file_name;
this.current_filedata = detailData.content;
}catch(error){
console.log('에러');
console.log(error);
}
}
},
show(folderN, e) {
e.preventDefault();
......
......@@ -24,12 +24,12 @@
</template>
<script>
import { accessed_list } from '../api/index';
import { accessedList } from '../api/index';
import Axios from 'axios';
export default {
data() {
return {
recent_list = []
recent_list : []
}
},
async created(){
......@@ -38,9 +38,9 @@
id : this.$store.state.id,
}
console.log(curData);
const list_reponse = await accessed_list(curData);
const list_reponse = await accessedList(curData);
this.$store.commit('setRecentList', list_reponse.data)
this.recent_list = this.$stroe.getters.recentL;
this.recent_list = this.$store.getters.recentL;
console.log(this.$store.getters.recentL);
} catch (error) {
console.log("에러");
......
<template lang="html">
<FileDetail></FileDetail>
</template>
<script>
import FileDetail from '@/components/FileDetail'
export default {
components:{
FileDetail
}
}
</script>
<style lang="css" scoped>
</style>
......@@ -21,7 +21,7 @@
</v-flex>
<v-flex><br><v-divider></v-divider><br></v-flex>
<v-container>
<accessList></accessList>
</v-container>
</v-flex>
<v-flex><br><v-divider></v-divider><br></v-flex>
......@@ -55,7 +55,7 @@
<script>
import Filecard from '@/components/accessList.vue'
import accessList from '@/components/accessList.vue'
export default {
data () {
return {
......
......@@ -27,6 +27,10 @@
<v-toolbar-title>빠른 액세스</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-container>
<accessList></accessList>
</v-container>
<!--
<v-simple-table>
<template v-slot:default>
<thead>
......@@ -43,6 +47,7 @@
</tbody>
</template>
</v-simple-table>
-->
<v-divider></v-divider>
</v-flex>
</v-layout>
......@@ -52,6 +57,7 @@
<script>
import accessList from '@/components/accessList.vue'
import FileList from '@/components/FileList'
import Favlist from '@/components/Fav_list'
import Filecard from '@/components/FileCardlist.vue'
......@@ -59,7 +65,8 @@
components:{
FileList,
Favlist,
Filecard
Filecard,
accessList
},
data () {
return {
......