최동원

file share

......@@ -9,7 +9,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" integrity="본인 api키" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" integrity="sha384-Bfad6CLCknfcloXFOyFnlgtENryhrpZCe29RTifKEixXQZ38WheV+i/6YWSzkz3V" crossorigin="anonymous">
</head>
<body>
<noscript>
......
......@@ -39,7 +39,7 @@ function file(curData) {
return axios.get('/api/file', {
params: {
id: curData.id,
folder_id: curData.cur,
cur: curData.cur,
},
});
}
......@@ -121,6 +121,10 @@ function getFavoriteList(userId) {
});
}
function shareFile(shareData) {
return axios.post('/api/share', shareData);
}
export {
registerUser,
loginUser,
......@@ -141,4 +145,5 @@ export {
detailFile,
modifyFile,
getFavoriteList,
shareFile,
};
......
......@@ -93,6 +93,28 @@
</v-card-actions>
</v-card>
</v-dialog>
<!-- file share menu -->
<v-dialog v-model="showShareF">
<v-card>
<v-card-title>
Share File
</v-card-title>
<v-card-text>
<v-text-field v-model="this.cfilename.file_name"></v-text-field>
</v-card-text>
<v-card-text>
<v-text-field
v-model="targetUid"
label="target user id"
></v-text-field>
</v-card-text>
<v-card-cation>
<v-spacer></v-spacer>
<v-btn @click.prevent="file_share">ok</v-btn>
<v-btn @click="showShareF = false">cancle</v-btn>
</v-card-cation>
</v-card>
</v-dialog>
<!-- Move Folder -->
<v-dialog v-model="dialog2" width="500px">
<v-card>
......@@ -233,7 +255,7 @@
</v-list-item>
<v-list-item
v-if="cfilename.favorite === 1"
@click="delete_favorite_file"
@click.prevent="delete_favorite_file"
>
<v-list-item-icon>
<v-icon>mdi-star-outline</v-icon>
......@@ -242,7 +264,10 @@
<v-list-item-title>즐겨 찾기 삭제</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item v-if="cfilename.favorite === 0" @click="add_favorite_file">
<v-list-item
v-if="cfilename.favorite === 0"
@click.prevent="add_favorite_file"
>
<v-list-item-icon>
<v-icon>mdi-star</v-icon>
</v-list-item-icon>
......@@ -250,6 +275,14 @@
<v-list-item-title>즐겨 찾기 추가</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item @click.prevent="showShareF != showShareF">
<v-list-item-icon>
<v-icon>fas fa-share-alt</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>공유 하기</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
<input
......@@ -306,6 +339,7 @@ import {
addFavoriteFile,
detailFile,
modifyFile,
shareFile,
} from '../api/index';
import Axios from 'axios';
export default {
......@@ -319,6 +353,9 @@ export default {
files: [],
search: '',
id: '',
share_file_name: '',
showShareF: false,
targetUid: '',
current_filename: null, //파일 상세정보 (이름)
current_filedata: null, //파일 상세정보 (내용)
dialog: false,
......@@ -354,11 +391,10 @@ export default {
};
console.log(curData);
const response = await folder(curData);
const file_response = await file(curData);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
this.$store.commit('setFile', file_response.data.files);
this.$store.commit('setFile', response.data.files);
this.folders = this.$store.getters.folderL;
console.log(this.$store.getters.fileL);
this.files = this.$store.getters.fileL;
......@@ -657,6 +693,25 @@ export default {
console.log(error);
}
},
async file_share() {
try {
const shareData = {
id: this.$store.state.id,
cur: this.$store.state.cur,
file_name: this.cfilename.file_name,
target_id: this.targetUid,
};
const response = await shareFile(shareData);
if (response.status == 200) {
alert('파일 공유 완료');
}
} catch (error) {
console.log('에러');
alert('존재 하지 않은 유저입니다.');
} finally {
this.showShareF = false;
}
},
show(folderObj, e) {
e.preventDefault();
this.curfName = folderObj;
......
......@@ -31,14 +31,6 @@
<v-list-item-title>즐겨찾기</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item router :to="{ name: 'Fav' }" exact>
<v-list-item-action>
<v-icon>fas fa-share-alt</v-icon>
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>공유</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item router :to="{ name: 'Quick' }" exact>
<v-list-item-action>
<v-icon>mdi-history</v-icon>
......
......@@ -94,6 +94,28 @@
</v-card-actions>
</v-card>
</v-dialog>
<!-- file share menu -->
<v-dialog v-model="showShareF">
<v-card>
<v-card-title>
Share File
</v-card-title>
<v-card-text>
<v-text-field v-model="this.cfilename.file_name"></v-text-field>
</v-card-text>
<v-card-text>
<v-text-field
v-model="targetUid"
label="target user id"
></v-text-field>
</v-card-text>
<v-card-cation>
<v-spacer></v-spacer>
<v-btn @click.prevent="file_share">ok</v-btn>
<v-btn @click="showShareF = false">cancle</v-btn>
</v-card-cation>
</v-card>
</v-dialog>
<!-- Move Folder -->
<v-dialog v-model="dialog2" width="500px">
<v-card>
......@@ -166,6 +188,14 @@
<v-list-item-title>즐겨 찾기 추가</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-icon>
<v-icon>fas fa-share-alt</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>공유 하기</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
<!-- -->
......@@ -251,6 +281,14 @@
<v-list-item-title>즐겨 찾기 추가</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item @click.prevent="showShareF != showShareF">
<v-list-item-icon>
<v-icon>fas fa-share-alt</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>공유 하기</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
<input
......@@ -307,6 +345,7 @@ import {
addFavoriteFile,
detailFile,
modifyFile,
shareFile,
} from '../api/index';
import Axios from 'axios';
......@@ -325,6 +364,9 @@ export default {
files: [],
search: '',
id: '',
share_file_name: '',
showShareF: false,
targetUid: '',
current_filename: null, //파일 상세정보 (이름)
current_filedata: null, //파일 상세정보 (내용)
dialog: false,
......@@ -664,6 +706,25 @@ export default {
console.log(error);
}
},
async file_share() {
try {
const shareData = {
id: this.$store.state.id,
cur: this.$store.state.cur,
file_name: this.cfilename.file_name,
target_id: this.targetUid,
};
const response = await shareFile(shareData);
if (response.status == 200) {
alert('파일 공유 완료');
}
} catch (error) {
console.log('에러');
alert('존재 하지 않은 유저입니다.');
} finally {
this.showShareF = false;
}
},
show(folderObj, e) {
e.preventDefault();
this.curfName = folderObj;
......