최동원

Merge branch 'share,favorite' into 'master'

Share,favorite



See merge request !1
Showing 46 changed files with 1292 additions and 402 deletions
...@@ -114,3 +114,6 @@ dist ...@@ -114,3 +114,6 @@ dist
114 .yarn/build-state.yml 114 .yarn/build-state.yml
115 .yarn/install-state.gz 115 .yarn/install-state.gz
116 .pnp.* 116 .pnp.*
117 +
118 +backend/routes/modules/s3/download/*
119 +backend/routes/modules/awsconfig.json
......
...@@ -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) {
......
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 });
......
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'});
......
This diff is collapsed. Click to expand it.
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
...@@ -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
......
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
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
This diff is collapsed. Click to expand it.
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 };
......
This diff is collapsed. Click to expand it.
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>
......
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>
This diff is collapsed. Click to expand it.
...@@ -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>
......
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>
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>
This diff is collapsed. Click to expand it.
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>
......
1 +<template lang="html">
2 + <FileDetail></FileDetail>
3 +</template>
4 +
5 +<script>
6 +import FileDetail from '@/components/FileDetail';
7 +export default {
8 + components: {
9 + FileDetail,
10 + },
11 +};
12 +</script>
13 +
14 +<style lang="css" scoped></style>
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>
......
1 +<template>
2 + <TrashList></TrashList>
3 +</template>
4 +
5 +<script>
6 +import TrashList from '../components/TrashList';
7 +export default {
8 + components: {
9 + TrashList,
10 + },
11 +};
12 +</script>
13 +
14 +<style></style>
...@@ -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 }
......