增加书签,不再从后台拉数据
This commit is contained in:
parent
cd36794c14
commit
373a9ecba4
|
|
@ -86,9 +86,18 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
|
|||
bookmarkService.addNote(note)
|
||||
.then((data) => {
|
||||
console.log(JSON.stringify(data));
|
||||
if(data.retCode == 0){
|
||||
note.id = data.insertId;
|
||||
note.created_at = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
note.name = '';
|
||||
$scope.notes.unshift(note);
|
||||
$timeout(function() {
|
||||
timeagoInstance.cancel();
|
||||
timeagoInstance.render(document.querySelectorAll('.need_to_be_rendered'), 'zh_CN');
|
||||
}, 100)
|
||||
}
|
||||
$scope.preContent = $scope.content;
|
||||
$scope.content = '';
|
||||
getNotes();
|
||||
updateEditPos();
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
|||
|
|
@ -1305,12 +1305,13 @@ api.post('/addNote', function(req, res) {
|
|||
params.user_id = req.session.user.id;
|
||||
|
||||
db.addNote(params)
|
||||
.then((affectedRows) => {
|
||||
.then((insertId) => {
|
||||
res.json({
|
||||
retCode: 0,
|
||||
insertId:insertId,
|
||||
msg: "添加备忘成功 ",
|
||||
})
|
||||
console.log('addNote affectedRows ', affectedRows)
|
||||
console.log('addNote insertId ', insertId)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('addNote error', err);
|
||||
|
|
|
|||
Loading…
Reference in New Issue