Merge branch 'share,favorite' into 'master'
Share,favorite See merge request !1
Showing
46 changed files
with
3682 additions
and
637 deletions
... | @@ -12,7 +12,10 @@ var registerRouter = require('./routes/userlogin/register'); | ... | @@ -12,7 +12,10 @@ var registerRouter = require('./routes/userlogin/register'); |
12 | var fileRouter = require('./routes/file/router'); | 12 | var fileRouter = require('./routes/file/router'); |
13 | //var trashcanRouter = require('./routes/trashcan/router'); | 13 | //var trashcanRouter = require('./routes/trashcan/router'); |
14 | var folderRouter = require('./routes/folders'); | 14 | var folderRouter = require('./routes/folders'); |
15 | -var contactRouter = require('./routes/contact') | 15 | +var quickRouter = require('./routes/quick'); |
16 | +var favoritesRouter = require('./routes/favorites'); | ||
17 | +var shareRouter = require('./routes/share'); | ||
18 | +var trashcanRouter = require('./routes/trashcan'); | ||
16 | 19 | ||
17 | 20 | ||
18 | var passport = require('passport'); | 21 | var passport = require('passport'); |
... | @@ -60,10 +63,12 @@ app.use('/api/user', userRouter); | ... | @@ -60,10 +63,12 @@ app.use('/api/user', userRouter); |
60 | app.use('/api/login', loginRouter); | 63 | app.use('/api/login', loginRouter); |
61 | app.use('/api/RegistUser', registerRouter); | 64 | app.use('/api/RegistUser', registerRouter); |
62 | app.use('/api/folder', folderRouter); | 65 | app.use('/api/folder', folderRouter); |
66 | +app.use('/api/favorites', favoritesRouter); | ||
67 | +app.use('/api/share', shareRouter); | ||
68 | +app.use('/api/trashcan', trashcanRouter); | ||
63 | //app.use('/users', usersRouter); | 69 | //app.use('/users', usersRouter); |
64 | app.use('/api/file', fileRouter); | 70 | app.use('/api/file', fileRouter); |
65 | -app.use('/api/contact',contactRouter); | 71 | +app.use('/api/quick', quickRouter); |
66 | -//app.use('/api/trashcan', trashcanRouter); | ||
67 | 72 | ||
68 | // catch 404 and forward to error handler | 73 | // catch 404 and forward to error handler |
69 | app.use(function(req, res, next) { | 74 | app.use(function(req, res, next) { | ... | ... |
backend/routes/favorites.js
0 → 100644
1 | +const express = require('express'); | ||
2 | +const router = express.Router(); | ||
3 | + | ||
4 | +router.get('/show', function(req, res, next) { | ||
5 | + console.log(req.query); | ||
6 | + user_id = req.query.id; | ||
7 | + let checkfolder = 'SELECT * FROM folders WHERE user_id = ? AND favorite = 1;'; | ||
8 | + let checkfiles = 'SELECT * FROM files WHERE user_id = ? AND favorite = 1;'; | ||
9 | + connection.query(checkfolder, [user_id], function(err, folder, fields) { | ||
10 | + if (err) { | ||
11 | + console.log('select error'); | ||
12 | + res.status(404).send(); | ||
13 | + } else { | ||
14 | + connection.query(checkfiles, [user_id], function(err, file, fields) { | ||
15 | + if (err) { | ||
16 | + console.log('select error'); | ||
17 | + res.status(404).send(); | ||
18 | + } else { | ||
19 | + res.status(200).send({ | ||
20 | + folders: folder, | ||
21 | + files: file | ||
22 | + }); | ||
23 | + } | ||
24 | + }); | ||
25 | + } | ||
26 | + }); | ||
27 | +}); | ||
28 | + | ||
29 | +router.post('/addfolder', function(req, res, next) { | ||
30 | + let user_id = req.body.id; | ||
31 | + let folder_name = req.body.name; | ||
32 | + let cur = req.body.cur; | ||
33 | + console.log(req.body); | ||
34 | + let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name = ? AND favorite = 1;'; | ||
35 | + connection.query(checkfolder, [cur, user_id, folder_name], function(err, rows, fields) { | ||
36 | + if (err) { | ||
37 | + console.log('select error'); | ||
38 | + res.status(400).send({ error: err }); | ||
39 | + } else { | ||
40 | + if (rows.length == 0) { | ||
41 | + let sql = 'UPDATE folders SET favorite = 1 WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
42 | + connection.query(sql, [cur, folder_name, user_id], function(err, result, fields) { | ||
43 | + if (err) { | ||
44 | + console.log('update error'); | ||
45 | + res.status(400).send({ error: err }); | ||
46 | + } else { | ||
47 | + let getfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; | ||
48 | + connection.query(getfolder, [cur, user_id, 'trashcan'], function(err, folders, fields) { | ||
49 | + res.status(200).send({ | ||
50 | + folders: folders | ||
51 | + }) | ||
52 | + }); | ||
53 | + } | ||
54 | + }); | ||
55 | + } else { | ||
56 | + console.log('already exist error'); | ||
57 | + res.status(400).send({ error: err }); | ||
58 | + } | ||
59 | + } | ||
60 | + }); | ||
61 | +}); | ||
62 | + | ||
63 | +router.post('/addfile', function(req, res, next) { | ||
64 | + let user_id = req.body.id; | ||
65 | + let file_name = req.body.name; | ||
66 | + let cur = req.body.cur; | ||
67 | + console.log(req.body); | ||
68 | + let checkfolder = 'SELECT * FROM files WHERE location = ? AND user_id = ? AND file_name = ? AND favorite = 1;'; | ||
69 | + connection.query(checkfolder, [cur, user_id, file_name], function(err, rows, fields) { | ||
70 | + if (err) { | ||
71 | + console.log('select error'); | ||
72 | + res.status(400).send({ error: err }); | ||
73 | + } else { | ||
74 | + if (rows.length == 0) { | ||
75 | + let sql = 'UPDATE files SET favorite = 1 WHERE location = ? AND file_name = ? AND user_id = ?;'; | ||
76 | + connection.query(sql, [cur, file_name, user_id], function(err, result, fields) { | ||
77 | + if (err) { | ||
78 | + console.log('update error'); | ||
79 | + res.status(400).send({ error: err }); | ||
80 | + } else { | ||
81 | + let getfolder = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; | ||
82 | + connection.query(getfolder, [cur, user_id], function(err, files, fields) { | ||
83 | + res.status(200).send({ | ||
84 | + files: files | ||
85 | + }) | ||
86 | + }); | ||
87 | + } | ||
88 | + }); | ||
89 | + } else { | ||
90 | + console.log('already exist error'); | ||
91 | + res.status(400).send({ error: err }); | ||
92 | + } | ||
93 | + } | ||
94 | + }); | ||
95 | +}); | ||
96 | + | ||
97 | +router.post('/delfolder', function(req, res, next) { | ||
98 | + let user_id = req.body.id; | ||
99 | + let folder_name = req.body.name; | ||
100 | + let cur = req.body.cur; | ||
101 | + let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name = ? AND favorite = 1;'; | ||
102 | + | ||
103 | + connection.query(checkfolder, [cur, user_id, folder_name], function(err, rows, fields) { | ||
104 | + if (err) { | ||
105 | + console.log('select error'); | ||
106 | + res.status(400).send({ error: err }); | ||
107 | + } else { | ||
108 | + if (rows.length != 0) { | ||
109 | + let sql = 'UPDATE folders SET favorite = 0 WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
110 | + connection.query(sql, [cur, folder_name, user_id], function(err, result, fields) { | ||
111 | + if (err) { | ||
112 | + console.log('update error'); | ||
113 | + res.status(400).send({ error: err }); | ||
114 | + } else { | ||
115 | + let getfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; | ||
116 | + connection.query(getfolder, [cur, user_id, 'trashcan'], function(err, folders, fields) { | ||
117 | + res.status(200).send({ | ||
118 | + folders: folders | ||
119 | + }) | ||
120 | + }); | ||
121 | + } | ||
122 | + }); | ||
123 | + } else { | ||
124 | + console.log('dont exist error'); | ||
125 | + res.status(400).send({ error: err }); | ||
126 | + } | ||
127 | + } | ||
128 | + }); | ||
129 | +}); | ||
130 | + | ||
131 | +router.post('/delfile', function(req, res, next) { | ||
132 | + let user_id = req.body.id; | ||
133 | + let file_name = req.body.name; | ||
134 | + let cur = req.body.cur; | ||
135 | + let checkfile = 'SELECT * FROM files WHERE location = ? AND user_id = ? AND file_name = ? AND favorite = 1;'; | ||
136 | + | ||
137 | + connection.query(checkfile, [cur, user_id, file_name], function(err, rows, fields) { | ||
138 | + if (err) { | ||
139 | + console.log('select error'); | ||
140 | + res.status(400).send({ error: err }); | ||
141 | + } else { | ||
142 | + if (rows.length != 0) { | ||
143 | + let sql = 'UPDATE files SET favorite = 0 WHERE location = ? AND file_name = ? AND user_id = ?;'; | ||
144 | + connection.query(sql, [cur, file_name, user_id], function(err, result, fields) { | ||
145 | + if (err) { | ||
146 | + console.log('update error'); | ||
147 | + res.status(400).send({ error: err }); | ||
148 | + } else { | ||
149 | + let getfile = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; | ||
150 | + connection.query(getfile, [cur, user_id], function(err, files, fields) { | ||
151 | + res.status(200).send({ | ||
152 | + files: files | ||
153 | + }) | ||
154 | + }); | ||
155 | + } | ||
156 | + }); | ||
157 | + } else { | ||
158 | + console.log('dont exist error'); | ||
159 | + res.status(400).send({ error: err }); | ||
160 | + } | ||
161 | + } | ||
162 | + }); | ||
163 | +}); | ||
164 | + | ||
165 | + | ||
166 | + | ||
167 | +module.exports = router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -7,7 +7,9 @@ var S3 = require('../modules/s3/s3'); | ... | @@ -7,7 +7,9 @@ var S3 = require('../modules/s3/s3'); |
7 | 7 | ||
8 | 8 | ||
9 | // /file/delete/:name | 9 | // /file/delete/:name |
10 | -router.get('/:name', function (req, res) { | 10 | +router.get('/:name', function(req, res) { |
11 | + console.log(req.query); | ||
12 | + console.log(req.params); | ||
11 | var file_name = req.params.name; | 13 | var file_name = req.params.name; |
12 | var user_id = req.query.id; | 14 | var user_id = req.query.id; |
13 | var curPath = req.query.cur; | 15 | var curPath = req.query.cur; |
... | @@ -15,32 +17,56 @@ router.get('/:name', function (req, res) { | ... | @@ -15,32 +17,56 @@ router.get('/:name', function (req, res) { |
15 | var targetPath = 'trashcan'; | 17 | var targetPath = 'trashcan'; |
16 | var sourceFile = curPath.substring(1) + file_name; | 18 | var sourceFile = curPath.substring(1) + file_name; |
17 | 19 | ||
18 | - var sql1 = 'DELETE FROM files WHERE file_name = (?) AND location=(?) AND user_Id = (?)'; | 20 | + var sql1 = 'UPDATE files SET location = ? WHERE location = ? AND file_name = ? AND user_id = ?;'; |
19 | - var sql2 = 'INSERT INTO trashcan (trash_name, location, user_Id) VALUES (?, ?, ?)'; | 21 | + connection.query(sql1, ['/trashcan/', curPath, file_name, user_id], function(err) { |
20 | - | ||
21 | - connection.query(sql1, [file_name, curPath, user_id], function (err) { | ||
22 | - if (err) { | ||
23 | - console.log('delete db error'); | ||
24 | - res.send({erorr: 'db delete error'}); | ||
25 | - } | ||
26 | - else { | ||
27 | - connection.query(sql2, [file_name, '/trashcan'+curPath, user_id], function (err) { | ||
28 | if (err) { | 22 | if (err) { |
29 | - console.log('insert in trashcan db error'); | 23 | + console.log('update db error'); |
30 | - res.send({error: 'db insert error'}); | 24 | + res.send({ erorr: 'db update error' }); |
31 | - } | 25 | + } else { |
32 | - else { | 26 | + S3.moveFile2(S3.BUCKET_NAME, user_id, sourceFile, file_name, targetPath, function(result) { |
33 | - // /drive/user_id/sourceFile --> /drive/user_id/trashcan/sourceFile | ||
34 | - S3.moveFile2(S3.BUCKET_NAME, user_id, sourceFile, targetPath, function (result) { | ||
35 | if (result) { | 27 | if (result) { |
36 | res.send("move to trashcan success"); | 28 | res.send("move to trashcan success"); |
37 | } | 29 | } |
38 | }) | 30 | }) |
39 | } | 31 | } |
40 | }) | 32 | }) |
41 | - } | ||
42 | - }) | ||
43 | }); | 33 | }); |
44 | 34 | ||
35 | +// // /file/delete/:name | ||
36 | +// router.get('/:name', function (req, res) { | ||
37 | +// var file_name = req.params.name; | ||
38 | +// var user_id = req.query.id; | ||
39 | +// var curPath = req.query.cur; | ||
40 | + | ||
41 | +// var targetPath = 'trashcan'; | ||
42 | +// var sourceFile = curPath.substring(1) + file_name; | ||
43 | + | ||
44 | +// var sql1 = 'DELETE FROM files WHERE file_name = (?) AND location=(?) AND user_Id = (?)'; | ||
45 | +// var sql2 = 'INSERT INTO trashcan (trash_name, location, user_Id) VALUES (?, ?, ?)'; | ||
46 | + | ||
47 | +// connection.query(sql1, [file_name, curPath, user_id], function (err) { | ||
48 | +// if (err) { | ||
49 | +// console.log('delete db error'); | ||
50 | +// res.send({erorr: 'db delete error'}); | ||
51 | +// } | ||
52 | +// else { | ||
53 | +// connection.query(sql2, [file_name, '/trashcan'+curPath, user_id], function (err) { | ||
54 | +// if (err) { | ||
55 | +// console.log('insert in trashcan db error'); | ||
56 | +// res.send({error: 'db insert error'}); | ||
57 | +// } | ||
58 | +// else { | ||
59 | +// // /drive/user_id/sourceFile --> /drive/user_id/trashcan/sourceFile | ||
60 | +// S3.moveFile2(S3.BUCKET_NAME, user_id, sourceFile, targetPath, function (result) { | ||
61 | +// if (result) { | ||
62 | +// res.send("move to trashcan success"); | ||
63 | +// } | ||
64 | +// }) | ||
65 | +// } | ||
66 | +// }) | ||
67 | +// } | ||
68 | +// }) | ||
69 | +// }); | ||
70 | + | ||
45 | 71 | ||
46 | module.exports = router; | 72 | module.exports = router; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -2,6 +2,7 @@ var express = require('express'); | ... | @@ -2,6 +2,7 @@ var express = require('express'); |
2 | var router = express.Router(); | 2 | var router = express.Router(); |
3 | 3 | ||
4 | var fs = require('fs'); | 4 | var fs = require('fs'); |
5 | +var moment = require('moment'); | ||
5 | 6 | ||
6 | var AWS = require('aws-sdk'); | 7 | var AWS = require('aws-sdk'); |
7 | AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); | 8 | AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); |
... | @@ -19,7 +20,14 @@ router.get('/:name', function (req, res) { | ... | @@ -19,7 +20,14 @@ router.get('/:name', function (req, res) { |
19 | 20 | ||
20 | S3.downloadFile3(S3.BUCKET_NAME, user_id, targetFile, function (result, downloadDir) { | 21 | S3.downloadFile3(S3.BUCKET_NAME, user_id, targetFile, function (result, downloadDir) { |
21 | if (result) { | 22 | if (result) { |
23 | + var sql = 'UPDATE files SET recent_access=(?) WHERE user_id=(?) AND location=(?) AND file_name=(?)'; | ||
24 | + connection.query(sql, [moment().format(), user_id, curPath, file_name], function(err){ | ||
25 | + if (err){ | ||
26 | + res.send({err: 'update error'}); | ||
27 | + }else{ | ||
22 | res.send({ src: downloadDir }) | 28 | res.send({ src: downloadDir }) |
29 | + } | ||
30 | + }) | ||
23 | }else{ | 31 | }else{ |
24 | res.send({ err: 'download error'}) | 32 | res.send({ err: 'download error'}) |
25 | } | 33 | } | ... | ... |
... | @@ -9,24 +9,25 @@ var fs = require('fs'); | ... | @@ -9,24 +9,25 @@ var fs = require('fs'); |
9 | 9 | ||
10 | 10 | ||
11 | // /file | 11 | // /file |
12 | -router.get('/', function (req, res) { | 12 | +router.get('/', function(req, res) { |
13 | + console.log(req.query); | ||
13 | var user_id = req.query.id; | 14 | var user_id = req.query.id; |
14 | var curPath = req.query.cur; // /folder1/folder2/ | 15 | var curPath = req.query.cur; // /folder1/folder2/ |
15 | 16 | ||
16 | var sql = 'SELECT * FROM files WHERE user_id=(?) AND location=(?) ORDER BY date DESC'; | 17 | var sql = 'SELECT * FROM files WHERE user_id=(?) AND location=(?) ORDER BY date DESC'; |
17 | - connection.query(sql, [user_id, curPath], function (err, result) { | 18 | + connection.query(sql, [user_id, curPath], function(err, result) { |
18 | - if (err){ | 19 | + if (err) { |
19 | - res.send({error: 'select error'}); | 20 | + res.send({ error: 'select error' }); |
20 | - }else{ | 21 | + } else { |
21 | 22 | ||
22 | - res.status(200).send({files: result}); | 23 | + res.status(200).send({ files: result }); |
23 | } | 24 | } |
24 | }) | 25 | }) |
25 | }); | 26 | }); |
26 | 27 | ||
27 | 28 | ||
28 | 29 | ||
29 | -router.get('/:name', function (req, res) { | 30 | +router.get('/:name', function(req, res) { |
30 | var file_name = req.params.name; | 31 | var file_name = req.params.name; |
31 | var curPath = req.query.cur; // /folder1/folder2/ | 32 | var curPath = req.query.cur; // /folder1/folder2/ |
32 | var user_id = req.query.id; | 33 | var user_id = req.query.id; |
... | @@ -35,13 +36,20 @@ router.get('/:name', function (req, res) { | ... | @@ -35,13 +36,20 @@ router.get('/:name', function (req, res) { |
35 | var extension = targetFile.split('.')[1].toLowerCase(); | 36 | var extension = targetFile.split('.')[1].toLowerCase(); |
36 | 37 | ||
37 | 38 | ||
38 | - S3.downloadFile3(S3.BUCKET_NAME, user_id, targetFile, function(result, downloadDir){ | 39 | + S3.downloadFile2(S3.BUCKET_NAME, user_id, targetFile, function(result, downloadDir) { |
39 | - if (result){ | 40 | + if (result) { |
40 | - if (extension == 'jpg' || extension == 'jpeg' || extension == 'png') { | 41 | + var content; |
41 | - res.status(200).send({ type: 'image', src: downloadDir}) | 42 | + content = fs.readFileSync(downloadDir, 'utf8'); |
42 | - }else{ | 43 | + res.send({ file_name: file_name, content: content }); |
43 | - res.status(200).send({type: 'text', src: downloadDir}) | 44 | + |
44 | - } | 45 | + //if (extension == 'jpg' || extension == 'jpeg' || extension == 'png') { |
46 | + // res.send({ type: 'image', src: downloadDir}) | ||
47 | + //}else{ | ||
48 | + // var content; | ||
49 | + // content = fs.readFileSync(downloadDir, 'utf8'); | ||
50 | + // res.send({file_name: file_name, content: content}); | ||
51 | + // //res.status(200).send({type: 'text', src: downloadDir}) | ||
52 | + //} | ||
45 | } | 53 | } |
46 | }) | 54 | }) |
47 | }); | 55 | }); | ... | ... |
backend/routes/file/modifyFile.js
0 → 100644
1 | +var express = require('express'); | ||
2 | +var router = express.Router(); | ||
3 | + | ||
4 | +var AWS = require('aws-sdk'); | ||
5 | +AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); | ||
6 | +var S3 = require('../modules/s3/s3'); | ||
7 | + | ||
8 | +var fs = require('fs'); | ||
9 | +var moment = require('moment'); | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | +// /file/modify/:name | ||
14 | +router.post('/:name', function(req, res){ | ||
15 | + var user_id = req.body.user_id; | ||
16 | + var curPath = req.body.cur; // /folder1/folder2/ | ||
17 | + var file_name = req.params.name; | ||
18 | + var modified_name = req.body.name; | ||
19 | + var modified_content = req.body.content; | ||
20 | + | ||
21 | + var targetPath; | ||
22 | + if (curPath == '/') { | ||
23 | + targetPath = ''; | ||
24 | + } else { | ||
25 | + targetPath = curPath.substring(1, curPaht.length-1); // folder1/folder2 | ||
26 | + } | ||
27 | + | ||
28 | + var originalDir = __dirname + '/../modules/s3/download/' + user_id + curPath + file_name; | ||
29 | + var tempDownloadDir; | ||
30 | + | ||
31 | + // 파일 이름 변경 | ||
32 | + S3.renameFile(S3.BUCKET_NAME, user_id, file_name, modified_name, targetPath, function(result, r_modified_name){ | ||
33 | + if (result){ | ||
34 | + modified_name = r_modified_name; | ||
35 | + tempDownloadDir = __dirname + '/../modules/s3/download/' + user_id + curPath + modified_name; | ||
36 | + fs.unlink(originalDir, function(err){ | ||
37 | + if (err){ | ||
38 | + console.log(err); | ||
39 | + res.send({error: 'original file not exists in server'}); | ||
40 | + }else{ | ||
41 | + // 파일 내용 변경 | ||
42 | + fs.writeFileSync(tempDownloadDir, modified_content); | ||
43 | + | ||
44 | + S3.coverFile(S3.BUCKET_NAME, user_id, modified_name, targetPath, tempDownloadDir, function (result) { | ||
45 | + if (result) { | ||
46 | + var sql = 'UPDATE files SET file_name=(?), updated=(?), recent_access=(?) WHERE user_id=(?) AND location=(?) AND file_name=(?)'; | ||
47 | + connection.query(sql, [modified_name, moment().format(), moment().format(), user_id, curPath, file_name], function (err) { | ||
48 | + if (err) { | ||
49 | + console.log(err); | ||
50 | + res.send({ error: 'update error' }); | ||
51 | + } else { | ||
52 | + fs.unlinkSync(tempDownloadDir); | ||
53 | + res.send('modify file success'); | ||
54 | + } | ||
55 | + }) | ||
56 | + } else { | ||
57 | + res.send({ error: 'modify file failed' }); | ||
58 | + } | ||
59 | + }) | ||
60 | + } | ||
61 | + }); | ||
62 | + }else{ | ||
63 | + res.send({error: 'rename error'}); | ||
64 | + } | ||
65 | + }) | ||
66 | +}); | ||
67 | + | ||
68 | + | ||
69 | +module.exports = router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -6,12 +6,14 @@ var files = require('./files'); | ... | @@ -6,12 +6,14 @@ var files = require('./files'); |
6 | var uploadFile = require('./uploadFile'); | 6 | var uploadFile = require('./uploadFile'); |
7 | var downloadFile = require('./downloadFile'); | 7 | var downloadFile = require('./downloadFile'); |
8 | var deleteFile = require('./deleteFile'); | 8 | var deleteFile = require('./deleteFile'); |
9 | +var modifyFile = require('./modifyFile'); | ||
9 | 10 | ||
10 | 11 | ||
11 | router.use('/', files); | 12 | router.use('/', files); |
12 | router.use('/upload', uploadFile); | 13 | router.use('/upload', uploadFile); |
13 | router.use('/download', downloadFile); | 14 | router.use('/download', downloadFile); |
14 | router.use('/delete', deleteFile); | 15 | router.use('/delete', deleteFile); |
16 | +router.use('/modify', modifyFile); | ||
15 | 17 | ||
16 | 18 | ||
17 | module.exports = router; | 19 | module.exports = router; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -2,6 +2,7 @@ var express = require('express'); | ... | @@ -2,6 +2,7 @@ var express = require('express'); |
2 | var router = express.Router(); | 2 | var router = express.Router(); |
3 | 3 | ||
4 | var formidable = require('formidable'); | 4 | var formidable = require('formidable'); |
5 | +var moment = require('moment'); | ||
5 | 6 | ||
6 | var AWS = require('aws-sdk'); | 7 | var AWS = require('aws-sdk'); |
7 | AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); | 8 | AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); |
... | @@ -43,6 +44,7 @@ router.post('/', function (req, res) { | ... | @@ -43,6 +44,7 @@ router.post('/', function (req, res) { |
43 | }else{ | 44 | }else{ |
44 | sourceFiles.push(files.file.name); | 45 | sourceFiles.push(files.file.name); |
45 | bodies.push(files.file.path); | 46 | bodies.push(files.file.path); |
47 | + console.log('bodies', bodies); | ||
46 | } | 48 | } |
47 | }else{ | 49 | }else{ |
48 | for (var file of files.file) { // 파일 여러개일 때 | 50 | for (var file of files.file) { // 파일 여러개일 때 |
... | @@ -65,8 +67,8 @@ router.post('/', function (req, res) { | ... | @@ -65,8 +67,8 @@ router.post('/', function (req, res) { |
65 | } | 67 | } |
66 | } | 68 | } |
67 | for (var sourceFile of noErrSourceFiles) { | 69 | for (var sourceFile of noErrSourceFiles) { |
68 | - var sql = 'INSERT INTO files (file_name, user_id, location) VALUES (?, ?, ?)'; | 70 | + var sql = 'INSERT INTO files (file_name, user_id, location, recent_access) VALUES (?, ?, ?, ?)'; |
69 | - connection.query(sql, [sourceFile, user_id, curPath], function (err, result) { | 71 | + connection.query(sql, [sourceFile, user_id, curPath, moment().format()], function (err, result) { |
70 | if (err) { | 72 | if (err) { |
71 | console.log('insert error'); | 73 | console.log('insert error'); |
72 | res.send({error: 'insert error'}); | 74 | res.send({error: 'insert error'}); | ... | ... |
... | @@ -2,49 +2,111 @@ const express = require('express'); | ... | @@ -2,49 +2,111 @@ const express = require('express'); |
2 | const router = express.Router(); | 2 | const router = express.Router(); |
3 | const AWS = require("aws-sdk"); | 3 | const AWS = require("aws-sdk"); |
4 | const moment = require("moment"); | 4 | const moment = require("moment"); |
5 | +AWS.config.loadFromPath(__dirname + "/modules/awsconfig.json"); | ||
5 | 6 | ||
6 | const BUCKET_NAME = "hong-s3-cloud"; | 7 | const BUCKET_NAME = "hong-s3-cloud"; |
7 | let curPath = ""; | 8 | let curPath = ""; |
8 | let user_id = ""; | 9 | let user_id = ""; |
9 | let parentPath = ""; | 10 | let parentPath = ""; |
10 | 11 | ||
11 | -const s3 = new AWS.S3({ | 12 | +const s3 = new AWS.S3(); |
12 | - accessKeyId: process.env.AWS_ACCESS_KEY_ID, | 13 | + |
13 | - secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | 14 | +// router.get('/show', function(req, res, next) { |
14 | - region: "ap-northeast-2" | 15 | +// console.log(req.query); |
15 | -}); | 16 | +// user_id = req.query.id; |
17 | +// curPath = req.query.cur; | ||
18 | +// if (curPath == '/') { | ||
19 | +// parentPath = '/'; | ||
20 | +// } else { | ||
21 | +// let pathSplit = curPath.split('/') | ||
22 | +// console.log(pathSplit); | ||
23 | +// parentPath = '/'; | ||
24 | +// for (let i = 1; i < pathSplit.length - 2; i++) { | ||
25 | +// parentPath += pathSplit[i]; | ||
26 | +// parentPath += '/'; | ||
27 | +// } | ||
28 | +// } | ||
29 | +// let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | ||
30 | +// connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { | ||
31 | +// if (err) { | ||
32 | +// console.log('select error'); | ||
33 | +// res.status(400).send({ err: err }); | ||
34 | +// } else { | ||
35 | +// res.status(200).send({ | ||
36 | +// folders: rows, | ||
37 | +// cur: curPath, | ||
38 | +// parentPath: parentPath | ||
39 | +// }) | ||
40 | +// } | ||
41 | +// }); | ||
42 | +// }); | ||
16 | 43 | ||
17 | router.get('/show', function(req, res, next) { | 44 | router.get('/show', function(req, res, next) { |
18 | console.log(req.query); | 45 | console.log(req.query); |
19 | user_id = req.query.id; | 46 | user_id = req.query.id; |
20 | - curPath = req.query.cur; | 47 | + folder_id = req.query.folder_id; |
21 | - if (curPath == '/') { | 48 | + if (folder_id == -1) { |
22 | - parentPath = '/'; | 49 | + let location = '/'; |
50 | + let gerFolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; | ||
51 | + connection.query(gerFolder, [location, user_id, 'trashcan'], function(err, folder) { | ||
52 | + if (err) { | ||
53 | + console.log('select2 error'); | ||
54 | + res.status(400).send({ err: err }); | ||
23 | } else { | 55 | } else { |
24 | - let pathSplit = curPath.split('/') | 56 | + let gerFile = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; |
25 | - console.log(pathSplit); | 57 | + connection.query(gerFile, [location, user_id], function(err, file) { |
26 | - parentPath = '/'; | 58 | + if (err) { |
27 | - for (let i = 1; i < pathSplit.length - 2; i++) { | 59 | + console.log('select3 error'); |
28 | - parentPath += pathSplit[i]; | 60 | + res.status(400).send({ err: err }); |
29 | - parentPath += '/'; | 61 | + } else { |
62 | + res.status(200).send({ | ||
63 | + folders: folder, | ||
64 | + files: file, | ||
65 | + cur: location | ||
66 | + }); | ||
30 | } | 67 | } |
68 | + }); | ||
31 | } | 69 | } |
32 | - let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 70 | + }); |
33 | - connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { | 71 | + } else { |
72 | + let checkfolder = 'SELECT * FROM folders WHERE folder_id = ? AND user_id = ?;'; | ||
73 | + connection.query(checkfolder, [folder_id, user_id], function(err, rows) { | ||
74 | + if (err) { | ||
75 | + console.log('select1 error'); | ||
76 | + res.status(400).send({ err: err }); | ||
77 | + } else { | ||
78 | + if (rows.length == 0) { | ||
79 | + console.log('does not exist'); | ||
80 | + res.status(400).send({ err: 'does not exist' }); | ||
81 | + } else { | ||
82 | + let location = rows[0].location + rows[0].folder_name + '/'; | ||
83 | + let gerFolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; | ||
84 | + connection.query(gerFolder, [location, user_id, 'trashcan'], function(err, folder) { | ||
34 | if (err) { | 85 | if (err) { |
35 | - console.log('select error'); | 86 | + console.log('select2 error'); |
36 | - res.status(404).send() | 87 | + res.status(400).send({ err: err }); |
88 | + } else { | ||
89 | + let gerFile = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; | ||
90 | + connection.query(gerFile, [location, user_id], function(err, file) { | ||
91 | + if (err) { | ||
92 | + console.log('select3 error'); | ||
93 | + res.status(400).send({ err: err }); | ||
37 | } else { | 94 | } else { |
38 | res.status(200).send({ | 95 | res.status(200).send({ |
39 | - folders: rows, | 96 | + folders: folder, |
40 | - cur: curPath, | 97 | + files: file, |
41 | - parentPath: parentPath | 98 | + cur: location |
42 | - }) | 99 | + }); |
100 | + } | ||
101 | + }); | ||
43 | } | 102 | } |
44 | }); | 103 | }); |
104 | + } | ||
105 | + } | ||
106 | + }); | ||
107 | + } | ||
45 | }); | 108 | }); |
46 | 109 | ||
47 | - | ||
48 | router.post('/makefolder', function(req, res, next) { | 110 | router.post('/makefolder', function(req, res, next) { |
49 | 111 | ||
50 | user_id = req.body.user_id; | 112 | user_id = req.body.user_id; |
... | @@ -54,7 +116,7 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -54,7 +116,7 @@ router.post('/makefolder', function(req, res, next) { |
54 | let date = moment().format(); | 116 | let date = moment().format(); |
55 | let params = { | 117 | let params = { |
56 | Bucket: BUCKET_NAME, | 118 | Bucket: BUCKET_NAME, |
57 | - Key: curPath + folder_name + '/', | 119 | + Key: 'drive/' + curPath + folder_name + '/', |
58 | Body: "", | 120 | Body: "", |
59 | ACL: "public-read-write" | 121 | ACL: "public-read-write" |
60 | }; | 122 | }; |
... | @@ -62,13 +124,13 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -62,13 +124,13 @@ router.post('/makefolder', function(req, res, next) { |
62 | console.log(req.body) | 124 | console.log(req.body) |
63 | connection.query(checksql, [cur, folder_name], function(err, rows, fields) { | 125 | connection.query(checksql, [cur, folder_name], function(err, rows, fields) { |
64 | if (err) { | 126 | if (err) { |
65 | - | 127 | + res.status(400).send({ err: err }); |
66 | } else { | 128 | } else { |
67 | if (rows.length == 0) { | 129 | if (rows.length == 0) { |
68 | s3.putObject(params, function(err, data) { | 130 | s3.putObject(params, function(err, data) { |
69 | if (err) { | 131 | if (err) { |
70 | console.log('s3 error'); | 132 | console.log('s3 error'); |
71 | - throw err; | 133 | + res.status(400).send({ err: err }); |
72 | } else { | 134 | } else { |
73 | console.log(data); | 135 | console.log(data); |
74 | let sql = 'INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);'; | 136 | let sql = 'INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);'; |
... | @@ -76,10 +138,10 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -76,10 +138,10 @@ router.post('/makefolder', function(req, res, next) { |
76 | connection.query(sql, values, function(err, result, field) { | 138 | connection.query(sql, values, function(err, result, field) { |
77 | if (err) { | 139 | if (err) { |
78 | console.log('insert error'); | 140 | console.log('insert error'); |
79 | - throw err; | 141 | + res.status(400).send({ err: err }); |
80 | } else { | 142 | } else { |
81 | - let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 143 | + let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; |
82 | - connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { | 144 | + connection.query(checkfolder, [cur, user_id, 'trashcan'], function(err, rows, fields) { |
83 | console.log(rows); | 145 | console.log(rows); |
84 | res.status(200).send({ | 146 | res.status(200).send({ |
85 | folders: rows | 147 | folders: rows |
... | @@ -98,51 +160,60 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -98,51 +160,60 @@ router.post('/makefolder', function(req, res, next) { |
98 | 160 | ||
99 | 161 | ||
100 | router.post('/delfolder', function(req, res, next) { | 162 | router.post('/delfolder', function(req, res, next) { |
101 | - | 163 | + console.log(req.body); |
102 | user_id = req.body.id; | 164 | user_id = req.body.id; |
103 | let cur = req.body.cur; | 165 | let cur = req.body.cur; |
104 | curPath = user_id + cur; | 166 | curPath = user_id + cur; |
105 | - let folder_name = req.body.folder_name; | 167 | + let name = req.body.folder_name; |
106 | - let params = { | 168 | + let newPath = user_id + '/trashcan/'; |
169 | + let checkfolder = 'SELECT * FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
170 | + connection.query(checkfolder, [cur, name, user_id], function(err1, rows, fields) { | ||
171 | + console.log(rows); | ||
172 | + if (rows.length != 0) { | ||
173 | + let copy_params = { | ||
174 | + Bucket: BUCKET_NAME, | ||
175 | + CopySource: BUCKET_NAME + '/drive/' + curPath + name + '/', | ||
176 | + Key: 'drive/' + newPath + name + '/' | ||
177 | + }; | ||
178 | + let del_params = { | ||
107 | Bucket: BUCKET_NAME, | 179 | Bucket: BUCKET_NAME, |
108 | - Key: curPath + folder_name + '/' | 180 | + Key: 'drive/' + curPath + name + '/' |
109 | }; | 181 | }; |
110 | - let checksql = 'SELECT * FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; | 182 | + s3.copyObject(copy_params, function(err, data) { |
111 | - let values = [cur, folder_name, user_id]; | ||
112 | - connection.query(checksql, values, function(err, rows, fields) { | ||
113 | if (err) { | 183 | if (err) { |
114 | - res.status(404).send({ error: "error" }); | 184 | + console.log(err, data); |
185 | + console.log("copy error"); | ||
186 | + res.status(304).send({ error: "copy error" }); | ||
115 | } else { | 187 | } else { |
116 | - if (rows.length != 0) { | 188 | + s3.deleteObject(del_params, function(err, data) { |
117 | - s3.deleteObject(params, function(err, data) { | ||
118 | if (err) { | 189 | if (err) { |
119 | - console.log('s3 error'); | 190 | + console.log(err, data); |
120 | - //throw err; | 191 | + console.log("delete error"); |
192 | + res.status(304).send({ error: "delete error" }); | ||
121 | } else { | 193 | } else { |
122 | - console.log(data); | 194 | + let values = ['/trashcan/', cur, name, user_id]; |
123 | - let sql = 'DELETE FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; | 195 | + let updatesql = 'UPDATE folders SET location = ? WHERE location = ? AND folder_name = ? AND user_id = ?;'; |
124 | - connection.query(sql, values, function(err, result, field) { | 196 | + connection.query(updatesql, values, function(err3, result, field) { |
125 | - if (err) { | 197 | + if (err3) { |
126 | - //throw err; | 198 | + console.log("updatesql error"); |
199 | + res.status(304).send({ error: "updatesql error" }); | ||
127 | } else { | 200 | } else { |
128 | - console.log(cur); | 201 | + let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; |
129 | - console.log(user_id); | 202 | + connection.query(resultsql, [cur, user_id, 'trashcan'], function(err, rows, fields) { |
130 | - let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | ||
131 | - connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { | ||
132 | res.status(200).send({ | 203 | res.status(200).send({ |
133 | folders: rows | 204 | folders: rows |
134 | - }) | ||
135 | }); | 205 | }); |
136 | - | 206 | + }); |
207 | + } | ||
208 | + }); | ||
137 | } | 209 | } |
138 | }); | 210 | }); |
139 | } | 211 | } |
140 | }); | 212 | }); |
141 | } else { | 213 | } else { |
142 | - console.log(req.body); | 214 | + console.log("Does not exist folder"); |
143 | res.status(304).send({ error: "Does not exist" }); | 215 | res.status(304).send({ error: "Does not exist" }); |
144 | } | 216 | } |
145 | - } | ||
146 | }); | 217 | }); |
147 | }); | 218 | }); |
148 | 219 | ||
... | @@ -152,21 +223,31 @@ router.post('/move', function(req, res, next) { | ... | @@ -152,21 +223,31 @@ router.post('/move', function(req, res, next) { |
152 | user_id = req.body.id; | 223 | user_id = req.body.id; |
153 | let cur = req.body.cur; | 224 | let cur = req.body.cur; |
154 | curPath = user_id + cur; | 225 | curPath = user_id + cur; |
155 | - let name = req.body.folder_name; | 226 | + let name = req.body.name; |
156 | let newPath = user_id + req.body.newPath; | 227 | let newPath = user_id + req.body.newPath; |
157 | if (req.body.isfolder) { | 228 | if (req.body.isfolder) { |
229 | + let infolderpath = cur + name + '/'; | ||
230 | + let checkinfolder = 'SELECT location FROM folders WHERE location = ? AND user_id = ? UNION ALL SELECT location FROM files WHERE location = ? AND user_id = ?;'; | ||
231 | + connection.query(checkinfolder, [infolderpath, user_id, infolderpath, user_id], function(err, infolder) { | ||
232 | + if (err) { | ||
233 | + console.log("copy error"); | ||
234 | + res.status(304).send({ error: "checkinfolder error" }); | ||
235 | + } else { | ||
236 | + if (infolder.length != 0) { | ||
237 | + res.status(204).send({ error: "infolder exist!" }) | ||
238 | + } else { | ||
158 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; | 239 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; |
159 | connection.query(checkfolder, [cur, name, user_id], function(err1, rows, fields) { | 240 | connection.query(checkfolder, [cur, name, user_id], function(err1, rows, fields) { |
160 | console.log(rows); | 241 | console.log(rows); |
161 | if (rows.length != 0) { | 242 | if (rows.length != 0) { |
162 | let copy_params = { | 243 | let copy_params = { |
163 | Bucket: BUCKET_NAME, | 244 | Bucket: BUCKET_NAME, |
164 | - CopySource: BUCKET_NAME + '/' + curPath + name + '/', | 245 | + CopySource: BUCKET_NAME + '/drive/' + curPath + name + '/', |
165 | - Key: newPath + name + '/' | 246 | + Key: 'drive/' + newPath + name + '/' |
166 | }; | 247 | }; |
167 | let del_params = { | 248 | let del_params = { |
168 | Bucket: BUCKET_NAME, | 249 | Bucket: BUCKET_NAME, |
169 | - Key: curPath + name + '/' | 250 | + Key: 'drive/' + curPath + name + '/' |
170 | }; | 251 | }; |
171 | s3.copyObject(copy_params, function(err, data) { | 252 | s3.copyObject(copy_params, function(err, data) { |
172 | if (err) { | 253 | if (err) { |
... | @@ -187,8 +268,8 @@ router.post('/move', function(req, res, next) { | ... | @@ -187,8 +268,8 @@ router.post('/move', function(req, res, next) { |
187 | console.log("updatesql error"); | 268 | console.log("updatesql error"); |
188 | res.status(304).send({ error: "updatesql error" }); | 269 | res.status(304).send({ error: "updatesql error" }); |
189 | } else { | 270 | } else { |
190 | - let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 271 | + let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;'; |
191 | - connection.query(resultsql, [cur, user_id], function(err, rows, fields) { | 272 | + connection.query(resultsql, [cur, user_id, 'trashcan'], function(err, rows, fields) { |
192 | res.status(200).send({ | 273 | res.status(200).send({ |
193 | folders: rows | 274 | folders: rows |
194 | }); | 275 | }); |
... | @@ -200,22 +281,25 @@ router.post('/move', function(req, res, next) { | ... | @@ -200,22 +281,25 @@ router.post('/move', function(req, res, next) { |
200 | } | 281 | } |
201 | }); | 282 | }); |
202 | } else { | 283 | } else { |
203 | - console.log("Does not exist"); | 284 | + console.log("Does not exist folder"); |
204 | res.status(304).send({ error: "Does not exist" }); | 285 | res.status(304).send({ error: "Does not exist" }); |
205 | } | 286 | } |
206 | }); | 287 | }); |
288 | + } | ||
289 | + } | ||
290 | + }); | ||
207 | } else { | 291 | } else { |
208 | - let checkfile = 'SELECT * FROM files WHERE location = ? AND file_name = ? AND user_id = ?'; | 292 | + let checkfile = 'SELECT * FROM files WHERE location = ? AND file_name = ? AND user_id = ?;'; |
209 | - connection.query(checkfile, [curPath, name, user_id], function(err1, rows, fields) { | 293 | + connection.query(checkfile, [cur, name, user_id], function(err1, rows, fields) { |
210 | if (rows.length != 0) { | 294 | if (rows.length != 0) { |
211 | let copy_params = { | 295 | let copy_params = { |
212 | Bucket: BUCKET_NAME, | 296 | Bucket: BUCKET_NAME, |
213 | - CopySource: BUCKET_NAME + '/' + curPath + file, | 297 | + CopySource: BUCKET_NAME + '/drive/' + curPath + name, |
214 | - Key: newPath + file | 298 | + Key: 'drive/' + newPath + name |
215 | }; | 299 | }; |
216 | let del_params = { | 300 | let del_params = { |
217 | Bucket: BUCKET_NAME, | 301 | Bucket: BUCKET_NAME, |
218 | - Key: curPath + file | 302 | + Key: 'drive/' + curPath + name |
219 | }; | 303 | }; |
220 | s3.copyObject(copy_params, function(err, data) { | 304 | s3.copyObject(copy_params, function(err, data) { |
221 | if (err) { | 305 | if (err) { |
... | @@ -227,16 +311,16 @@ router.post('/move', function(req, res, next) { | ... | @@ -227,16 +311,16 @@ router.post('/move', function(req, res, next) { |
227 | console.log(err, data); | 311 | console.log(err, data); |
228 | res.status(304).send({ error: "delete error" }); | 312 | res.status(304).send({ error: "delete error" }); |
229 | } else { | 313 | } else { |
230 | - let values = [newPath, cur, name, user_id]; | 314 | + let values = [req.body.newPath, cur, name, user_id]; |
231 | let updatesql = 'UPDATE files SET location = ? WHERE location = ? AND file_name = ? AND user_id = ?;'; | 315 | let updatesql = 'UPDATE files SET location = ? WHERE location = ? AND file_name = ? AND user_id = ?;'; |
232 | connection.query(updatesql, values, function(err3, result, field) { | 316 | connection.query(updatesql, values, function(err3, result, field) { |
233 | if (err3) { | 317 | if (err3) { |
234 | res.status(304).send({ error: "updatesql error" }); | 318 | res.status(304).send({ error: "updatesql error" }); |
235 | } else { | 319 | } else { |
236 | - let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 320 | + let resultsql = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; |
237 | connection.query(resultsql, [cur, user_id], function(err, rows, fields) { | 321 | connection.query(resultsql, [cur, user_id], function(err, rows, fields) { |
238 | res.status(200).send({ | 322 | res.status(200).send({ |
239 | - folders: rows | 323 | + files: rows |
240 | }); | 324 | }); |
241 | }); | 325 | }); |
242 | } | 326 | } |
... | @@ -246,6 +330,7 @@ router.post('/move', function(req, res, next) { | ... | @@ -246,6 +330,7 @@ router.post('/move', function(req, res, next) { |
246 | } | 330 | } |
247 | }); | 331 | }); |
248 | } else { | 332 | } else { |
333 | + console.log("Does not exist file"); | ||
249 | res.status(304).send({ error: "Does not exist" }); | 334 | res.status(304).send({ error: "Does not exist" }); |
250 | } | 335 | } |
251 | }); | 336 | }); |
... | @@ -254,20 +339,89 @@ router.post('/move', function(req, res, next) { | ... | @@ -254,20 +339,89 @@ router.post('/move', function(req, res, next) { |
254 | }); | 339 | }); |
255 | 340 | ||
256 | 341 | ||
257 | -router.post('/search/:target', function(req, res, next) { | 342 | +// router.post('/modify', function(req, res, next) { |
258 | - user_id = req.params.id; | 343 | +// console.log(req.body); |
259 | - let cur = req.params.cur; | 344 | +// user_id = req.body.id; |
260 | - folders = {} | 345 | +// let cur = req.body.cur; |
261 | - let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 346 | +// curPath = user_id + cur; |
262 | - connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { | 347 | +// let name = req.body.folder_name; |
263 | - if (rows.length != 0) { | 348 | +// let newName = req.body.newName; |
349 | + | ||
350 | +// let checkfolder = 'SELECT * FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
351 | +// connection.query(checkfolder, [cur, name, user_id], function(err1, rows, fields) { | ||
352 | +// console.log(rows); | ||
353 | +// if (rows.length != 0) { | ||
354 | +// let copy_params = { | ||
355 | +// Bucket: BUCKET_NAME, | ||
356 | +// CopySource: BUCKET_NAME + '/drive/' + curPath + name + '/', | ||
357 | +// Key: 'drive/' + curPath + newName + '/' | ||
358 | +// }; | ||
359 | +// let del_params = { | ||
360 | +// Bucket: BUCKET_NAME, | ||
361 | +// Key: 'drive/' + curPath + name + '/' | ||
362 | +// }; | ||
363 | +// s3.copyObject(copy_params, function(err, data) { | ||
364 | +// if (err) { | ||
365 | +// console.log(err, data); | ||
366 | +// console.log("copy error"); | ||
367 | +// res.status(304).send({ error: "copy error" }); | ||
368 | +// } else { | ||
369 | +// s3.deleteObject(del_params, function(err, data) { | ||
370 | +// if (err) { | ||
371 | +// console.log(err, data); | ||
372 | +// console.log("delete error"); | ||
373 | +// res.status(304).send({ error: "delete error" }); | ||
374 | +// } else { | ||
375 | +// let date = moment().format(); | ||
376 | +// let values = [newName, date, cur, name, user_id]; | ||
377 | +// let updatesql = 'UPDATE folders SET folder_name = ? AND modify = ? WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
378 | +// connection.query(updatesql, values, function(err3, result, field) { | ||
379 | +// if (err3) { | ||
380 | +// console.log("updatesql error"); | ||
381 | +// res.status(304).send({ error: "updatesql error" }); | ||
382 | +// } else { | ||
383 | +// let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | ||
384 | +// connection.query(resultsql, [cur, user_id], function(err, rows, fields) { | ||
385 | +// res.status(200).send({ | ||
386 | +// folders: rows | ||
387 | +// }); | ||
388 | +// }); | ||
389 | +// } | ||
390 | +// }); | ||
391 | +// } | ||
392 | +// }); | ||
393 | +// } | ||
394 | +// }); | ||
395 | +// } else { | ||
396 | +// console.log("Does not exist"); | ||
397 | +// res.status(304).send({ error: "Does not exist" }); | ||
398 | +// } | ||
399 | +// }); | ||
400 | + | ||
401 | +// }); | ||
402 | + | ||
403 | +router.get('/search', function(req, res, next) { | ||
404 | + console.log(req.query); | ||
405 | + user_id = req.query.id; | ||
406 | + let target = connection.escape('%' + req.query.target + '%'); | ||
407 | + console.log(target); | ||
408 | + let folders = [] | ||
409 | + let files = [] | ||
410 | + let checkfolder = 'SELECT * FROM folders WHERE folder_name LIKE ' + target + ' AND user_id = ? AND folder_name != ?;'; | ||
411 | + connection.query(checkfolder, [user_id, 'trashcan'], function(err, folder, fields) { | ||
412 | + console.log(folder); | ||
413 | + folders.push(folder) | ||
414 | + let checkfile = 'SELECT * FROM files WHERE file_name LIKE ' + target + ' AND user_id = ?;'; | ||
415 | + connection.query(checkfile, [user_id], function(err, file, fields) { | ||
416 | + console.log(file); | ||
417 | + files.push(file) | ||
264 | res.status(200).send({ | 418 | res.status(200).send({ |
265 | - folders: folders | 419 | + folders: folders, |
420 | + files: files | ||
266 | }) | 421 | }) |
267 | - } else { | ||
268 | - res.send({ error: "Does not exist" }); | ||
269 | - } | ||
270 | }); | 422 | }); |
423 | + }); | ||
424 | + | ||
271 | }); | 425 | }); |
272 | 426 | ||
273 | module.exports = router; | 427 | module.exports = router; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | { | 1 | { |
2 | - "accessKeyId": "ASIAXZL2SWFEYG2GUYVJ", | 2 | + "accessKeyId": "", |
3 | - "secretAccessKey": "ceYvfLs25iiBDfigO7PbP67kJoKswJdfduqROrJt", | 3 | + "secretAccessKey": "", |
4 | - "sessionToken": "FwoGZXIvYXdzEDMaDGvezwF9kQrAJ+uhfSLDASWFKBk7UNbRzZVEM1eoGJ3E+UI9d4xSpqEDqRYjsOTn5wYIGM3mUCZ8S6/XCnGP5yFz+qv9mBLDf311iP9ajY091OhQ8c2nB6l+JHuRKAz6FhGLrjHtD1AecHtjHOu5dXODU2+9ctvGj7V60KYqjToah5Tvv84EVac/41Les3rtrqcXS/bbmVwv5kDz9K1FJStln4sXZ/foueGHZAkAJQ6LAtIQWg4/reFUcWAi8E0bUjMckmymDQhnVNWcSbgQ+htBYiiPg+P2BTItOqWuZojM5lw32rTv7+PuOaeyHjx3+Vcd4bo3orSJr57P2ZPfmglZNKY7W5aw", | 4 | + "sessionToken": "", |
5 | - "region": "us-east-1" | 5 | + "region": "ap-northeast-2" |
6 | } | 6 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -asdf | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
File mode changed
File mode changed
File mode changed
... | @@ -13,11 +13,10 @@ | ... | @@ -13,11 +13,10 @@ |
13 | // targetFile: folder2/file.txt | 13 | // targetFile: folder2/file.txt |
14 | 14 | ||
15 | 15 | ||
16 | - | ||
17 | var AWS = require('aws-sdk'); | 16 | var AWS = require('aws-sdk'); |
18 | AWS.config.update({ region: 'ap-northeast-2' }); | 17 | AWS.config.update({ region: 'ap-northeast-2' }); |
19 | 18 | ||
20 | -var BUCKET_NAME = 'khuloud'; | 19 | +var BUCKET_NAME = 'qkrrlqja-test'; |
21 | 20 | ||
22 | var s3 = new AWS.S3(); | 21 | var s3 = new AWS.S3(); |
23 | var fs = require('fs'); | 22 | var fs = require('fs'); |
... | @@ -73,6 +72,32 @@ var S3 = { | ... | @@ -73,6 +72,32 @@ var S3 = { |
73 | }) | 72 | }) |
74 | }, | 73 | }, |
75 | 74 | ||
75 | + // 파일 덮어쓰기 | ||
76 | + coverFile: function(bucketName, userId, sourceFile, targetPath, body, callback) { | ||
77 | + var pathbody = fs.createReadStream(body); | ||
78 | + | ||
79 | + if (targetPath != '' && targetPath[targetPath.length - 1] != '/') { | ||
80 | + targetPath = targetPath + '/'; | ||
81 | + } | ||
82 | + var targetFile = targetPath + sourceFile; | ||
83 | + | ||
84 | + var coverParams = { | ||
85 | + Bucket: bucketName, | ||
86 | + Key: 'drive/' + userId + '/' + targetFile, | ||
87 | + Body: pathbody | ||
88 | + }; | ||
89 | + | ||
90 | + s3.upload(coverParams, function (err, data) { | ||
91 | + if (err) { | ||
92 | + console.log("Cover Error" + err); | ||
93 | + callback(false); | ||
94 | + } else { | ||
95 | + console.log("Cover Success"); | ||
96 | + callback(true); | ||
97 | + } | ||
98 | + }) | ||
99 | + }, | ||
100 | + | ||
76 | deleteFile: function (bucketName, userId, targetFile, callback) { | 101 | deleteFile: function (bucketName, userId, targetFile, callback) { |
77 | // targetFile => folder1/folder2/test.txt | 102 | // targetFile => folder1/folder2/test.txt |
78 | var deleteParams = { | 103 | var deleteParams = { |
... | @@ -104,10 +129,8 @@ var S3 = { | ... | @@ -104,10 +129,8 @@ var S3 = { |
104 | console.log("Download File Error", err); | 129 | console.log("Download File Error", err); |
105 | callback(false); | 130 | callback(false); |
106 | } else { | 131 | } else { |
107 | - if (data) { | ||
108 | console.log("Get File Success"); | 132 | console.log("Get File Success"); |
109 | - callback(true, data.body.toString()); | 133 | + callback(true, data.Body.toString()); |
110 | - } | ||
111 | } | 134 | } |
112 | }) | 135 | }) |
113 | }, | 136 | }, |
... | @@ -143,10 +166,13 @@ var S3 = { | ... | @@ -143,10 +166,13 @@ var S3 = { |
143 | Key: 'drive/' + userId + '/' + targetFile | 166 | Key: 'drive/' + userId + '/' + targetFile |
144 | }; | 167 | }; |
145 | try { | 168 | try { |
146 | - s3.getObject(params).createReadStream().pipe(file); | 169 | + var stream = s3.getObject(params).createReadStream().pipe(file); |
170 | + stream.on('end', function(){ | ||
171 | + console.log('end!'); | ||
147 | callback(true, tempDownloadDir); | 172 | callback(true, tempDownloadDir); |
173 | + }); | ||
148 | }catch(err){ | 174 | }catch(err){ |
149 | - console.log('no such file'); | 175 | + console.log('no such file', err); |
150 | callback(false); | 176 | callback(false); |
151 | } | 177 | } |
152 | }else{ | 178 | }else{ |
... | @@ -277,6 +303,75 @@ var S3 = { | ... | @@ -277,6 +303,75 @@ var S3 = { |
277 | }) | 303 | }) |
278 | }, | 304 | }, |
279 | 305 | ||
306 | + // 파일 이름이 달라지는 경우 | ||
307 | + moveFile3: function (bucketName, userId, oldFile, newFile, targetPath, callback) { | ||
308 | + if (targetPath != ''){ | ||
309 | + targetPath = targetPath + '/'; | ||
310 | + } | ||
311 | + sourceFile = targetPath + oldFile; // test.txt or folder1/test.txt | ||
312 | + var targetFile = targetPath + newFile; | ||
313 | + | ||
314 | + S3.copyFile2(bucketName, userId, sourceFile, targetFile, function(result){ | ||
315 | + if (!result){ | ||
316 | + console.log("Move Error on Copying File3"); | ||
317 | + callback(false); | ||
318 | + }else{ | ||
319 | + S3.deleteFile(bucketName, userId, sourceFile, function (res) { | ||
320 | + if (!res) { | ||
321 | + console.log("Move Error on Deleting File"); | ||
322 | + callback(false); | ||
323 | + } else { | ||
324 | + console.log("Move Success"); | ||
325 | + callback(true); | ||
326 | + } | ||
327 | + }) | ||
328 | + } | ||
329 | + }) | ||
330 | + }, | ||
331 | + | ||
332 | + renameFile: function(bucketName, userId, sourceFile, modiFile, targetPath, callback){ | ||
333 | + // sourceFile = test.txt | ||
334 | + // modiFile = test2.txt | ||
335 | + // targetPath = '' or 'folder1/folder2' | ||
336 | + | ||
337 | + if (sourceFile == modiFile){ // 이름 변경되지 않은 경우 | ||
338 | + callback(true, sourceFile); | ||
339 | + }else{ | ||
340 | + if (targetPath != '') { | ||
341 | + targetPath = targetpath + '/'; | ||
342 | + } | ||
343 | + var targetFile = targetPath + modiFile; | ||
344 | + | ||
345 | + S3.isFileOverlapped(bucketName, userId, targetFile, function (res, ans, lvNum) { | ||
346 | + if (!res) { | ||
347 | + console.log("Overlap Check failed"); | ||
348 | + callback(false, sourceFile); | ||
349 | + } else { | ||
350 | + if (ans) { | ||
351 | + console.log("File Duplication"); | ||
352 | + S3.makeVersion(bucketName, userId, targetFile, lvNum + 1, function (res, versionedSourceFile) { | ||
353 | + if (!res) { | ||
354 | + console.log("Make version failed"); | ||
355 | + callback(false, sourceFile); | ||
356 | + } else { | ||
357 | + S3.renameFile(bucketName, userId, sourceFile, versionedSourceFile, targetPath, callback); | ||
358 | + } | ||
359 | + }) | ||
360 | + } else { | ||
361 | + S3.moveFile3(bucketName, userId, sourceFile, modiFile, targetPath, function (result) { | ||
362 | + if (result) { | ||
363 | + callback(true, modiFile); | ||
364 | + } else { | ||
365 | + console.log('File Rename failed'); | ||
366 | + callback(false); | ||
367 | + } | ||
368 | + }) | ||
369 | + } | ||
370 | + } | ||
371 | + }); | ||
372 | + } | ||
373 | + }, | ||
374 | + | ||
280 | uploadFile: function (bucketName, userId, sourceFile, targetPath, body, callback) { | 375 | uploadFile: function (bucketName, userId, sourceFile, targetPath, body, callback) { |
281 | var pathbody = fs.createReadStream(body); | 376 | var pathbody = fs.createReadStream(body); |
282 | 377 | ... | ... |
backend/routes/quick.js
0 → 100644
1 | +var express = require('express'); | ||
2 | +var router = express.Router(); | ||
3 | + | ||
4 | + | ||
5 | +router.get('/', function(req, res){ | ||
6 | + var user_id = req.query.id; | ||
7 | + | ||
8 | + var sql = 'SELECT * FROM files WHERE recent_access>date_sub(now(), interval 3 day) AND user_id=(?)'; | ||
9 | + connection.query(sql, user_id, function(err, result){ | ||
10 | + if (err){ | ||
11 | + console.log('select error'); | ||
12 | + res.send({error: 'quick error'}); | ||
13 | + }else{ | ||
14 | + res.send(result); | ||
15 | + } | ||
16 | + }) | ||
17 | +}) | ||
18 | + | ||
19 | + | ||
20 | +module.exports = router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
backend/routes/share.js
0 → 100644
1 | +const express = require('express'); | ||
2 | +const router = express.Router(); | ||
3 | +const AWS = require("aws-sdk"); | ||
4 | +const moment = require("moment"); | ||
5 | +AWS.config.loadFromPath(__dirname + "/modules/awsconfig.json"); | ||
6 | + | ||
7 | +const BUCKET_NAME = "hong-s3-cloud"; | ||
8 | + | ||
9 | +const s3 = new AWS.S3(); | ||
10 | + | ||
11 | + | ||
12 | +router.post('/', function(req, res, next) { | ||
13 | + console.log(req.body); | ||
14 | + let user_id = req.body.id; | ||
15 | + let cur = req.body.cur; | ||
16 | + let curPath = user_id + cur; | ||
17 | + let name = req.body.file_name; | ||
18 | + let target_id = req.body.target_id; | ||
19 | + | ||
20 | + let checkfile = 'SELECT * FROM files WHERE location = ? AND file_name = ? AND user_id = ?'; | ||
21 | + connection.query(checkfile, [cur, name, user_id], function(err1, rows, fields) { | ||
22 | + if (rows.length != 0) { | ||
23 | + let copy_params = { | ||
24 | + Bucket: BUCKET_NAME, | ||
25 | + CopySource: BUCKET_NAME + '/drive/' + curPath + name, | ||
26 | + Key: 'drive/' + target_id + '/share/' + name | ||
27 | + }; | ||
28 | + s3.copyObject(copy_params, function(err, data) { | ||
29 | + if (err) { | ||
30 | + console.log(err, data); | ||
31 | + res.status(304).send({ error: "copy error" }); | ||
32 | + } else { | ||
33 | + let values = [name, '/share/', target_id]; | ||
34 | + let sharesql = 'INSERT INTO files (file_name,location,user_id) values (?,?,?);'; | ||
35 | + connection.query(sharesql, values, function(err3, result, field) { | ||
36 | + if (err3) { | ||
37 | + console.log("sharesql error"); | ||
38 | + res.status(304).send({ error: "sharesql error" }); | ||
39 | + } else { | ||
40 | + res.status(200).send({}); | ||
41 | + } | ||
42 | + }); | ||
43 | + } | ||
44 | + }); | ||
45 | + } else { | ||
46 | + console.log("Does not exist"); | ||
47 | + res.status(304).send({ error: "Does not exist" }); | ||
48 | + } | ||
49 | + }); | ||
50 | + | ||
51 | +}); | ||
52 | + | ||
53 | +module.exports = router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
backend/routes/trashcan.js
0 → 100644
1 | +const express = require('express'); | ||
2 | +const router = express.Router(); | ||
3 | +const AWS = require("aws-sdk"); | ||
4 | +const moment = require("moment"); | ||
5 | +AWS.config.loadFromPath(__dirname + "/modules/awsconfig.json"); | ||
6 | +var S3 = require(__dirname + '/modules/s3/s3'); | ||
7 | + | ||
8 | +const s3 = new AWS.S3(); | ||
9 | + | ||
10 | +router.get('/show', function(req, res, next) { | ||
11 | + console.log(req.query); | ||
12 | + user_id = req.query.id; | ||
13 | + | ||
14 | + let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | ||
15 | + connection.query(checkfolder, ['/trashcan/', user_id], function(err, folder) { | ||
16 | + if (err) { | ||
17 | + console.log('select error'); | ||
18 | + res.status(400).send({ err: err }); | ||
19 | + } else { | ||
20 | + let checkfile = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; | ||
21 | + connection.query(checkfile, ['/trashcan/', user_id], function(err, file) { | ||
22 | + if (err) { | ||
23 | + console.log('select error'); | ||
24 | + res.status(400).send({ err: err }); | ||
25 | + } else { | ||
26 | + res.status(200).send({ | ||
27 | + folders: folder, | ||
28 | + files: file | ||
29 | + }) | ||
30 | + } | ||
31 | + }); | ||
32 | + } | ||
33 | + }); | ||
34 | +}); | ||
35 | + | ||
36 | +router.get('/delfile', function(req, res, next) { | ||
37 | + var file_id = req.query.file_id; | ||
38 | + var user_id = req.query.id; | ||
39 | + | ||
40 | + | ||
41 | + var getsql = 'SELECT * FROM files WHERE file_id = (?)'; | ||
42 | + connection.query(getsql, [file_id], function(err, rows) { | ||
43 | + if (err) { | ||
44 | + console.log('select db error'); | ||
45 | + res.send({ erorr: 'db select error' }); | ||
46 | + } else { | ||
47 | + if (rows.length == 0) { | ||
48 | + console.log('exist error'); | ||
49 | + res.send({ erorr: 'exist error' }); | ||
50 | + } else { | ||
51 | + var curPath = '/trashcan/'; | ||
52 | + var file_name = rows[0].file_name; | ||
53 | + var sourceFile = curPath.substring(1) + file_name; | ||
54 | + | ||
55 | + var sql1 = 'DELETE FROM files WHERE file_name = (?) AND location=(?) AND user_Id = (?)'; | ||
56 | + connection.query(sql1, [file_name, curPath, user_id], function(err) { | ||
57 | + if (err) { | ||
58 | + console.log('delete db error'); | ||
59 | + res.send({ erorr: 'db delete error' }); | ||
60 | + } else { | ||
61 | + S3.deleteFile(S3.BUCKET_NAME, user_id, sourceFile, function(result) { | ||
62 | + if (result) { | ||
63 | + let checkfile = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; | ||
64 | + connection.query(checkfile, ['/trashcan/', user_id], function(err, file) { | ||
65 | + res.status(200).send({ | ||
66 | + files: file | ||
67 | + }) | ||
68 | + }); | ||
69 | + } | ||
70 | + }) | ||
71 | + } | ||
72 | + }) | ||
73 | + } | ||
74 | + } | ||
75 | + }) | ||
76 | +}); | ||
77 | + | ||
78 | + | ||
79 | +router.get('/delfolder', function(req, res, next) { | ||
80 | + var folder_id = req.query.folder_id; | ||
81 | + var user_id = req.query.id; | ||
82 | + | ||
83 | + | ||
84 | + var getsql = 'SELECT * FROM folders WHERE folder_id = (?)'; | ||
85 | + connection.query(getsql, [folder_id], function(err, rows) { | ||
86 | + if (err) { | ||
87 | + console.log('select db error'); | ||
88 | + res.send({ erorr: 'db select error' }); | ||
89 | + } else { | ||
90 | + if (rows.length == 0) { | ||
91 | + console.log('exist error'); | ||
92 | + res.send({ erorr: 'exist error' }); | ||
93 | + } else { | ||
94 | + var curPath = '/trashcan/' | ||
95 | + var folder_name = rows[0].folder_name; | ||
96 | + | ||
97 | + var sql1 = 'DELETE FROM folders WHERE folder_name = (?) AND location=(?) AND user_Id = (?)'; | ||
98 | + connection.query(sql1, [folder_name, curPath, user_id], function(err) { | ||
99 | + if (err) { | ||
100 | + console.log('delete db error'); | ||
101 | + res.send({ erorr: 'db delete error' }); | ||
102 | + } else { | ||
103 | + var params = { | ||
104 | + Bucket: S3.BUCKET_NAME, | ||
105 | + Key: 'drive/' + user_id + curPath + folder_name + '/' | ||
106 | + }; | ||
107 | + s3.deleteObject(params, function(err, data) { | ||
108 | + if (err) { | ||
109 | + res.status(400).send({ err: err }); | ||
110 | + } else { | ||
111 | + let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | ||
112 | + connection.query(checkfolder, [curPath, user_id], function(err, rows) { | ||
113 | + res.status(200).send({ | ||
114 | + folders: rows | ||
115 | + }) | ||
116 | + }); | ||
117 | + | ||
118 | + } | ||
119 | + }) | ||
120 | + } | ||
121 | + }) | ||
122 | + } | ||
123 | + } | ||
124 | + }) | ||
125 | +}); | ||
126 | + | ||
127 | +router.get('/all', function(req, res, next) { | ||
128 | + var user_id = req.query.id; | ||
129 | + | ||
130 | + var getfolder = "SELECT * FROM folders WHERE user_id = ? AND location = ?;"; | ||
131 | + connection.query(getfolder, [user_id, '/trashcan/'], function(err, folders) { | ||
132 | + if (err) { | ||
133 | + console.log('select db error'); | ||
134 | + res.send({ erorr: 'db select error' }); | ||
135 | + } else { | ||
136 | + var getfile = "SELECT * FROM files WHERE user_id = ? AND location = ?;"; | ||
137 | + connection.query(getfile, [user_id, '/trashcan/'], function(err, files) { | ||
138 | + if (err) { | ||
139 | + console.log('select db error'); | ||
140 | + res.send({ erorr: 'db select error' }); | ||
141 | + } else { | ||
142 | + for (let i of files) { | ||
143 | + var sql1 = 'DELETE FROM files WHERE file_id = ?;'; | ||
144 | + var sourceFile = 'trashcan/' + i.file_name; | ||
145 | + connection.query(sql1, [i.file_id], function(err) { | ||
146 | + if (err) { | ||
147 | + console.log('delete db error'); | ||
148 | + res.send({ erorr: 'db delete error' }); | ||
149 | + } else { | ||
150 | + S3.deleteFile(S3.BUCKET_NAME, user_id, sourceFile, function(result) {}) | ||
151 | + } | ||
152 | + }) | ||
153 | + } | ||
154 | + for (let j of folders) { | ||
155 | + var curPath = '/trashcan/'; | ||
156 | + | ||
157 | + var sql1 = 'DELETE FROM folders WHERE folder_name = (?) AND location=(?) AND user_Id = (?)'; | ||
158 | + connection.query(sql1, [j.folder_name, curPath, user_id], function(err) { | ||
159 | + if (err) { | ||
160 | + console.log('delete db error'); | ||
161 | + res.send({ erorr: 'db delete error' }); | ||
162 | + } else { | ||
163 | + var params = { | ||
164 | + Bucket: S3.BUCKET_NAME, | ||
165 | + Key: 'drive/' + user_id + curPath + j.folder_name + '/' | ||
166 | + }; | ||
167 | + s3.deleteObject(params, function(err, data) { | ||
168 | + if (err) { | ||
169 | + res.status(400).send({ err: err }); | ||
170 | + } | ||
171 | + }); | ||
172 | + } | ||
173 | + }); | ||
174 | + } | ||
175 | + res.send({ success: "success" }); | ||
176 | + } | ||
177 | + }); | ||
178 | + } | ||
179 | + }); | ||
180 | +}); | ||
181 | + | ||
182 | +router.post('/restore', function(req, res, next) { | ||
183 | + console.log(req.body); | ||
184 | + let user_id = req.body.user_id; | ||
185 | + let id = req.body.id; | ||
186 | + if (req.body.isfolder) { | ||
187 | + let checkfolder = 'SELECT * FROM folders WHERE folder_id = ? AND user_id = ?;'; | ||
188 | + connection.query(checkfolder, [id, user_id], function(err1, rows, fields) { | ||
189 | + console.log(rows); | ||
190 | + if (rows.length != 0) { | ||
191 | + let curPath = user_id + '/trashcan/' | ||
192 | + let name = rows[0].folder_name | ||
193 | + let copy_params = { | ||
194 | + Bucket: S3.BUCKET_NAM, | ||
195 | + CopySource: S3.BUCKET_NAM + '/drive/' + curPath + name + '/', | ||
196 | + Key: 'drive/' + user_id + '/' + name + '/' | ||
197 | + }; | ||
198 | + let del_params = { | ||
199 | + Bucket: S3.BUCKET_NAM, | ||
200 | + Key: 'drive/' + curPath + name + '/' | ||
201 | + }; | ||
202 | + s3.copyObject(copy_params, function(err, data) { | ||
203 | + if (err) { | ||
204 | + console.log(err, data); | ||
205 | + console.log("copy error"); | ||
206 | + res.status(304).send({ error: "copy error" }); | ||
207 | + } else { | ||
208 | + s3.deleteObject(del_params, function(err, data) { | ||
209 | + if (err) { | ||
210 | + console.log(err, data); | ||
211 | + console.log("delete error"); | ||
212 | + res.status(304).send({ error: "delete error" }); | ||
213 | + } else { | ||
214 | + let values = ['/', '/trashcan/', name, user_id]; | ||
215 | + let updatesql = 'UPDATE folders SET location = ? WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
216 | + connection.query(updatesql, values, function(err3, result, field) { | ||
217 | + if (err3) { | ||
218 | + console.log("updatesql error"); | ||
219 | + res.status(304).send({ error: "updatesql error" }); | ||
220 | + } else { | ||
221 | + let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | ||
222 | + connection.query(resultsql, ['/trashcan/', user_id], function(err, folder, fields) { | ||
223 | + res.status(200).send({ | ||
224 | + folders: folder | ||
225 | + }); | ||
226 | + }); | ||
227 | + } | ||
228 | + }); | ||
229 | + } | ||
230 | + }); | ||
231 | + } | ||
232 | + }); | ||
233 | + } else { | ||
234 | + console.log("Does not exist folder"); | ||
235 | + res.status(304).send({ error: "Does not exist" }); | ||
236 | + } | ||
237 | + }); | ||
238 | + } else { | ||
239 | + let checkfile = 'SELECT * FROM files WHERE file_id = ? AND user_id = ?;'; | ||
240 | + connection.query(checkfile, [id, user_id], function(err1, rows, fields) { | ||
241 | + console.log(rows); | ||
242 | + if (rows.length != 0) { | ||
243 | + let curPath = user_id + '/trashcan/' | ||
244 | + let name = rows[0].file_name | ||
245 | + let copy_params = { | ||
246 | + Bucket: S3.BUCKET_NAME, | ||
247 | + CopySource: S3.BUCKET_NAME + '/drive/' + curPath + name, | ||
248 | + Key: 'drive/' + user_id + '/' + name | ||
249 | + }; | ||
250 | + let del_params = { | ||
251 | + Bucket: S3.BUCKET_NAME, | ||
252 | + Key: 'drive/' + curPath + name | ||
253 | + }; | ||
254 | + s3.copyObject(copy_params, function(err, data) { | ||
255 | + if (err) { | ||
256 | + console.log(err, data); | ||
257 | + console.log("copy error"); | ||
258 | + res.status(304).send({ error: "copy error" }); | ||
259 | + } else { | ||
260 | + s3.deleteObject(del_params, function(err, data) { | ||
261 | + if (err) { | ||
262 | + console.log(err, data); | ||
263 | + console.log("delete error"); | ||
264 | + res.status(304).send({ error: "delete error" }); | ||
265 | + } else { | ||
266 | + let values = ['/', '/trashcan/', name, user_id]; | ||
267 | + let updatesql = 'UPDATE files SET location = ? WHERE location = ? AND folder_name = ? AND user_id = ?;'; | ||
268 | + connection.query(updatesql, values, function(err3, result, field) { | ||
269 | + if (err3) { | ||
270 | + console.log("updatesql error"); | ||
271 | + res.status(304).send({ error: "updatesql error" }); | ||
272 | + } else { | ||
273 | + let resultsql = 'SELECT * FROM files WHERE location = ? AND user_id = ?;'; | ||
274 | + connection.query(resultsql, ['/trashcan/', user_id], function(err, file, fields) { | ||
275 | + res.status(200).send({ | ||
276 | + files: file | ||
277 | + }); | ||
278 | + }); | ||
279 | + } | ||
280 | + }); | ||
281 | + } | ||
282 | + }); | ||
283 | + } | ||
284 | + }); | ||
285 | + } else { | ||
286 | + console.log("Does not exist file"); | ||
287 | + res.status(304).send({ error: "Does not exist" }); | ||
288 | + } | ||
289 | + }); | ||
290 | + | ||
291 | + } | ||
292 | +}); | ||
293 | + | ||
294 | +module.exports = router; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | var request = require('request'); | 2 | var request = require('request'); |
3 | var async = require('async'); | 3 | var async = require('async'); |
4 | - | 4 | +const AWS = require("aws-sdk"); |
5 | +AWS.config.loadFromPath(__dirname + "/../modules/awsconfig.json"); | ||
5 | var cryptoM = require('./../../routes/modules/cryptoM.js'); | 6 | var cryptoM = require('./../../routes/modules/cryptoM.js'); |
7 | +const moment = require("moment"); | ||
8 | + | ||
9 | +const BUCKET_NAME = "hong-s3-cloud"; | ||
10 | +const s3 = new AWS.S3(); | ||
6 | 11 | ||
7 | var router = express.Router(); | 12 | var router = express.Router(); |
8 | 13 | ||
... | @@ -14,25 +19,83 @@ router.get('/', function(req, res, next) { | ... | @@ -14,25 +19,83 @@ router.get('/', function(req, res, next) { |
14 | 19 | ||
15 | router.post('/', function(req, res, next) { | 20 | router.post('/', function(req, res, next) { |
16 | console.log(req.body); | 21 | console.log(req.body); |
17 | - var user_id=req.body.user_id; | 22 | + var user_id = req.body.user_id; |
18 | - var user_pw=req.body.user_pw; | 23 | + var user_pw = req.body.user_pw; |
19 | - var user_email=req.body.user_email; | 24 | + var user_email = req.body.user_email; |
20 | - var user_name=req.body.user_name; | 25 | + var user_name = req.body.user_name; |
21 | - var user_phone=req.body.user_phone; | 26 | + var user_phone = req.body.user_phone; |
22 | 27 | ||
23 | var sqlquery = "SELECT * FROM users WHERE user_id = ?"; | 28 | var sqlquery = "SELECT * FROM users WHERE user_id = ?"; |
24 | - connection.query(sqlquery, [user_id], function (err, rows) { | 29 | + connection.query(sqlquery, [user_id], function(err, rows) { |
25 | if (rows.length == 0) { | 30 | if (rows.length == 0) { |
26 | - user_pw=cryptoM.encrypt(user_pw); | 31 | + user_pw = cryptoM.encrypt(user_pw); |
27 | console.log(user_pw); | 32 | console.log(user_pw); |
28 | var sql = 'INSERT INTO users(user_id,user_pw, user_email, user_phone, user_name) values (?,?,?,?,?)'; | 33 | var sql = 'INSERT INTO users(user_id,user_pw, user_email, user_phone, user_name) values (?,?,?,?,?)'; |
29 | - var values = [user_id, user_pw, user_email, user_phone,user_name]; | 34 | + var values = [user_id, user_pw, user_email, user_phone, user_name]; |
30 | - connection.query(sql, values, function (err) { | 35 | + connection.query(sql, values, function(err) { |
31 | if (err) { | 36 | if (err) { |
32 | console.log("inserting user failed"); | 37 | console.log("inserting user failed"); |
33 | - throw err; | 38 | + res.status(400).send({ err: err }); |
39 | + } else { | ||
40 | + let params = { | ||
41 | + Bucket: BUCKET_NAME, | ||
42 | + Key: 'drive/' + user_id + '/', | ||
43 | + Body: "", | ||
44 | + ACL: "public-read-write" | ||
45 | + }; | ||
46 | + s3.putObject(params, function(err, data) { | ||
47 | + if (err) { | ||
48 | + console.log('s3 error'); | ||
49 | + res.status(400).send({ err: err }); | ||
50 | + } else { | ||
51 | + let params2 = { | ||
52 | + Bucket: BUCKET_NAME, | ||
53 | + Key: 'drive/' + user_id + '/share/', | ||
54 | + Body: "", | ||
55 | + ACL: "public-read-write" | ||
56 | + }; | ||
57 | + s3.putObject(params2, function(err, data) { | ||
58 | + if (err) { | ||
59 | + console.log('s3 error'); | ||
60 | + res.status(400).send({ err: err }); | ||
61 | + } else { | ||
62 | + let params3 = { | ||
63 | + Bucket: BUCKET_NAME, | ||
64 | + Key: 'drive/' + user_id + '/trashcan/', | ||
65 | + Body: "", | ||
66 | + ACL: "public-read-write" | ||
67 | + }; | ||
68 | + s3.putObject(params3, function(err, data) { | ||
69 | + if (err) { | ||
70 | + console.log('s3 error'); | ||
71 | + res.status(400).send({ err: err }); | ||
72 | + } else { | ||
73 | + let date = moment().format(); | ||
74 | + let root = '/'; | ||
75 | + let sql = "INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);"; | ||
76 | + connection.query(sql, ['share', root, user_id, date], function(err, result, field) { | ||
77 | + if (err) { | ||
78 | + console.log('insert1 error'); | ||
79 | + res.status(400).send({ err: err }); | ||
80 | + } else { | ||
81 | + let sql = "INSERT INTO folders (folder_name,location,user_id,created) values (?,?,?,?);"; | ||
82 | + connection.query(sql, ['trashcan', root, user_id, date], function(err, result, field) { | ||
83 | + if (err) { | ||
84 | + console.log('insert2 error'); | ||
85 | + res.status(400).send({ err: err }); | ||
34 | } else { | 86 | } else { |
35 | res.status(200).send('saved'); | 87 | res.status(200).send('saved'); |
88 | + } | ||
89 | + }); | ||
90 | + } | ||
91 | + }); | ||
92 | + } | ||
93 | + }); | ||
94 | + } | ||
95 | + }); | ||
96 | + } | ||
97 | + }); | ||
98 | + | ||
36 | 99 | ||
37 | } | 100 | } |
38 | }); | 101 | }); | ... | ... |
... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
9 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"> | 9 | <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"> |
10 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"> | 10 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"> |
11 | <meta name="viewport" content="width=device-width,initial-scale=1.0"> | 11 | <meta name="viewport" content="width=device-width,initial-scale=1.0"> |
12 | + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" integrity="sha384-Bfad6CLCknfcloXFOyFnlgtENryhrpZCe29RTifKEixXQZ38WheV+i/6YWSzkz3V" crossorigin="anonymous"> | ||
12 | </head> | 13 | </head> |
13 | <body> | 14 | <body> |
14 | <noscript> | 15 | <noscript> | ... | ... |
... | @@ -3,16 +3,14 @@ | ... | @@ -3,16 +3,14 @@ |
3 | </template> | 3 | </template> |
4 | 4 | ||
5 | <script> | 5 | <script> |
6 | -import ToolView from './components/ToolView' | 6 | +import ToolView from './components/ToolView'; |
7 | 7 | ||
8 | - export default { | 8 | +export default { |
9 | data() { | 9 | data() { |
10 | - return { | 10 | + return {}; |
11 | - | ||
12 | - } | ||
13 | }, | 11 | }, |
14 | components: { | 12 | components: { |
15 | ToolView, | 13 | ToolView, |
16 | - } | 14 | + }, |
17 | - } | 15 | +}; |
18 | </script> | 16 | </script> | ... | ... |
... | @@ -18,7 +18,7 @@ function folder(curData) { | ... | @@ -18,7 +18,7 @@ function folder(curData) { |
18 | return axios.get('/api/folder/show', { | 18 | return axios.get('/api/folder/show', { |
19 | params: { | 19 | params: { |
20 | id: curData.id, | 20 | id: curData.id, |
21 | - cur: curData.cur, | 21 | + folder_id: curData.folder_id, |
22 | }, | 22 | }, |
23 | }); | 23 | }); |
24 | } | 24 | } |
... | @@ -53,7 +53,7 @@ function uploadFile(fileData) { | ... | @@ -53,7 +53,7 @@ function uploadFile(fileData) { |
53 | } | 53 | } |
54 | 54 | ||
55 | function detailFile(fileData) { | 55 | function detailFile(fileData) { |
56 | - return axios.get(`/api/file/${fileData.name}`, { | 56 | + return axios.get(`/api/file/${fileData.fileName}`, { |
57 | params: { | 57 | params: { |
58 | id: fileData.id, | 58 | id: fileData.id, |
59 | cur: fileData.cur, | 59 | cur: fileData.cur, |
... | @@ -70,8 +70,9 @@ function deleteFile(fileData) { | ... | @@ -70,8 +70,9 @@ function deleteFile(fileData) { |
70 | }, | 70 | }, |
71 | }); | 71 | }); |
72 | } | 72 | } |
73 | + | ||
73 | function downloadFile(fileData) { | 74 | function downloadFile(fileData) { |
74 | - return axios.get(`api/file/download/${fileData.fileName}`, { | 75 | + return axios.get(`/api/file/download/${fileData.fileName}`, { |
75 | params: { | 76 | params: { |
76 | //현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다. | 77 | //현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다. |
77 | id: fileData.id, | 78 | id: fileData.id, |
... | @@ -80,6 +81,84 @@ function downloadFile(fileData) { | ... | @@ -80,6 +81,84 @@ function downloadFile(fileData) { |
80 | }); | 81 | }); |
81 | } | 82 | } |
82 | 83 | ||
84 | +function accessedList(curData) { | ||
85 | + return axios.get('/api/quick', { | ||
86 | + params: { | ||
87 | + id: curData.id, | ||
88 | + }, | ||
89 | + }); | ||
90 | +} | ||
91 | + | ||
92 | +function showTrashcan(userId) { | ||
93 | + return axios.get('/api/trashcan/show', { | ||
94 | + params: { | ||
95 | + id: userId, | ||
96 | + }, | ||
97 | + }); | ||
98 | +} | ||
99 | + | ||
100 | +function modifyFile(fileData) { | ||
101 | + return axios.post(`/api/file/modify/${fileData.name}`, fileData); | ||
102 | +} | ||
103 | + | ||
104 | +function delFavorite(folderData) { | ||
105 | + return axios.post('/api/favorites/delfolder', folderData); | ||
106 | +} | ||
107 | + | ||
108 | +function addFavorite(folderData) { | ||
109 | + return axios.post('/api/favorites/addfolder', folderData); | ||
110 | +} | ||
111 | + | ||
112 | +function moveFile(fileData) { | ||
113 | + return axios.post('/api/folder/move', fileData); | ||
114 | +} | ||
115 | + | ||
116 | +function delFavoriteFile(fileData) { | ||
117 | + return axios.post('/api/favorites/delfile', fileData); | ||
118 | +} | ||
119 | + | ||
120 | +function addFavoriteFile(fileData) { | ||
121 | + return axios.post('/api/favorites/addfile', fileData); | ||
122 | +} | ||
123 | + | ||
124 | +function getFavoriteList(userId) { | ||
125 | + return axios.get('/api/favorites/show', { | ||
126 | + params: { | ||
127 | + id: userId, | ||
128 | + }, | ||
129 | + }); | ||
130 | +} | ||
131 | + | ||
132 | +function shareFile(shareData) { | ||
133 | + return axios.post('/api/share', shareData); | ||
134 | +} | ||
135 | + | ||
136 | +function tdelFolder(tData) { | ||
137 | + return axios.get('/api/trashcan/delfolder', { | ||
138 | + params: { | ||
139 | + id: tData.id, | ||
140 | + folder_id: tData.folder_id, | ||
141 | + }, | ||
142 | + }); | ||
143 | +} | ||
144 | + | ||
145 | +function tdelFile(tData) { | ||
146 | + return axios.get('/api/trashcan/delfile', { | ||
147 | + params: { | ||
148 | + id: tData.id, | ||
149 | + file_id: tData.file_id, | ||
150 | + }, | ||
151 | + }); | ||
152 | +} | ||
153 | + | ||
154 | +function tdelAll(userId) { | ||
155 | + return axios.get('/api/trashcan/all', { | ||
156 | + params: { | ||
157 | + id: userId, | ||
158 | + }, | ||
159 | + }); | ||
160 | +} | ||
161 | + | ||
83 | export { | 162 | export { |
84 | registerUser, | 163 | registerUser, |
85 | loginUser, | 164 | loginUser, |
... | @@ -91,4 +170,18 @@ export { | ... | @@ -91,4 +170,18 @@ export { |
91 | uploadFile, | 170 | uploadFile, |
92 | deleteFile, | 171 | deleteFile, |
93 | downloadFile, | 172 | downloadFile, |
173 | + delFavorite, | ||
174 | + addFavorite, | ||
175 | + moveFile, | ||
176 | + delFavoriteFile, | ||
177 | + addFavoriteFile, | ||
178 | + accessedList, | ||
179 | + detailFile, | ||
180 | + modifyFile, | ||
181 | + getFavoriteList, | ||
182 | + shareFile, | ||
183 | + tdelFolder, | ||
184 | + tdelFile, | ||
185 | + tdelAll, | ||
186 | + showTrashcan, | ||
94 | }; | 187 | }; | ... | ... |
1 | <template> | 1 | <template> |
2 | - <v-card | 2 | + <div> |
3 | - max-width="98%" | 3 | + <v-toolbar flat> |
4 | - class="mx-auto" | 4 | + <v-toolbar-title>내 드라이브</v-toolbar-title> |
5 | - > | ||
6 | - <v-toolbar | ||
7 | - color="light-blue" | ||
8 | - dark | ||
9 | - > | ||
10 | - <v-toolbar-title>즐겨찾기</v-toolbar-title> | ||
11 | <v-spacer></v-spacer> | 5 | <v-spacer></v-spacer> |
6 | + <v-text-field | ||
7 | + v-model="search" | ||
8 | + append-icon="mdi-magnify" | ||
9 | + label="검색" | ||
10 | + single-line | ||
11 | + hide-details | ||
12 | + ></v-text-field> | ||
12 | </v-toolbar> | 13 | </v-toolbar> |
13 | - <v-list two-line subheader> | 14 | + <v-list> |
15 | + <!-- <v-subheader inset>Folders</v-subheader> --> | ||
16 | + <!-- Folder view --> | ||
14 | <v-list-item | 17 | <v-list-item |
15 | - v-for="item in items" | 18 | + v-if="this.$route.path !== '/fav'" |
16 | - :key="item.title" | 19 | + @click="" |
20 | + @dblclick="$router.go(-1)" | ||
21 | + >...</v-list-item | ||
22 | + > | ||
23 | + <v-list-item | ||
24 | + v-for="item in calData" | ||
25 | + :key="item.folder_id" | ||
26 | + :search="search" | ||
27 | + @click.right="show(item, $event)" | ||
17 | @click="" | 28 | @click="" |
29 | + @dblclick=" | ||
30 | + $router.push({ | ||
31 | + name: 'Folder', | ||
32 | + params: { id: item.folder_id }, | ||
33 | + }) | ||
34 | + " | ||
18 | > | 35 | > |
19 | <v-list-item-avatar> | 36 | <v-list-item-avatar> |
20 | - <v-icon | 37 | + <v-icon>mdi-folder</v-icon> |
21 | - :class="[item.iconClass]" | ||
22 | - v-text="item.icon" | ||
23 | - ></v-icon> | ||
24 | </v-list-item-avatar> | 38 | </v-list-item-avatar> |
25 | <v-list-item-content> | 39 | <v-list-item-content> |
26 | - <v-list-item-title v-text="item.title"></v-list-item-title> | 40 | + <v-list-item-title v-text="item.folder_name"></v-list-item-title> |
27 | - <v-list-item-subtitle v-text="item.subtitle"></v-list-item-subtitle> | ||
28 | </v-list-item-content> | 41 | </v-list-item-content> |
29 | <v-list-item-action> | 42 | <v-list-item-action> |
30 | - <v-btn icon> | 43 | + <v-icon v-if="item.favorite === 0"> |
31 | - <v-icon color="grey lighten-1">mdi-information</v-icon> | 44 | + mdi-star-outline |
32 | - </v-btn> | 45 | + </v-icon> |
46 | + <v-icon v-else> | ||
47 | + mdi-star | ||
48 | + </v-icon> | ||
33 | </v-list-item-action> | 49 | </v-list-item-action> |
34 | </v-list-item> | 50 | </v-list-item> |
51 | + <!-- File view --> | ||
35 | <v-list-item | 52 | <v-list-item |
36 | - v-for="item in items2" | 53 | + v-for="item in calData2" |
37 | :key="item.title" | 54 | :key="item.title" |
55 | + @click.right="showF(item, $event)" | ||
56 | + @dblclick=" | ||
57 | + detailF(item, $event); | ||
58 | + file_detail(item); | ||
59 | + " | ||
38 | @click="" | 60 | @click="" |
39 | > | 61 | > |
40 | <v-list-item-avatar> | 62 | <v-list-item-avatar> |
41 | - <v-icon | 63 | + <v-icon> mdi-file</v-icon> |
42 | - :class="[item.iconClass]" | ||
43 | - v-text="item.icon" | ||
44 | - ></v-icon> | ||
45 | </v-list-item-avatar> | 64 | </v-list-item-avatar> |
46 | <v-list-item-content> | 65 | <v-list-item-content> |
47 | - <v-list-item-title v-text="item.title"></v-list-item-title> | 66 | + <v-list-item-title v-text="item.file_name"></v-list-item-title> |
48 | - <v-list-item-subtitle v-text="item.subtitle"></v-list-item-subtitle> | ||
49 | </v-list-item-content> | 67 | </v-list-item-content> |
50 | <v-list-item-action> | 68 | <v-list-item-action> |
51 | - <v-btn icon> | 69 | + <v-icon v-if="item.favorite === 0"> |
52 | - <v-icon color="grey lighten-1">mdi-information</v-icon> | 70 | + mdi-star-outline |
53 | - </v-btn> | 71 | + </v-icon> |
72 | + <v-icon v-else> | ||
73 | + mdi-star | ||
74 | + </v-icon> | ||
54 | </v-list-item-action> | 75 | </v-list-item-action> |
55 | </v-list-item> | 76 | </v-list-item> |
56 | </v-list> | 77 | </v-list> |
78 | + <!--file detial --> | ||
79 | + <v-dialog v-model="showdetailF" max-width="290"> | ||
80 | + <v-card> | ||
81 | + <v-card-title class="headline"> | ||
82 | + <v-text-field v-model="current_filename"></v-text-field> | ||
83 | + </v-card-title> | ||
84 | + <v-card-text> | ||
85 | + <v-text-field v-model="current_filedata"></v-text-field> | ||
86 | + </v-card-text> | ||
87 | + <v-card-actions> | ||
88 | + <v-spacer></v-spacer> | ||
89 | + <v-btn | ||
90 | + color="green darken-1" | ||
91 | + text | ||
92 | + @click=" | ||
93 | + showdetailF = false; | ||
94 | + modify_file(); | ||
95 | + " | ||
96 | + > | ||
97 | + save | ||
98 | + </v-btn> | ||
99 | + </v-card-actions> | ||
100 | + </v-card> | ||
101 | + </v-dialog> | ||
102 | + <!-- Move Folder --> | ||
103 | + <v-dialog v-model="dialog2" width="500px"> | ||
104 | + <v-card> | ||
105 | + <v-card-title class="grey darken-2"> | ||
106 | + Move Folder | ||
107 | + </v-card-title> | ||
108 | + <v-container> | ||
109 | + <v-list> | ||
110 | + <v-list-item | ||
111 | + v-for="item2 in folders" | ||
112 | + :key="item2.folder_id" | ||
113 | + @click.left="transferF(item2.folder_name)" | ||
114 | + v-if="item2.folder_name !== curfName.folder_name" | ||
115 | + > | ||
116 | + <v-list-item-avatar> | ||
117 | + <v-icon>mdi-folder</v-icon> | ||
118 | + </v-list-item-avatar> | ||
119 | + <v-list-item-content> | ||
120 | + <v-list-item-title | ||
121 | + v-text="item2.folder_name" | ||
122 | + ></v-list-item-title> | ||
123 | + </v-list-item-content> | ||
124 | + </v-list-item> | ||
125 | + </v-list> | ||
126 | + </v-container> | ||
127 | + <v-card-actions> | ||
128 | + <v-spacer></v-spacer> | ||
129 | + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn> | ||
130 | + </v-card-actions> | ||
57 | </v-card> | 131 | </v-card> |
132 | + </v-dialog> | ||
133 | + <!-- sub menu for folder --> | ||
134 | + <v-menu | ||
135 | + v-model="showMenu" | ||
136 | + :position-x="x" | ||
137 | + :position-y="y" | ||
138 | + absolute | ||
139 | + offset-y | ||
140 | + > | ||
141 | + <v-list dense> | ||
142 | + <v-list-item @click.prevent="dialog2 = !dialog2"> | ||
143 | + <v-list-item-icon> | ||
144 | + <v-icon>mdi-send</v-icon> | ||
145 | + </v-list-item-icon> | ||
146 | + <v-list-item-content> | ||
147 | + <v-list-item-title>이동</v-list-item-title> | ||
148 | + </v-list-item-content> | ||
149 | + </v-list-item> | ||
150 | + <v-list-item @click.prevent="deleteF"> | ||
151 | + <v-list-item-icon> | ||
152 | + <v-icon>mdi-delete</v-icon> | ||
153 | + </v-list-item-icon> | ||
154 | + <v-list-item-content> | ||
155 | + <v-list-item-title>삭제</v-list-item-title> | ||
156 | + </v-list-item-content> | ||
157 | + </v-list-item> | ||
158 | + <v-list-item v-if="curfName.favorite === 1" @click="delete_favorite"> | ||
159 | + <v-list-item-icon> | ||
160 | + <v-icon>mdi-star-outline</v-icon> | ||
161 | + </v-list-item-icon> | ||
162 | + <v-list-item-content> | ||
163 | + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> | ||
164 | + </v-list-item-content> | ||
165 | + </v-list-item> | ||
166 | + <v-list-item v-if="curfName.favorite === 0" @click="add_favorite"> | ||
167 | + <v-list-item-icon> | ||
168 | + <v-icon>mdi-star</v-icon> | ||
169 | + </v-list-item-icon> | ||
170 | + <v-list-item-content> | ||
171 | + <v-list-item-title>즐겨 찾기 추가</v-list-item-title> | ||
172 | + </v-list-item-content> | ||
173 | + </v-list-item> | ||
174 | + </v-list> | ||
175 | + </v-menu> | ||
176 | + <!-- --> | ||
177 | + <!-- Move File --> | ||
178 | + <v-dialog v-model="dialog3" width="500px"> | ||
179 | + <v-card> | ||
180 | + <v-card-title class="grey darken-2"> | ||
181 | + Move File | ||
182 | + </v-card-title> | ||
183 | + <v-container> | ||
184 | + <v-list> | ||
185 | + <v-list-item | ||
186 | + v-for="item2 in folders" | ||
187 | + :key="item2.folder_id" | ||
188 | + @click.left="transferFile(item2.folder_name)" | ||
189 | + > | ||
190 | + <v-list-item-avatar> | ||
191 | + <v-icon>mdi-folder</v-icon> | ||
192 | + </v-list-item-avatar> | ||
193 | + <v-list-item-content> | ||
194 | + <v-list-item-title | ||
195 | + v-text="item2.folder_name" | ||
196 | + ></v-list-item-title> | ||
197 | + </v-list-item-content> | ||
198 | + </v-list-item> | ||
199 | + </v-list> | ||
200 | + </v-container> | ||
201 | + <v-card-actions> | ||
202 | + <v-spacer></v-spacer> | ||
203 | + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn> | ||
204 | + </v-card-actions> | ||
205 | + </v-card> | ||
206 | + </v-dialog> | ||
207 | + <!-- sub menu for file --> | ||
208 | + <v-menu | ||
209 | + v-model="showMenuF" | ||
210 | + :position-x="x" | ||
211 | + :position-y="y" | ||
212 | + absolute | ||
213 | + offset-y | ||
214 | + > | ||
215 | + <v-list dense> | ||
216 | + <v-list-item @click.prevent="dialog3 = !dialog3"> | ||
217 | + <v-list-item-icon> | ||
218 | + <v-icon>mdi-send</v-icon> | ||
219 | + </v-list-item-icon> | ||
220 | + <v-list-item-content> | ||
221 | + <v-list-item-title>이동</v-list-item-title> | ||
222 | + </v-list-item-content> | ||
223 | + </v-list-item> | ||
224 | + <v-list-item @click.prevent="delete_file"> | ||
225 | + <v-list-item-icon> | ||
226 | + <v-icon>mdi-delete</v-icon> | ||
227 | + </v-list-item-icon> | ||
228 | + <v-list-item-content> | ||
229 | + <v-list-item-title>삭제</v-list-item-title> | ||
230 | + </v-list-item-content> | ||
231 | + </v-list-item> | ||
232 | + <v-list-item @click.prevent="download_file"> | ||
233 | + <v-list-item-icon> | ||
234 | + <v-icon>mdi-download</v-icon> | ||
235 | + </v-list-item-icon> | ||
236 | + <v-list-item-content> | ||
237 | + <v-list-item-title>다운로드</v-list-item-title> | ||
238 | + </v-list-item-content> | ||
239 | + </v-list-item> | ||
240 | + <v-list-item | ||
241 | + v-if="cfilename.favorite === 1" | ||
242 | + @click="delete_favorite_file" | ||
243 | + > | ||
244 | + <v-list-item-icon> | ||
245 | + <v-icon>mdi-star-outline</v-icon> | ||
246 | + </v-list-item-icon> | ||
247 | + <v-list-item-content> | ||
248 | + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> | ||
249 | + </v-list-item-content> | ||
250 | + </v-list-item> | ||
251 | + <v-list-item v-if="cfilename.favorite === 0" @click="add_favorite_file"> | ||
252 | + <v-list-item-icon> | ||
253 | + <v-icon>mdi-star</v-icon> | ||
254 | + </v-list-item-icon> | ||
255 | + <v-list-item-content> | ||
256 | + <v-list-item-title>즐겨 찾기 추가</v-list-item-title> | ||
257 | + </v-list-item-content> | ||
258 | + </v-list-item> | ||
259 | + </v-list> | ||
260 | + </v-menu> | ||
261 | + </div> | ||
58 | </template> | 262 | </template> |
59 | - | ||
60 | <script> | 263 | <script> |
61 | - export default { | 264 | +import { |
62 | - data: () => ({ | 265 | + folder, |
63 | - items: [ | 266 | + makeFolder, |
64 | - { icon: 'folder', iconClass: 'grey lighten-1 white--text', title: 'Photos', subtitle: 'Jan 9, 2014' }, | 267 | + deleteFolder, |
65 | - { icon: 'folder', iconClass: 'grey lighten-1 white--text', title: 'Recipes', subtitle: 'Jan 17, 2014' }, | 268 | + moveFolder, |
66 | - { icon: 'folder', iconClass: 'grey lighten-1 white--text', title: 'Work', subtitle: 'Jan 28, 2014' }, | 269 | + file, |
67 | - ], | 270 | + uploadFile, |
68 | - items2: [ | 271 | + deleteFile, |
69 | - { icon: 'assignment', iconClass: 'blue white--text', title: 'Vacation itinerary', subtitle: 'Jan 20, 2014' }, | 272 | + downloadFile, |
70 | - { icon: 'call_to_action', iconClass: 'amber white--text', title: 'Kitchen remodel', subtitle: 'Jan 10, 2014' }, | 273 | + delFavorite, |
71 | - ], | 274 | + addFavorite, |
72 | - }), | 275 | + moveFile, |
276 | + delFavoriteFile, | ||
277 | + addFavoriteFile, | ||
278 | + detailFile, | ||
279 | + modifyFile, | ||
280 | + getFavoriteList, | ||
281 | +} from '../api/index'; | ||
282 | +import Axios from 'axios'; | ||
283 | + | ||
284 | +export default { | ||
285 | + props: { | ||
286 | + folderId: Number, | ||
287 | + }, | ||
288 | + data() { | ||
289 | + return { | ||
290 | + folder_id: this.$route.params.id, | ||
291 | + uploadedfile: null, | ||
292 | + foldername: '', | ||
293 | + curfName: {}, | ||
294 | + cfilename: {}, | ||
295 | + folders: [], | ||
296 | + files: [], | ||
297 | + search: '', | ||
298 | + id: '', | ||
299 | + current_filename: null, //파일 상세정보 (이름) | ||
300 | + current_filedata: null, //파일 상세정보 (내용) | ||
301 | + dialog: false, | ||
302 | + howMenu: false, | ||
303 | + showMenu: false, | ||
304 | + showMenuF: false, //파일 관련 메뉴 | ||
305 | + showdetailF: false, //txt 파일 상세정보 및 수정 | ||
306 | + x: 0, | ||
307 | + y: 0, | ||
308 | + dialog2: false, | ||
309 | + dialog3: false, //파일 관련 메뉴 | ||
310 | + detail: { | ||
311 | + dataname: null, | ||
312 | + date: null, | ||
313 | + owner_id: null, | ||
314 | + datasize: null, | ||
315 | + datatype: null, | ||
316 | + }, | ||
317 | + }; | ||
318 | + }, | ||
319 | + created() { | ||
320 | + this.fetchData(); | ||
321 | + }, | ||
322 | + computed: { | ||
323 | + calData() { | ||
324 | + return this.folders | ||
325 | + .filter(data => { | ||
326 | + return data.folder_name | ||
327 | + .toLowerCase() | ||
328 | + .includes(this.search.toLowerCase()); | ||
329 | + }) | ||
330 | + .slice(0); | ||
331 | + }, | ||
332 | + calData2() { | ||
333 | + return this.files | ||
334 | + .filter(data => { | ||
335 | + return data.file_name | ||
336 | + .toLowerCase() | ||
337 | + .includes(this.search.toLowerCase()); | ||
338 | + }) | ||
339 | + .slice(0); | ||
340 | + }, | ||
341 | + }, | ||
342 | + watch: { | ||
343 | + $route: 'fetchData', | ||
344 | + }, | ||
345 | + methods: { | ||
346 | + async fetchData() { | ||
347 | + try { | ||
348 | + const response = await getFavoriteList(this.$store.state.id); | ||
349 | + console.log(response.data); | ||
350 | + this.$store.commit('setfavFolderList', response.data.folders); | ||
351 | + this.$store.commit('setfavFileList', response.data.files); | ||
352 | + this.folders = response.data.folders; | ||
353 | + this.files = response.data.files; | ||
354 | + } catch (error) { | ||
355 | + console.log('에러'); | ||
356 | + console.log(error); | ||
357 | + } | ||
358 | + }, | ||
359 | + handleFileUpload() { | ||
360 | + this.uploadedfile = this.$refs.uploadedfile.files[0]; | ||
361 | + console.log(this.uploadedfile); | ||
362 | + }, | ||
363 | + initFolderName() { | ||
364 | + this.foldername = ''; | ||
365 | + }, | ||
366 | + cancelMove() { | ||
367 | + this.curfName = {}; | ||
368 | + this.cfilename = {}; | ||
369 | + this.dialog2 = false; | ||
370 | + this.dialog3 = false; | ||
371 | + }, | ||
372 | + async makeF() { | ||
373 | + try { | ||
374 | + const folderData = { | ||
375 | + user_id: this.$store.state.id, | ||
376 | + cur: this.$store.state.cur, | ||
377 | + folder_name: this.foldername, | ||
378 | + }; | ||
379 | + const response = await makeFolder(folderData); | ||
380 | + console.log(response.data); | ||
381 | + console.log('폴더 생성 완료'); | ||
382 | + this.$store.commit('setFolder', response.data.folders); | ||
383 | + this.folders = response.data.folders; | ||
384 | + } catch (error) { | ||
385 | + console.log('에러'); | ||
386 | + console.log(error.response.data); | ||
387 | + } finally { | ||
388 | + this.initFolderName(); | ||
389 | + this.dialog = false; | ||
390 | + } | ||
391 | + }, | ||
392 | + async moveF(move_folder_name) { | ||
393 | + try { | ||
394 | + const curData = { | ||
395 | + id: this.$store.state.id, | ||
396 | + cur: this.$store.state.cur + move_folder_name + '/', | ||
397 | + }; | ||
398 | + const response = await folder(curData); | ||
399 | + const file_response = await file(curData); | ||
400 | + console.log(response.data); | ||
401 | + this.$store.commit('setFolder', response.data.folders); | ||
402 | + this.$store.commit('setFile', file_response.data.files); | ||
403 | + this.$store.commit('setCur', response.data.cur); | ||
404 | + this.$store.commit('setParent', response.data.parentPath); | ||
405 | + this.folders = this.$store.getters.folderL; | ||
406 | + this.files = this.$store.getters.fileL; | ||
407 | + } catch (error) { | ||
408 | + console.log('에러'); | ||
409 | + console.log(error.response.data); | ||
410 | + } | ||
411 | + }, | ||
412 | + async moveParent() { | ||
413 | + try { | ||
414 | + const cData = { | ||
415 | + id: this.$store.state.id, | ||
416 | + cur: this.$store.state.parent, | ||
417 | + }; | ||
418 | + const response = await folder(cData); | ||
419 | + const file_response = await file(cData); | ||
420 | + console.log(response.data); | ||
421 | + this.$store.commit('setFolder', response.data.folders); | ||
422 | + this.$store.commit('setFile', file_response.data.files); | ||
423 | + this.$store.commit('setCur', response.data.cur); | ||
424 | + this.$store.commit('setParent', response.data.parentPath); | ||
425 | + this.folders = this.$store.getters.folderL; | ||
426 | + this.files = this.$store.getters.fileL; | ||
427 | + } catch (error) { | ||
428 | + console.log('에러'); | ||
429 | + console.log(error.response.data); | ||
430 | + } | ||
431 | + }, | ||
432 | + async deleteF() { | ||
433 | + try { | ||
434 | + const cData = { | ||
435 | + id: this.$store.state.id, | ||
436 | + cur: this.$store.state.cur, | ||
437 | + folder_name: this.curfName.folder_name, | ||
438 | + }; | ||
439 | + const response = await deleteFolder(cData); | ||
440 | + console.log(response); | ||
441 | + this.$store.commit('setFolder', response.data.folders); | ||
442 | + this.folders = this.$store.getters.folderL; | ||
443 | + } catch (error) { | ||
444 | + console.log('에러'); | ||
445 | + console.log(error.response.data); | ||
446 | + } finally { | ||
447 | + this.curfName = ''; | ||
448 | + } | ||
449 | + }, | ||
450 | + async transferF(folderName) { | ||
451 | + try { | ||
452 | + const cData = { | ||
453 | + id: this.$store.state.id, | ||
454 | + cur: this.$store.state.cur, | ||
455 | + name: this.curfName.folder_name, | ||
456 | + isfolder: true, | ||
457 | + newPath: this.$store.state.cur + folderName + '/', | ||
458 | + }; | ||
459 | + const response = await moveFolder(cData); | ||
460 | + console.log(response); | ||
461 | + this.$store.commit('setFolder', response.data.folders); | ||
462 | + this.folders = this.$store.getters.folderL; | ||
463 | + } catch (error) { | ||
464 | + console.log('에러'); | ||
465 | + console.log(error.response.data); | ||
466 | + } finally { | ||
467 | + this.curfName = {}; | ||
468 | + this.dialog2 = false; | ||
469 | + } | ||
470 | + }, | ||
471 | + async upload_file() { | ||
472 | + try { | ||
473 | + const formData = new FormData(); | ||
474 | + formData.append('file', this.uploadedfile); | ||
475 | + formData.append('user_id', this.$store.state.id); | ||
476 | + formData.append('cur', this.$store.state.cur); | ||
477 | + const currentData = { | ||
478 | + id: this.$store.state.id, | ||
479 | + cur: this.$store.state.cur, | ||
480 | + }; | ||
481 | + console.log(currentData); | ||
482 | + const response = await uploadFile(formData); | ||
483 | + const filelist = await file(currentData); | ||
484 | + console.log(filelist.data.files); | ||
485 | + this.$store.commit('setFile', filelist.data.files); | ||
486 | + console.log(this.$store.getters.fileL); | ||
487 | + this.files = this.$store.getters.fileL; | ||
488 | + } catch (error) { | ||
489 | + console.log('에러'); | ||
490 | + console.log(error); | ||
491 | + } | ||
492 | + }, | ||
493 | + async delete_file() { | ||
494 | + try { | ||
495 | + var itemlist = this.$store.getters.fileL; | ||
496 | + const currentData = { | ||
497 | + fileName: null, | ||
498 | + user_id: null, | ||
499 | + cur: this.$store.state.cur, | ||
500 | + }; | ||
501 | + for (var i = 0; i < itemlist.length; i++) { | ||
502 | + if (itemlist[i].file_name == this.cfilename.file_name) { | ||
503 | + currentData.fileName = itemlist[i].file_name; | ||
504 | + currentData.user_id = itemlist[i].user_id; | ||
505 | + } | ||
506 | + } | ||
507 | + const filelistData = { | ||
508 | + id: currentData.user_id, | ||
509 | + cur: currentData.cur, | ||
510 | + }; | ||
511 | + const response = await deleteFile(currentData); | ||
512 | + setTimeout(function() {}, 500); | ||
513 | + const filelist = await file(filelistData); | ||
514 | + this.$store.commit('setFile', filelist.data.files); | ||
515 | + this.files = this.$store.getters.fileL; | ||
516 | + } catch (error) { | ||
517 | + console.log('에러'); | ||
518 | + console.log(error); | ||
519 | + } | ||
520 | + }, | ||
521 | + async download_file() { | ||
522 | + try { | ||
523 | + const currentData = { | ||
524 | + fileName: this.cfilename.file_name, | ||
525 | + id: this.$store.state.id, | ||
526 | + cur: this.$store.state.cur, | ||
527 | + }; | ||
528 | + const result = await downloadFile(currentData); | ||
529 | + console.log(result); | ||
530 | + } catch (error) { | ||
531 | + console.log('에러'); | ||
532 | + console.log(error); | ||
533 | + } | ||
534 | + }, | ||
535 | + async delete_favorite() { | ||
536 | + try { | ||
537 | + const cData = { | ||
538 | + id: this.$store.state.id, | ||
539 | + cur: this.curfName.location, | ||
540 | + name: this.curfName.folder_name, | ||
541 | + }; | ||
542 | + console.log(cData); | ||
543 | + const del = await delFavorite(cData); | ||
544 | + const response = await getFavoriteList(this.$store.state.id); | ||
545 | + this.$store.commit('setfavFolderList', response.data.folders); | ||
546 | + this.folders = response.data.folders; | ||
547 | + } catch (error) { | ||
548 | + console.log('에러'); | ||
549 | + } | ||
550 | + }, | ||
551 | + async add_favorite() { | ||
552 | + try { | ||
553 | + const cData = { | ||
554 | + id: this.$store.state.id, | ||
555 | + cur: this.$store.state.cur, | ||
556 | + name: this.curfName.folder_name, | ||
557 | + }; | ||
558 | + console.log(cData); | ||
559 | + const response = await addFavorite(cData); | ||
560 | + this.$store.commit('setFolder', response.data.folders); | ||
561 | + } catch (error) { | ||
562 | + console.log('에러'); | ||
563 | + } | ||
564 | + }, | ||
565 | + async delete_favorite_file() { | ||
566 | + try { | ||
567 | + const fData = { | ||
568 | + id: this.$store.state.id, | ||
569 | + cur: this.cfilename.location, | ||
570 | + name: this.cfilename.file_name, | ||
571 | + }; | ||
572 | + console.log(fData); | ||
573 | + const del = await delFavoriteFile(fData); | ||
574 | + const response = await getFavoriteList(this.$store.state.id); | ||
575 | + this.$store.commit('setfavFileList', response.data.files); | ||
576 | + this.files = response.data.files; | ||
577 | + } catch (error) { | ||
578 | + console.log('에러'); | ||
579 | + } | ||
580 | + }, | ||
581 | + async add_favorite_file() { | ||
582 | + try { | ||
583 | + const fData = { | ||
584 | + id: this.$store.state.id, | ||
585 | + cur: this.$store.state.cur, | ||
586 | + name: this.cfilename.file_name, | ||
587 | + }; | ||
588 | + console.log(fData); | ||
589 | + const response = await addFavoriteFile(fData); | ||
590 | + this.$store.commit('setFile', response.data.files); | ||
591 | + } catch (error) { | ||
592 | + console.log('에러'); | ||
593 | + } | ||
594 | + }, | ||
595 | + async transferFile(folderName) { | ||
596 | + try { | ||
597 | + const fData = { | ||
598 | + id: this.$store.state.id, | ||
599 | + cur: this.$store.state.cur, | ||
600 | + name: this.cfilename.file_name, | ||
601 | + isfolder: false, | ||
602 | + newPath: this.$store.state.cur + folderName + '/', | ||
603 | + }; | ||
604 | + const response = await moveFile(fData); | ||
605 | + console.log(response); | ||
606 | + this.$store.commit('setFile', response.data.files); | ||
607 | + this.files = this.$store.getters.fileL; | ||
608 | + } catch (error) { | ||
609 | + console.log('에러'); | ||
610 | + console.log(error.response.data); | ||
611 | + } finally { | ||
612 | + this.cfilename = {}; | ||
613 | + this.dialog3 = false; | ||
614 | + } | ||
615 | + }, | ||
616 | + async file_detail() { | ||
617 | + try { | ||
618 | + const currentData = { | ||
619 | + id: this.cfilename.user_id, | ||
620 | + cur: this.cfilename.location, | ||
621 | + fileName: this.cfilename.file_name, | ||
622 | + }; | ||
623 | + const detailData = await detailFile(currentData); | ||
624 | + this.current_filename = detailData.data.file_name; | ||
625 | + this.current_filedata = detailData.data.content; | ||
626 | + console.log(this.current_filename); | ||
627 | + console.log(this.current_filedata); | ||
628 | + } catch (error) { | ||
629 | + console.log('에러'); | ||
630 | + console.log(error); | ||
631 | + } | ||
632 | + }, | ||
633 | + async modify_file() { | ||
634 | + try { | ||
635 | + const modifyData = { | ||
636 | + user_id: this.cfilename.user_id, | ||
637 | + cur: this.cfilename.location, | ||
638 | + name: this.current_filename, | ||
639 | + content: this.current_filedata, | ||
640 | + }; | ||
641 | + const result = await modifyFile(modifyData); | ||
642 | + const after_data = { | ||
643 | + id: this.cfilename.user_id, | ||
644 | + cur: this.cfilename.location, | ||
645 | + fileName: this.current_filename, | ||
646 | + }; | ||
647 | + const detailData = await detailFile(after_data); | ||
648 | + } catch (error) { | ||
649 | + console.log('에러'); | ||
650 | + console.log(error); | ||
73 | } | 651 | } |
652 | + }, | ||
653 | + show(folderObj, e) { | ||
654 | + e.preventDefault(); | ||
655 | + this.curfName = folderObj; | ||
656 | + this.showMenu = false; | ||
657 | + this.x = e.clientX; | ||
658 | + this.y = e.clientY; | ||
659 | + this.$nextTick(() => { | ||
660 | + this.showMenu = true; | ||
661 | + }); | ||
662 | + }, | ||
663 | + showF(fileObj, e) { | ||
664 | + e.preventDefault(); | ||
665 | + this.cfilename = fileObj; | ||
666 | + this.showMenuF = false; | ||
667 | + this.x = e.clientX; | ||
668 | + this.y = e.clientY; | ||
669 | + this.$nextTick(() => { | ||
670 | + this.showMenuF = true; | ||
671 | + }); | ||
672 | + }, | ||
673 | + detailF(fileObj, e) { | ||
674 | + e.preventDefault(); | ||
675 | + this.cfilename = fileObj; | ||
676 | + this.showdetailF = false; | ||
677 | + this.x = e.clientX; | ||
678 | + this.y = e.clientY; | ||
679 | + this.$nextTick(() => { | ||
680 | + this.showdetailF = true; | ||
681 | + }); | ||
682 | + }, | ||
683 | + }, | ||
684 | +}; | ||
74 | </script> | 685 | </script> | ... | ... |
1 | <template> | 1 | <template> |
2 | - <v-card | 2 | + <v-card max-width="98%" class="mx-auto"> |
3 | - max-width="98%" | 3 | + <v-toolbar color="light-blue" dark> |
4 | - class="mx-auto" | ||
5 | - > | ||
6 | - <v-toolbar | ||
7 | - color="light-blue" | ||
8 | - dark | ||
9 | - > | ||
10 | <v-toolbar-title>파일</v-toolbar-title> | 4 | <v-toolbar-title>파일</v-toolbar-title> |
11 | <v-spacer></v-spacer> | 5 | <v-spacer></v-spacer> |
12 | </v-toolbar> | 6 | </v-toolbar> |
13 | <v-list two-line subheader> | 7 | <v-list two-line subheader> |
14 | - <v-list-item | 8 | + <v-list-item v-for="item in items" :key="item.title" @click=""> |
15 | - v-for="item in items" | ||
16 | - :key="item.title" | ||
17 | - @click="" | ||
18 | - > | ||
19 | <v-list-item-avatar> | 9 | <v-list-item-avatar> |
20 | - <v-icon | 10 | + <v-icon :class="[item.iconClass]" v-text="item.icon"></v-icon> |
21 | - :class="[item.iconClass]" | ||
22 | - v-text="item.icon" | ||
23 | - ></v-icon> | ||
24 | </v-list-item-avatar> | 11 | </v-list-item-avatar> |
25 | <v-list-item-content> | 12 | <v-list-item-content> |
26 | <v-list-item-title v-text="item.title"></v-list-item-title> | 13 | <v-list-item-title v-text="item.title"></v-list-item-title> |
... | @@ -32,16 +19,9 @@ | ... | @@ -32,16 +19,9 @@ |
32 | </v-btn> | 19 | </v-btn> |
33 | </v-list-item-action> | 20 | </v-list-item-action> |
34 | </v-list-item> | 21 | </v-list-item> |
35 | - <v-list-item | 22 | + <v-list-item v-for="item in items2" :key="item.title" @click=""> |
36 | - v-for="item in items2" | ||
37 | - :key="item.title" | ||
38 | - @click="" | ||
39 | - > | ||
40 | <v-list-item-avatar> | 23 | <v-list-item-avatar> |
41 | - <v-icon | 24 | + <v-icon :class="[item.iconClass]" v-text="item.icon"></v-icon> |
42 | - :class="[item.iconClass]" | ||
43 | - v-text="item.icon" | ||
44 | - ></v-icon> | ||
45 | </v-list-item-avatar> | 25 | </v-list-item-avatar> |
46 | <v-list-item-content> | 26 | <v-list-item-content> |
47 | <v-list-item-title v-text="item.title"></v-list-item-title> | 27 | <v-list-item-title v-text="item.title"></v-list-item-title> |
... | @@ -58,17 +38,42 @@ | ... | @@ -58,17 +38,42 @@ |
58 | </template> | 38 | </template> |
59 | 39 | ||
60 | <script> | 40 | <script> |
61 | - export default { | 41 | +export default { |
62 | data: () => ({ | 42 | data: () => ({ |
63 | items: [ | 43 | items: [ |
64 | - { icon: 'folder', iconClass: 'grey lighten-1 white--text', title: 'Photos', subtitle: 'Jan 9, 2014' }, | 44 | + { |
65 | - { icon: 'folder', iconClass: 'grey lighten-1 white--text', title: 'Recipes', subtitle: 'Jan 17, 2014' }, | 45 | + icon: 'folder', |
66 | - { icon: 'folder', iconClass: 'grey lighten-1 white--text', title: 'Work', subtitle: 'Jan 28, 2014' }, | 46 | + iconClass: 'grey lighten-1 white--text', |
47 | + title: 'Photos', | ||
48 | + subtitle: 'Jan 9, 2014', | ||
49 | + }, | ||
50 | + { | ||
51 | + icon: 'folder', | ||
52 | + iconClass: 'grey lighten-1 white--text', | ||
53 | + title: 'Recipes', | ||
54 | + subtitle: 'Jan 17, 2014', | ||
55 | + }, | ||
56 | + { | ||
57 | + icon: 'folder', | ||
58 | + iconClass: 'grey lighten-1 white--text', | ||
59 | + title: 'Work', | ||
60 | + subtitle: 'Jan 28, 2014', | ||
61 | + }, | ||
67 | ], | 62 | ], |
68 | items2: [ | 63 | items2: [ |
69 | - { icon: 'assignment', iconClass: 'blue white--text', title: 'Vacation itinerary', subtitle: 'Jan 20, 2014' }, | 64 | + { |
70 | - { icon: 'call_to_action', iconClass: 'amber white--text', title: 'Kitchen remodel', subtitle: 'Jan 10, 2014' }, | 65 | + icon: 'assignment', |
66 | + iconClass: 'blue white--text', | ||
67 | + title: 'Vacation itinerary', | ||
68 | + subtitle: 'Jan 20, 2014', | ||
69 | + }, | ||
70 | + { | ||
71 | + icon: 'call_to_action', | ||
72 | + iconClass: 'amber white--text', | ||
73 | + title: 'Kitchen remodel', | ||
74 | + subtitle: 'Jan 10, 2014', | ||
75 | + }, | ||
71 | ], | 76 | ], |
72 | }), | 77 | }), |
73 | - } | 78 | +}; |
74 | </script> | 79 | </script> | ... | ... |
front-end/src/components/FileDetail.vue
0 → 100644
1 | +<template lang="html"> | ||
2 | + <v-dialog v-model="dialog" max-width="290"> | ||
3 | + <v-card> | ||
4 | + <v-card-title class="headline" | ||
5 | + >Use Google's location service?</v-card-title | ||
6 | + > | ||
7 | + | ||
8 | + <v-card-text> | ||
9 | + Let Google help apps determine location. This means sending anonymous | ||
10 | + location data to Google, even when no apps are running. | ||
11 | + </v-card-text> | ||
12 | + | ||
13 | + <v-card-actions> | ||
14 | + <v-spacer></v-spacer> | ||
15 | + | ||
16 | + <v-btn color="green darken-1" text @click="dialog = false"> | ||
17 | + Disagree | ||
18 | + </v-btn> | ||
19 | + | ||
20 | + <v-btn color="green darken-1" text @click="dialog = false"> | ||
21 | + Agree | ||
22 | + </v-btn> | ||
23 | + </v-card-actions> | ||
24 | + </v-card> | ||
25 | + </v-dialog> | ||
26 | +</template> | ||
27 | + | ||
28 | +<script> | ||
29 | +export default { | ||
30 | + data() { | ||
31 | + return { | ||
32 | + dialog: false, | ||
33 | + }; | ||
34 | + }, | ||
35 | +}; | ||
36 | +</script> | ||
37 | + | ||
38 | +<style lang="css" scoped></style> |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | <v-toolbar flat> | 3 | <v-toolbar flat> |
4 | - <v-toolbar-title>파일 </v-toolbar-title> | 4 | + <v-toolbar-title>내 드라이브</v-toolbar-title> |
5 | <v-spacer></v-spacer> | 5 | <v-spacer></v-spacer> |
6 | <v-text-field | 6 | <v-text-field |
7 | v-model="search" | 7 | v-model="search" |
8 | append-icon="mdi-magnify" | 8 | append-icon="mdi-magnify" |
9 | - label="파일 검색" | 9 | + label="검색" |
10 | single-line | 10 | single-line |
11 | hide-details | 11 | hide-details |
12 | ></v-text-field> | 12 | ></v-text-field> |
13 | </v-toolbar> | 13 | </v-toolbar> |
14 | - <v-list two-line subheader> | 14 | + <v-list> |
15 | - <v-subheader inset>Folders</v-subheader> | 15 | + <!-- <v-subheader inset>Folders</v-subheader> --> |
16 | - <v-btn @click="moveParent">...</v-btn> | 16 | + <!-- Folder view --> |
17 | <v-list-item | 17 | <v-list-item |
18 | - v-for="item in this.$store.getters.folderL" | 18 | + v-for="item in calData" |
19 | - :key="item.title" | 19 | + :key="item.folder_id" |
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="" |
23 | + @dblclick=" | ||
24 | + $router.push({ | ||
25 | + name: 'Folder', | ||
26 | + params: { id: item.folder_id }, | ||
27 | + }) | ||
28 | + " | ||
23 | > | 29 | > |
24 | <v-list-item-avatar> | 30 | <v-list-item-avatar> |
25 | <v-icon>mdi-folder</v-icon> | 31 | <v-icon>mdi-folder</v-icon> |
... | @@ -27,7 +33,120 @@ | ... | @@ -27,7 +33,120 @@ |
27 | <v-list-item-content> | 33 | <v-list-item-content> |
28 | <v-list-item-title v-text="item.folder_name"></v-list-item-title> | 34 | <v-list-item-title v-text="item.folder_name"></v-list-item-title> |
29 | </v-list-item-content> | 35 | </v-list-item-content> |
30 | - | 36 | + <v-list-item-action> |
37 | + <v-icon v-if="item.favorite === 0"> | ||
38 | + mdi-star-outline | ||
39 | + </v-icon> | ||
40 | + <v-icon v-else> | ||
41 | + mdi-star | ||
42 | + </v-icon> | ||
43 | + </v-list-item-action> | ||
44 | + </v-list-item> | ||
45 | + <!-- File view --> | ||
46 | + <v-list-item | ||
47 | + v-for="item in calData2" | ||
48 | + :key="item.file_id" | ||
49 | + @click.right="showF(item, $event)" | ||
50 | + @dblclick=" | ||
51 | + detailF(item, $event); | ||
52 | + file_detail(item); | ||
53 | + " | ||
54 | + @click="" | ||
55 | + > | ||
56 | + <v-list-item-avatar> | ||
57 | + <v-icon> mdi-file</v-icon> | ||
58 | + </v-list-item-avatar> | ||
59 | + <v-list-item-content> | ||
60 | + <v-list-item-title v-text="item.file_name"></v-list-item-title> | ||
61 | + </v-list-item-content> | ||
62 | + <v-list-item-action> | ||
63 | + <v-icon v-if="item.favorite === 0"> | ||
64 | + mdi-star-outline | ||
65 | + </v-icon> | ||
66 | + <v-icon v-else> | ||
67 | + mdi-star | ||
68 | + </v-icon> | ||
69 | + </v-list-item-action> | ||
70 | + </v-list-item> | ||
71 | + </v-list> | ||
72 | + <!--file detial --> | ||
73 | + <v-dialog v-model="showdetailF" max-width="290"> | ||
74 | + <v-card> | ||
75 | + <v-card-title class="headline"> | ||
76 | + <v-text-field v-model="current_filename"></v-text-field> | ||
77 | + </v-card-title> | ||
78 | + <v-card-text> | ||
79 | + <v-text-field v-model="current_filedata"></v-text-field> | ||
80 | + </v-card-text> | ||
81 | + <v-card-actions> | ||
82 | + <v-spacer></v-spacer> | ||
83 | + <v-btn | ||
84 | + color="green darken-1" | ||
85 | + text | ||
86 | + @click=" | ||
87 | + showdetailF = false; | ||
88 | + modify_file(); | ||
89 | + " | ||
90 | + > | ||
91 | + save | ||
92 | + </v-btn> | ||
93 | + </v-card-actions> | ||
94 | + </v-card> | ||
95 | + </v-dialog> | ||
96 | + <!-- file share menu --> | ||
97 | + <v-dialog v-model="showShareF" width="500px"> | ||
98 | + <v-card> | ||
99 | + <v-card-title> | ||
100 | + Share File | ||
101 | + </v-card-title> | ||
102 | + <v-card-text> | ||
103 | + <v-text-field v-model="this.cfilename.file_name"></v-text-field> | ||
104 | + </v-card-text> | ||
105 | + <v-card-text> | ||
106 | + <v-text-field | ||
107 | + v-model="targetUid" | ||
108 | + label="target user id" | ||
109 | + ></v-text-field> | ||
110 | + </v-card-text> | ||
111 | + <v-card-actions> | ||
112 | + <v-spacer></v-spacer> | ||
113 | + <v-btn @click.prevent="file_share">ok</v-btn> | ||
114 | + <v-btn @click="showShareF = false">cancle</v-btn> | ||
115 | + </v-card-actions> | ||
116 | + </v-card> | ||
117 | + </v-dialog> | ||
118 | + <!-- Move Folder --> | ||
119 | + <v-dialog v-model="dialog2" width="500px"> | ||
120 | + <v-card> | ||
121 | + <v-card-title class="grey darken-2"> | ||
122 | + Move Folder | ||
123 | + </v-card-title> | ||
124 | + <v-container> | ||
125 | + <v-list> | ||
126 | + <v-list-item | ||
127 | + v-for="(item2, index) in folders" | ||
128 | + :key="index" | ||
129 | + @click.left="transferF(item2.folder_name)" | ||
130 | + v-if="item2.folder_name !== curfName.folder_name" | ||
131 | + > | ||
132 | + <v-list-item-avatar> | ||
133 | + <v-icon>mdi-folder</v-icon> | ||
134 | + </v-list-item-avatar> | ||
135 | + <v-list-item-content> | ||
136 | + <v-list-item-title | ||
137 | + v-text="item2.folder_name" | ||
138 | + ></v-list-item-title> | ||
139 | + </v-list-item-content> | ||
140 | + </v-list-item> | ||
141 | + </v-list> | ||
142 | + </v-container> | ||
143 | + <v-card-actions> | ||
144 | + <v-spacer></v-spacer> | ||
145 | + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn> | ||
146 | + </v-card-actions> | ||
147 | + </v-card> | ||
148 | + </v-dialog> | ||
149 | + <!-- sub menu for folder --> | ||
31 | <v-menu | 150 | <v-menu |
32 | v-model="showMenu" | 151 | v-model="showMenu" |
33 | :position-x="x" | 152 | :position-x="x" |
... | @@ -37,23 +156,53 @@ | ... | @@ -37,23 +156,53 @@ |
37 | > | 156 | > |
38 | <v-list dense> | 157 | <v-list dense> |
39 | <v-list-item @click.prevent="dialog2 = !dialog2"> | 158 | <v-list-item @click.prevent="dialog2 = !dialog2"> |
159 | + <v-list-item-icon> | ||
160 | + <v-icon>mdi-send</v-icon> | ||
161 | + </v-list-item-icon> | ||
162 | + <v-list-item-content> | ||
40 | <v-list-item-title>이동</v-list-item-title> | 163 | <v-list-item-title>이동</v-list-item-title> |
164 | + </v-list-item-content> | ||
41 | </v-list-item> | 165 | </v-list-item> |
42 | <v-list-item @click.prevent="deleteF"> | 166 | <v-list-item @click.prevent="deleteF"> |
167 | + <v-list-item-icon> | ||
168 | + <v-icon>mdi-delete</v-icon> | ||
169 | + </v-list-item-icon> | ||
170 | + <v-list-item-content> | ||
43 | <v-list-item-title>삭제</v-list-item-title> | 171 | <v-list-item-title>삭제</v-list-item-title> |
172 | + </v-list-item-content> | ||
173 | + </v-list-item> | ||
174 | + <v-list-item v-if="curfName.favorite === 1" @click="delete_favorite"> | ||
175 | + <v-list-item-icon> | ||
176 | + <v-icon>mdi-star-outline</v-icon> | ||
177 | + </v-list-item-icon> | ||
178 | + <v-list-item-content> | ||
179 | + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> | ||
180 | + </v-list-item-content> | ||
181 | + </v-list-item> | ||
182 | + <v-list-item v-if="curfName.favorite === 0" @click="add_favorite"> | ||
183 | + <v-list-item-icon> | ||
184 | + <v-icon>mdi-star</v-icon> | ||
185 | + </v-list-item-icon> | ||
186 | + <v-list-item-content> | ||
187 | + <v-list-item-title>즐겨 찾기 추가</v-list-item-title> | ||
188 | + </v-list-item-content> | ||
44 | </v-list-item> | 189 | </v-list-item> |
45 | </v-list> | 190 | </v-list> |
46 | </v-menu> | 191 | </v-menu> |
47 | - </v-list-item> | 192 | + <!-- --> |
48 | - <v-dialog v-model="dialog2" width="500px"> | 193 | + <!-- Move File --> |
194 | + <v-dialog v-model="dialog3" width="500px"> | ||
49 | <v-card> | 195 | <v-card> |
50 | <v-card-title class="grey darken-2"> | 196 | <v-card-title class="grey darken-2"> |
51 | - Move Folder | 197 | + Move File |
52 | </v-card-title> | 198 | </v-card-title> |
53 | <v-container> | 199 | <v-container> |
54 | - <v-list-item-group v-for="item2 in folders" :key="item2.folder_id"> | 200 | + <v-list> |
55 | - <template v-if="!(item2.folder_name === curfName)"> | 201 | + <v-list-item |
56 | - <v-hover @click.left="transferF(item2.folder_name)"> | 202 | + v-for="(item2, index) in folders" |
203 | + :key="index" | ||
204 | + @click.left="transferFile(item2.folder_name)" | ||
205 | + > | ||
57 | <v-list-item-avatar> | 206 | <v-list-item-avatar> |
58 | <v-icon>mdi-folder</v-icon> | 207 | <v-icon>mdi-folder</v-icon> |
59 | </v-list-item-avatar> | 208 | </v-list-item-avatar> |
... | @@ -62,10 +211,8 @@ | ... | @@ -62,10 +211,8 @@ |
62 | v-text="item2.folder_name" | 211 | v-text="item2.folder_name" |
63 | ></v-list-item-title> | 212 | ></v-list-item-title> |
64 | </v-list-item-content> | 213 | </v-list-item-content> |
65 | - </v-hover> | 214 | + </v-list-item> |
66 | - </template> | 215 | + </v-list> |
67 | - <!-- <template v-else></template> --> | ||
68 | - </v-list-item-group> | ||
69 | </v-container> | 216 | </v-container> |
70 | <v-card-actions> | 217 | <v-card-actions> |
71 | <v-spacer></v-spacer> | 218 | <v-spacer></v-spacer> |
... | @@ -73,25 +220,71 @@ | ... | @@ -73,25 +220,71 @@ |
73 | </v-card-actions> | 220 | </v-card-actions> |
74 | </v-card> | 221 | </v-card> |
75 | </v-dialog> | 222 | </v-dialog> |
76 | - <v-divider inset></v-divider> | 223 | + <!-- sub menu for file --> |
77 | - <v-subheader inset>Files</v-subheader> | 224 | + <v-menu |
78 | - <v-list-item v-for="item in this.$store.getters.fileL" :key="item.title"> | 225 | + v-model="showMenuF" |
79 | - <v-list-item-avatar> | 226 | + :position-x="x" |
80 | - <v-icon> mdi-file</v-icon> | 227 | + :position-y="y" |
81 | - </v-list-item-avatar> | 228 | + absolute |
229 | + offset-y | ||
230 | + > | ||
231 | + <v-list dense> | ||
232 | + <v-list-item @click.prevent="dialog3 = !dialog3"> | ||
233 | + <v-list-item-icon> | ||
234 | + <v-icon>mdi-send</v-icon> | ||
235 | + </v-list-item-icon> | ||
82 | <v-list-item-content> | 236 | <v-list-item-content> |
83 | - <v-list-item-title v-text="item.file_name"></v-list-item-title> | 237 | + <v-list-item-title>이동</v-list-item-title> |
238 | + </v-list-item-content> | ||
239 | + </v-list-item> | ||
240 | + <v-list-item @click.prevent="delete_file"> | ||
241 | + <v-list-item-icon> | ||
242 | + <v-icon>mdi-delete</v-icon> | ||
243 | + </v-list-item-icon> | ||
244 | + <v-list-item-content> | ||
245 | + <v-list-item-title>삭제</v-list-item-title> | ||
246 | + </v-list-item-content> | ||
247 | + </v-list-item> | ||
248 | + <v-list-item @click.prevent="download_file"> | ||
249 | + <v-list-item-icon> | ||
250 | + <v-icon>mdi-download</v-icon> | ||
251 | + </v-list-item-icon> | ||
252 | + <v-list-item-content> | ||
253 | + <v-list-item-title>다운로드</v-list-item-title> | ||
254 | + </v-list-item-content> | ||
255 | + </v-list-item> | ||
256 | + <v-list-item | ||
257 | + v-if="cfilename.favorite === 1" | ||
258 | + @click.prevent="delete_favorite_file" | ||
259 | + > | ||
260 | + <v-list-item-icon> | ||
261 | + <v-icon>mdi-star-outline</v-icon> | ||
262 | + </v-list-item-icon> | ||
263 | + <v-list-item-content> | ||
264 | + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> | ||
265 | + </v-list-item-content> | ||
266 | + </v-list-item> | ||
267 | + <v-list-item | ||
268 | + v-if="cfilename.favorite === 0" | ||
269 | + @click.prevent="add_favorite_file" | ||
270 | + > | ||
271 | + <v-list-item-icon> | ||
272 | + <v-icon>mdi-star</v-icon> | ||
273 | + </v-list-item-icon> | ||
274 | + <v-list-item-content> | ||
275 | + <v-list-item-title>즐겨 찾기 추가</v-list-item-title> | ||
276 | + </v-list-item-content> | ||
277 | + </v-list-item> | ||
278 | + <v-list-item @click.prevent="showShareF = !showShareF"> | ||
279 | + <v-list-item-icon> | ||
280 | + <v-icon>fas fa-share-alt</v-icon> | ||
281 | + </v-list-item-icon> | ||
282 | + <v-list-item-content> | ||
283 | + <v-list-item-title>공유 하기</v-list-item-title> | ||
84 | </v-list-item-content> | 284 | </v-list-item-content> |
85 | - <v-list-item-action> | ||
86 | - <v-btn icon @click="download_file(item.file_name)"> | ||
87 | - <v-icon color="grey lighten-1">mdi-download</v-icon> | ||
88 | - </v-btn> | ||
89 | - <v-btn icon @click="delete_file(item.file_name)"> | ||
90 | - <v-icon color="grey lighten-1">mdi-delete</v-icon> | ||
91 | - </v-btn> | ||
92 | - </v-list-item-action> | ||
93 | </v-list-item> | 285 | </v-list-item> |
94 | </v-list> | 286 | </v-list> |
287 | + </v-menu> | ||
95 | <input | 288 | <input |
96 | id="file-selector" | 289 | id="file-selector" |
97 | ref="uploadedfile" | 290 | ref="uploadedfile" |
... | @@ -99,42 +292,11 @@ | ... | @@ -99,42 +292,11 @@ |
99 | v-on:change="handleFileUpload()" | 292 | v-on:change="handleFileUpload()" |
100 | /> | 293 | /> |
101 | <br /> | 294 | <br /> |
102 | - <!-- | 295 | + <v-btn @click="upload_file"><v-icon>fas fa-upload</v-icon></v-btn> |
103 | - <v-file-input | ||
104 | - v-model="files" | ||
105 | - color="deep-purple accent-4" | ||
106 | - counter | ||
107 | - label="업로드" | ||
108 | - multiple | ||
109 | - placeholder="파일을 화면으로 드래그앤 드롭 하거나, 이곳을 클릭하세요." | ||
110 | - prepend-icon="mdi-paperclip" | ||
111 | - outlined | ||
112 | - :show-size="1000" | ||
113 | - > | ||
114 | - <template v-slot:selection="{ index, text }"> | ||
115 | - <v-chip | ||
116 | - v-if="index < 2" | ||
117 | - color="deep-purple accent-4" | ||
118 | - dark | ||
119 | - label | ||
120 | - small | ||
121 | - > | ||
122 | - {{ text }} | ||
123 | - </v-chip> | ||
124 | - <span | ||
125 | - v-else-if="index === 2" | ||
126 | - class="overline grey--text text--darken-3 mx-2" | ||
127 | - > | ||
128 | - +{{ files.length - 2 }} File(s) | ||
129 | - </span> | ||
130 | - </template> | ||
131 | - | ||
132 | - </v-file-input> | ||
133 | ---> | ||
134 | - <v-btn color="blue" @click="upload_file">upload</v-btn> | ||
135 | <v-btn bottom color="blue" dark fab fixed right @click="dialog = !dialog"> | 296 | <v-btn bottom color="blue" dark fab fixed right @click="dialog = !dialog"> |
136 | <v-icon>mdi-plus</v-icon> | 297 | <v-icon>mdi-plus</v-icon> |
137 | </v-btn> | 298 | </v-btn> |
299 | + <!-- Create Folder --> | ||
138 | <v-dialog v-model="dialog" width="500px"> | 300 | <v-dialog v-model="dialog" width="500px"> |
139 | <v-card> | 301 | <v-card> |
140 | <v-card-title class="grey darken-2"> | 302 | <v-card-title class="grey darken-2"> |
... | @@ -170,25 +332,42 @@ import { | ... | @@ -170,25 +332,42 @@ import { |
170 | uploadFile, | 332 | uploadFile, |
171 | deleteFile, | 333 | deleteFile, |
172 | downloadFile, | 334 | downloadFile, |
335 | + delFavorite, | ||
336 | + addFavorite, | ||
337 | + moveFile, | ||
338 | + delFavoriteFile, | ||
339 | + addFavoriteFile, | ||
340 | + detailFile, | ||
341 | + modifyFile, | ||
342 | + shareFile, | ||
173 | } from '../api/index'; | 343 | } from '../api/index'; |
174 | import Axios from 'axios'; | 344 | import Axios from 'axios'; |
175 | - | ||
176 | export default { | 345 | export default { |
177 | data() { | 346 | data() { |
178 | return { | 347 | return { |
179 | uploadedfile: null, | 348 | uploadedfile: null, |
180 | foldername: '', | 349 | foldername: '', |
181 | - curfName: '', | 350 | + curfName: {}, |
351 | + cfilename: {}, | ||
182 | folders: [], | 352 | folders: [], |
183 | files: [], | 353 | files: [], |
184 | search: '', | 354 | search: '', |
185 | id: '', | 355 | id: '', |
356 | + searchD: '', | ||
357 | + share_file_name: '', | ||
358 | + showShareF: false, | ||
359 | + targetUid: '', | ||
360 | + current_filename: null, //파일 상세정보 (이름) | ||
361 | + current_filedata: null, //파일 상세정보 (내용) | ||
186 | dialog: false, | 362 | dialog: false, |
187 | howMenu: false, | 363 | howMenu: false, |
188 | showMenu: false, | 364 | showMenu: false, |
365 | + showMenuF: false, //파일 관련 메뉴 | ||
366 | + showdetailF: false, //txt 파일 상세정보 및 수정 | ||
189 | x: 0, | 367 | x: 0, |
190 | y: 0, | 368 | y: 0, |
191 | dialog2: false, | 369 | dialog2: false, |
370 | + dialog3: false, //파일 관련 메뉴 | ||
192 | detail: { | 371 | detail: { |
193 | dataname: null, | 372 | dataname: null, |
194 | date: null, | 373 | date: null, |
... | @@ -198,20 +377,45 @@ export default { | ... | @@ -198,20 +377,45 @@ export default { |
198 | }, | 377 | }, |
199 | }; | 378 | }; |
200 | }, | 379 | }, |
201 | - async created() { | 380 | + created() { |
381 | + this.fetchData(); | ||
382 | + }, | ||
383 | + computed: { | ||
384 | + calData() { | ||
385 | + return this.folders | ||
386 | + .filter(data => { | ||
387 | + return data.folder_name | ||
388 | + .toLowerCase() | ||
389 | + .includes(this.search.toLowerCase()); | ||
390 | + }) | ||
391 | + .slice(0); | ||
392 | + }, | ||
393 | + calData2() { | ||
394 | + return this.files | ||
395 | + .filter(data => { | ||
396 | + return data.file_name | ||
397 | + .toLowerCase() | ||
398 | + .includes(this.search.toLowerCase()); | ||
399 | + }) | ||
400 | + .slice(0); | ||
401 | + }, | ||
402 | + }, | ||
403 | + watch: { | ||
404 | + $route: 'fetchData', | ||
405 | + }, | ||
406 | + methods: { | ||
407 | + async fetchData() { | ||
202 | try { | 408 | try { |
203 | const curData = { | 409 | const curData = { |
204 | id: this.$store.state.id, | 410 | id: this.$store.state.id, |
205 | - cur: '/', | 411 | + folder_id: -1, |
206 | }; | 412 | }; |
207 | console.log(curData); | 413 | console.log(curData); |
208 | const response = await folder(curData); | 414 | const response = await folder(curData); |
209 | - const file_response = await file(curData); | ||
210 | this.$store.commit('setFolder', response.data.folders); | 415 | this.$store.commit('setFolder', response.data.folders); |
211 | this.$store.commit('setCur', response.data.cur); | 416 | this.$store.commit('setCur', response.data.cur); |
212 | this.$store.commit('setParent', response.data.parentPath); | 417 | this.$store.commit('setParent', response.data.parentPath); |
213 | - this.folders = this.$store.getters.folderL; | 418 | + this.$store.commit('setFile', response.data.files); |
214 | - this.$store.commit('setFile', file_response.data.files); | ||
215 | this.folders = this.$store.getters.folderL; | 419 | this.folders = this.$store.getters.folderL; |
216 | console.log(this.$store.getters.fileL); | 420 | console.log(this.$store.getters.fileL); |
217 | this.files = this.$store.getters.fileL; | 421 | this.files = this.$store.getters.fileL; |
... | @@ -220,7 +424,6 @@ export default { | ... | @@ -220,7 +424,6 @@ export default { |
220 | console.log(error); | 424 | console.log(error); |
221 | } | 425 | } |
222 | }, | 426 | }, |
223 | - methods: { | ||
224 | handleFileUpload() { | 427 | handleFileUpload() { |
225 | this.uploadedfile = this.$refs.uploadedfile.files[0]; | 428 | this.uploadedfile = this.$refs.uploadedfile.files[0]; |
226 | console.log(this.uploadedfile); | 429 | console.log(this.uploadedfile); |
... | @@ -229,8 +432,10 @@ export default { | ... | @@ -229,8 +432,10 @@ export default { |
229 | this.foldername = ''; | 432 | this.foldername = ''; |
230 | }, | 433 | }, |
231 | cancelMove() { | 434 | cancelMove() { |
232 | - this.curfName = ''; | 435 | + this.curfName = {}; |
436 | + this.cfilename = {}; | ||
233 | this.dialog2 = false; | 437 | this.dialog2 = false; |
438 | + this.dialog3 = false; | ||
234 | }, | 439 | }, |
235 | async makeF() { | 440 | async makeF() { |
236 | try { | 441 | try { |
... | @@ -252,23 +457,6 @@ export default { | ... | @@ -252,23 +457,6 @@ export default { |
252 | this.dialog = false; | 457 | this.dialog = false; |
253 | } | 458 | } |
254 | }, | 459 | }, |
255 | - async moveF(move_folder_name) { | ||
256 | - try { | ||
257 | - const curData = { | ||
258 | - id: this.$store.state.id, | ||
259 | - cur: this.$store.state.cur + move_folder_name + '/', | ||
260 | - }; | ||
261 | - const response = await folder(curData); | ||
262 | - console.log(response.data); | ||
263 | - this.$store.commit('setFolder', response.data.folders); | ||
264 | - this.$store.commit('setCur', response.data.cur); | ||
265 | - this.$store.commit('setParent', response.data.parentPath); | ||
266 | - this.folders = this.$store.getters.folderL; | ||
267 | - } catch (error) { | ||
268 | - console.log('에러'); | ||
269 | - console.log(error.response.data); | ||
270 | - } | ||
271 | - }, | ||
272 | async moveParent() { | 460 | async moveParent() { |
273 | try { | 461 | try { |
274 | const cData = { | 462 | const cData = { |
... | @@ -276,11 +464,14 @@ export default { | ... | @@ -276,11 +464,14 @@ export default { |
276 | cur: this.$store.state.parent, | 464 | cur: this.$store.state.parent, |
277 | }; | 465 | }; |
278 | const response = await folder(cData); | 466 | const response = await folder(cData); |
467 | + const file_response = await file(cData); | ||
279 | console.log(response.data); | 468 | console.log(response.data); |
280 | this.$store.commit('setFolder', response.data.folders); | 469 | this.$store.commit('setFolder', response.data.folders); |
470 | + this.$store.commit('setFile', file_response.data.files); | ||
281 | this.$store.commit('setCur', response.data.cur); | 471 | this.$store.commit('setCur', response.data.cur); |
282 | this.$store.commit('setParent', response.data.parentPath); | 472 | this.$store.commit('setParent', response.data.parentPath); |
283 | this.folders = this.$store.getters.folderL; | 473 | this.folders = this.$store.getters.folderL; |
474 | + this.files = this.$store.getters.fileL; | ||
284 | } catch (error) { | 475 | } catch (error) { |
285 | console.log('에러'); | 476 | console.log('에러'); |
286 | console.log(error.response.data); | 477 | console.log(error.response.data); |
... | @@ -291,7 +482,7 @@ export default { | ... | @@ -291,7 +482,7 @@ export default { |
291 | const cData = { | 482 | const cData = { |
292 | id: this.$store.state.id, | 483 | id: this.$store.state.id, |
293 | cur: this.$store.state.cur, | 484 | cur: this.$store.state.cur, |
294 | - folder_name: this.curfName, | 485 | + folder_name: this.curfName.folder_name, |
295 | }; | 486 | }; |
296 | const response = await deleteFolder(cData); | 487 | const response = await deleteFolder(cData); |
297 | console.log(response); | 488 | console.log(response); |
... | @@ -309,7 +500,7 @@ export default { | ... | @@ -309,7 +500,7 @@ export default { |
309 | const cData = { | 500 | const cData = { |
310 | id: this.$store.state.id, | 501 | id: this.$store.state.id, |
311 | cur: this.$store.state.cur, | 502 | cur: this.$store.state.cur, |
312 | - folder_name: this.curfName, | 503 | + name: this.curfName.folder_name, |
313 | isfolder: true, | 504 | isfolder: true, |
314 | newPath: this.$store.state.cur + folderName + '/', | 505 | newPath: this.$store.state.cur + folderName + '/', |
315 | }; | 506 | }; |
... | @@ -321,8 +512,7 @@ export default { | ... | @@ -321,8 +512,7 @@ export default { |
321 | console.log('에러'); | 512 | console.log('에러'); |
322 | console.log(error.response.data); | 513 | console.log(error.response.data); |
323 | } finally { | 514 | } finally { |
324 | - this.initFolderName(); | 515 | + this.curfName = {}; |
325 | - this.curfName = ''; | ||
326 | this.dialog2 = false; | 516 | this.dialog2 = false; |
327 | } | 517 | } |
328 | }, | 518 | }, |
... | @@ -348,20 +538,16 @@ export default { | ... | @@ -348,20 +538,16 @@ export default { |
348 | console.log(error); | 538 | console.log(error); |
349 | } | 539 | } |
350 | }, | 540 | }, |
351 | - async delete_file(itemName) { | 541 | + async delete_file() { |
352 | try { | 542 | try { |
353 | var itemlist = this.$store.getters.fileL; | 543 | var itemlist = this.$store.getters.fileL; |
354 | - console.log(itemlist); | ||
355 | - console.log(itemName); | ||
356 | const currentData = { | 544 | const currentData = { |
357 | fileName: null, | 545 | fileName: null, |
358 | user_id: null, | 546 | user_id: null, |
359 | cur: this.$store.state.cur, | 547 | cur: this.$store.state.cur, |
360 | }; | 548 | }; |
361 | - | ||
362 | for (var i = 0; i < itemlist.length; i++) { | 549 | for (var i = 0; i < itemlist.length; i++) { |
363 | - console.log(itemlist[i].file_name); | 550 | + if (itemlist[i].file_name == this.cfilename.file_name) { |
364 | - if (itemlist[i].file_name == itemName) { | ||
365 | currentData.fileName = itemlist[i].file_name; | 551 | currentData.fileName = itemlist[i].file_name; |
366 | currentData.user_id = itemlist[i].user_id; | 552 | currentData.user_id = itemlist[i].user_id; |
367 | } | 553 | } |
... | @@ -370,23 +556,20 @@ export default { | ... | @@ -370,23 +556,20 @@ export default { |
370 | id: currentData.user_id, | 556 | id: currentData.user_id, |
371 | cur: currentData.cur, | 557 | cur: currentData.cur, |
372 | }; | 558 | }; |
373 | - console.log(currentData); | ||
374 | const response = await deleteFile(currentData); | 559 | const response = await deleteFile(currentData); |
375 | setTimeout(function() {}, 500); | 560 | setTimeout(function() {}, 500); |
376 | const filelist = await file(filelistData); | 561 | const filelist = await file(filelistData); |
377 | - console.log(filelist.data.files); | ||
378 | this.$store.commit('setFile', filelist.data.files); | 562 | this.$store.commit('setFile', filelist.data.files); |
379 | - console.log(this.$store.getters.fileL); | ||
380 | this.files = this.$store.getters.fileL; | 563 | this.files = this.$store.getters.fileL; |
381 | } catch (error) { | 564 | } catch (error) { |
382 | console.log('에러'); | 565 | console.log('에러'); |
383 | console.log(error); | 566 | console.log(error); |
384 | } | 567 | } |
385 | }, | 568 | }, |
386 | - async download_file(namedata) { | 569 | + async download_file() { |
387 | try { | 570 | try { |
388 | const currentData = { | 571 | const currentData = { |
389 | - fileName: namedata, | 572 | + fileName: this.cfilename.file_name, |
390 | id: this.$store.state.id, | 573 | id: this.$store.state.id, |
391 | cur: this.$store.state.cur, | 574 | cur: this.$store.state.cur, |
392 | }; | 575 | }; |
... | @@ -397,10 +580,146 @@ export default { | ... | @@ -397,10 +580,146 @@ export default { |
397 | console.log(error); | 580 | console.log(error); |
398 | } | 581 | } |
399 | }, | 582 | }, |
583 | + async delete_favorite() { | ||
584 | + try { | ||
585 | + const cData = { | ||
586 | + id: this.$store.state.id, | ||
587 | + cur: this.$store.state.cur, | ||
588 | + name: this.curfName.folder_name, | ||
589 | + }; | ||
590 | + console.log(cData); | ||
591 | + const response = await delFavorite(cData); | ||
592 | + this.$store.commit('setFolder', response.data.folders); | ||
593 | + this.folders = response.data.folders; | ||
594 | + } catch (error) { | ||
595 | + console.log('에러'); | ||
596 | + } | ||
597 | + }, | ||
598 | + async add_favorite() { | ||
599 | + try { | ||
600 | + const cData = { | ||
601 | + id: this.$store.state.id, | ||
602 | + cur: this.$store.state.cur, | ||
603 | + name: this.curfName.folder_name, | ||
604 | + }; | ||
605 | + console.log(cData); | ||
606 | + const response = await addFavorite(cData); | ||
607 | + this.$store.commit('setFolder', response.data.folders); | ||
608 | + this.folders = response.data.folders; | ||
609 | + } catch (error) { | ||
610 | + console.log('에러'); | ||
611 | + } | ||
612 | + }, | ||
613 | + async delete_favorite_file() { | ||
614 | + try { | ||
615 | + const fData = { | ||
616 | + id: this.$store.state.id, | ||
617 | + cur: this.$store.state.cur, | ||
618 | + name: this.cfilename.file_name, | ||
619 | + }; | ||
620 | + console.log(fData); | ||
621 | + const response = await delFavoriteFile(fData); | ||
622 | + this.$store.commit('setFile', response.data.files); | ||
623 | + this.files = response.data.files; | ||
624 | + } catch (error) { | ||
625 | + console.log('에러'); | ||
626 | + } | ||
627 | + }, | ||
628 | + async add_favorite_file() { | ||
629 | + try { | ||
630 | + const fData = { | ||
631 | + id: this.$store.state.id, | ||
632 | + cur: this.$store.state.cur, | ||
633 | + name: this.cfilename.file_name, | ||
634 | + }; | ||
635 | + console.log(fData); | ||
636 | + const response = await addFavoriteFile(fData); | ||
637 | + this.$store.commit('setFile', response.data.files); | ||
638 | + this.files = response.data.files; | ||
639 | + } catch (error) { | ||
640 | + console.log('에러'); | ||
641 | + } | ||
642 | + }, | ||
643 | + async transferFile(folderName) { | ||
644 | + try { | ||
645 | + const fData = { | ||
646 | + id: this.$store.state.id, | ||
647 | + cur: this.$store.state.cur, | ||
648 | + name: this.cfilename.file_name, | ||
649 | + isfolder: false, | ||
650 | + newPath: this.$store.state.cur + folderName + '/', | ||
651 | + }; | ||
652 | + const response = await moveFile(fData); | ||
653 | + console.log(response); | ||
654 | + this.$store.commit('setFile', response.data.files); | ||
655 | + this.files = this.$store.getters.fileL; | ||
656 | + } catch (error) { | ||
657 | + console.log('에러'); | ||
658 | + console.log(error.response.data); | ||
659 | + } finally { | ||
660 | + this.cfilename = {}; | ||
661 | + this.dialog3 = false; | ||
662 | + } | ||
663 | + }, | ||
664 | + async file_detail() { | ||
665 | + try { | ||
666 | + const currentData = { | ||
667 | + id: this.cfilename.user_id, | ||
668 | + cur: this.cfilename.location, | ||
669 | + fileName: this.cfilename.file_name, | ||
670 | + }; | ||
671 | + const detailData = await detailFile(currentData); | ||
672 | + this.current_filename = detailData.data.file_name; | ||
673 | + this.current_filedata = detailData.data.content; | ||
674 | + console.log(this.current_filename); | ||
675 | + console.log(this.current_filedata); | ||
676 | + } catch (error) { | ||
677 | + console.log('에러'); | ||
678 | + console.log(error); | ||
679 | + } | ||
680 | + }, | ||
681 | + async modify_file() { | ||
682 | + try { | ||
683 | + const modifyData = { | ||
684 | + user_id: this.cfilename.user_id, | ||
685 | + cur: this.cfilename.location, | ||
686 | + name: this.current_filename, | ||
687 | + content: this.current_filedata, | ||
688 | + }; | ||
689 | + const result = await modifyFile(modifyData); | ||
690 | + const after_data = { | ||
691 | + id: this.cfilename.user_id, | ||
692 | + cur: this.cfilename.location, | ||
693 | + fileName: this.current_filename, | ||
694 | + }; | ||
695 | + const detailData = await detailFile(after_data); | ||
696 | + } catch (error) { | ||
697 | + console.log('에러'); | ||
698 | + console.log(error); | ||
699 | + } | ||
400 | }, | 700 | }, |
401 | - show(folderN, e) { | 701 | + async file_share() { |
702 | + try { | ||
703 | + const shareData = { | ||
704 | + id: this.$store.state.id, | ||
705 | + cur: this.$store.state.cur, | ||
706 | + file_name: this.cfilename.file_name, | ||
707 | + target_id: this.targetUid, | ||
708 | + }; | ||
709 | + const response = await shareFile(shareData); | ||
710 | + if (response.status == 200) { | ||
711 | + alert('파일 공유 완료'); | ||
712 | + } | ||
713 | + } catch (error) { | ||
714 | + console.log('에러'); | ||
715 | + alert('존재 하지 않은 유저입니다.'); | ||
716 | + } finally { | ||
717 | + this.showShareF = false; | ||
718 | + } | ||
719 | + }, | ||
720 | + show(folderObj, e) { | ||
402 | e.preventDefault(); | 721 | e.preventDefault(); |
403 | - this.curfName = folderN; | 722 | + this.curfName = folderObj; |
404 | this.showMenu = false; | 723 | this.showMenu = false; |
405 | this.x = e.clientX; | 724 | this.x = e.clientX; |
406 | this.y = e.clientY; | 725 | this.y = e.clientY; |
... | @@ -408,5 +727,26 @@ export default { | ... | @@ -408,5 +727,26 @@ export default { |
408 | this.showMenu = true; | 727 | this.showMenu = true; |
409 | }); | 728 | }); |
410 | }, | 729 | }, |
730 | + showF(fileObj, e) { | ||
731 | + e.preventDefault(); | ||
732 | + this.cfilename = fileObj; | ||
733 | + this.showMenuF = false; | ||
734 | + this.x = e.clientX; | ||
735 | + this.y = e.clientY; | ||
736 | + this.$nextTick(() => { | ||
737 | + this.showMenuF = true; | ||
738 | + }); | ||
739 | + }, | ||
740 | + detailF(fileObj, e) { | ||
741 | + e.preventDefault(); | ||
742 | + this.cfilename = fileObj; | ||
743 | + this.showdetailF = false; | ||
744 | + this.x = e.clientX; | ||
745 | + this.y = e.clientY; | ||
746 | + this.$nextTick(() => { | ||
747 | + this.showdetailF = true; | ||
748 | + }); | ||
749 | + }, | ||
750 | + }, | ||
411 | }; | 751 | }; |
412 | </script> | 752 | </script> | ... | ... |
... | @@ -47,15 +47,7 @@ | ... | @@ -47,15 +47,7 @@ |
47 | <v-list-item-title>연락처</v-list-item-title> | 47 | <v-list-item-title>연락처</v-list-item-title> |
48 | </v-list-item-content> | 48 | </v-list-item-content> |
49 | </v-list-item> | 49 | </v-list-item> |
50 | - <v-list-item router :to="{ name: 'Main' }" exact> | 50 | + <v-list-item router :to="{ name: 'Trash' }" exact> |
51 | - <v-list-item-action> | ||
52 | - <v-icon>mdi-settings</v-icon> | ||
53 | - </v-list-item-action> | ||
54 | - <v-list-item-content> | ||
55 | - <v-list-item-title>설정</v-list-item-title> | ||
56 | - </v-list-item-content> | ||
57 | - </v-list-item> | ||
58 | - <v-list-item> | ||
59 | <v-list-item-action> | 51 | <v-list-item-action> |
60 | <v-icon>mdi-delete</v-icon> | 52 | <v-icon>mdi-delete</v-icon> |
61 | </v-list-item-action> | 53 | </v-list-item-action> | ... | ... |
front-end/src/components/TrashList.vue
0 → 100644
1 | +<template> | ||
2 | + <div> | ||
3 | + <v-toolbar flat> | ||
4 | + <v-toolbar-title>휴지통</v-toolbar-title> | ||
5 | + <v-spacer></v-spacer> | ||
6 | + <v-btn @click="delAll">비우기</v-btn> | ||
7 | + </v-toolbar> | ||
8 | + <v-list> | ||
9 | + <!-- <v-subheader inset>Folders</v-subheader> --> | ||
10 | + <!-- Folder view --> | ||
11 | + <v-list-item | ||
12 | + v-for="item in this.$store.getters.trashFolderL" | ||
13 | + :key="item.folder_id" | ||
14 | + :search="search" | ||
15 | + @click.right="show(item, $event)" | ||
16 | + @click="" | ||
17 | + > | ||
18 | + <v-list-item-avatar> | ||
19 | + <v-icon>mdi-folder</v-icon> | ||
20 | + </v-list-item-avatar> | ||
21 | + <v-list-item-content> | ||
22 | + <v-list-item-title v-text="item.folder_name"></v-list-item-title> | ||
23 | + </v-list-item-content> | ||
24 | + </v-list-item> | ||
25 | + <!-- File view --> | ||
26 | + <v-list-item | ||
27 | + v-for="item in this.$store.getters.trashFileL" | ||
28 | + :key="item.title" | ||
29 | + @click.right="showF(item, $event)" | ||
30 | + > | ||
31 | + <v-list-item-avatar> | ||
32 | + <v-icon> mdi-file</v-icon> | ||
33 | + </v-list-item-avatar> | ||
34 | + <v-list-item-content> | ||
35 | + <v-list-item-title v-text="item.file_name"></v-list-item-title> | ||
36 | + </v-list-item-content> | ||
37 | + </v-list-item> | ||
38 | + </v-list> | ||
39 | + <v-menu | ||
40 | + v-model="showMenu" | ||
41 | + :position-x="x" | ||
42 | + :position-y="y" | ||
43 | + absolute | ||
44 | + offset-y | ||
45 | + > | ||
46 | + <v-list dense> | ||
47 | + <v-list-item @click.prevent="delFolder"> | ||
48 | + <v-list-item-icon> | ||
49 | + <v-icon>mdi-delete</v-icon> | ||
50 | + </v-list-item-icon> | ||
51 | + <v-list-item-content> | ||
52 | + <v-list-item-title>삭제</v-list-item-title> | ||
53 | + </v-list-item-content> | ||
54 | + </v-list-item> | ||
55 | + <v-list-item @click.prevent="transferF"> | ||
56 | + <v-list-item-icon> | ||
57 | + <v-icon>fas fa-trash-restore</v-icon> | ||
58 | + </v-list-item-icon> | ||
59 | + <v-list-item-content> | ||
60 | + <v-list-item-title>복원</v-list-item-title> | ||
61 | + </v-list-item-content> | ||
62 | + </v-list-item> | ||
63 | + </v-list> | ||
64 | + </v-menu> | ||
65 | + <v-menu | ||
66 | + v-model="showMenuF" | ||
67 | + :position-x="x" | ||
68 | + :position-y="y" | ||
69 | + absolute | ||
70 | + offset-y | ||
71 | + > | ||
72 | + <v-list dense> | ||
73 | + <v-list-item @click.prevent="delFile"> | ||
74 | + <v-list-item-icon> | ||
75 | + <v-icon>mdi-delete</v-icon> | ||
76 | + </v-list-item-icon> | ||
77 | + <v-list-item-content> | ||
78 | + <v-list-item-title>삭제</v-list-item-title> | ||
79 | + </v-list-item-content> | ||
80 | + </v-list-item> | ||
81 | + <v-list-item @click.prevent="transferFile"> | ||
82 | + <v-list-item-icon> | ||
83 | + <v-icon>fas fa-trash-restore</v-icon> | ||
84 | + </v-list-item-icon> | ||
85 | + <v-list-item-content> | ||
86 | + <v-list-item-title>복원</v-list-item-title> | ||
87 | + </v-list-item-content> | ||
88 | + </v-list-item> | ||
89 | + </v-list> | ||
90 | + </v-menu> | ||
91 | + </div> | ||
92 | +</template> | ||
93 | + | ||
94 | +<script> | ||
95 | +import { | ||
96 | + tdelFolder, | ||
97 | + tdelFile, | ||
98 | + tdelAll, | ||
99 | + moveFolder, | ||
100 | + moveFile, | ||
101 | + showTrashcan, | ||
102 | +} from '../api/index'; | ||
103 | +export default { | ||
104 | + data() { | ||
105 | + return { | ||
106 | + curfName: {}, | ||
107 | + showMenu: false, | ||
108 | + search: '', | ||
109 | + x: 0, | ||
110 | + y: 0, | ||
111 | + cfilename: {}, | ||
112 | + showMenuF: false, | ||
113 | + }; | ||
114 | + }, | ||
115 | + created() { | ||
116 | + this.fetchData(); | ||
117 | + }, | ||
118 | + watch: { | ||
119 | + $route: 'fetchData', | ||
120 | + }, | ||
121 | + methods: { | ||
122 | + async fetchData() { | ||
123 | + try { | ||
124 | + const id = this.$store.state.id; | ||
125 | + const response = await showTrashcan(id); | ||
126 | + console.log(response.data); | ||
127 | + this.$store.commit('settrashFolderList', response.data.folders); | ||
128 | + this.$store.commit('settrashFileList', response.data.files); | ||
129 | + } catch (error) { | ||
130 | + console.log('에러'); | ||
131 | + } | ||
132 | + }, | ||
133 | + async delFolder() { | ||
134 | + try { | ||
135 | + const tData = { | ||
136 | + id: this.$store.state.id, | ||
137 | + folder_id: this.curfName.folder_id, | ||
138 | + }; | ||
139 | + const response = await tdelFolder(tData); | ||
140 | + this.$store.commit('settrashFolderList', response.data.folders); | ||
141 | + } catch (error) { | ||
142 | + console.log('에러'); | ||
143 | + alert('삭제 실패'); | ||
144 | + } | ||
145 | + }, | ||
146 | + async delFile() { | ||
147 | + try { | ||
148 | + const tData = { | ||
149 | + id: this.$store.state.id, | ||
150 | + folder_id: this.cfilename.file_id, | ||
151 | + }; | ||
152 | + const response = await tdelFile(tData); | ||
153 | + this.$store.commit('settrashFileList', response.data.files); | ||
154 | + } catch (error) { | ||
155 | + console.log('에러'); | ||
156 | + alert('삭제 실패'); | ||
157 | + } | ||
158 | + }, | ||
159 | + async delAll() { | ||
160 | + try { | ||
161 | + const id = this.$store.state.id; | ||
162 | + const response = await tdelAll(id); | ||
163 | + this.$store.commit('settrashFolderList', response.data.folders); | ||
164 | + this.$store.commit('settrashFileList', response.data.files); | ||
165 | + } catch (error) { | ||
166 | + console.log('에러'); | ||
167 | + alert('삭제 실패'); | ||
168 | + } | ||
169 | + }, | ||
170 | + async transferF() { | ||
171 | + try { | ||
172 | + const cData = { | ||
173 | + id: this.$store.state.id, | ||
174 | + cur: '/trashcan/', | ||
175 | + name: this.curfName.folder_name, | ||
176 | + isfolder: true, | ||
177 | + newPath: '/', | ||
178 | + }; | ||
179 | + const response = await moveFolder(cData); | ||
180 | + console.log(response); | ||
181 | + this.$store.commit('settrashFolderList', response.data.folders); | ||
182 | + } catch (error) { | ||
183 | + console.log('에러'); | ||
184 | + console.log(error.response.data); | ||
185 | + } | ||
186 | + }, | ||
187 | + async transferFile() { | ||
188 | + try { | ||
189 | + const fData = { | ||
190 | + id: this.$store.state.id, | ||
191 | + cur: '/trashcan/', | ||
192 | + name: this.cfilename.file_name, | ||
193 | + isfolder: false, | ||
194 | + newPath: '/', | ||
195 | + }; | ||
196 | + const response = await moveFile(fData); | ||
197 | + console.log(response); | ||
198 | + this.$store.commit('settrashFileList', response.data.files); | ||
199 | + } catch (error) { | ||
200 | + console.log('에러'); | ||
201 | + console.log(error.response.data); | ||
202 | + } | ||
203 | + }, | ||
204 | + show(folderObj, e) { | ||
205 | + e.preventDefault(); | ||
206 | + this.curfName = folderObj; | ||
207 | + this.showMenu = false; | ||
208 | + this.x = e.clientX; | ||
209 | + this.y = e.clientY; | ||
210 | + this.$nextTick(() => { | ||
211 | + this.showMenu = true; | ||
212 | + }); | ||
213 | + }, | ||
214 | + showF(fileObj, e) { | ||
215 | + e.preventDefault(); | ||
216 | + this.cfilename = fileObj; | ||
217 | + this.showMenuF = false; | ||
218 | + this.x = e.clientX; | ||
219 | + this.y = e.clientY; | ||
220 | + this.$nextTick(() => { | ||
221 | + this.showMenuF = true; | ||
222 | + }); | ||
223 | + }, | ||
224 | + }, | ||
225 | +}; | ||
226 | +</script> | ||
227 | + | ||
228 | +<style></style> |
front-end/src/components/accessList.vue
0 → 100644
1 | +<template lang="html"> | ||
2 | + <v-flex> | ||
3 | + <h1>빠른액세스</h1> | ||
4 | + <v-simple-table> | ||
5 | + <template v-slot:default> | ||
6 | + <thead> | ||
7 | + <tr> | ||
8 | + <th class="text-left">File ID</th> | ||
9 | + <th class="text-left">Name</th> | ||
10 | + <th class="text-left">Dir</th> | ||
11 | + <th class="text-left">Date</th> | ||
12 | + </tr> | ||
13 | + </thead> | ||
14 | + <tbody> | ||
15 | + <tr v-for="item in recent_list" :key="item.name"> | ||
16 | + <td>{{ item.file_id }}</td> | ||
17 | + <td>{{ item.file_name }}</td> | ||
18 | + <td>{{ item.location }}</td> | ||
19 | + <td>{{ item.date }}</td> | ||
20 | + </tr> | ||
21 | + </tbody> | ||
22 | + </template> | ||
23 | + </v-simple-table> | ||
24 | + <v-divider></v-divider> | ||
25 | + </v-flex> | ||
26 | +</template> | ||
27 | + | ||
28 | +<script> | ||
29 | +import { accessedList } from '../api/index'; | ||
30 | +import Axios from 'axios'; | ||
31 | +export default { | ||
32 | + data() { | ||
33 | + return { | ||
34 | + recent_list: [], | ||
35 | + }; | ||
36 | + }, | ||
37 | + async created() { | ||
38 | + try { | ||
39 | + const curData = { | ||
40 | + id: this.$store.state.id, | ||
41 | + }; | ||
42 | + console.log(curData); | ||
43 | + const list_reponse = await accessedList(curData); | ||
44 | + this.$store.commit('setRecentList', list_reponse.data); | ||
45 | + this.recent_list = this.$store.getters.recentL; | ||
46 | + console.log(this.$store.getters.recentL); | ||
47 | + } catch (error) { | ||
48 | + console.log('에러'); | ||
49 | + console.log(error); | ||
50 | + } | ||
51 | + }, | ||
52 | + methods: {}, | ||
53 | +}; | ||
54 | +</script> | ||
55 | + | ||
56 | +<style lang="css" scoped></style> |
front-end/src/components/folderc.vue
0 → 100644
1 | +<template> | ||
2 | + <div> | ||
3 | + <v-toolbar flat> | ||
4 | + <v-toolbar-title>내 드라이브</v-toolbar-title> | ||
5 | + <v-spacer></v-spacer> | ||
6 | + <v-text-field | ||
7 | + v-model="search" | ||
8 | + append-icon="mdi-magnify" | ||
9 | + label="검색" | ||
10 | + single-line | ||
11 | + hide-details | ||
12 | + ></v-text-field> | ||
13 | + </v-toolbar> | ||
14 | + <v-list> | ||
15 | + <!-- <v-subheader inset>Folders</v-subheader> --> | ||
16 | + <!-- Folder view --> | ||
17 | + <v-list-item @click="" @dblclick="$router.go(-1)">...</v-list-item> | ||
18 | + <v-list-item | ||
19 | + v-for="item in calData" | ||
20 | + :key="item.folder_id" | ||
21 | + :search="search" | ||
22 | + @click.right="show(item, $event)" | ||
23 | + @click="" | ||
24 | + @dblclick=" | ||
25 | + $router.push({ | ||
26 | + name: 'Folder', | ||
27 | + params: { id: item.folder_id }, | ||
28 | + }) | ||
29 | + " | ||
30 | + > | ||
31 | + <v-list-item-avatar> | ||
32 | + <v-icon>mdi-folder</v-icon> | ||
33 | + </v-list-item-avatar> | ||
34 | + <v-list-item-content> | ||
35 | + <v-list-item-title v-text="item.folder_name"></v-list-item-title> | ||
36 | + </v-list-item-content> | ||
37 | + <v-list-item-action> | ||
38 | + <v-icon v-if="item.favorite === 0"> | ||
39 | + mdi-star-outline | ||
40 | + </v-icon> | ||
41 | + <v-icon v-else> | ||
42 | + mdi-star | ||
43 | + </v-icon> | ||
44 | + </v-list-item-action> | ||
45 | + </v-list-item> | ||
46 | + <!-- File view --> | ||
47 | + <v-list-item | ||
48 | + v-for="item in calData2" | ||
49 | + :key="item.title" | ||
50 | + @click.right="showF(item, $event)" | ||
51 | + @dblclick=" | ||
52 | + detailF(item, $event); | ||
53 | + file_detail(item); | ||
54 | + " | ||
55 | + @click="" | ||
56 | + > | ||
57 | + <v-list-item-avatar> | ||
58 | + <v-icon> mdi-file</v-icon> | ||
59 | + </v-list-item-avatar> | ||
60 | + <v-list-item-content> | ||
61 | + <v-list-item-title v-text="item.file_name"></v-list-item-title> | ||
62 | + </v-list-item-content> | ||
63 | + <v-list-item-action> | ||
64 | + <v-icon v-if="item.favorite === 0"> | ||
65 | + mdi-star-outline | ||
66 | + </v-icon> | ||
67 | + <v-icon v-else> | ||
68 | + mdi-star | ||
69 | + </v-icon> | ||
70 | + </v-list-item-action> | ||
71 | + </v-list-item> | ||
72 | + </v-list> | ||
73 | + <!--file detail --> | ||
74 | + <v-dialog v-model="showdetailF" max-width="290"> | ||
75 | + <v-card> | ||
76 | + <v-card-title class="headline"> | ||
77 | + <v-text-field v-model="current_filename"></v-text-field> | ||
78 | + </v-card-title> | ||
79 | + <v-card-text> | ||
80 | + <v-text-field v-model="current_filedata"></v-text-field> | ||
81 | + </v-card-text> | ||
82 | + <v-card-actions> | ||
83 | + <v-spacer></v-spacer> | ||
84 | + <v-btn | ||
85 | + color="green darken-1" | ||
86 | + text | ||
87 | + @click=" | ||
88 | + showdetailF = false; | ||
89 | + modify_file(); | ||
90 | + " | ||
91 | + > | ||
92 | + save | ||
93 | + </v-btn> | ||
94 | + </v-card-actions> | ||
95 | + </v-card> | ||
96 | + </v-dialog> | ||
97 | + <!-- file share menu --> | ||
98 | + <v-dialog v-model="showShareF" width="500px"> | ||
99 | + <v-card> | ||
100 | + <v-card-title> | ||
101 | + Share File | ||
102 | + </v-card-title> | ||
103 | + <v-card-text> | ||
104 | + <v-text-field v-model="this.cfilename.file_name"></v-text-field> | ||
105 | + </v-card-text> | ||
106 | + <v-card-text> | ||
107 | + <v-text-field | ||
108 | + v-model="targetUid" | ||
109 | + label="target user id" | ||
110 | + ></v-text-field> | ||
111 | + </v-card-text> | ||
112 | + <v-card-actions> | ||
113 | + <v-spacer></v-spacer> | ||
114 | + <v-btn @click.prevent="file_share">ok</v-btn> | ||
115 | + <v-btn @click="showShareF = false">cancle</v-btn> | ||
116 | + </v-card-actions> | ||
117 | + </v-card> | ||
118 | + </v-dialog> | ||
119 | + <!-- Move Folder --> | ||
120 | + <v-dialog v-model="dialog2" width="500px"> | ||
121 | + <v-card> | ||
122 | + <v-card-title class="grey darken-2"> | ||
123 | + Move Folder | ||
124 | + </v-card-title> | ||
125 | + <v-container> | ||
126 | + <v-list> | ||
127 | + <v-list-item | ||
128 | + v-for="item2 in folders" | ||
129 | + :key="item2.folder_id" | ||
130 | + @click.left="transferF(item2.folder_name)" | ||
131 | + v-if="item2.folder_name !== curfName.folder_name" | ||
132 | + > | ||
133 | + <v-list-item-avatar> | ||
134 | + <v-icon>mdi-folder</v-icon> | ||
135 | + </v-list-item-avatar> | ||
136 | + <v-list-item-content> | ||
137 | + <v-list-item-title | ||
138 | + v-text="item2.folder_name" | ||
139 | + ></v-list-item-title> | ||
140 | + </v-list-item-content> | ||
141 | + </v-list-item> | ||
142 | + </v-list> | ||
143 | + </v-container> | ||
144 | + <v-card-actions> | ||
145 | + <v-spacer></v-spacer> | ||
146 | + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn> | ||
147 | + </v-card-actions> | ||
148 | + </v-card> | ||
149 | + </v-dialog> | ||
150 | + <!-- sub menu for folder --> | ||
151 | + <v-menu | ||
152 | + v-model="showMenu" | ||
153 | + :position-x="x" | ||
154 | + :position-y="y" | ||
155 | + absolute | ||
156 | + offset-y | ||
157 | + > | ||
158 | + <v-list dense> | ||
159 | + <v-list-item @click.prevent="dialog2 = !dialog2"> | ||
160 | + <v-list-item-icon> | ||
161 | + <v-icon>mdi-send</v-icon> | ||
162 | + </v-list-item-icon> | ||
163 | + <v-list-item-content> | ||
164 | + <v-list-item-title>이동</v-list-item-title> | ||
165 | + </v-list-item-content> | ||
166 | + </v-list-item> | ||
167 | + <v-list-item @click.prevent="deleteF"> | ||
168 | + <v-list-item-icon> | ||
169 | + <v-icon>mdi-delete</v-icon> | ||
170 | + </v-list-item-icon> | ||
171 | + <v-list-item-content> | ||
172 | + <v-list-item-title>삭제</v-list-item-title> | ||
173 | + </v-list-item-content> | ||
174 | + </v-list-item> | ||
175 | + <v-list-item v-if="curfName.favorite === 1" @click="delete_favorite"> | ||
176 | + <v-list-item-icon> | ||
177 | + <v-icon>mdi-star-outline</v-icon> | ||
178 | + </v-list-item-icon> | ||
179 | + <v-list-item-content> | ||
180 | + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> | ||
181 | + </v-list-item-content> | ||
182 | + </v-list-item> | ||
183 | + <v-list-item v-if="curfName.favorite === 0" @click="add_favorite"> | ||
184 | + <v-list-item-icon> | ||
185 | + <v-icon>mdi-star</v-icon> | ||
186 | + </v-list-item-icon> | ||
187 | + <v-list-item-content> | ||
188 | + <v-list-item-title>즐겨 찾기 추가</v-list-item-title> | ||
189 | + </v-list-item-content> | ||
190 | + </v-list-item> | ||
191 | + </v-list> | ||
192 | + </v-menu> | ||
193 | + <!-- --> | ||
194 | + <!-- Move File --> | ||
195 | + <v-dialog v-model="dialog3" width="500px"> | ||
196 | + <v-card> | ||
197 | + <v-card-title class="grey darken-2"> | ||
198 | + Move File | ||
199 | + </v-card-title> | ||
200 | + <v-container> | ||
201 | + <v-list> | ||
202 | + <v-list-item | ||
203 | + v-for="item2 in folders" | ||
204 | + :key="item2.folder_id" | ||
205 | + @click.left="transferFile(item2.folder_name)" | ||
206 | + > | ||
207 | + <v-list-item-avatar> | ||
208 | + <v-icon>mdi-folder</v-icon> | ||
209 | + </v-list-item-avatar> | ||
210 | + <v-list-item-content> | ||
211 | + <v-list-item-title | ||
212 | + v-text="item2.folder_name" | ||
213 | + ></v-list-item-title> | ||
214 | + </v-list-item-content> | ||
215 | + </v-list-item> | ||
216 | + </v-list> | ||
217 | + </v-container> | ||
218 | + <v-card-actions> | ||
219 | + <v-spacer></v-spacer> | ||
220 | + <v-btn text color="primary" @click="cancelMove">Cancel</v-btn> | ||
221 | + </v-card-actions> | ||
222 | + </v-card> | ||
223 | + </v-dialog> | ||
224 | + <!-- sub menu for file --> | ||
225 | + <v-menu | ||
226 | + v-model="showMenuF" | ||
227 | + :position-x="x" | ||
228 | + :position-y="y" | ||
229 | + absolute | ||
230 | + offset-y | ||
231 | + > | ||
232 | + <v-list dense> | ||
233 | + <v-list-item @click.prevent="dialog3 = !dialog3"> | ||
234 | + <v-list-item-icon> | ||
235 | + <v-icon>mdi-send</v-icon> | ||
236 | + </v-list-item-icon> | ||
237 | + <v-list-item-content> | ||
238 | + <v-list-item-title>이동</v-list-item-title> | ||
239 | + </v-list-item-content> | ||
240 | + </v-list-item> | ||
241 | + <v-list-item @click.prevent="delete_file"> | ||
242 | + <v-list-item-icon> | ||
243 | + <v-icon>mdi-delete</v-icon> | ||
244 | + </v-list-item-icon> | ||
245 | + <v-list-item-content> | ||
246 | + <v-list-item-title>삭제</v-list-item-title> | ||
247 | + </v-list-item-content> | ||
248 | + </v-list-item> | ||
249 | + <v-list-item @click.prevent="download_file"> | ||
250 | + <v-list-item-icon> | ||
251 | + <v-icon>mdi-download</v-icon> | ||
252 | + </v-list-item-icon> | ||
253 | + <v-list-item-content> | ||
254 | + <v-list-item-title>다운로드</v-list-item-title> | ||
255 | + </v-list-item-content> | ||
256 | + </v-list-item> | ||
257 | + <v-list-item | ||
258 | + v-if="cfilename.favorite === 1" | ||
259 | + @click="delete_favorite_file" | ||
260 | + > | ||
261 | + <v-list-item-icon> | ||
262 | + <v-icon>mdi-star-outline</v-icon> | ||
263 | + </v-list-item-icon> | ||
264 | + <v-list-item-content> | ||
265 | + <v-list-item-title>즐겨 찾기 삭제</v-list-item-title> | ||
266 | + </v-list-item-content> | ||
267 | + </v-list-item> | ||
268 | + <v-list-item v-if="cfilename.favorite === 0" @click="add_favorite_file"> | ||
269 | + <v-list-item-icon> | ||
270 | + <v-icon>mdi-star</v-icon> | ||
271 | + </v-list-item-icon> | ||
272 | + <v-list-item-content> | ||
273 | + <v-list-item-title>즐겨 찾기 추가</v-list-item-title> | ||
274 | + </v-list-item-content> | ||
275 | + </v-list-item> | ||
276 | + <v-list-item @click.prevent="showShareF = !showShareF"> | ||
277 | + <v-list-item-icon> | ||
278 | + <v-icon>fas fa-share-alt</v-icon> | ||
279 | + </v-list-item-icon> | ||
280 | + <v-list-item-content> | ||
281 | + <v-list-item-title>공유 하기</v-list-item-title> | ||
282 | + </v-list-item-content> | ||
283 | + </v-list-item> | ||
284 | + </v-list> | ||
285 | + </v-menu> | ||
286 | + <input | ||
287 | + id="file-selector" | ||
288 | + ref="uploadedfile" | ||
289 | + type="file" | ||
290 | + v-on:change="handleFileUpload()" | ||
291 | + /> | ||
292 | + <br /> | ||
293 | + <v-btn color="blue" @click="upload_file">upload</v-btn> | ||
294 | + <v-btn bottom color="blue" dark fab fixed right @click="dialog = !dialog"> | ||
295 | + <v-icon>mdi-plus</v-icon> | ||
296 | + </v-btn> | ||
297 | + <!-- Create Folder --> | ||
298 | + <v-dialog v-model="dialog" width="500px"> | ||
299 | + <v-card> | ||
300 | + <v-card-title class="grey darken-2"> | ||
301 | + Create Folder | ||
302 | + </v-card-title> | ||
303 | + <v-container> | ||
304 | + <div> | ||
305 | + <v-icon>mdi-folder</v-icon> | ||
306 | + <v-text-field | ||
307 | + placeholder="name" | ||
308 | + id="foldername" | ||
309 | + type="text" | ||
310 | + v-model="foldername" | ||
311 | + ></v-text-field> | ||
312 | + </div> | ||
313 | + </v-container> | ||
314 | + <v-card-actions> | ||
315 | + <v-spacer></v-spacer> | ||
316 | + <v-btn text color="primary" @click="dialog = false">Cancel</v-btn> | ||
317 | + <v-btn text @click="makeF">Create</v-btn> | ||
318 | + </v-card-actions> | ||
319 | + </v-card> | ||
320 | + </v-dialog> | ||
321 | + </div> | ||
322 | +</template> | ||
323 | +<script> | ||
324 | +import { | ||
325 | + folder, | ||
326 | + makeFolder, | ||
327 | + deleteFolder, | ||
328 | + moveFolder, | ||
329 | + file, | ||
330 | + uploadFile, | ||
331 | + deleteFile, | ||
332 | + downloadFile, | ||
333 | + delFavorite, | ||
334 | + addFavorite, | ||
335 | + moveFile, | ||
336 | + delFavoriteFile, | ||
337 | + addFavoriteFile, | ||
338 | + detailFile, | ||
339 | + modifyFile, | ||
340 | + shareFile, | ||
341 | +} from '../api/index'; | ||
342 | +import Axios from 'axios'; | ||
343 | + | ||
344 | +export default { | ||
345 | + props: { | ||
346 | + folderId: Number, | ||
347 | + }, | ||
348 | + data() { | ||
349 | + return { | ||
350 | + folder_id: this.$route.params.id, | ||
351 | + uploadedfile: null, | ||
352 | + foldername: '', | ||
353 | + curfName: {}, | ||
354 | + cfilename: {}, | ||
355 | + folders: [], | ||
356 | + files: [], | ||
357 | + search: '', | ||
358 | + id: '', | ||
359 | + share_file_name: '', | ||
360 | + showShareF: false, | ||
361 | + targetUid: '', | ||
362 | + current_filename: null, //파일 상세정보 (이름) | ||
363 | + current_filedata: null, //파일 상세정보 (내용) | ||
364 | + dialog: false, | ||
365 | + howMenu: false, | ||
366 | + showMenu: false, | ||
367 | + showMenuF: false, //파일 관련 메뉴 | ||
368 | + showdetailF: false, //txt 파일 상세정보 및 수정 | ||
369 | + x: 0, | ||
370 | + y: 0, | ||
371 | + dialog2: false, | ||
372 | + dialog3: false, //파일 관련 메뉴 | ||
373 | + detail: { | ||
374 | + dataname: null, | ||
375 | + date: null, | ||
376 | + owner_id: null, | ||
377 | + datasize: null, | ||
378 | + datatype: null, | ||
379 | + }, | ||
380 | + }; | ||
381 | + }, | ||
382 | + created() { | ||
383 | + this.fetchData(); | ||
384 | + }, | ||
385 | + computed: { | ||
386 | + calData() { | ||
387 | + return this.folders | ||
388 | + .filter(data => { | ||
389 | + return data.folder_name | ||
390 | + .toLowerCase() | ||
391 | + .includes(this.search.toLowerCase()); | ||
392 | + }) | ||
393 | + .slice(0); | ||
394 | + }, | ||
395 | + calData2() { | ||
396 | + return this.files | ||
397 | + .filter(data => { | ||
398 | + return data.file_name | ||
399 | + .toLowerCase() | ||
400 | + .includes(this.search.toLowerCase()); | ||
401 | + }) | ||
402 | + .slice(0); | ||
403 | + }, | ||
404 | + }, | ||
405 | + watch: { | ||
406 | + $route: 'fetchData', | ||
407 | + }, | ||
408 | + methods: { | ||
409 | + async fetchData() { | ||
410 | + try { | ||
411 | + console.log(this.$route.params.id); | ||
412 | + const curData = { | ||
413 | + id: this.$store.state.id, | ||
414 | + folder_id: this.$route.params.id, | ||
415 | + }; | ||
416 | + console.log(curData); | ||
417 | + const response = await folder(curData); | ||
418 | + // const file_response = await file(curData); | ||
419 | + this.$store.commit('setFolder', response.data.folders); | ||
420 | + this.$store.commit('setCur', response.data.cur); | ||
421 | + this.$store.commit('setParent', response.data.parentPath); | ||
422 | + this.$store.commit('setFile', response.data.files); | ||
423 | + this.folders = this.$store.getters.folderL; | ||
424 | + console.log(this.$store.getters.fileL); | ||
425 | + this.files = this.$store.getters.fileL; | ||
426 | + } catch (error) { | ||
427 | + console.log('에러'); | ||
428 | + console.log(error); | ||
429 | + } | ||
430 | + }, | ||
431 | + handleFileUpload() { | ||
432 | + this.uploadedfile = this.$refs.uploadedfile.files[0]; | ||
433 | + console.log(this.uploadedfile); | ||
434 | + }, | ||
435 | + initFolderName() { | ||
436 | + this.foldername = ''; | ||
437 | + }, | ||
438 | + cancelMove() { | ||
439 | + this.curfName = {}; | ||
440 | + this.cfilename = {}; | ||
441 | + this.dialog2 = false; | ||
442 | + this.dialog3 = false; | ||
443 | + }, | ||
444 | + async makeF() { | ||
445 | + try { | ||
446 | + const folderData = { | ||
447 | + user_id: this.$store.state.id, | ||
448 | + cur: this.$store.state.cur, | ||
449 | + folder_name: this.foldername, | ||
450 | + }; | ||
451 | + const response = await makeFolder(folderData); | ||
452 | + console.log(response.data); | ||
453 | + console.log('폴더 생성 완료'); | ||
454 | + this.$store.commit('setFolder', response.data.folders); | ||
455 | + this.folders = response.data.folders; | ||
456 | + } catch (error) { | ||
457 | + console.log('에러'); | ||
458 | + console.log(error.response.data); | ||
459 | + } finally { | ||
460 | + this.initFolderName(); | ||
461 | + this.dialog = false; | ||
462 | + } | ||
463 | + }, | ||
464 | + async moveParent() { | ||
465 | + try { | ||
466 | + const cData = { | ||
467 | + id: this.$store.state.id, | ||
468 | + cur: this.$store.state.parent, | ||
469 | + }; | ||
470 | + const response = await folder(cData); | ||
471 | + const file_response = await file(cData); | ||
472 | + console.log(response.data); | ||
473 | + this.$store.commit('setFolder', response.data.folders); | ||
474 | + this.$store.commit('setFile', file_response.data.files); | ||
475 | + this.$store.commit('setCur', response.data.cur); | ||
476 | + this.$store.commit('setParent', response.data.parentPath); | ||
477 | + this.folders = this.$store.getters.folderL; | ||
478 | + this.files = this.$store.getters.fileL; | ||
479 | + } catch (error) { | ||
480 | + console.log('에러'); | ||
481 | + console.log(error.response.data); | ||
482 | + } | ||
483 | + }, | ||
484 | + async deleteF() { | ||
485 | + try { | ||
486 | + const cData = { | ||
487 | + id: this.$store.state.id, | ||
488 | + cur: this.$store.state.cur, | ||
489 | + folder_name: this.curfName.folder_name, | ||
490 | + }; | ||
491 | + const response = await deleteFolder(cData); | ||
492 | + console.log(response); | ||
493 | + this.$store.commit('setFolder', response.data.folders); | ||
494 | + this.folders = this.$store.getters.folderL; | ||
495 | + } catch (error) { | ||
496 | + console.log('에러'); | ||
497 | + console.log(error.response.data); | ||
498 | + } finally { | ||
499 | + this.curfName = ''; | ||
500 | + } | ||
501 | + }, | ||
502 | + async transferF(folderName) { | ||
503 | + try { | ||
504 | + const cData = { | ||
505 | + id: this.$store.state.id, | ||
506 | + cur: this.$store.state.cur, | ||
507 | + name: this.curfName.folder_name, | ||
508 | + isfolder: true, | ||
509 | + newPath: this.$store.state.cur + folderName + '/', | ||
510 | + }; | ||
511 | + const response = await moveFolder(cData); | ||
512 | + console.log(response); | ||
513 | + this.$store.commit('setFolder', response.data.folders); | ||
514 | + this.folders = this.$store.getters.folderL; | ||
515 | + } catch (error) { | ||
516 | + console.log('에러'); | ||
517 | + console.log(error.response.data); | ||
518 | + } finally { | ||
519 | + this.curfName = {}; | ||
520 | + this.dialog2 = false; | ||
521 | + } | ||
522 | + }, | ||
523 | + async upload_file() { | ||
524 | + try { | ||
525 | + const formData = new FormData(); | ||
526 | + formData.append('file', this.uploadedfile); | ||
527 | + formData.append('user_id', this.$store.state.id); | ||
528 | + formData.append('cur', this.$store.state.cur); | ||
529 | + const currentData = { | ||
530 | + id: this.$store.state.id, | ||
531 | + cur: this.$store.state.cur, | ||
532 | + }; | ||
533 | + console.log(currentData); | ||
534 | + const response = await uploadFile(formData); | ||
535 | + const filelist = await file(currentData); | ||
536 | + console.log(filelist.data.files); | ||
537 | + this.$store.commit('setFile', filelist.data.files); | ||
538 | + console.log(this.$store.getters.fileL); | ||
539 | + this.files = this.$store.getters.fileL; | ||
540 | + } catch (error) { | ||
541 | + console.log('에러'); | ||
542 | + console.log(error); | ||
543 | + } | ||
544 | + }, | ||
545 | + async delete_file() { | ||
546 | + try { | ||
547 | + var itemlist = this.$store.getters.fileL; | ||
548 | + const currentData = { | ||
549 | + fileName: null, | ||
550 | + user_id: null, | ||
551 | + cur: this.$store.state.cur, | ||
552 | + }; | ||
553 | + for (var i = 0; i < itemlist.length; i++) { | ||
554 | + if (itemlist[i].file_name == this.cfilename.file_name) { | ||
555 | + currentData.fileName = itemlist[i].file_name; | ||
556 | + currentData.user_id = itemlist[i].user_id; | ||
557 | + } | ||
558 | + } | ||
559 | + const filelistData = { | ||
560 | + id: currentData.user_id, | ||
561 | + cur: currentData.cur, | ||
562 | + }; | ||
563 | + const response = await deleteFile(currentData); | ||
564 | + setTimeout(function() {}, 500); | ||
565 | + const filelist = await file(filelistData); | ||
566 | + this.$store.commit('setFile', filelist.data.files); | ||
567 | + this.files = this.$store.getters.fileL; | ||
568 | + } catch (error) { | ||
569 | + console.log('에러'); | ||
570 | + console.log(error); | ||
571 | + } | ||
572 | + }, | ||
573 | + async download_file() { | ||
574 | + try { | ||
575 | + const currentData = { | ||
576 | + fileName: this.cfilename.file_name, | ||
577 | + id: this.$store.state.id, | ||
578 | + cur: this.$store.state.cur, | ||
579 | + }; | ||
580 | + const result = await downloadFile(currentData); | ||
581 | + console.log(result); | ||
582 | + } catch (error) { | ||
583 | + console.log('에러'); | ||
584 | + console.log(error); | ||
585 | + } | ||
586 | + }, | ||
587 | + async delete_favorite() { | ||
588 | + try { | ||
589 | + const cData = { | ||
590 | + id: this.$store.state.id, | ||
591 | + cur: this.$store.state.cur, | ||
592 | + name: this.curfName.folder_name, | ||
593 | + }; | ||
594 | + console.log(cData); | ||
595 | + const response = await delFavorite(cData); | ||
596 | + this.$store.commit('setFolder', response.data.folders); | ||
597 | + this.folders = response.data.folders; | ||
598 | + } catch (error) { | ||
599 | + console.log('에러'); | ||
600 | + } | ||
601 | + }, | ||
602 | + async add_favorite() { | ||
603 | + try { | ||
604 | + const cData = { | ||
605 | + id: this.$store.state.id, | ||
606 | + cur: this.$store.state.cur, | ||
607 | + name: this.curfName.folder_name, | ||
608 | + }; | ||
609 | + console.log(cData); | ||
610 | + const response = await addFavorite(cData); | ||
611 | + this.$store.commit('setFolder', response.data.folders); | ||
612 | + this.folders = response.data.folders; | ||
613 | + } catch (error) { | ||
614 | + console.log('에러'); | ||
615 | + } | ||
616 | + }, | ||
617 | + async delete_favorite_file() { | ||
618 | + try { | ||
619 | + const fData = { | ||
620 | + id: this.$store.state.id, | ||
621 | + cur: this.$store.state.cur, | ||
622 | + name: this.cfilename.file_name, | ||
623 | + }; | ||
624 | + console.log(fData); | ||
625 | + const response = await delFavoriteFile(fData); | ||
626 | + this.$store.commit('setFile', response.data.files); | ||
627 | + this.files = response.data.files; | ||
628 | + } catch (error) { | ||
629 | + console.log('에러'); | ||
630 | + } | ||
631 | + }, | ||
632 | + async add_favorite_file() { | ||
633 | + try { | ||
634 | + const fData = { | ||
635 | + id: this.$store.state.id, | ||
636 | + cur: this.$store.state.cur, | ||
637 | + name: this.cfilename.file_name, | ||
638 | + }; | ||
639 | + console.log(fData); | ||
640 | + const response = await addFavoriteFile(fData); | ||
641 | + this.$store.commit('setFile', response.data.files); | ||
642 | + this.files = response.data.files; | ||
643 | + } catch (error) { | ||
644 | + console.log('에러'); | ||
645 | + } | ||
646 | + }, | ||
647 | + async transferFile(folderName) { | ||
648 | + try { | ||
649 | + const fData = { | ||
650 | + id: this.$store.state.id, | ||
651 | + cur: this.$store.state.cur, | ||
652 | + name: this.cfilename.file_name, | ||
653 | + isfolder: false, | ||
654 | + newPath: this.$store.state.cur + folderName + '/', | ||
655 | + }; | ||
656 | + const response = await moveFile(fData); | ||
657 | + console.log(response); | ||
658 | + this.$store.commit('setFile', response.data.files); | ||
659 | + this.files = this.$store.getters.fileL; | ||
660 | + } catch (error) { | ||
661 | + console.log('에러'); | ||
662 | + console.log(error.response.data); | ||
663 | + } finally { | ||
664 | + this.cfilename = {}; | ||
665 | + this.dialog3 = false; | ||
666 | + } | ||
667 | + }, | ||
668 | + async file_detail() { | ||
669 | + try { | ||
670 | + const currentData = { | ||
671 | + id: this.cfilename.user_id, | ||
672 | + cur: this.cfilename.location, | ||
673 | + fileName: this.cfilename.file_name, | ||
674 | + }; | ||
675 | + const detailData = await detailFile(currentData); | ||
676 | + this.current_filename = detailData.data.file_name; | ||
677 | + this.current_filedata = detailData.data.content; | ||
678 | + console.log(this.current_filename); | ||
679 | + console.log(this.current_filedata); | ||
680 | + } catch (error) { | ||
681 | + console.log('에러'); | ||
682 | + console.log(error); | ||
683 | + } | ||
684 | + }, | ||
685 | + async modify_file() { | ||
686 | + try { | ||
687 | + const modifyData = { | ||
688 | + user_id: this.cfilename.user_id, | ||
689 | + cur: this.cfilename.location, | ||
690 | + name: this.current_filename, | ||
691 | + content: this.current_filedata, | ||
692 | + }; | ||
693 | + const result = await modifyFile(modifyData); | ||
694 | + const after_data = { | ||
695 | + id: this.cfilename.user_id, | ||
696 | + cur: this.cfilename.location, | ||
697 | + fileName: this.current_filename, | ||
698 | + }; | ||
699 | + const detailData = await detailFile(after_data); | ||
700 | + } catch (error) { | ||
701 | + console.log('에러'); | ||
702 | + console.log(error); | ||
703 | + } | ||
704 | + }, | ||
705 | + async file_share() { | ||
706 | + try { | ||
707 | + const shareData = { | ||
708 | + id: this.$store.state.id, | ||
709 | + cur: this.$store.state.cur, | ||
710 | + file_name: this.cfilename.file_name, | ||
711 | + target_id: this.targetUid, | ||
712 | + }; | ||
713 | + const response = await shareFile(shareData); | ||
714 | + if (response.status == 200) { | ||
715 | + alert('파일 공유 완료'); | ||
716 | + } | ||
717 | + } catch (error) { | ||
718 | + console.log('에러'); | ||
719 | + alert('존재 하지 않은 유저입니다.'); | ||
720 | + } finally { | ||
721 | + this.showShareF = false; | ||
722 | + } | ||
723 | + }, | ||
724 | + show(folderObj, e) { | ||
725 | + e.preventDefault(); | ||
726 | + this.curfName = folderObj; | ||
727 | + this.showMenu = false; | ||
728 | + this.x = e.clientX; | ||
729 | + this.y = e.clientY; | ||
730 | + this.$nextTick(() => { | ||
731 | + this.showMenu = true; | ||
732 | + }); | ||
733 | + }, | ||
734 | + showF(fileObj, e) { | ||
735 | + e.preventDefault(); | ||
736 | + this.cfilename = fileObj; | ||
737 | + this.showMenuF = false; | ||
738 | + this.x = e.clientX; | ||
739 | + this.y = e.clientY; | ||
740 | + this.$nextTick(() => { | ||
741 | + this.showMenuF = true; | ||
742 | + }); | ||
743 | + }, | ||
744 | + detailF(fileObj, e) { | ||
745 | + e.preventDefault(); | ||
746 | + this.cfilename = fileObj; | ||
747 | + this.showdetailF = false; | ||
748 | + this.x = e.clientX; | ||
749 | + this.y = e.clientY; | ||
750 | + this.$nextTick(() => { | ||
751 | + this.showdetailF = true; | ||
752 | + }); | ||
753 | + }, | ||
754 | + }, | ||
755 | +}; | ||
756 | +</script> |
1 | -import Vue from 'vue' | 1 | +import Vue from 'vue'; |
2 | -import App from './App.vue' | 2 | +import App from './App.vue'; |
3 | -import router from './routes/index' | 3 | +import router from './routes/index'; |
4 | -import store from './store/index' | 4 | +import store from './store/index'; |
5 | import vuetify from './plugins/vuetify'; | 5 | import vuetify from './plugins/vuetify'; |
6 | 6 | ||
7 | -Vue.config.productionTip = false | 7 | +Vue.config.productionTip = false; |
8 | 8 | ||
9 | new Vue({ | 9 | new Vue({ |
10 | router, | 10 | router, |
11 | store, | 11 | store, |
12 | vuetify, | 12 | vuetify, |
13 | - render: h => h(App) | 13 | + render: h => h(App), |
14 | -}).$mount('#app') | 14 | +}).$mount('#app'); | ... | ... |
... | @@ -67,9 +67,15 @@ export default new VueRouter({ | ... | @@ -67,9 +67,15 @@ export default new VueRouter({ |
67 | component: () => import('../views/Feedback.vue'), | 67 | component: () => import('../views/Feedback.vue'), |
68 | }, | 68 | }, |
69 | { | 69 | { |
70 | - path: '/folder', | 70 | + path: '/file/:id', |
71 | name: 'Folder', | 71 | name: 'Folder', |
72 | - component: () => import('../views/FolderPage.vue'), | 72 | + component: () => import('../components/folderc'), |
73 | + props: true, | ||
74 | + }, | ||
75 | + { | ||
76 | + path: '/trash', | ||
77 | + name: 'Trash', | ||
78 | + component: () => import('../views/TrashPage'), | ||
73 | }, | 79 | }, |
74 | ], | 80 | ], |
75 | }); | 81 | }); | ... | ... |
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: { | 7 | state: { |
... | @@ -9,7 +9,12 @@ export default new Vuex.Store({ | ... | @@ -9,7 +9,12 @@ export default new Vuex.Store({ |
9 | folders: [], | 9 | folders: [], |
10 | files: [], | 10 | files: [], |
11 | cur: '/', | 11 | cur: '/', |
12 | - parent: '/' | 12 | + parent: '/', |
13 | + recentList: [], | ||
14 | + favFolderList: [], | ||
15 | + favFileList: [], | ||
16 | + trashFolderList: [], | ||
17 | + trashFileList: [], | ||
13 | }, | 18 | }, |
14 | mutations: { | 19 | mutations: { |
15 | setId(state, userid) { | 20 | setId(state, userid) { |
... | @@ -29,7 +34,22 @@ export default new Vuex.Store({ | ... | @@ -29,7 +34,22 @@ export default new Vuex.Store({ |
29 | }, | 34 | }, |
30 | setParent(state, parent) { | 35 | setParent(state, parent) { |
31 | state.parent = parent; | 36 | state.parent = parent; |
32 | - } | 37 | + }, |
38 | + setRecentList(state, list) { | ||
39 | + state.recentList = list; | ||
40 | + }, | ||
41 | + setfavFolderList(state, fflist) { | ||
42 | + state.favFolderList = fflist; | ||
43 | + }, | ||
44 | + setfavFileList(state, fflist) { | ||
45 | + state.favFileList = fflist; | ||
46 | + }, | ||
47 | + settrashFolderList(state, tflist) { | ||
48 | + state.trashFolderList = tflist; | ||
49 | + }, | ||
50 | + settrashFileList(state, tflist) { | ||
51 | + state.trashFileList = tflist; | ||
52 | + }, | ||
33 | }, | 53 | }, |
34 | getters: { | 54 | getters: { |
35 | isLogin(state) { | 55 | isLogin(state) { |
... | @@ -44,14 +64,29 @@ export default new Vuex.Store({ | ... | @@ -44,14 +64,29 @@ export default new Vuex.Store({ |
44 | fileL(state) { | 64 | fileL(state) { |
45 | return state.files; | 65 | return state.files; |
46 | }, | 66 | }, |
67 | + recentL(state) { | ||
68 | + return state.recentList; | ||
69 | + }, | ||
47 | cur(state) { | 70 | cur(state) { |
48 | return state.cur; | 71 | return state.cur; |
49 | }, | 72 | }, |
50 | - setFolder(state, folderlist){ | 73 | + setFolder(state, folderlist) { |
51 | state.folders = folderlist; | 74 | state.folders = folderlist; |
52 | }, | 75 | }, |
53 | - setFile(state, filelist){ | 76 | + setFile(state, filelist) { |
54 | state.files = filelist; | 77 | state.files = filelist; |
55 | }, | 78 | }, |
79 | + favFolderL(state) { | ||
80 | + return state.favFolderList; | ||
81 | + }, | ||
82 | + favFileL(state) { | ||
83 | + return state.favFileList; | ||
84 | + }, | ||
85 | + trashFolderL(state) { | ||
86 | + return state.trashFolderList; | ||
87 | + }, | ||
88 | + trashFileL(state) { | ||
89 | + return state.trashFileList; | ||
90 | + }, | ||
56 | }, | 91 | }, |
57 | -}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
92 | +}); | ... | ... |
... | @@ -3,13 +3,12 @@ | ... | @@ -3,13 +3,12 @@ |
3 | </template> | 3 | </template> |
4 | 4 | ||
5 | <script> | 5 | <script> |
6 | - import contact from '@/components/make_contact.vue' | 6 | +import contact from '@/components/make_contact.vue'; |
7 | - export default { | 7 | +export default { |
8 | - components:{ | 8 | + components: { |
9 | - contact | 9 | + contact, |
10 | - } | 10 | + }, |
11 | - } | 11 | +}; |
12 | </script> | 12 | </script> |
13 | 13 | ||
14 | -<style lang="css" scoped> | 14 | +<style lang="css" scoped></style> |
15 | -</style> | ... | ... |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <v-toolbar flat> | 3 | + <Fav_list></Fav_list> |
4 | - <v-toolbar-title>즐겨찾기</v-toolbar-title> | ||
5 | - | ||
6 | - <v-spacer></v-spacer> | ||
7 | - <v-text-field | ||
8 | - v-model="search" | ||
9 | - append-icon="mdi-magnify" | ||
10 | - label="즐겨찾기 검색" | ||
11 | - single-line | ||
12 | - hide-details | ||
13 | - ></v-text-field> | ||
14 | - </v-toolbar> | ||
15 | - | ||
16 | - <v-list two-line subheader> | ||
17 | - | ||
18 | - | ||
19 | - <v-list-item | ||
20 | - v-for="item in items" | ||
21 | - :key="item.title" | ||
22 | - @click="" | ||
23 | - > | ||
24 | - <v-list-item-avatar> | ||
25 | - <v-icon | ||
26 | - | ||
27 | - >{{item.iconClass}}</v-icon> | ||
28 | - </v-list-item-avatar> | ||
29 | - | ||
30 | - <v-list-item-content> | ||
31 | - <v-list-item-title v-text="item.title"></v-list-item-title> | ||
32 | - <v-list-item-subtitle v-text="item.subtitle"></v-list-item-subtitle> | ||
33 | - </v-list-item-content> | ||
34 | - | ||
35 | - <v-list-item-action> | ||
36 | - <v-btn icon> | ||
37 | - <v-icon color="grey lighten-1">mdi-information</v-icon> | ||
38 | - </v-btn> | ||
39 | - </v-list-item-action> | ||
40 | - </v-list-item> | ||
41 | - | ||
42 | - | ||
43 | - <v-list-item | ||
44 | - v-for="item in items2" | ||
45 | - :key="item.title" | ||
46 | - @click="" | ||
47 | - > | ||
48 | - <v-list-item-avatar> | ||
49 | - <v-icon> {{item.iconClass}}</v-icon> | ||
50 | - </v-list-item-avatar> | ||
51 | - | ||
52 | - <v-list-item-content> | ||
53 | - <v-list-item-title v-text="item.title"></v-list-item-title> | ||
54 | - <v-list-item-subtitle v-text="item.subtitle"></v-list-item-subtitle> | ||
55 | - </v-list-item-content> | ||
56 | - | ||
57 | - <v-list-item-action> | ||
58 | - <v-btn icon> | ||
59 | - <v-icon color="grey lighten-1">mdi-information</v-icon> | ||
60 | - </v-btn> | ||
61 | - </v-list-item-action> | ||
62 | - </v-list-item> | ||
63 | - </v-list> | ||
64 | </div> | 4 | </div> |
65 | </template> | 5 | </template> |
66 | 6 | ||
67 | <script> | 7 | <script> |
68 | - export default { | 8 | +import Fav_list from '../components/Fav_list'; |
69 | - data: () => ({ | 9 | +export default { |
70 | - items: [ | 10 | + components: { |
71 | - { icon: 'folder', iconClass: 'mdi-folder', title: 'Photos', subtitle: 'Jan 9, 2014' }, | 11 | + Fav_list, |
72 | - { icon: 'folder', iconClass: 'mdi-folder', title: 'Recipes', subtitle: 'Jan 17, 2014' }, | 12 | + }, |
73 | - { icon: 'folder', iconClass: 'mdi-folder', title: 'Work', subtitle: 'Jan 28, 2014' }, | 13 | +}; |
74 | - ], | ||
75 | - items2: [ | ||
76 | - { icon: 'assignment', iconClass: 'mdi-file', title: 'Vacation itinerary', subtitle: 'Jan 20, 2014' }, | ||
77 | - { icon: 'call_to_action', iconClass: 'mdi-PdfBox', title: 'Kitchen remodel', subtitle: 'Jan 10, 2014' }, | ||
78 | - ], | ||
79 | - }), | ||
80 | - } | ||
81 | </script> | 14 | </script> |
15 | + | ||
16 | +<style></style> | ... | ... |
... | @@ -4,17 +4,15 @@ | ... | @@ -4,17 +4,15 @@ |
4 | </v-container> | 4 | </v-container> |
5 | </template> | 5 | </template> |
6 | 6 | ||
7 | - | ||
8 | - | ||
9 | <script> | 7 | <script> |
10 | - import FileList from '@/components/FileList' | 8 | +import FileList from '@/components/FileList'; |
11 | - import Favlist from '@/components/Fav_list' | 9 | +import Favlist from '@/components/Fav_list'; |
12 | - export default { | 10 | +export default { |
13 | - components:{ | 11 | + components: { |
14 | FileList, | 12 | FileList, |
15 | - Favlist | 13 | + Favlist, |
16 | }, | 14 | }, |
17 | - data () { | 15 | + data() { |
18 | return { | 16 | return { |
19 | headers: [ | 17 | headers: [ |
20 | { | 18 | { |
... | @@ -37,7 +35,7 @@ | ... | @@ -37,7 +35,7 @@ |
37 | carbs: 24, | 35 | carbs: 24, |
38 | protein: 4.0, | 36 | protein: 4.0, |
39 | iron: '1%', | 37 | iron: '1%', |
40 | - format : 'dir' | 38 | + format: 'dir', |
41 | }, | 39 | }, |
42 | { | 40 | { |
43 | name: 'Ice cream sandwich', | 41 | name: 'Ice cream sandwich', |
... | @@ -46,7 +44,7 @@ | ... | @@ -46,7 +44,7 @@ |
46 | carbs: 37, | 44 | carbs: 37, |
47 | protein: 4.3, | 45 | protein: 4.3, |
48 | iron: '1%', | 46 | iron: '1%', |
49 | - format: 'pdf' | 47 | + format: 'pdf', |
50 | }, | 48 | }, |
51 | { | 49 | { |
52 | name: 'Eclair', | 50 | name: 'Eclair', |
... | @@ -55,7 +53,7 @@ | ... | @@ -55,7 +53,7 @@ |
55 | carbs: 23, | 53 | carbs: 23, |
56 | protein: 6.0, | 54 | protein: 6.0, |
57 | iron: '7%', | 55 | iron: '7%', |
58 | - format: 'file' | 56 | + format: 'file', |
59 | }, | 57 | }, |
60 | { | 58 | { |
61 | name: 'Cupcake', | 59 | name: 'Cupcake', |
... | @@ -64,7 +62,7 @@ | ... | @@ -64,7 +62,7 @@ |
64 | carbs: 67, | 62 | carbs: 67, |
65 | protein: 4.3, | 63 | protein: 4.3, |
66 | iron: '8%', | 64 | iron: '8%', |
67 | - format : 'dir' | 65 | + format: 'dir', |
68 | }, | 66 | }, |
69 | { | 67 | { |
70 | name: 'Gingerbread', | 68 | name: 'Gingerbread', |
... | @@ -73,7 +71,7 @@ | ... | @@ -73,7 +71,7 @@ |
73 | carbs: 49, | 71 | carbs: 49, |
74 | protein: 3.9, | 72 | protein: 3.9, |
75 | iron: '16%', | 73 | iron: '16%', |
76 | - format : 'pdf' | 74 | + format: 'pdf', |
77 | }, | 75 | }, |
78 | { | 76 | { |
79 | name: 'Jelly bean', | 77 | name: 'Jelly bean', |
... | @@ -82,7 +80,7 @@ | ... | @@ -82,7 +80,7 @@ |
82 | carbs: 94, | 80 | carbs: 94, |
83 | protein: 0.0, | 81 | protein: 0.0, |
84 | iron: '0%', | 82 | iron: '0%', |
85 | - format:'file' | 83 | + format: 'file', |
86 | }, | 84 | }, |
87 | { | 85 | { |
88 | name: 'Lollipop', | 86 | name: 'Lollipop', |
... | @@ -91,7 +89,7 @@ | ... | @@ -91,7 +89,7 @@ |
91 | carbs: 98, | 89 | carbs: 98, |
92 | protein: 0, | 90 | protein: 0, |
93 | iron: '2%', | 91 | iron: '2%', |
94 | - format:'dir' | 92 | + format: 'dir', |
95 | }, | 93 | }, |
96 | { | 94 | { |
97 | name: 'Honeycomb', | 95 | name: 'Honeycomb', |
... | @@ -100,7 +98,7 @@ | ... | @@ -100,7 +98,7 @@ |
100 | carbs: 87, | 98 | carbs: 87, |
101 | protein: 6.5, | 99 | protein: 6.5, |
102 | iron: '45%', | 100 | iron: '45%', |
103 | - foramt:'file' | 101 | + foramt: 'file', |
104 | }, | 102 | }, |
105 | { | 103 | { |
106 | name: 'Donut', | 104 | name: 'Donut', |
... | @@ -109,7 +107,7 @@ | ... | @@ -109,7 +107,7 @@ |
109 | carbs: 51, | 107 | carbs: 51, |
110 | protein: 4.9, | 108 | protein: 4.9, |
111 | iron: '22%', | 109 | iron: '22%', |
112 | - foramt:'pdf' | 110 | + foramt: 'pdf', |
113 | }, | 111 | }, |
114 | { | 112 | { |
115 | name: 'KitKat', | 113 | name: 'KitKat', |
... | @@ -118,20 +116,20 @@ | ... | @@ -118,20 +116,20 @@ |
118 | carbs: 65, | 116 | carbs: 65, |
119 | protein: 7, | 117 | protein: 7, |
120 | iron: '6%', | 118 | iron: '6%', |
121 | - foramt:'dir' | 119 | + foramt: 'dir', |
122 | }, | 120 | }, |
123 | ], | 121 | ], |
124 | - favorite:[ | 122 | + favorite: [ |
125 | { | 123 | { |
126 | name: 'KitKat', | 124 | name: 'KitKat', |
127 | - date: '20.05.17' | 125 | + date: '20.05.17', |
128 | }, | 126 | }, |
129 | { | 127 | { |
130 | name: 'Vuetify', | 128 | name: 'Vuetify', |
131 | - date: '20.05.17' | 129 | + date: '20.05.17', |
132 | - } | 130 | + }, |
133 | ], | 131 | ], |
134 | - } | 132 | + }; |
135 | }, | 133 | }, |
136 | - } | 134 | +}; |
137 | </script> | 135 | </script> | ... | ... |
front-end/src/views/FileDetail.vue
0 → 100644
1 | +<template> | ||
2 | + <div> | ||
3 | + <folderc v-bind:folderId="folderId"></folderc> | ||
4 | + </div> | ||
5 | +</template> | ||
6 | + | ||
7 | +<script> | ||
8 | +import folderc from '../components/folderc'; | ||
9 | +export default { | ||
10 | + props: { | ||
11 | + folderId: Number, | ||
12 | + }, | ||
13 | + components: { | ||
14 | + folderc, | ||
15 | + }, | ||
16 | +}; | ||
17 | +</script> | ||
18 | + | ||
19 | +<style></style> | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | <v-container> | 2 | <v-container> |
3 | <div> | 3 | <div> |
4 | <h2>안녕하세요!</h2> | 4 | <h2>안녕하세요!</h2> |
5 | - <br><br> | 5 | + <br /><br /> |
6 | </div> | 6 | </div> |
7 | <v-layout column> | 7 | <v-layout column> |
8 | <v-flex> | 8 | <v-flex> |
... | @@ -19,29 +19,12 @@ | ... | @@ -19,29 +19,12 @@ |
19 | ></v-data-table> | 19 | ></v-data-table> |
20 | <v-spacer></v-spacer> | 20 | <v-spacer></v-spacer> |
21 | </v-flex> | 21 | </v-flex> |
22 | - <v-flex><br><v-divider></v-divider><br></v-flex> | 22 | + <v-flex><br /><v-divider></v-divider><br /></v-flex> |
23 | - <v-flex> | 23 | + <v-container> |
24 | - <h1>빠른액세스</h1> | 24 | + <accessList></accessList> |
25 | - <v-simple-table> | 25 | + </v-container> |
26 | - <template v-slot:default> | ||
27 | - <thead> | ||
28 | - <tr> | ||
29 | - <th class="text-left">Name</th> | ||
30 | - <th class="text-left">Date</th> | ||
31 | - </tr> | ||
32 | - </thead> | ||
33 | - <tbody> | ||
34 | - <tr v-for="item in favorite" :key="item.name"> | ||
35 | - <td>{{ item.name }}</td> | ||
36 | - <td>{{ item.date }}</td> | ||
37 | - </tr> | ||
38 | - </tbody> | ||
39 | - </template> | ||
40 | - </v-simple-table> | ||
41 | - <v-divider></v-divider> | ||
42 | - </v-flex> | ||
43 | </v-flex> | 26 | </v-flex> |
44 | - <v-flex><br><v-divider></v-divider><br></v-flex> | 27 | + <v-flex><br /><v-divider></v-divider><br /></v-flex> |
45 | <v-flex xs6> | 28 | <v-flex xs6> |
46 | <h1>즐겨찾기</h1> | 29 | <h1>즐겨찾기</h1> |
47 | <v-simple-table> | 30 | <v-simple-table> |
... | @@ -64,16 +47,14 @@ | ... | @@ -64,16 +47,14 @@ |
64 | </v-flex> | 47 | </v-flex> |
65 | </v-layout> | 48 | </v-layout> |
66 | </v-flex> | 49 | </v-flex> |
67 | - | ||
68 | </v-layout> | 50 | </v-layout> |
69 | </v-container> | 51 | </v-container> |
70 | </template> | 52 | </template> |
71 | 53 | ||
72 | - | ||
73 | - | ||
74 | <script> | 54 | <script> |
75 | - export default { | 55 | +import accessList from '@/components/accessList.vue'; |
76 | - data () { | 56 | +export default { |
57 | + data() { | ||
77 | return { | 58 | return { |
78 | headers: [ | 59 | headers: [ |
79 | { | 60 | { |
... | @@ -96,7 +77,7 @@ | ... | @@ -96,7 +77,7 @@ |
96 | carbs: 24, | 77 | carbs: 24, |
97 | protein: 4.0, | 78 | protein: 4.0, |
98 | iron: '1%', | 79 | iron: '1%', |
99 | - format : 'dir' | 80 | + format: 'dir', |
100 | }, | 81 | }, |
101 | { | 82 | { |
102 | name: 'Ice cream sandwich', | 83 | name: 'Ice cream sandwich', |
... | @@ -105,7 +86,7 @@ | ... | @@ -105,7 +86,7 @@ |
105 | carbs: 37, | 86 | carbs: 37, |
106 | protein: 4.3, | 87 | protein: 4.3, |
107 | iron: '1%', | 88 | iron: '1%', |
108 | - format: 'pdf' | 89 | + format: 'pdf', |
109 | }, | 90 | }, |
110 | { | 91 | { |
111 | name: 'Eclair', | 92 | name: 'Eclair', |
... | @@ -114,7 +95,7 @@ | ... | @@ -114,7 +95,7 @@ |
114 | carbs: 23, | 95 | carbs: 23, |
115 | protein: 6.0, | 96 | protein: 6.0, |
116 | iron: '7%', | 97 | iron: '7%', |
117 | - format: 'file' | 98 | + format: 'file', |
118 | }, | 99 | }, |
119 | { | 100 | { |
120 | name: 'Cupcake', | 101 | name: 'Cupcake', |
... | @@ -123,7 +104,7 @@ | ... | @@ -123,7 +104,7 @@ |
123 | carbs: 67, | 104 | carbs: 67, |
124 | protein: 4.3, | 105 | protein: 4.3, |
125 | iron: '8%', | 106 | iron: '8%', |
126 | - format : 'dir' | 107 | + format: 'dir', |
127 | }, | 108 | }, |
128 | { | 109 | { |
129 | name: 'Gingerbread', | 110 | name: 'Gingerbread', |
... | @@ -132,7 +113,7 @@ | ... | @@ -132,7 +113,7 @@ |
132 | carbs: 49, | 113 | carbs: 49, |
133 | protein: 3.9, | 114 | protein: 3.9, |
134 | iron: '16%', | 115 | iron: '16%', |
135 | - format : 'pdf' | 116 | + format: 'pdf', |
136 | }, | 117 | }, |
137 | { | 118 | { |
138 | name: 'Jelly bean', | 119 | name: 'Jelly bean', |
... | @@ -141,7 +122,7 @@ | ... | @@ -141,7 +122,7 @@ |
141 | carbs: 94, | 122 | carbs: 94, |
142 | protein: 0.0, | 123 | protein: 0.0, |
143 | iron: '0%', | 124 | iron: '0%', |
144 | - format:'file' | 125 | + format: 'file', |
145 | }, | 126 | }, |
146 | { | 127 | { |
147 | name: 'Lollipop', | 128 | name: 'Lollipop', |
... | @@ -150,7 +131,7 @@ | ... | @@ -150,7 +131,7 @@ |
150 | carbs: 98, | 131 | carbs: 98, |
151 | protein: 0, | 132 | protein: 0, |
152 | iron: '2%', | 133 | iron: '2%', |
153 | - format:'dir' | 134 | + format: 'dir', |
154 | }, | 135 | }, |
155 | { | 136 | { |
156 | name: 'Honeycomb', | 137 | name: 'Honeycomb', |
... | @@ -159,7 +140,7 @@ | ... | @@ -159,7 +140,7 @@ |
159 | carbs: 87, | 140 | carbs: 87, |
160 | protein: 6.5, | 141 | protein: 6.5, |
161 | iron: '45%', | 142 | iron: '45%', |
162 | - foramt:'file' | 143 | + foramt: 'file', |
163 | }, | 144 | }, |
164 | { | 145 | { |
165 | name: 'Donut', | 146 | name: 'Donut', |
... | @@ -168,7 +149,7 @@ | ... | @@ -168,7 +149,7 @@ |
168 | carbs: 51, | 149 | carbs: 51, |
169 | protein: 4.9, | 150 | protein: 4.9, |
170 | iron: '22%', | 151 | iron: '22%', |
171 | - foramt:'pdf' | 152 | + foramt: 'pdf', |
172 | }, | 153 | }, |
173 | { | 154 | { |
174 | name: 'KitKat', | 155 | name: 'KitKat', |
... | @@ -177,20 +158,20 @@ | ... | @@ -177,20 +158,20 @@ |
177 | carbs: 65, | 158 | carbs: 65, |
178 | protein: 7, | 159 | protein: 7, |
179 | iron: '6%', | 160 | iron: '6%', |
180 | - foramt:'dir' | 161 | + foramt: 'dir', |
181 | }, | 162 | }, |
182 | ], | 163 | ], |
183 | - favorite:[ | 164 | + favorite: [ |
184 | { | 165 | { |
185 | name: 'KitKat', | 166 | name: 'KitKat', |
186 | - date: '20.05.17' | 167 | + date: '20.05.17', |
187 | }, | 168 | }, |
188 | { | 169 | { |
189 | name: 'Vuetify', | 170 | name: 'Vuetify', |
190 | - date: '20.05.17' | 171 | + date: '20.05.17', |
191 | - } | 172 | + }, |
192 | ], | 173 | ], |
193 | - } | 174 | + }; |
194 | }, | 175 | }, |
195 | - } | 176 | +}; |
196 | </script> | 177 | </script> | ... | ... |
... | @@ -5,15 +5,13 @@ | ... | @@ -5,15 +5,13 @@ |
5 | </template> | 5 | </template> |
6 | 6 | ||
7 | <script> | 7 | <script> |
8 | -import LoginForm from '../components/LoginForm' | 8 | +import LoginForm from '../components/LoginForm'; |
9 | 9 | ||
10 | export default { | 10 | export default { |
11 | components: { | 11 | components: { |
12 | LoginForm, | 12 | LoginForm, |
13 | - } | 13 | + }, |
14 | -} | 14 | +}; |
15 | </script> | 15 | </script> |
16 | 16 | ||
17 | -<style> | ||
18 | - | ||
19 | -</style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
17 | +<style></style> | ... | ... |
1 | <template lang="html"> | 1 | <template lang="html"> |
2 | <v-container> | 2 | <v-container> |
3 | - <div> | ||
4 | - <h2>안녕하세요!</h2> | ||
5 | - <br><br> | ||
6 | - </div> | ||
7 | <v-layout column> | 3 | <v-layout column> |
8 | <v-flex> | 4 | <v-flex> |
9 | - <v-layout row wrap> | 5 | + <v-layout column> |
10 | - <v-flex lg6> | 6 | + <v-flex><br /><br /></v-flex> |
11 | <v-flex> | 7 | <v-flex> |
12 | - <Filecard></Filecard> | 8 | + <FileList></FileList> |
13 | - </v-flex> | ||
14 | - <v-flex><br><br></v-flex> | ||
15 | - </v-flex> | ||
16 | - <v-flex><br><br></v-flex> | ||
17 | - <v-flex lg6> | ||
18 | - <Favlist></Favlist> | ||
19 | </v-flex> | 9 | </v-flex> |
20 | </v-layout> | 10 | </v-layout> |
21 | </v-flex> | 11 | </v-flex> |
22 | </v-layout> | 12 | </v-layout> |
13 | + <v-flex><br /><br /></v-flex> | ||
23 | <v-divider></v-divider> | 14 | <v-divider></v-divider> |
24 | <v-layout column> | 15 | <v-layout column> |
25 | <v-flex> | 16 | <v-flex> |
26 | - <v-toolbar flat> | 17 | + <v-container> |
27 | - <v-toolbar-title>빠른 액세스</v-toolbar-title> | 18 | + <accessList></accessList> |
28 | - <v-spacer></v-spacer> | 19 | + </v-container> |
29 | - </v-toolbar> | ||
30 | - <v-simple-table> | ||
31 | - <template v-slot:default> | ||
32 | - <thead> | ||
33 | - <tr> | ||
34 | - <th class="text-left">Name</th> | ||
35 | - <th class="text-left">Date</th> | ||
36 | - </tr> | ||
37 | - </thead> | ||
38 | - <tbody> | ||
39 | - <tr v-for="item in favorite" :key="item.name"> | ||
40 | - <td>{{ item.name }}</td> | ||
41 | - <td>{{ item.date }}</td> | ||
42 | - </tr> | ||
43 | - </tbody> | ||
44 | - </template> | ||
45 | - </v-simple-table> | ||
46 | <v-divider></v-divider> | 20 | <v-divider></v-divider> |
47 | </v-flex> | 21 | </v-flex> |
48 | </v-layout> | 22 | </v-layout> |
49 | </v-container> | 23 | </v-container> |
50 | </template> | 24 | </template> |
51 | 25 | ||
52 | - | ||
53 | - | ||
54 | <script> | 26 | <script> |
55 | - import FileList from '@/components/FileList' | 27 | +import accessList from '@/components/accessList.vue'; |
56 | - import Favlist from '@/components/Fav_list' | 28 | +import FileList from '@/components/FileList'; |
57 | - import Filecard from '@/components/FileCardlist.vue' | 29 | +import Favlist from '@/components/Fav_list'; |
58 | - export default { | 30 | +import Filecard from '@/components/FileCardlist.vue'; |
59 | - components:{ | 31 | +export default { |
32 | + components: { | ||
60 | FileList, | 33 | FileList, |
61 | Favlist, | 34 | Favlist, |
62 | - Filecard | 35 | + Filecard, |
36 | + accessList, | ||
63 | }, | 37 | }, |
64 | - data () { | 38 | + data() { |
65 | return { | 39 | return { |
66 | headers: [ | 40 | headers: [ |
67 | { | 41 | { |
... | @@ -84,7 +58,7 @@ | ... | @@ -84,7 +58,7 @@ |
84 | carbs: 24, | 58 | carbs: 24, |
85 | protein: 4.0, | 59 | protein: 4.0, |
86 | iron: '1%', | 60 | iron: '1%', |
87 | - format : 'dir' | 61 | + format: 'dir', |
88 | }, | 62 | }, |
89 | { | 63 | { |
90 | name: 'Ice cream sandwich', | 64 | name: 'Ice cream sandwich', |
... | @@ -93,7 +67,7 @@ | ... | @@ -93,7 +67,7 @@ |
93 | carbs: 37, | 67 | carbs: 37, |
94 | protein: 4.3, | 68 | protein: 4.3, |
95 | iron: '1%', | 69 | iron: '1%', |
96 | - format: 'pdf' | 70 | + format: 'pdf', |
97 | }, | 71 | }, |
98 | { | 72 | { |
99 | name: 'Eclair', | 73 | name: 'Eclair', |
... | @@ -102,7 +76,7 @@ | ... | @@ -102,7 +76,7 @@ |
102 | carbs: 23, | 76 | carbs: 23, |
103 | protein: 6.0, | 77 | protein: 6.0, |
104 | iron: '7%', | 78 | iron: '7%', |
105 | - format: 'file' | 79 | + format: 'file', |
106 | }, | 80 | }, |
107 | { | 81 | { |
108 | name: 'Cupcake', | 82 | name: 'Cupcake', |
... | @@ -111,7 +85,7 @@ | ... | @@ -111,7 +85,7 @@ |
111 | carbs: 67, | 85 | carbs: 67, |
112 | protein: 4.3, | 86 | protein: 4.3, |
113 | iron: '8%', | 87 | iron: '8%', |
114 | - format : 'dir' | 88 | + format: 'dir', |
115 | }, | 89 | }, |
116 | { | 90 | { |
117 | name: 'Gingerbread', | 91 | name: 'Gingerbread', |
... | @@ -120,7 +94,7 @@ | ... | @@ -120,7 +94,7 @@ |
120 | carbs: 49, | 94 | carbs: 49, |
121 | protein: 3.9, | 95 | protein: 3.9, |
122 | iron: '16%', | 96 | iron: '16%', |
123 | - format : 'pdf' | 97 | + format: 'pdf', |
124 | }, | 98 | }, |
125 | { | 99 | { |
126 | name: 'Jelly bean', | 100 | name: 'Jelly bean', |
... | @@ -129,7 +103,7 @@ | ... | @@ -129,7 +103,7 @@ |
129 | carbs: 94, | 103 | carbs: 94, |
130 | protein: 0.0, | 104 | protein: 0.0, |
131 | iron: '0%', | 105 | iron: '0%', |
132 | - format:'file' | 106 | + format: 'file', |
133 | }, | 107 | }, |
134 | { | 108 | { |
135 | name: 'Lollipop', | 109 | name: 'Lollipop', |
... | @@ -138,7 +112,7 @@ | ... | @@ -138,7 +112,7 @@ |
138 | carbs: 98, | 112 | carbs: 98, |
139 | protein: 0, | 113 | protein: 0, |
140 | iron: '2%', | 114 | iron: '2%', |
141 | - format:'dir' | 115 | + format: 'dir', |
142 | }, | 116 | }, |
143 | { | 117 | { |
144 | name: 'Honeycomb', | 118 | name: 'Honeycomb', |
... | @@ -147,7 +121,7 @@ | ... | @@ -147,7 +121,7 @@ |
147 | carbs: 87, | 121 | carbs: 87, |
148 | protein: 6.5, | 122 | protein: 6.5, |
149 | iron: '45%', | 123 | iron: '45%', |
150 | - foramt:'file' | 124 | + foramt: 'file', |
151 | }, | 125 | }, |
152 | { | 126 | { |
153 | name: 'Donut', | 127 | name: 'Donut', |
... | @@ -156,7 +130,7 @@ | ... | @@ -156,7 +130,7 @@ |
156 | carbs: 51, | 130 | carbs: 51, |
157 | protein: 4.9, | 131 | protein: 4.9, |
158 | iron: '22%', | 132 | iron: '22%', |
159 | - foramt:'pdf' | 133 | + foramt: 'pdf', |
160 | }, | 134 | }, |
161 | { | 135 | { |
162 | name: 'KitKat', | 136 | name: 'KitKat', |
... | @@ -165,20 +139,20 @@ | ... | @@ -165,20 +139,20 @@ |
165 | carbs: 65, | 139 | carbs: 65, |
166 | protein: 7, | 140 | protein: 7, |
167 | iron: '6%', | 141 | iron: '6%', |
168 | - foramt:'dir' | 142 | + foramt: 'dir', |
169 | }, | 143 | }, |
170 | ], | 144 | ], |
171 | - favorite:[ | 145 | + favorite: [ |
172 | { | 146 | { |
173 | name: 'KitKat', | 147 | name: 'KitKat', |
174 | - date: '20.05.17' | 148 | + date: '20.05.17', |
175 | }, | 149 | }, |
176 | { | 150 | { |
177 | name: 'Vuetify', | 151 | name: 'Vuetify', |
178 | - date: '20.05.17' | 152 | + date: '20.05.17', |
179 | - } | 153 | + }, |
180 | ], | 154 | ], |
181 | - } | 155 | + }; |
182 | }, | 156 | }, |
183 | - } | 157 | +}; |
184 | </script> | 158 | </script> | ... | ... |
... | @@ -14,17 +14,9 @@ | ... | @@ -14,17 +14,9 @@ |
14 | </v-toolbar> | 14 | </v-toolbar> |
15 | 15 | ||
16 | <v-list two-line subheader> | 16 | <v-list two-line subheader> |
17 | - | 17 | + <v-list-item v-for="item in items" :key="item.title" @click=""> |
18 | - | ||
19 | - <v-list-item | ||
20 | - v-for="item in items" | ||
21 | - :key="item.title" | ||
22 | - @click="" | ||
23 | - > | ||
24 | <v-list-item-avatar> | 18 | <v-list-item-avatar> |
25 | - <v-icon | 19 | + <v-icon>{{ item.iconClass }}</v-icon> |
26 | - | ||
27 | - >{{item.iconClass}}</v-icon> | ||
28 | </v-list-item-avatar> | 20 | </v-list-item-avatar> |
29 | 21 | ||
30 | <v-list-item-content> | 22 | <v-list-item-content> |
... | @@ -39,14 +31,9 @@ | ... | @@ -39,14 +31,9 @@ |
39 | </v-list-item-action> | 31 | </v-list-item-action> |
40 | </v-list-item> | 32 | </v-list-item> |
41 | 33 | ||
42 | - | 34 | + <v-list-item v-for="item in items2" :key="item.title" @click=""> |
43 | - <v-list-item | ||
44 | - v-for="item in items2" | ||
45 | - :key="item.title" | ||
46 | - @click="" | ||
47 | - > | ||
48 | <v-list-item-avatar> | 35 | <v-list-item-avatar> |
49 | - <v-icon> {{item.iconClass}}</v-icon> | 36 | + <v-icon> {{ item.iconClass }}</v-icon> |
50 | </v-list-item-avatar> | 37 | </v-list-item-avatar> |
51 | 38 | ||
52 | <v-list-item-content> | 39 | <v-list-item-content> |
... | @@ -65,17 +52,42 @@ | ... | @@ -65,17 +52,42 @@ |
65 | </template> | 52 | </template> |
66 | 53 | ||
67 | <script> | 54 | <script> |
68 | - export default { | 55 | +export default { |
69 | data: () => ({ | 56 | data: () => ({ |
70 | items: [ | 57 | items: [ |
71 | - { icon: 'folder', iconClass: 'mdi-folder', title: 'Photos', subtitle: 'Jan 9, 2014' }, | 58 | + { |
72 | - { icon: 'folder', iconClass: 'mdi-folder', title: 'Recipes', subtitle: 'Jan 17, 2014' }, | 59 | + icon: 'folder', |
73 | - { icon: 'folder', iconClass: 'mdi-folder', title: 'Work', subtitle: 'Jan 28, 2014' }, | 60 | + iconClass: 'mdi-folder', |
61 | + title: 'Photos', | ||
62 | + subtitle: 'Jan 9, 2014', | ||
63 | + }, | ||
64 | + { | ||
65 | + icon: 'folder', | ||
66 | + iconClass: 'mdi-folder', | ||
67 | + title: 'Recipes', | ||
68 | + subtitle: 'Jan 17, 2014', | ||
69 | + }, | ||
70 | + { | ||
71 | + icon: 'folder', | ||
72 | + iconClass: 'mdi-folder', | ||
73 | + title: 'Work', | ||
74 | + subtitle: 'Jan 28, 2014', | ||
75 | + }, | ||
74 | ], | 76 | ], |
75 | items2: [ | 77 | items2: [ |
76 | - { icon: 'assignment', iconClass: 'mdi-file', title: 'Vacation itinerary', subtitle: 'Jan 20, 2014' }, | 78 | + { |
77 | - { icon: 'call_to_action', iconClass: 'mdi-PdfBox', title: 'Kitchen remodel', subtitle: 'Jan 10, 2014' }, | 79 | + icon: 'assignment', |
80 | + iconClass: 'mdi-file', | ||
81 | + title: 'Vacation itinerary', | ||
82 | + subtitle: 'Jan 20, 2014', | ||
83 | + }, | ||
84 | + { | ||
85 | + icon: 'call_to_action', | ||
86 | + iconClass: 'mdi-PdfBox', | ||
87 | + title: 'Kitchen remodel', | ||
88 | + subtitle: 'Jan 10, 2014', | ||
89 | + }, | ||
78 | ], | 90 | ], |
79 | }), | 91 | }), |
80 | - } | 92 | +}; |
81 | </script> | 93 | </script> | ... | ... |
... | @@ -5,14 +5,12 @@ | ... | @@ -5,14 +5,12 @@ |
5 | </template> | 5 | </template> |
6 | 6 | ||
7 | <script> | 7 | <script> |
8 | -import SignupForm from '../components/SignupForm' | 8 | +import SignupForm from '../components/SignupForm'; |
9 | export default { | 9 | export default { |
10 | components: { | 10 | components: { |
11 | SignupForm, | 11 | SignupForm, |
12 | - } | 12 | + }, |
13 | -} | 13 | +}; |
14 | </script> | 14 | </script> |
15 | 15 | ||
16 | -<style> | ||
17 | - | ||
18 | -</style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
16 | +<style></style> | ... | ... |
front-end/src/views/TrashPage.vue
0 → 100644
... | @@ -2,34 +2,10 @@ | ... | @@ -2,34 +2,10 @@ |
2 | "requires": true, | 2 | "requires": true, |
3 | "lockfileVersion": 1, | 3 | "lockfileVersion": 1, |
4 | "dependencies": { | 4 | "dependencies": { |
5 | - "axios": { | 5 | + "readline": { |
6 | - "version": "0.19.2", | 6 | + "version": "1.3.0", |
7 | - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", | 7 | + "resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz", |
8 | - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", | 8 | + "integrity": "sha1-xYDXfvLPyHUrEySYBg3JeTp6wBw=" |
9 | - "requires": { | ||
10 | - "follow-redirects": "1.5.10" | ||
11 | - } | ||
12 | - }, | ||
13 | - "debug": { | ||
14 | - "version": "3.1.0", | ||
15 | - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", | ||
16 | - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", | ||
17 | - "requires": { | ||
18 | - "ms": "2.0.0" | ||
19 | - } | ||
20 | - }, | ||
21 | - "follow-redirects": { | ||
22 | - "version": "1.5.10", | ||
23 | - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", | ||
24 | - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", | ||
25 | - "requires": { | ||
26 | - "debug": "=3.1.0" | ||
27 | - } | ||
28 | - }, | ||
29 | - "ms": { | ||
30 | - "version": "2.0.0", | ||
31 | - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", | ||
32 | - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" | ||
33 | } | 9 | } |
34 | } | 10 | } |
35 | } | 11 | } | ... | ... |
-
Please register or login to post a comment