|
|
|
const licia = require('miniprogram-licia')
|
|
|
|
const app = getApp<IAppOption>()
|
|
|
|
|
|
|
|
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']
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
endGif: false,
|
|
|
|
gifPath: '',
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
this.loadGifImage()
|
|
|
|
app.waitLogin({type:1}).then(() => {
|
|
|
|
this.setArea()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
setArea() {
|
|
|
|
// const calendar = this.selectComponent('#calendar').calendar
|
|
|
|
// calendar.chooseDateArea(['2025-06-10', '2025-06-20'])
|
|
|
|
},
|
|
|
|
|
|
|
|
takeoverTap() {
|
|
|
|
this.setData({
|
|
|
|
endGif: true,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
loadGifImage() {
|
|
|
|
wx.preloadAssets({
|
|
|
|
data: [
|
|
|
|
{
|
|
|
|
type: 'image',
|
|
|
|
src: `${app.globalData.imageUrl}gif2.gif?t=${app.globalData.Timestamp}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
success: () => {
|
|
|
|
wx.getImageInfo({
|
|
|
|
src: `${app.globalData.imageUrl}gif2.gif?t=${app.globalData.Timestamp}`,
|
|
|
|
success: (res) => {
|
|
|
|
this.setData({
|
|
|
|
gifPath: res.path,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|
|
|
|
// wx.getImageInfo({
|
|
|
|
// src: `${app.globalData.imageUrl}gif2.gif?t=${app.globalData.Timestamp}`,
|
|
|
|
// success: (res) => {
|
|
|
|
// this.setData({
|
|
|
|
// gifPath: res.path,
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
// })
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
export {}
|