diff --git a/CHANGELOG.md b/CHANGELOG.md index f21e0dc..2ce90d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -122,4 +122,9 @@ ## v1.2.9 ### fix: 1. 未设置一周从哪天开始时,插件出现异常 [#38] -2. 设置一周从哪天开始设置项的文字未显示 \ No newline at end of file +2. 设置一周从哪天开始设置项的文字未显示 + +## v1.3.0 +### feat: +1. 支持滑动选择时间 +2. 添加农历显示 \ No newline at end of file diff --git a/README_zh_CN.md b/README_zh_CN.md index d22f6b9..2d06362 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -2,6 +2,9 @@ # 日程管理 +## 本次更新 +1. 在周、月、日视图中,支持滑动选择时间 +2. 添加农历显示 最近事情比较多,先更新比较简单的功能吧,正在研究实现跨平台日程提醒,目前的思路是通过iCal、CalDav、Google Calendar等连接第三方日历应用(比如可以连接手机自带日历),将日程添加到这些日历应用中,不知道大家有没有更好的想法,可以在链滴上发帖子讨论,或者到github上提issue diff --git a/package.json b/package.json index 46f0147..648046f 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@fullcalendar/vue3": "^6.1.8", "buffer": "^6.0.3", "date-fns": "^2.30.0", + "js-calendar-converter": "^0.0.6", "mitt": "^3.0.1", "moment": "^2.29.4", "stream": "^0.0.2", diff --git a/plugin.json b/plugin.json index e964eb2..323555e 100644 --- a/plugin.json +++ b/plugin.json @@ -2,7 +2,7 @@ "name": "siyuan-plugin-schedule-manager", "author": "RogerHuHu", "url": "https://github.com/RogerHuHu/siyuan-plugin-schedule-manager", - "version": "1.2.9", + "version": "1.3.0", "minAppVersion": "2.10.6", "backends": ["all"], "frontends": ["all"], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b94cbeb..c9f2884 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ dependencies: date-fns: specifier: ^2.30.0 version: 2.30.0 + js-calendar-converter: + specifier: ^0.0.6 + version: 0.0.6 mitt: specifier: ^3.0.1 version: 3.0.1 @@ -1772,6 +1775,10 @@ packages: merge-stream: 2.0.0 supports-color: 8.1.1 + /js-calendar-converter@0.0.6: + resolution: {integrity: sha512-0TRHm2jaGRAbXd1sKvzHSW3hB+oqo2h6EAHMAPpuEj0WYic+KWgsA+41PnNx03ggyGTAHx29diDqFxqHFctAGg==} + dev: false + /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true diff --git a/src/ScheduleCategories.ts b/src/ScheduleCategories.ts index 32eaeeb..6515b1d 100644 --- a/src/ScheduleCategories.ts +++ b/src/ScheduleCategories.ts @@ -158,7 +158,7 @@ export class ScheduleCategories { let newEvent = null; if(schedule.isRecurringSchedule) { - console.log("Schedule byyearday: ", schedule.yeardays); + //console.log("Schedule byyearday: ", schedule.yeardays); newEvent = { id: schedule.id, title: this.getEventName(schedule.title, schedule.status), diff --git a/src/components/Calendar.vue b/src/components/Calendar.vue index 263b358..5d3b9d8 100644 --- a/src/components/Calendar.vue +++ b/src/components/Calendar.vue @@ -47,6 +47,7 @@ import timeGridPlugin from '@fullcalendar/timegrid'; import listPlugin from '@fullcalendar/list'; import rrulePlugin from '@fullcalendar/rrule' + import calendarChinese from 'js-calendar-converter' import ScheduleEditor from "./ScheduleEditor.vue"; @@ -97,6 +98,25 @@ hour12: false // 设置时间为24小时 }, + views: { + dayGridMonth: { // 转农历 + dayCellContent(item) { + let mark = sessionStorage.getItem('joinholiday') + let _date = new Date(item.date).toLocaleDateString().split('/') + let _dateF = calendarChinese.solar2lunar(_date[0], _date[1], _date[2]) + if(item.dayNumerText == mark + '日') { + return { + html: `
${_dateF.IDayCn}
` + } + } else { + return { + html: `${_dateF.IDayCn}
` + } + } + } + } + }, + // 事件 select: this.handleDateSelect, // 选中日历格事件 eventClick: this.handleEventClick, // 点击日历日程事件 @@ -147,7 +167,7 @@ }, handleDatesSet(dateInfo) { - console.log(dateInfo) + //console.log(dateInfo) }, handleEvents(events) { diff --git a/src/components/ScheduleEditor.vue b/src/components/ScheduleEditor.vue index 3cb93f1..5462414 100644 --- a/src/components/ScheduleEditor.vue +++ b/src/components/ScheduleEditor.vue @@ -189,6 +189,7 @@ export default defineComponent({ intervalText: i18n.interval, onlyAllowNumberText: i18n.onlyAllowNumber, selectedDate: "", + canNewSchedule: false, modalClosable: false, modalShowIcon: false, isDeleteButtonVisible: false, @@ -312,14 +313,26 @@ export default defineComponent({ }, newSchedule(param) { - if(this.selectedDate !== "" && this.selectedDate === param.startStr) { - this.selectedDate = ""; - this.selectedScheduleStatus = this.scheduleStatusList[0].value; - this.isDeleteButtonVisible = false; - this.showEditModal = true; - this.createRecurringDays(); + let diff = 1 + if(param.view.type == 'dayGridMonth') { // 在月视图单击某个格子,则 end-start 刚好是24小时,由于设计的是双击触发日程新增界面,因此要排除这个情况 + diff = 86400000 + } + + if((getTime(param.end) - getTime(param.start)) !== diff || this.selectedDate !== "") { + this.canNewSchedule = true; } else { - this.selectedDate = param.startStr; + this.canNewSchedule = false; + this.selectedDate = param.startStr; + } + + if(this.canNewSchedule === true) { + this.selectedDate = ""; + this.startTime = getTime(param.start) + this.endTime = getTime(param.end) + this.selectedScheduleStatus = this.scheduleStatusList[0].value; + this.isDeleteButtonVisible = false; + this.showEditModal = true; + this.createRecurringDays(); } },