|
|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<view class="mt-24 bg-white relative z-4">
|
|
|
- <uni-calendar :insert="true" :lunar="false" :readonly="false" :showMonth="false" :selected="selected"
|
|
|
+ <uni-calendar ref="calendarRef" :insert="true" :lunar="false" :readonly="false" :showMonth="false" :selected="selected"
|
|
|
:endDate="endDate" @change-month="changeMonth" @change="handleChangeDate" />
|
|
|
- <view class="wrap mt-20 w-fit mx-auto px-98 py-16 flex items-center justify-center">
|
|
|
+ <view class="wrap mt-20 w-fit mx-auto px-98 py-16 flex items-center justify-center transition-all duration-300">
|
|
|
<ie-image src="/pagesStudy/static/image/icon-calendar.png" custom-class="w-22 h-22" />
|
|
|
<text class="ml-4 text-20 text-primary">{{ tip }}</text>
|
|
|
</view>
|
|
|
@@ -23,8 +23,8 @@ import { STUDY_PLAN_STATS, STUDY_PLAN } from '@/types/injectionSymbols';
|
|
|
import { Study } from '@/types';
|
|
|
const studyPlan = inject(STUDY_PLAN) || ref({} as Study.StudyPlan);
|
|
|
const studyPlanStats = inject(STUDY_PLAN_STATS) || ref({} as Study.StudyPlanStats);
|
|
|
-
|
|
|
-let selectDate = ref(uni.$uv.timeFormat(new Date(), 'yyyy-mm-dd'));
|
|
|
+const today = uni.$uv.timeFormat(new Date(), 'yyyy-mm-dd');
|
|
|
+let selectDate = ref(today);
|
|
|
const stat = computed(() => {
|
|
|
let todayData = {} as Study.StudyStats;
|
|
|
const questionCnt = studyPlan.value.questionCnt;
|
|
|
@@ -65,6 +65,9 @@ const stat = computed(() => {
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
+const isShowToday = computed(() => {
|
|
|
+ return selectDate.value === today;
|
|
|
+});
|
|
|
const selected = computed(() => {
|
|
|
if (!studyPlanStats.value?.studyList?.length) {
|
|
|
return [];
|
|
|
@@ -94,10 +97,14 @@ const todayPlanFinish = computed(() => {
|
|
|
return false
|
|
|
});
|
|
|
const tip = computed(() => {
|
|
|
- if (todayPlanFinish.value) {
|
|
|
- return '恭喜你,今日计划已完成'
|
|
|
+ if (isShowToday.value) {
|
|
|
+ if (todayPlanFinish.value) {
|
|
|
+ return '恭喜你,今日计划已完成'
|
|
|
+ }
|
|
|
+ return '今日计划进行中,加油~'
|
|
|
+ } else {
|
|
|
+ return '历史完成情况';
|
|
|
}
|
|
|
- return '今日计划进行中,加油~'
|
|
|
});
|
|
|
const getValue = (val?: number) => {
|
|
|
return val || 0;
|
|
|
@@ -105,6 +112,7 @@ const getValue = (val?: number) => {
|
|
|
const init = () => {
|
|
|
endDate.value = uni.$uv.timeFormat(new Date(), 'yyyy-mm-dd')
|
|
|
}
|
|
|
+const calendarRef = ref();
|
|
|
const emit = defineEmits(['changeMonth', 'changeDate']);
|
|
|
const changeMonth = (e: any) => {
|
|
|
emit('changeMonth', e);
|