feat: add 创建排课 button to calendar; fix 操作记录 spacing

- Add "创建排课" custom button in FullCalendar header toolbar, defaults
  to current date/time + 45min duration, guarded by is_teacher check
- Add margin-bottom to 操作记录 cell so it doesn't crowd the footer buttons

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 22:17:49 +08:00
parent c96830c301
commit d3df324b8b
+15 -2
View File
@@ -98,7 +98,7 @@
<van-tag :closeable="false" type="primary" @click="gotoDaka(daka.id)" v-for="daka in store.current.dakas.vals">{{daka.name}}</van-tag>
</div>
<van-calendar v-model:show="state.showCalendar" :min-date="repeatMinDate" :default-date="repeatDefaultDate" @confirm="onChangeDate" type="range" color="#1989fa" />
<van-cell title="操作记录" is-link v-if="state.readonly && store.current.id" @click="showAuditLogPopup" />
<van-cell title="操作记录" is-link v-if="state.readonly && store.current.id" @click="showAuditLogPopup" style="margin-bottom: 0.2rem;" />
</div>
<div class="footer" v-if="is_creator || !store.current.id ">
<template v-if="state.readonly">
@@ -462,12 +462,25 @@ export default defineComponent({
click: function() {
calendar.value.getApi().gotoDate(new Date())
}
},
createClazz: {
text: '创建排课',
click: function() {
if (!is_teacher.value) return;
const now = new Date();
store.current.start_from = formatDate(now, DateFormatter.DateTimeSave);
now.setMinutes(now.getMinutes() + 45);
store.current.end_by = formatDate(now, DateFormatter.DateTimeSave);
state.editing = true;
state.readonly = false;
state.title = "新增排课"
}
}
},
headerToolbar: {
left: 'prev,current,next',
center: 'title',
right: ''
right: 'createClazz'
},
plugins: [ dayGridPlugin, bootstrap5Plugin, timeGridPlugin, interactionPlugin ],
initialView: 'timeGridWeek',