Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Hong
2020-05-28 17:45:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8d0ff2d8083995b146ebacd9ffb7ac7078d241d2
8d0ff2d8
1 parent
273b7fd2
상위폴더구현
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
9 deletions
backend/routes/folders.js
front-end/src/components/FileList.vue
front-end/src/store/index.js
backend/routes/folders.js
View file @
8d0ff2d
...
...
@@ -6,6 +6,7 @@ const moment = require("moment");
const
BUCKET_NAME
=
"hong-s3-cloud"
;
let
curPath
=
""
;
let
user_id
=
""
;
let
parentPath
=
""
;
const
s3
=
new
AWS
.
S3
({
accessKeyId
:
process
.
env
.
AWS_ACCESS_KEY_ID
,
...
...
@@ -17,6 +18,17 @@ router.get('/show', function(req, res, next) {
console
.
log
(
req
.
query
);
user_id
=
req
.
query
.
id
;
curPath
=
req
.
query
.
cur
;
if
(
curPath
==
'/'
)
{
parentPath
=
'/'
;
}
else
{
let
pathSplit
=
curPath
.
split
(
'/'
)
console
.
log
(
pathSplit
);
parentPath
=
'/'
;
for
(
let
i
=
1
;
i
<
pathSplit
.
length
-
2
;
i
++
)
{
parentPath
+=
pathSplit
[
i
];
parentPath
+=
'/'
;
}
}
folders
=
{}
let
checkfolder
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
curPath
,
user_id
],
function
(
err
,
rows
,
fields
)
{
...
...
@@ -27,12 +39,14 @@ router.get('/show', function(req, res, next) {
if
(
rows
.
length
!=
0
)
{
res
.
status
(
200
).
send
({
folders
:
rows
,
cur
:
curPath
cur
:
curPath
,
parentPath
:
parentPath
})
}
else
{
res
.
status
(
200
).
send
({
folders
:
rows
,
cur
:
curPath
cur
:
curPath
,
parentPath
:
parentPath
})
}
}
...
...
@@ -77,8 +91,7 @@ router.post('/makefolder', function(req, res, next) {
connection
.
query
(
checkfolder
,
[
cur
,
user_id
],
function
(
err
,
rows
,
fields
)
{
if
(
rows
.
length
!=
0
)
{
res
.
status
(
200
).
send
({
folders
:
rows
,
cur
:
curPath
folders
:
rows
})
}
else
{
res
.
send
({
error
:
"Does not exist"
});
...
...
front-end/src/components/FileList.vue
View file @
8d0ff2d
...
...
@@ -142,9 +142,10 @@ import { folder, makeFolder } from '../api/index';
cur: '/'
}
const response = await folder(curData);
console.log(response);
console.log(response
.data
);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
} catch (error) {
console.log("에러");
console.log(error.response.data);
...
...
@@ -162,9 +163,9 @@ import { folder, makeFolder } from '../api/index';
folder_name : this.foldername
};
const response = await makeFolder(folderData);
console.log(response.data)
console.log("폴더 생성 완료");
this.$store.commit('setFolder', response.data.folders);
console.log(response.data)
console.log("폴더 생성 완료");
this.$store.commit('setFolder', response.data.folders);
} catch (error) {
console.log("에러");
console.log(error.response.data);
...
...
@@ -180,9 +181,10 @@ import { folder, makeFolder } from '../api/index';
cur: this.$store.state.cur + move_folder_name + '/'
}
const response = await folder(curData);
console.log(response);
console.log(response
.data
);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
} catch (error) {
console.log("에러");
console.log(error.response.data);
...
...
front-end/src/store/index.js
View file @
8d0ff2d
...
...
@@ -9,6 +9,7 @@ export default new Vuex.Store({
folders
:
{},
files
:
{},
cur
:
'/'
,
parent
:
'/'
},
mutations
:
{
setId
(
state
,
userid
)
{
...
...
@@ -25,6 +26,9 @@ export default new Vuex.Store({
},
setCur
(
state
,
cur
)
{
state
.
cur
=
cur
;
},
setParent
(
state
,
parent
)
{
state
.
parent
=
parent
;
}
},
getters
:
{
...
...
@@ -42,6 +46,9 @@ export default new Vuex.Store({
},
cur
(
state
)
{
return
state
.
cur
;
},
parent
(
state
)
{
return
state
.
parent
;
}
}
})
\ No newline at end of file
...
...
Please
register
or
login
to post a comment