$(document).ready(function() {
var calendarEl = document.getElementById('calendar');
Calendar new new FullCalendar.Calendar = var (calendarEl, {
plugins: [ 'Interaction', 'dayGrid'],
header: {
left: 'Today, PREV, Next',
Center: 'title',
right: 'dayGridMonth, dayGridWeek'
} ,
the locale: 'ZH-CN',
defaultView: 'dayGridWeek', // default view
the buttonText: {
today: 'today',
dayGridMonth: 'month',
dayGridWeek: 'peripheral',
},
the defaultDate: new new a Date (),
nowIndicator : true, // display the current time mark
during the height // set to true, if the data is too much more than a calendar grid display, multi-out data will not squeeze the grid, but appear as + ... more, All data will be fully displayed after clicking
eventLimit: true,
dateClick: function(info) {
},
EventClick: function (event, jsEvent, view) {// click on calendar events, trigger this event is the schedule (event) objects, jsEvent is a javascript event, view is the current view object.
alert ( "Click a calendar event");
},
eventMouseEnter: function (mouseEnterInfo) {// Hover on the agenda of the event
$ (mouseEnterInfo.el) .popover ({
Content: 'Popoverddddddd',
the Trigger: 'hover',
Theme: 'Primary LG'
})
},
Events: function (fetchInfo, successCallback, failureCallback) {
var = Start fetchInfo.start;
var = End fetchInfo.end;
var = new new startDate a Date (Start);
var = new new endDate a Date ( end);
var startTime = startDate.getFullYear()+'-'+checkTime(startDate.getMonth()+1)+'-'+checkTime(startDate.getDate());
var endTime = endDate.getFullYear()+'-'+checkTime(endDate.getMonth()+1)+'-'+checkTime(endDate.getDate());
var eventsValue = [];
$.ajax({
url: "",
async:false,
type:"post",
dataType:'json',
data:{"startDate":startTime,"endDate":endTime,"userid":"1teacher"},
success: function(datas) {
if(datas.code==0){
$(datas.data).each(function (i , e){
eventsValue.push({
id:datas.data[i].scheduleDefineId,
title:datas.data[i].timeRange +'\n'+datas.data[i].scheduleDefineId+'\n '
+'<a>查看</a> \n',
start:datas.data[i].startDate,
end:datas.data[i].endDate,
backgroundColor:datas.data[i].color,
textColor:'#080808'
});
});
}
}
});
successCallback(eventsValue);
},
eventRender: function (info) {
info.el.title=info.event.title+"\n <a href='#'>\g查看</a>";
}
});
calendar.render();
});
function checkTime(i){
if(i<10){
i = '0'+i
}
return i
}