feat(messages): add message loading status

This commit is contained in:
OldHawk
2017-12-18 17:39:58 +08:00
parent 433657dcbf
commit 3b2f3e5100
5 changed files with 20 additions and 7 deletions

View File

@@ -836,6 +836,7 @@
MESSAGES_SEND: 'Send Messages',
ADMIN_MESSAGES_SEND: 'Send System Messages',
MESSAGES_SEND_BUTTON: 'Send',
MESSAGES_IS_LOADING: 'Loading messages, please wait ...',
MESSAGES_IS_EMPTY: 'Messages Box is empty!',
MESSAGES_FIELD: {
TO: 'Send to:',

View File

@@ -836,7 +836,8 @@
MESSAGES_SEND: '发送消息',
ADMIN_MESSAGES_SEND: '发送系统消息',
MESSAGES_SEND_BUTTON: '发送',
MESSAGES_IS_EMPTY: '消息盒子为空!',
MESSAGES_IS_LOADING: '正在装载, 请稍候 ...',
MESSAGES_IS_EMPTY: '消息列表为空!',
MESSAGES_FIELD: {
TO: '发送至:',
TYPE: '消息类型:',

View File

@@ -89,6 +89,8 @@
* getMessageList
*/
vm.getMessageList = function () {
vm.pagedItems = [];
vm.resultMsg = 'MESSAGES_IS_LOADING';
MessagesService.get({
type: vm.messageType,
role: vm.getMessageTypeRole()
@@ -123,6 +125,11 @@
var end = begin + vm.itemsPerPage;
vm.pagedItems = vm.filteredItems.slice(begin, end);
if (vm.pagedItems.length === 0) {
vm.resultMsg = 'MESSAGES_IS_EMPTY'
} else {
vm.resultMsg = undefined;
}
if (callback) callback();
};

View File

@@ -46,10 +46,7 @@
</div>
</div>
<div class="table-responsive margin-top-50 margin-bottom-50 padding-top-40 padding-bottom-50 text-center" ng-if="!vm.pagedItems">
<h4>{{ 'MESSAGES_IS_EMPTY' | translate }}</h4>
</div>
<div class="table-responsive" ng-if="vm.pagedItems">
<div class="table-responsive">
<table class="table table-hover tb-v-middle">
<thead>
<tr>
@@ -65,7 +62,14 @@
</tr>
</thead>
<tbody>
<tr class="message-item" ng-repeat="m in vm.pagedItems" ng-click="vm.showMessage($event, m);">
<tr ng-if="vm.resultMsg">
<td colspan="5">
<div class="text-center margin-top-50 margin-bottom-30 padding-top-20 padding-bottom-50">
<h3>{{vm.resultMsg | translate}}</h3>
</div>
</td>
</tr>
<tr class="message-item" ng-if="!vm.resultMsg" ng-repeat="m in vm.pagedItems" ng-click="vm.showMessage($event, m);">
<td class="width-400">
<img class="message-avatar" ng-src="{{m.from_user.profileImageURL}}" ng-if="m.type=='user'">
<span class="message-avatar glyphicon glyphicon-cog server-message-avatar" ng-if="m.type=='server'"></span>

View File

@@ -179,7 +179,7 @@
<tr ng-if="vm.tooltipMsg">
<td colspan="7">
<div class="text-center margin-top-50 margin-bottom-30 padding-top-20 padding-bottom-50">
<h2>{{vm.tooltipMsg | translate}}</h2>
<h3>{{vm.tooltipMsg | translate}}</h3>
</div>
</td>
</tr>