const licia = require('miniprogram-licia') const app = getApp() Page({ data: { calendarConfig: { multi: false, hideSelectYear: true, markToday: '今', // 当天日期展示不使用默认数字,用特殊文字标记 autoChoosedWhenJump: true, firstDayOfWeek: 'Mon', theme: 'geneb', takeoverTap: true, highlightToday: true, onlyShowCurrentMonth: true, disableMode: { type: 'after', // [‘before’, 'after'] }, }, }, onLoad() { app.waitLogin().then(() => { this.setArea() }) }, setArea() { const calendar = this.selectComponent('#calendar').calendar calendar.chooseDateArea(['2025-06-10', '2025-06-20']) }, setCalendarTodos({ bleedDate = [], injectionDate = [] }: { bleedDate: any[]; injectionDate: string[] }) { const calendar = this.selectComponent('#calendar').calendar const dates: any[] = [] const intersectDate = licia.intersect(bleedDate, injectionDate) const filterAdlDate = bleedDate.filter((item) => !intersectDate.includes(item)) const filterMedication = injectionDate.filter((item) => !intersectDate.includes(item)) filterAdlDate.forEach((Date: string) => { dates.push({ year: Date.split('-')[0], month: Date.split('-')[1], date: Date.split('-')[2], color: ['#FB787F'], }) }) filterMedication.forEach((Date: string) => { dates.push({ year: Date.split('-')[0], month: Date.split('-')[1], date: Date.split('-')[2], color: ['#0030AE'], }) }) intersectDate.forEach((Date: string) => { dates.push({ year: Date.split('-')[0], month: Date.split('-')[1], date: Date.split('-')[2], color: ['#FB787F', '#0030AE'], }) }) calendar.setTodos({ // 待办点标记设置 pos: 'bottom', // 待办点标记位置 ['top', 'bottom'] dotColor: 'purple', // 待办点标记颜色 circle: false, // 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥 showLunar: true, showLabelAlways: true, // 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效 dates, }) }, }) export {}