This commit is contained in:
王念超
2024-06-06 16:25:36 +08:00
parent 682b692070
commit 99341a699f
7 changed files with 46 additions and 133 deletions

View File

@@ -22,7 +22,7 @@ export const EventKey = {
jumpSpecifiedChapter: 'jumpSpecifiedChapter',
}
export function useEvent(key: string, func: () => void) {
export function useEvent(key: string, func: any) {
onMounted(() => {
emitter.on(key, func)
})

View File

@@ -227,11 +227,18 @@ export async function _checkDictWords(dict: Dict) {
}
}
//获取完成天数
export function _getAccomplishDays(total: number, dayNumber: number) {
return Math.ceil(total / dayNumber)
}
//获取完成日期
export function _getAccomplishDate(total: number, dayNumber: number) {
let d = _getAccomplishDays(total, dayNumber)
return dayjs().add(d, 'day').format('YYYY-MM-DD')
}
//获取学习进度
export function _getStudyProgress(index: number, total: number) {
return Number(((index / total) * 100).toFixed())
}