Skip to content

LimeDailyPunch 打卡签到日历

  • 一款签到打卡的日历插件,数据驱动,补签,统计连续打卡天数,uvue目前使用canvas实现,兼容uniapp/uniappx(web,ios,安卓)
  • 初版,可能个性化不足,可以交流。或自行修改样式

安装

插件市场入口 导入

文档

打卡签到

代码演示

基础使用

通过设置signedDates传入已经打卡的日期

html
<l-daily-punch :signedDates="checkIns"></l-daily-punch>
js
// 已打卡
const checkIns = ref(['2024-09-12','2024-09-02','2024-09-10','2024-09-03'])

事件

当点击日期时,触发select事件,当传入已打卡日期会触发streak事件,这事件是统计连续打卡天数,当切换月份时触发panelChange

html
<l-daily-punch :signedDates="checkIns" @select="select" @panelChange="change"></l-daily-punch>
js
import { LDay,  LYearMonth} from '@/uni_modules/lime-daily-punch'

// 已打卡
const checkIns = ref(['2024-09-12','2024-09-02','2024-09-10','2024-09-03'])

const select = (day : LDay) => {
	if (day.canSupplement) {
		uni.showModal({
			title: '补签',
			content: '是否补签?',
			success: (res : ShowModalSuccess) => {
				if (!res.confirm) return
				checkIns.value.push(day.fullDate)
			}
		})
	}
	if(!day.isCheckedIn) {
		console.log('已签')
		uni.showModal({
			title: '签到',
			content: '是否签到?',
			success: (res : ShowModalSuccess) => {
				if (!res.confirm) return
				checkIns.value.push(day.fullDate)
			}
		})
	}
	if(day.isToday) {
		console.log('今天')
	}
}

const change = (res: LYearMonth) => {
	console.log('res', res)
}

查看示例

  • 导入后直接使用这个标签查看演示效果
vue
// 代码位于 uni_modules/lime-daily-punch/compoents/lime-daily-punch
<lime-daily-punch />

插件标签

  • 默认 l-daily-punch 为 component
  • 默认 lime-daily-punch 为 demo

API

Props

参数说明类型默认值
canSupplement是否支持补签booleantrue
yearMonth显示年月,格式:YYYY-MMstring当前月份
signedDates打卡数据,格式:YYYY-MM-DD[]string[][]
dayHeight天格子的高度number76
week星期string[]['周日', '周一', '周二', '周三', '周四', '周五', '周六']
weekStartsOn星期几为一周的开始,默认是6,即周一number6
weekColor星期文本颜色string#BDC0C3
weekFontSize星期文本字体number14
weekHeight星期文本高度number30
selectedDayBgColor选择中背景色stringrgba(0,0,0,0.06)
dayFontSize天的字体大小number16
textColor文本颜色string#1A1F24
disabledColor禁用颜色(日历中非本月的日期,week文本)string#BDC0C3
monthTitleHeight日历年月标题高度number50
monthTitleFontSize日历年月标题字体大小number20
color主色,签到和today选中颜色string#3B87F6
unsignedColor可补签小点颜色string#F1A33A'

打赏

如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。

源代码

组件源码