FileList.vue
6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<template>
<div>
<v-toolbar flat>
<v-toolbar-title>파일
</v-toolbar-title>
<v-spacer></v-spacer>
<v-text-field
v-model="search"
append-icon="mdi-magnify"
label="파일 검색"
single-line
hide-details
></v-text-field>
</v-toolbar>
<v-list two-line subheader>
<v-subheader inset>Folders</v-subheader>
<v-list-item
v-for="item in this.$store.getters.folderL"
:key="item.title"
@click="$router.push({name: 'Folder'})"
>
<v-list-item-avatar>
<v-icon>mdi-folder</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="item.folder_name"></v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon>
<v-icon color="grey lighten-1">mdi-information</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
<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"
@click=""
>
<v-list-item-avatar>
<v-icon> mdi-file</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="item"></v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon>
<v-icon color="grey lighten-1">mdi-information</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list>
<v-file-input
v-model="files"
color="deep-purple accent-4"
counter
label="업로드"
multiple
placeholder="파일을 화면으로 드래그앤 드롭 하거나, 이곳을 클릭하세요."
prepend-icon="mdi-paperclip"
outlined
:show-size="1000"
>
<template v-slot:selection="{ index, text }">
<v-chip
v-if="index < 2"
color="deep-purple accent-4"
dark
label
small
>
{{ text }}
</v-chip>
<span
v-else-if="index === 2"
class="overline grey--text text--darken-3 mx-2"
>
+{{ files.length - 2 }} File(s)
</span>
</template>
<<<<<<< HEAD
</v-file-input>
=======
</v-file-input>
>>>>>>> eacf2da71fd7ae8340b48d4dac8ee121a816fd94
<v-btn
bottom
color="blue"
dark
fab
fixed
right
@click="dialog = !dialog"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
<v-dialog
v-model="dialog"
width="800px"
>
<v-card>
<v-card-title class="grey darken-2">
Create Folder
</v-card-title>
<v-container>
<div>
<v-icon>mdi-folder</v-icon>
<<<<<<< HEAD
<v-text-field placeholder="name" id="foldername" type="text" v-model="foldername"></v-text-field>
=======
<v-text-field placeholder="name" id="foldername" type="text" v-model="foldername" ></v-text-field>
>>>>>>> eacf2da71fd7ae8340b48d4dac8ee121a816fd94
</div>
</v-container>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
text
color="primary"
@click="dialog = false"
>Cancel</v-btn>
<v-btn
text
@click="makeF"
>Create</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
<<<<<<< HEAD
import { folder, makeFolder } from '../api/index';
export default {
data() {
return {
foldername:'',
folders: [],
files: [],
search:'',
id: '',
dialog:false
=======
import { dropbox, makeFolder } from '../api/index';
export default {
data() {
return {
foldername: '',
folders: [],
files: [],
search:'',
id: '',
dialog: false,
>>>>>>> eacf2da71fd7ae8340b48d4dac8ee121a816fd94
}
},
async created(){
try {
<<<<<<< HEAD
const curData = {
id : this.$store.state.id,
cur: this.$store.state.cur
}
const response = await folder(curData);
console.log(response);
this.$store.commit('setFolder', response.data.folders);
=======
const userData = this.$store.state.id;
console.log(this.id);
const response = await dropbox(userData);
console.log(response);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setFile', response.data.files);
>>>>>>> eacf2da71fd7ae8340b48d4dac8ee121a816fd94
} catch (error) {
console.log("에러");
console.log(error.response.data);
}
},
<<<<<<< HEAD
methods: {
initFolderName(){
this.foldername = '';
},
async makeF(){
try {
const folderData = {
user_id : this.$store.state.id,
cur : this.$store.state.cur,
folder_name : this.foldername
};
const response = await makeFolder(folderData);
console.log(response.data)
console.log("폴더 생성 완료");
this.$store.commit('setFolder', response.data.folders);
} catch (error) {
console.log("에러");
console.log(error.response.data);
} finally{
this.initFolderName();
this.dialog = false;
}
}
}
=======
methods: {
initFolderName(){
this.foldername = '';
},
async makeF(){
try {
const folderData = {
user_id : this.$store.state.id,
cur : this.$store.state.id,
folder_name : this.foldername
};
const response = await makeFolder(folderData);
this.$store.commit('setFolder', response.data.folders);
console.log("폴더 생성 완료");
} catch (error) {
console.log("에러");
console.log(error.response.data);
} finally{
this.initFolderName();
this.dialog = false;
}
}
}
>>>>>>> eacf2da71fd7ae8340b48d4dac8ee121a816fd94
}
</script>