增加分享备忘å地址
This commit is contained in:
parent
1097633fcd
commit
f66c327cec
|
|
@ -1165,4 +1165,18 @@ db.updateNote = function(id, content, tag_id) {
|
|||
});
|
||||
}
|
||||
|
||||
db.getNote = function(id) {
|
||||
var sql = "SELECT content FROM `notes` WHERE `id` = '"+ id +"' LIMIT 0, 1";
|
||||
console.log(sql);
|
||||
return new Promise(function(resolve, reject) {
|
||||
client.query(sql, (err, result) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(result.length > 0 ? result[0].content : "content not exist!");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = db;
|
||||
|
|
|
|||
|
|
@ -285,6 +285,10 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
|
|||
}
|
||||
}
|
||||
|
||||
$scope.share = function (noteId) {
|
||||
dataService.clipboard(`https://mybookmark.cn/api/notes/?shareNote=${noteId}`);
|
||||
}
|
||||
|
||||
function updateSelectTag(tagId) {
|
||||
$scope.tags.forEach((tag) => {
|
||||
tag.clicked = false;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
</label>
|
||||
<img class="ui mini spaced image" id="noteid{{note.id}}" style="width:16px;height:16px;margin:0 8px;" ng-src="./images/copy.png"
|
||||
id="url{{bookmark.id}}" ng-click="copy(note.content)" title="复制备忘">
|
||||
<i class="share alternate icon" title="复制分享地址" ng-click="share(note.id)"></i>
|
||||
<i class="chevron up icon" title="收起详情" ng-click="noteClick(note, true, $event)"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1433,10 +1433,16 @@ api.get('/notes', function(req, res) {
|
|||
return;
|
||||
}
|
||||
var params = req.query;
|
||||
if (params.shareNote) {
|
||||
db.getNote(params.shareNote)
|
||||
.then((data) => res.send(`<body style="margin:0px;background-color:RGB(243,244,245)"><div style="text-align:center;"><pre style="padding:50px 0px 50px 0px; display: inline-block;text-align: left; font-size: 15px; font-family:italic arial,sans-serif;">${data}</pre></div></body>`))
|
||||
.catch((err) => console.log('notes', err));
|
||||
} else {
|
||||
params.user_id = req.session.user.id;
|
||||
db.getNotes(params)
|
||||
.then((data) => res.json(data))
|
||||
.catch((err) => console.log('notes', err));
|
||||
}
|
||||
});
|
||||
|
||||
api.delete('/delNote', function(req, res) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue