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-06-10 21:21:51 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3e2953434ff545119fd0412145bb24ca328ce6f1
3e295343
1 parent
1abacfd6
.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
97 deletions
backend/routes/folders.js
front-end/src/components/TrashList.vue
front-end/src/store/index.js
backend/routes/folders.js
View file @
3e29534
...
...
@@ -140,8 +140,8 @@ router.post('/makefolder', function(req, res, next) {
console
.
log
(
'insert error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
checkfolder
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
cur
,
user_id
],
function
(
err
,
rows
,
fields
)
{
let
checkfolder
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?
AND folder_name != ?
;'
;
connection
.
query
(
checkfolder
,
[
cur
,
user_id
,
'trashcan'
],
function
(
err
,
rows
,
fields
)
{
console
.
log
(
rows
);
res
.
status
(
200
).
send
({
folders
:
rows
...
...
@@ -198,8 +198,8 @@ router.post('/delfolder', function(req, res, next) {
console
.
log
(
"updatesql error"
);
res
.
status
(
304
).
send
({
error
:
"updatesql error"
});
}
else
{
let
resultsql
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
resultsql
,
[
cur
,
user_id
],
function
(
err
,
rows
,
fields
)
{
let
resultsql
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?
AND folder_name != ?
;'
;
connection
.
query
(
resultsql
,
[
cur
,
user_id
,
'trashcan'
],
function
(
err
,
rows
,
fields
)
{
res
.
status
(
200
).
send
({
folders
:
rows
});
...
...
@@ -268,8 +268,8 @@ router.post('/move', function(req, res, next) {
console
.
log
(
"updatesql error"
);
res
.
status
(
304
).
send
({
error
:
"updatesql error"
});
}
else
{
let
resultsql
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
resultsql
,
[
cur
,
user_id
],
function
(
err
,
rows
,
fields
)
{
let
resultsql
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?
AND folder_name != ?
;'
;
connection
.
query
(
resultsql
,
[
cur
,
user_id
,
'trashcan'
],
function
(
err
,
rows
,
fields
)
{
res
.
status
(
200
).
send
({
folders
:
rows
});
...
...
@@ -317,10 +317,10 @@ router.post('/move', function(req, res, next) {
if
(
err3
)
{
res
.
status
(
304
).
send
({
error
:
"updatesql error"
});
}
else
{
let
resultsql
=
'SELECT * FROM f
older
s WHERE location = ? AND user_id = ?;'
;
let
resultsql
=
'SELECT * FROM f
ile
s WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
resultsql
,
[
cur
,
user_id
],
function
(
err
,
rows
,
fields
)
{
res
.
status
(
200
).
send
({
f
older
s
:
rows
f
ile
s
:
rows
});
});
}
...
...
@@ -407,8 +407,8 @@ router.get('/search', function(req, res, next) {
console
.
log
(
target
);
let
folders
=
[]
let
files
=
[]
let
checkfolder
=
'SELECT * FROM folders WHERE folder_name LIKE '
+
target
+
' AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
user_id
],
function
(
err
,
folder
,
fields
)
{
let
checkfolder
=
'SELECT * FROM folders WHERE folder_name LIKE '
+
target
+
' AND user_id = ?
AND folder_name != ?
;'
;
connection
.
query
(
checkfolder
,
[
user_id
,
'trashcan'
],
function
(
err
,
folder
,
fields
)
{
console
.
log
(
folder
);
folders
.
push
(
folder
)
let
checkfile
=
'SELECT * FROM files WHERE file_name LIKE '
+
target
+
' AND user_id = ?;'
;
...
...
front-end/src/components/TrashList.vue
View file @
3e29534
...
...
@@ -69,7 +69,7 @@
</v-list>
</v-menu>
<v-menu
v-model="showMenu"
v-model="showMenu
F
"
:position-x="x"
:position-y="y"
absolute
...
...
@@ -111,6 +111,9 @@ export default {
return {
curfName: {},
showMenu: false,
search: '',
x: 0,
y: 0,
cfilename: {},
showMenuF: false,
};
...
...
@@ -126,6 +129,7 @@ export default {
try {
const id = this.$store.state.id;
const response = await showTrashcan(id);
console.log(response.data);
this.$store.commit('settrashFolderList', response.data.folders);
this.$store.commit('settrashFileList', response.data.files);
} catch (error) {
...
...
front-end/src/store/index.js
View file @
3e29534
...
...
@@ -4,89 +4,89 @@ import Vuex from 'vuex';
Vue
.
use
(
Vuex
);
export
default
new
Vuex
.
Store
({
state
:
{
id
:
''
,
folders
:
[],
files
:
[],
cur
:
'/'
,
parent
:
'/'
,
recentList
:
[],
favFolderList
:
[],
favFileList
:
[],
trashFolderList
:
[],
trashFileList
:
[],
},
mutations
:
{
setId
(
state
,
userid
)
{
state
.
id
=
userid
;
},
clearid
(
state
)
{
state
.
id
=
''
;
},
setFolder
(
state
,
folderlist
)
{
state
.
folders
=
folderlist
;
},
setFile
(
state
,
filelist
)
{
state
.
files
=
filelist
;
},
setCur
(
state
,
cur
)
{
state
.
cur
=
cur
;
},
setParent
(
state
,
parent
)
{
state
.
parent
=
parent
;
},
setRecentList
(
state
,
list
)
{
state
.
recentList
=
list
;
},
setfavFolderList
(
state
,
fflist
)
{
state
.
favFolderList
=
fflist
;
},
setfavFileList
(
state
,
fflist
)
{
state
.
favFileList
=
fflist
;
},
settrashFolderList
(
state
,
tflist
)
{
state
.
trashFolderList
=
tflist
;
},
settrashFileList
(
state
,
tflist
)
{
state
.
trashFileList
=
tflist
;
},
},
getters
:
{
isLogin
(
state
)
{
return
state
.
id
!==
''
;
},
userID
(
state
)
{
return
state
.
id
;
},
folderL
(
state
)
{
return
state
.
folders
;
},
fileL
(
state
)
{
return
state
.
files
;
},
recentL
(
state
)
{
return
state
.
recentList
;
},
cur
(
state
)
{
return
state
.
cur
;
},
setFolder
(
state
,
folderlist
)
{
state
.
folders
=
folderlist
;
},
setFile
(
state
,
filelist
)
{
state
.
files
=
filelist
;
},
favFolderL
(
state
)
{
return
state
.
favFolderList
;
},
favFileL
(
state
)
{
return
state
.
favFileList
;
},
trashFolderL
(
state
)
{
return
state
.
trashFolderList
;
},
trashFileL
(
state
)
{
return
state
.
trashFolder
List
;
},
},
});
state
:
{
id
:
''
,
folders
:
[],
files
:
[],
cur
:
'/'
,
parent
:
'/'
,
recentList
:
[],
favFolderList
:
[],
favFileList
:
[],
trashFolderList
:
[],
trashFileList
:
[],
},
mutations
:
{
setId
(
state
,
userid
)
{
state
.
id
=
userid
;
},
clearid
(
state
)
{
state
.
id
=
''
;
},
setFolder
(
state
,
folderlist
)
{
state
.
folders
=
folderlist
;
},
setFile
(
state
,
filelist
)
{
state
.
files
=
filelist
;
},
setCur
(
state
,
cur
)
{
state
.
cur
=
cur
;
},
setParent
(
state
,
parent
)
{
state
.
parent
=
parent
;
},
setRecentList
(
state
,
list
)
{
state
.
recentList
=
list
;
},
setfavFolderList
(
state
,
fflist
)
{
state
.
favFolderList
=
fflist
;
},
setfavFileList
(
state
,
fflist
)
{
state
.
favFileList
=
fflist
;
},
settrashFolderList
(
state
,
tflist
)
{
state
.
trashFolderList
=
tflist
;
},
settrashFileList
(
state
,
tflist
)
{
state
.
trashFileList
=
tflist
;
},
},
getters
:
{
isLogin
(
state
)
{
return
state
.
id
!==
''
;
},
userID
(
state
)
{
return
state
.
id
;
},
folderL
(
state
)
{
return
state
.
folders
;
},
fileL
(
state
)
{
return
state
.
files
;
},
recentL
(
state
)
{
return
state
.
recentList
;
},
cur
(
state
)
{
return
state
.
cur
;
},
setFolder
(
state
,
folderlist
)
{
state
.
folders
=
folderlist
;
},
setFile
(
state
,
filelist
)
{
state
.
files
=
filelist
;
},
favFolderL
(
state
)
{
return
state
.
favFolderList
;
},
favFileL
(
state
)
{
return
state
.
favFileList
;
},
trashFolderL
(
state
)
{
return
state
.
trashFolderList
;
},
trashFileL
(
state
)
{
return
state
.
trashFile
List
;
},
},
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment