2016-11-16 17:27:03 +08:00
|
|
|
|
$(function () {
|
|
|
|
|
var $headerIcon = $('#headerIcon');
|
|
|
|
|
var preIcon = $headerIcon.attr('src');
|
|
|
|
|
$('#fileIcon').fileinput({
|
|
|
|
|
uploadUrl: '../api/Infos',
|
|
|
|
|
language: 'zh',
|
|
|
|
|
allowedFileExtensions: ['jpg'],
|
|
|
|
|
initialPreview: [
|
|
|
|
|
preIcon
|
|
|
|
|
],
|
|
|
|
|
initialPreviewConfig: [
|
|
|
|
|
{ caption: "现在头像", size: 730, showZoom: false },
|
|
|
|
|
],
|
|
|
|
|
initialPreviewAsData: true,
|
|
|
|
|
overwriteInitial: true,
|
2016-11-17 10:15:17 +08:00
|
|
|
|
dropZoneTitle: "请选择头像"
|
2016-11-16 17:27:03 +08:00
|
|
|
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
|
|
|
|
var url = data.response;
|
|
|
|
|
if (!!url) $headerIcon.attr('src', url);
|
|
|
|
|
});
|
2016-11-16 20:06:28 +08:00
|
|
|
|
|
|
|
|
|
var bsa = new BootstrapAdmin({
|
|
|
|
|
url: '../api/Infos',
|
|
|
|
|
bootstrapTable: null,
|
|
|
|
|
dataEntity: new DataEntity({
|
|
|
|
|
map: {
|
|
|
|
|
Password: "currentPassword",
|
|
|
|
|
NewPassword: "newPassword",
|
|
|
|
|
DisplayName: "displayName",
|
|
|
|
|
UserName: "userName"
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
click: {
|
|
|
|
|
assign: [{
|
|
|
|
|
id: 'btnSavePassword',
|
|
|
|
|
click: function (row, data) {
|
|
|
|
|
data.UserStatus = 2;
|
|
|
|
|
User.changePassword(data);
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
id: 'btnSaveDisplayName',
|
|
|
|
|
click: function (row, data) {
|
|
|
|
|
data.UserStatus = 1;
|
|
|
|
|
User.saveUserDisplayName(data, function (result) {
|
|
|
|
|
if (result) {
|
|
|
|
|
$('#userDisplayName').text(data.DisplayName);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('button[data-admin="True"]').attr('disabled', 'disabled');
|
2016-11-16 23:20:16 +08:00
|
|
|
|
$('#kvFileinputModal').appendTo('body');
|
2016-11-16 17:27:03 +08:00
|
|
|
|
});
|