Hong

Merge branch 'share,favorite' of http://khuhub.khu.ac.kr/2020-1-CloudComputing/D…

…_Team_Khuloud into share,favorite
...@@ -80,6 +80,10 @@ function downloadFile(fileData) { ...@@ -80,6 +80,10 @@ function downloadFile(fileData) {
80 }); 80 });
81 } 81 }
82 82
83 +function changeFavorite() {
84 + return axios.post();
85 +}
86 +
83 export { 87 export {
84 registerUser, 88 registerUser,
85 loginUser, 89 loginUser,
...@@ -91,4 +95,5 @@ export { ...@@ -91,4 +95,5 @@ export {
91 uploadFile, 95 uploadFile,
92 deleteFile, 96 deleteFile,
93 downloadFile, 97 downloadFile,
98 + changeFavorite,
94 }; 99 };
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 v-for="item in this.$store.getters.folderL" 18 v-for="item in this.$store.getters.folderL"
19 :key="item.title" 19 :key="item.title"
20 :search="search" 20 :search="search"
21 - @click.right="show(item.folder_name, $event)" 21 + @click.right="show(item, $event)"
22 @click.left="moveF(item.folder_name)" 22 @click.left="moveF(item.folder_name)"
23 > 23 >
24 <v-list-item-avatar> 24 <v-list-item-avatar>
...@@ -27,6 +27,15 @@ ...@@ -27,6 +27,15 @@
27 <v-list-item-content> 27 <v-list-item-content>
28 <v-list-item-title v-text="item.folder_name"></v-list-item-title> 28 <v-list-item-title v-text="item.folder_name"></v-list-item-title>
29 </v-list-item-content> 29 </v-list-item-content>
30 + <v-list-item-action>
31 + <v-icon v-if="item.favorite === 'false'" color="grey lighten-1">
32 + star_border
33 + </v-icon>
34 +
35 + <v-icon v-else color="yellow">
36 + star
37 + </v-icon>
38 + </v-list-item-action>
30 </v-list-item> 39 </v-list-item>
31 40
32 <v-divider inset></v-divider> 41 <v-divider inset></v-divider>
...@@ -60,7 +69,7 @@ ...@@ -60,7 +69,7 @@
60 v-for="item2 in folders" 69 v-for="item2 in folders"
61 :key="item2.folder_id" 70 :key="item2.folder_id"
62 @click.left="transferF(item2.folder_name)" 71 @click.left="transferF(item2.folder_name)"
63 - v-if="item2.folder_name !== curfName" 72 + v-if="item2.folder_name !== curfName.folder_name"
64 > 73 >
65 <v-list-item-avatar> 74 <v-list-item-avatar>
66 <v-icon>mdi-folder</v-icon> 75 <v-icon>mdi-folder</v-icon>
...@@ -94,6 +103,16 @@ ...@@ -94,6 +103,16 @@
94 <v-list-item @click.prevent="deleteF"> 103 <v-list-item @click.prevent="deleteF">
95 <v-list-item-title>삭제</v-list-item-title> 104 <v-list-item-title>삭제</v-list-item-title>
96 </v-list-item> 105 </v-list-item>
106 + <template v-if="curfName.favorite === 'true'" @click="change_favorite">
107 + <v-list-item>
108 + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title>
109 + </v-list-item>
110 + </template>
111 + <template v-if="curfName.favorite === 'false'" @click="change_favorite">
112 + <v-list-item>
113 + <v-list-item-title>즐겨 찾기 추가</v-list-item-title>
114 + </v-list-item>
115 + </template>
97 </v-list> 116 </v-list>
98 </v-menu> 117 </v-menu>
99 118
...@@ -151,7 +170,7 @@ export default { ...@@ -151,7 +170,7 @@ export default {
151 return { 170 return {
152 uploadedfile: null, 171 uploadedfile: null,
153 foldername: '', 172 foldername: '',
154 - curfName: '', 173 + curfName: {},
155 folders: [], 174 folders: [],
156 files: [], 175 files: [],
157 search: '', 176 search: '',
...@@ -201,7 +220,7 @@ export default { ...@@ -201,7 +220,7 @@ export default {
201 this.foldername = ''; 220 this.foldername = '';
202 }, 221 },
203 cancelMove() { 222 cancelMove() {
204 - this.curfName = ''; 223 + this.curfName = {};
205 this.dialog2 = false; 224 this.dialog2 = false;
206 }, 225 },
207 async makeF() { 226 async makeF() {
...@@ -263,7 +282,7 @@ export default { ...@@ -263,7 +282,7 @@ export default {
263 const cData = { 282 const cData = {
264 id: this.$store.state.id, 283 id: this.$store.state.id,
265 cur: this.$store.state.cur, 284 cur: this.$store.state.cur,
266 - folder_name: this.curfName, 285 + folder_name: this.curfName.folder_name,
267 }; 286 };
268 const response = await deleteFolder(cData); 287 const response = await deleteFolder(cData);
269 console.log(response); 288 console.log(response);
...@@ -281,7 +300,7 @@ export default { ...@@ -281,7 +300,7 @@ export default {
281 const cData = { 300 const cData = {
282 id: this.$store.state.id, 301 id: this.$store.state.id,
283 cur: this.$store.state.cur, 302 cur: this.$store.state.cur,
284 - folder_name: this.curfName, 303 + folder_name: this.curfName.folder_name,
285 isfolder: true, 304 isfolder: true,
286 newPath: this.$store.state.cur + folderName + '/', 305 newPath: this.$store.state.cur + folderName + '/',
287 }; 306 };
...@@ -294,7 +313,7 @@ export default { ...@@ -294,7 +313,7 @@ export default {
294 console.log(error.response.data); 313 console.log(error.response.data);
295 } finally { 314 } finally {
296 this.initFolderName(); 315 this.initFolderName();
297 - this.curfName = ''; 316 + this.curfName = {};
298 this.dialog2 = false; 317 this.dialog2 = false;
299 } 318 }
300 }, 319 },
...@@ -369,9 +388,10 @@ export default { ...@@ -369,9 +388,10 @@ export default {
369 console.log(error); 388 console.log(error);
370 } 389 }
371 }, 390 },
372 - show(folderN, e) { 391 + async change_favorite() {},
392 + show(folderObj, e) {
373 e.preventDefault(); 393 e.preventDefault();
374 - this.curfName = folderN; 394 + this.curfName = folderObj;
375 this.showMenu = false; 395 this.showMenu = false;
376 this.x = e.clientX; 396 this.x = e.clientX;
377 this.y = e.clientY; 397 this.y = e.clientY;
......
1 -import Vue from 'vue' 1 +import Vue from 'vue';
2 -import Vuex from 'vuex' 2 +import Vuex from 'vuex';
3 3
4 -Vue.use(Vuex) 4 +Vue.use(Vuex);
5 5
6 export default new Vuex.Store({ 6 export default new Vuex.Store({
7 - state: {
8 - id: '',
9 - folders: [],
10 - files: [],
11 - cur: '/',
12 - parent: '/'
13 - },
14 - mutations: {
15 - setId(state, userid) {
16 - state.id = userid;
17 - },
18 - clearid(state) {
19 - state.id = '';
20 - },
21 - setFolder(state, folderlist) {
22 - state.folders = folderlist;
23 - },
24 - setFile(state, filelist) {
25 - state.files = filelist;
26 - },
27 - setCur(state, cur) {
28 - state.cur = cur;
29 - },
30 - setParent(state, parent) {
31 - state.parent = parent;
32 - }
33 - },
34 - getters: {
35 - isLogin(state) {
36 - return state.id !== '';
37 - },
38 - userID(state) {
39 - return state.id;
40 - },
41 - folderL(state) {
42 - return state.folders;
43 - },
44 - fileL(state) {
45 - return state.files;
46 - },
47 - cur(state) {
48 - return state.cur;
49 - },
50 - setFolder(state, folderlist){
51 - state.folders = folderlist;
52 - },
53 - setFile(state, filelist){
54 - state.files = filelist;
55 - },
56 - },
57 -})
...\ No newline at end of file ...\ No newline at end of file
7 + state: {
8 + id: '',
9 + folders: [],
10 + files: [],
11 + cur: '/',
12 + parent: '/',
13 + },
14 + mutations: {
15 + setId(state, userid) {
16 + state.id = userid;
17 + },
18 + clearid(state) {
19 + state.id = '';
20 + },
21 + setFolder(state, folderlist) {
22 + state.folders = folderlist;
23 + },
24 + setFile(state, filelist) {
25 + state.files = filelist;
26 + },
27 + setCur(state, cur) {
28 + state.cur = cur;
29 + },
30 + setParent(state, parent) {
31 + state.parent = parent;
32 + },
33 + },
34 + getters: {
35 + isLogin(state) {
36 + return state.id !== '';
37 + },
38 + userID(state) {
39 + return state.id;
40 + },
41 + folderL(state) {
42 + return state.folders;
43 + },
44 + fileL(state) {
45 + return state.files;
46 + },
47 + cur(state) {
48 + return state.cur;
49 + },
50 + setFolder(state, folderlist) {
51 + state.folders = folderlist;
52 + },
53 + setFile(state, filelist) {
54 + state.files = filelist;
55 + },
56 + },
57 +});
......