2018-06-07 00:45:47 +08:00
|
|
|
|
(function ($) {
|
2018-09-09 13:58:31 +08:00
|
|
|
|
var logPlugin = function (options) {
|
2018-06-07 00:45:47 +08:00
|
|
|
|
this.options = $.extend({}, logPlugin.settings, options);
|
2018-09-09 13:58:31 +08:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
});
|
|
|
|
|
}
|
2018-09-09 13:19:05 +08:00
|
|
|
|
};
|
2018-06-07 00:45:47 +08:00
|
|
|
|
|
|
|
|
|
logPlugin.settings = {
|
2018-09-09 13:19:05 +08:00
|
|
|
|
url: 'api/Logs',
|
2018-06-07 00:45:47 +08:00
|
|
|
|
click: {
|
2018-09-09 13:58:31 +08:00
|
|
|
|
'#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: '分配菜单' });
|
2019-03-05 13:05:19 +08:00
|
|
|
|
},
|
|
|
|
|
'#btnReset': function () {
|
|
|
|
|
this.log({ crud: '重置密码' });
|
2019-03-09 19:09:42 +08:00
|
|
|
|
},
|
|
|
|
|
'#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 () {
|
2019-06-12 14:09:58 +08:00
|
|
|
|
this.log({ crud: '保存网站标题' });
|
2019-03-09 19:09:42 +08:00
|
|
|
|
},
|
|
|
|
|
'button[data-method="footer"]': function () {
|
|
|
|
|
this.log({ crud: '保存网站页脚' });
|
|
|
|
|
},
|
|
|
|
|
'button[data-method="css"]': function () {
|
|
|
|
|
this.log({ crud: '设置网站样式' });
|
2018-09-09 13:58:31 +08:00
|
|
|
|
}
|
2018-06-07 00:45:47 +08:00
|
|
|
|
}
|
2018-09-09 13:19:05 +08:00
|
|
|
|
};
|
2018-06-07 00:45:47 +08:00
|
|
|
|
|
|
|
|
|
logPlugin.prototype = {
|
|
|
|
|
constructor: logPlugin,
|
2018-09-09 13:58:31 +08:00
|
|
|
|
log: function (data) {
|
2019-03-09 19:09:42 +08:00
|
|
|
|
var bcData = $.logData.shift();
|
|
|
|
|
if (bcData !== undefined) $.extend(data, { requestData: JSON.stringify(bcData) });
|
2018-09-09 13:58:31 +08:00
|
|
|
|
$.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-09-09 13:19:05 +08:00
|
|
|
|
};
|
2018-06-07 00:45:47 +08:00
|
|
|
|
|
2019-06-12 14:09:58 +08:00
|
|
|
|
$.extend({
|
|
|
|
|
logPlugin: function (options) {
|
|
|
|
|
if (!window.logPlugin) window.logPlugin = new logPlugin(options);
|
|
|
|
|
return window.logPlugin;
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-03-09 19:09:42 +08:00
|
|
|
|
$.logData = [];
|
2019-06-12 14:09:58 +08:00
|
|
|
|
$.logData.log = function () {
|
|
|
|
|
$.logPlugin().log({ crud: '删除数据' });
|
|
|
|
|
};
|
2018-06-07 00:45:47 +08:00
|
|
|
|
})(jQuery);
|
|
|
|
|
|
|
|
|
|
$(function () {
|
2018-09-09 13:58:31 +08:00
|
|
|
|
$.logPlugin();
|
2016-11-05 16:46:19 +08:00
|
|
|
|
});
|