BootstrapAdmin/Bootstrap.Admin/wwwroot/js/log.js

89 lines
3.0 KiB
JavaScript
Raw Normal View History

2018-06-07 00:45:47 +08:00
(function ($) {
var logPlugin = function (options) {
2018-06-07 00:45:47 +08:00
this.options = $.extend({}, logPlugin.settings, options);
var that = this;
for (var name in this.options.click) {
$(name).on('click', { handler: this.options.click[name] }, function (e) {
e.data.handler.call(that);
});
}
$('body').on('click', '.sweet-alert button.confirm', function(e) {
if($.logData.length > 0)
that.log({ crud: '删除' });
});
};
2018-06-07 00:45:47 +08:00
logPlugin.settings = {
url: 'api/Logs',
2018-06-07 00:45:47 +08:00
click: {
'#btnSubmit': function () {
this.log({ crud: '保存' });
},
'#btnSubmitRole': function () {
this.log({ crud: '分配角色' });
},
'#btnSubmitGroup': function () {
this.log({ crud: '分配部门' });
},
'#btnSubmitUser': function () {
this.log({ crud: '分配用户' });
},
'#btnSubmitMenu': function () {
this.log({ crud: '分配菜单' });
},
'#btnReset': function () {
this.log({ crud: '重置密码' });
},
'#btnSaveDisplayName': function () {
this.log({ crud: '设置显示名称' });
},
'#btnSavePassword': function () {
this.log({ crud: '修改密码' });
},
'#btnSaveApp': function () {
this.log({ crud: '设置默认应用' });
},
'#btnSaveCss': function () {
this.log({ crud: '设置个人样式' });
},
'a.btn.fileinput-upload-button': function () {
this.log({ crud: '设置头像' });
},
'button.kv-file-remove': function () {
this.log({ crud: '删除头像' });
},
'button[data-method="title"]': function () {
this.log({ crud: '保存网站标题'});
},
'button[data-method="footer"]': function () {
this.log({ crud: '保存网站页脚' });
},
'button[data-method="css"]': function () {
this.log({ crud: '设置网站样式' });
}
2018-06-07 00:45:47 +08:00
}
};
2018-06-07 00:45:47 +08:00
logPlugin.prototype = {
constructor: logPlugin,
log: function (data) {
var bcData = $.logData.shift();
if (bcData !== undefined) $.extend(data, { requestData: JSON.stringify(bcData) });
$.extend(data, { requestUrl: window.location.pathname });
$.post({
url: $.formatUrl(this.options.url),
data: JSON.stringify(data),
contentType: 'application/json',
dataType: 'json'
});
2018-06-07 00:45:47 +08:00
}
};
2018-06-07 00:45:47 +08:00
$.extend({ logPlugin: function (options) { return new logPlugin(options); } });
$.logData = [];
2018-06-07 00:45:47 +08:00
})(jQuery);
$(function () {
$.logPlugin();
});