修复数据库字段变更前端未同步文笔

This commit is contained in:
HelloWorld 2020-04-08 11:45:11 +08:00
parent 0e68de24aa
commit f889ba70aa
9 changed files with 22 additions and 17 deletions

BIN
www/images/developing.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -195,7 +195,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
if (note.id == $scope.currentNoteId) {
note.content = $scope.content;
note.tagName = tagName;
note.tag_id = $scope.currentTagId;
note.tagId = $scope.currentTagId;
toPos(note.id);
}
})
@ -292,7 +292,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
var key = event.key.toUpperCase();
if ($scope.hoverNote && dataService.keyShortcuts()) {
if (key == 'E') {
$scope.editNote($scope.hoverNote.id, $scope.hoverNote.content, $scope.hoverNote.tag_id)
$scope.editNote($scope.hoverNote.id, $scope.hoverNote.content, $scope.hoverNote.tagId)
} else if (key == 'I') {
$scope.detailNote($scope.hoverNote.content)
} else if (key == 'D') {
@ -304,7 +304,6 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
})
});
let count = 1;
async function getNotes(tagId) {
$scope.notes = [];
$scope.loading = true;
@ -314,7 +313,6 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
keyword: $scope.keyword,
tagId: tagId || $scope.currentTagId
};
// if (count++ % 2) return;
let reply = await get("notes", params);
$timeout(function () {
@ -325,14 +323,14 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
note.brief = note.brief.replace(/\n/g, "");
}
note.brief = " " + note.brief.substring(0, 200) + (note.content.length > 200 ? " ......" : "");
let tag = $scope.tags.find(tag => tag.id == note.tagId);
tag && (note.tagName = tag.name);
})
$scope.notes = notes;
$scope.totalPages = reply.totalPages;
$scope.totalItems = reply.count;
timeagoInstance.cancel();
timeagoInstance.render(document.querySelectorAll('.need_to_be_rendered'), 'zh_CN');
// 如果需要增加书签
if ($scope.key == 'A') {
$scope.key = null;
@ -343,6 +341,11 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
$(".js-note").removeClass("hidden");
}
})
$timeout(() => {
timeagoInstance.cancel();
timeagoInstance.render(document.querySelectorAll('.need_to_be_rendered'), 'zh_CN');
}, 50);
}
async function updateTags(_tags) {

View File

@ -225,8 +225,8 @@ app.controller('weixinArticleCtr', ['$scope', '$state', '$sce', '$filter', '$win
}
}
b.favCount = bookmark.favCount;
b.created_at = $filter('date')(new Date(bookmark.createtime < bookmark.updatetime ? bookmark.createtime : bookmark.updatetime), "yyyy-MM-dd HH:mm:ss");
b.last_click = $filter('date')(new Date(bookmark.createtime > bookmark.updatetime ? bookmark.createtime : bookmark.updatetime), "yyyy-MM-dd HH:mm:ss");
b.createdAt = $filter('date')(new Date(bookmark.createtime < bookmark.updatetime ? bookmark.createtime : bookmark.updatetime), "yyyy-MM-dd HH:mm:ss");
b.lastClick = $filter('date')(new Date(bookmark.createtime > bookmark.updatetime ? bookmark.createtime : bookmark.updatetime), "yyyy-MM-dd HH:mm:ss");
b.id = bookmark.articleId;
b.index = $scope.bookmarks.length - 1;
$scope.bookmarks.push(b);

View File

@ -21,7 +21,7 @@
<div class="content">
<a class="author">{{ advice.username }}</a>
<div class="metadata">
<span class="date">{{ advice.created_at }}</span>
<span class="date">{{ advice.createdAt }}</span>
</div>
<div class="text">{{ advice.comment }}</div>
</div>

View File

@ -18,7 +18,7 @@
<div class="two column row">
<div class="column">
<i class="add to calendar icon"></i>创建日期:
<span>{{bookmark.created_at}}</span>
<span>{{bookmark.createdAt}}</span>
</div>
<div class="column">
<i class="calendar icon"></i>最后点击:

View File

@ -1,3 +1,5 @@
<div class="ui massive text centered inline loader">
正在开发中...
<div class="ui segment" style="text-align: center;">
<img src="./images/developing.png" />
<div>正在开发中...</div>
</div>

View File

@ -37,16 +37,16 @@
<div class="ui right aligned grid" ng-show="note.detail">
<div class="sixteen wide column" style="margin:0px 20px 0px 0px;padding:20px 0px 0px 0px;">
<div class="extra content" ng-show="true" ng-mouseleave="note.edit=false;" style="height:50px;">
<div class="ui mini label" ng-click="clickTag(note.tag_id)" style="margin:3px 0px 0px 10px;cursor:default;">{{ note.tagName || "未分类" }}</div>
<div class="ui mini label" ng-click="clickTag(note.tagId)" style="margin:3px 0px 0px 10px;cursor:default;">{{ note.tagName || "未分类" }}</div>
<span style="margin:0 8px;">
<span title="添加于{{note.created_at}}" class="need_to_be_rendered" data-timeago="{{ note.created_at }}"></span>
<span title="添加于{{note.createdAt}}" class="need_to_be_rendered" data-timeago="{{ note.createdAt }}"></span>
<span style="margin-left:-3px;">添加</span>
</span>
<i ng-if="note.public == 0" class="black lock icon" title="点击公开备忘" ng-click="updatePublic(note, 1)"></i>
<i ng-if="note.public == 1" class="black open lock icon" title="点击不公开备忘" ng-click="updatePublic(note, 0)"></i>
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 8px;" ng-src="./images/delete.png" ng-click="delNote(note.id, note.content)" title="删除备忘" />
<label for="noteedit">
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 8px;" ng-src="./images/edit-bookmark.png" ng-click="editNote(note.id, note.content, note.tag_id)" title="编辑备忘" />
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 8px;" ng-src="./images/edit-bookmark.png" ng-click="editNote(note.id, note.content, note.tagId)" title="编辑备忘" />
</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="black share alternate icon" title="复制分享地址" ng-click="share(note)"></i>

View File

@ -78,7 +78,7 @@
</td>
<td>{{ bookmark.click_count }}</td>
<td>
<span title="{{bookmark.created_at}}" class="need_to_be_rendered" data-timeago="{{bookmark.created_at}}"></span>
<span title="{{bookmark.createdAt}}" class="need_to_be_rendered" data-timeago="{{bookmark.createdAt}}"></span>
</td>
<td>
<span id="time{{bookmark.id}}" title="{{bookmark.last_click}}" class="need_to_be_rendered" data-timeago="{{bookmark.last_click}}"></span>

View File

@ -42,7 +42,7 @@
&nbsp;&nbsp;
<span title="公众号账号">{{bookmark.account}}</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span>{{bookmark.created_at}}</span>
<span>{{bookmark.createdAt}}</span>
</div>
<div class="ui divider"></div>
<p ng-bind-html="bookmark.content"></p>