Skip to content

Commit

Permalink
feat: 1.Supports selecting time by sliding 2.Add lunar calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHuHu committed Mar 13, 2024
1 parent e489737 commit 4747e82
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 11 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,9 @@
## v1.2.9
### fix:
1. 未设置一周从哪天开始时,插件出现异常 [#38]
2. 设置一周从哪天开始设置项的文字未显示
2. 设置一周从哪天开始设置项的文字未显示

## v1.3.0
### feat:
1. 支持滑动选择时间
2. 添加农历显示
3 changes: 3 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# 日程管理

## 本次更新
1. 在周、月、日视图中,支持滑动选择时间
2. 添加农历显示

<b><font color="#4096ff">最近事情比较多,先更新比较简单的功能吧,正在研究实现跨平台日程提醒,目前的思路是通过iCal、CalDav、Google Calendar等连接第三方日历应用(比如可以连接手机自带日历),将日程添加到这些日历应用中,不知道大家有没有更好的想法,可以在链滴上发帖子讨论,或者到github上提issue</font></b>

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/ScheduleCategories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
22 changes: 21 additions & 1 deletion src/components/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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: `<p id='selectedHolidy'><label>${_dateF.cDay}</label></p><p><span>${_dateF.IDayCn}</span></p>`
}
} else {
return {
html: `<p><label>${_dateF.cDay}</label></p><p><span>${_dateF.IDayCn}</span></p>`
}
}
}
}
},
// 事件
select: this.handleDateSelect, // 选中日历格事件
eventClick: this.handleEventClick, // 点击日历日程事件
Expand Down Expand Up @@ -147,7 +167,7 @@
},
handleDatesSet(dateInfo) {
console.log(dateInfo)
//console.log(dateInfo)
},
handleEvents(events) {
Expand Down
27 changes: 20 additions & 7 deletions src/components/ScheduleEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export default defineComponent({
intervalText: i18n.interval,
onlyAllowNumberText: i18n.onlyAllowNumber,
selectedDate: "",
canNewSchedule: false,
modalClosable: false,
modalShowIcon: false,
isDeleteButtonVisible: false,
Expand Down Expand Up @@ -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();
}
},
Expand Down

0 comments on commit 4747e82

Please sign in to comment.