$(function () {
function loadData() {
$.bc({
url: Messages.url, method: 'GET', swal: false,
callback: function (result) {
if (result) {
$('#s_inbox').text(result.inboxCount);
$('#s_sendmail').text(result.sendmailCount);
$('#s_mark').text(result.markCount);
$('#s_trash').text(result.trashCount);
}
}
});
}
var html = '
| | {2}{4} | {5} | {6} | {7} |
';
function listData(options) {
$.bc({
Id: options.Id, url: Messages.url, method: 'GET', swal: false,
callback: function (result) {
if (result) {
var content = result.map(function (mail) {
if (mail.Status == '0')
mailStatus = 'class="unread"';
else
mailStatus = " "
if (mail.Mark == '1')
mailMark = "inbox-started";
else
mailMark = " ";
if (mail.Label == '0')
mailLabel = 'label-success';
else
mailLabel = 'label-warning';
return $.format(html, mailStatus, mailMark, mail.FromDisplayName, mailLabel, mail.LabelName, mail.Title, mail.Content, mail.SendTime);
}).join('');
$('#tbMsg').html(content);
}
}
});
}
listData({ Id: 'inbox' });
loadData();
$('#mailBox').on('click', 'a', function () {
listData({ Id: $(this).attr('data-id') });
})
});