2016-11-12 15:26:40 +08:00
|
|
|
|
$(function () {
|
2016-11-18 20:49:44 +08:00
|
|
|
|
var $btnRefreshUser = $('#refreshUsers');
|
2016-12-16 12:46:48 +08:00
|
|
|
|
var htmlNewUsersHeader = '<li class="task-header"><div class="task-title notifi"><span class="task-title-sp">登陆名称</span><span class="task-value">显示名称/备注</span><span class="task-time">注册时间</span><div class="pull-right task-oper">操作</div></div></li>';
|
2017-01-14 16:45:12 +08:00
|
|
|
|
var htmlNewUsers = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{4}:{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" role="tooltip" data-id="{3}" data-result="1" title="同意授权"></button><button class="btn btn-danger btn-xs fa fa-remove" role="tooltip" data-id="{3}" data-result="0" title="拒绝授权"></button></div></div></li>';
|
2016-11-12 15:26:40 +08:00
|
|
|
|
|
2016-11-18 20:49:44 +08:00
|
|
|
|
function listData() {
|
|
|
|
|
$btnRefreshUser.toggleClass('fa-spin');
|
2016-12-16 12:46:48 +08:00
|
|
|
|
var $taskUsers = $('#tasks-users');
|
|
|
|
|
$taskUsers.html(htmlNewUsersHeader);
|
2016-11-18 20:49:44 +08:00
|
|
|
|
$.bc({
|
|
|
|
|
Id: 'newusers', url: Notifications.url, method: 'GET', swal: false,
|
2016-11-18 14:42:51 +08:00
|
|
|
|
callback: function (result) {
|
|
|
|
|
if (result) {
|
2016-11-18 10:18:41 +08:00
|
|
|
|
var content = result.Users.map(function (noti) {
|
2016-12-16 12:46:48 +08:00
|
|
|
|
return $.format(htmlNewUsers, noti.UserName, noti.Description, noti.RegisterTime, noti.ID, noti.DisplayName);
|
2016-11-18 10:18:41 +08:00
|
|
|
|
}).join('');
|
2016-12-16 12:46:48 +08:00
|
|
|
|
$taskUsers.append(content);
|
2017-01-15 12:49:05 +08:00
|
|
|
|
$('#tasks-users').find('[role="tooltip"]').lgbTooltip();
|
2016-11-18 10:18:41 +08:00
|
|
|
|
}
|
2016-11-18 20:49:44 +08:00
|
|
|
|
$btnRefreshUser.toggleClass('fa-spin');
|
2016-11-12 15:26:40 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
listData();
|
|
|
|
|
|
2017-01-15 12:49:05 +08:00
|
|
|
|
$btnRefreshUser.lgbTooltip().on('click', function () {
|
2016-11-18 20:49:44 +08:00
|
|
|
|
listData();
|
2016-11-12 15:26:40 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#tasks-users').on('click', 'button', function () {
|
|
|
|
|
var id = $(this).attr('data-id');
|
|
|
|
|
var result = $(this).attr('data-result');
|
2016-11-18 20:49:44 +08:00
|
|
|
|
$.bc({
|
|
|
|
|
Id: id, url: User.url, method: "PUT", data: { type: "user", userIds: result }, title: result == "1" ? "授权用户" : "拒绝用户",
|
|
|
|
|
callback: function (result) {
|
|
|
|
|
listData({ ctl: $('#refreshUsers') });
|
|
|
|
|
}
|
2016-11-12 15:26:40 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|