user-login-log.page.js
1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require('admin/user-login-log.page.css');
require('bootstrap-daterangepicker');
require('bootpag/lib/jquery.bootpag.min');
const moment = require('moment');
function bind_date_picker() {
if (typeof ($.fn.daterangepicker) === 'undefined') {
return;
}
$('#time').daterangepicker({
timePicker: true,
timePickerIncrement: 30,
startDate: moment().add(-30, 'day'),
endDate: moment(),
locale: {
format: 'YYYY-MM-DD HH:mm:ss'
}
});
}
function bind_button_event() {
$('.btn-export').click(() => {
const url = $('#url').val();
const time = $('#time').val();
const timeArray = time.split(' - ');
let startTime, endTime;
if (timeArray.length === 2) {
startTime = moment(timeArray[0]).valueOf();
endTime = moment(timeArray[1]).valueOf();
}
window.open(`/admin/user/exportUserLoginLog?startTime=${startTime}&endTime=${endTime}&url=${url}`, '_blank');
});
}
(() => {
bind_date_picker();
bind_button_event();
})();