From 8483af1f742c2278e64d10380ab6d16e009ade4b Mon Sep 17 00:00:00 2001 From: tonkia Date: Tue, 25 Dec 2018 22:48:37 +0800 Subject: [PATCH] syn --- app.js | 7 ++-- db.js | 2 +- views/createScheme.html | 10 ++---- views/home.html | 71 ++++++++++++++++++++++++++++++++++++++--- views/share.html | 15 +++++++++ 5 files changed, 90 insertions(+), 15 deletions(-) create mode 100644 views/share.html diff --git a/app.js b/app.js index c33b133..49e5040 100644 --- a/app.js +++ b/app.js @@ -16,6 +16,8 @@ var storage = multer.diskStorage({ } }); var upload = multer({ storage: storage }); +//共享页面 +var shareLink = '127.0.0.1/share' app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json({ limit: '50mb' })); @@ -85,10 +87,12 @@ app.post('/home', function (req, res) { //用户信息 var user = req.session.user; db.querySchemeByUid(user.id, function (schemeList) { + //去除用户密码信息 delete user.password; var homeData = { user: user, - schemeList: schemeList + schemeList: schemeList, + shareLink: shareLink } res.send(homeData); }); @@ -185,7 +189,6 @@ app.post('/getScheme/:id', function (req, res) { } res.send(replyData); } else { - //TODO 找不到方案 replyData = { msg: 1 } diff --git a/db.js b/db.js index 112c014..a5cdedf 100644 --- a/db.js +++ b/db.js @@ -40,7 +40,7 @@ module.exports.querySchemeByUid = function (uid, callback) { if (err) { console.info(err); } else { - conn.query('SELECT id,name,img FROM scheme WHERE uid = ?', [uid], function (err, rows) { + conn.query('SELECT id,name,img,share_state,share_password FROM scheme WHERE uid = ?', [uid], function (err, rows) { if (err) { console.log(err); return; diff --git a/views/createScheme.html b/views/createScheme.html index d0eac49..6d6c7bc 100644 --- a/views/createScheme.html +++ b/views/createScheme.html @@ -146,7 +146,7 @@