|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view class="mt-24 bg-white relative z-4">
|
|
<view class="mt-24 bg-white relative z-4">
|
|
|
- <uni-calendar ref="calendarRef" :insert="true" :lunar="false" :readonly="false" :showMonth="false" :selected="selected"
|
|
|
|
|
- :endDate="endDate" @change-month="changeMonth" @change="handleChangeDate" />
|
|
|
|
|
|
|
+ <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 transition-all duration-300">
|
|
<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" />
|
|
<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>
|
|
<text class="ml-4 text-20 text-primary">{{ tip }}</text>
|
|
@@ -26,17 +26,17 @@ const studyPlanStats = inject(STUDY_PLAN_STATS) || ref({} as Study.StudyPlanStat
|
|
|
const today = uni.$uv.timeFormat(new Date(), 'yyyy-mm-dd');
|
|
const today = uni.$uv.timeFormat(new Date(), 'yyyy-mm-dd');
|
|
|
let selectDate = ref(today);
|
|
let selectDate = ref(today);
|
|
|
const stat = computed(() => {
|
|
const stat = computed(() => {
|
|
|
- let todayData = {} as Study.StudyStats;
|
|
|
|
|
|
|
+ let todayData = selectedDate.value;
|
|
|
const questionCnt = studyPlan.value.questionCnt;
|
|
const questionCnt = studyPlan.value.questionCnt;
|
|
|
const videoTime = studyPlan.value.videoTime;
|
|
const videoTime = studyPlan.value.videoTime;
|
|
|
- if (studyPlanStats.value?.studyList?.length) {
|
|
|
|
|
- const index = studyPlanStats?.value?.studyList.findIndex(item => item.date === selectDate.value);
|
|
|
|
|
- if (index !== -1) {
|
|
|
|
|
- todayData = studyPlanStats.value?.studyList[index].data;
|
|
|
|
|
- } else {
|
|
|
|
|
- todayData = {} as Study.StudyStats;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (studyPlanStats.value?.studyList?.length) {
|
|
|
|
|
+ // const index = studyPlanStats?.value?.studyList.findIndex(item => item.date === selectDate.value);
|
|
|
|
|
+ // if (index !== -1) {
|
|
|
|
|
+ // todayData = studyPlanStats.value?.studyList[index].data;
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // todayData = {} as Study.StudyStats;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
return [
|
|
return [
|
|
|
{
|
|
{
|
|
@@ -51,20 +51,30 @@ const stat = computed(() => {
|
|
|
value: `${getValue(todayData?.videoTime)}/${getValue(videoTime)}`,
|
|
value: `${getValue(todayData?.videoTime)}/${getValue(videoTime)}`,
|
|
|
icon: '/pagesStudy/static/image/icon-video.png'
|
|
icon: '/pagesStudy/static/image/icon-video.png'
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- name: '学习时长',
|
|
|
|
|
- unit: '分钟',
|
|
|
|
|
- value: `${getValue(todayData?.videoTimes)}`,
|
|
|
|
|
- icon: '/pagesStudy/static/image/icon-time.png'
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
name: '正确率',
|
|
name: '正确率',
|
|
|
unit: '',
|
|
unit: '',
|
|
|
value: `${getValue(todayData?.rightRate)}%`,
|
|
value: `${getValue(todayData?.rightRate)}%`,
|
|
|
icon: '/pagesStudy/static/image/icon-chart.png'
|
|
icon: '/pagesStudy/static/image/icon-chart.png'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: '学习时长',
|
|
|
|
|
+ unit: '分钟',
|
|
|
|
|
+ value: `${formatMinutes(todayData?.videoTimes)}`,
|
|
|
|
|
+ icon: '/pagesStudy/static/image/icon-time.png'
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
|
|
+const selectedDate = computed(() => {
|
|
|
|
|
+ if (studyPlanStats.value?.studyList?.length) {
|
|
|
|
|
+ const index = studyPlanStats?.value?.studyList.findIndex(item => item.date === selectDate.value);
|
|
|
|
|
+ if (index !== -1) {
|
|
|
|
|
+ return studyPlanStats.value?.studyList[index].data;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return {} as Study.StudyStats;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
const isShowToday = computed(() => {
|
|
const isShowToday = computed(() => {
|
|
|
return selectDate.value === today;
|
|
return selectDate.value === today;
|
|
|
});
|
|
});
|
|
@@ -85,7 +95,8 @@ const selected = computed(() => {
|
|
|
|
|
|
|
|
const endDate = ref('')
|
|
const endDate = ref('')
|
|
|
const todayPlanFinish = computed(() => {
|
|
const todayPlanFinish = computed(() => {
|
|
|
- const todayData = studyPlanStats?.value?.today;
|
|
|
|
|
|
|
+ // const todayData = studyPlanStats?.value?.today;
|
|
|
|
|
+ const todayData = selectedDate.value;
|
|
|
const questionCnt = studyPlan.value.questionCnt;
|
|
const questionCnt = studyPlan.value.questionCnt;
|
|
|
const videoTime = studyPlan.value.videoTime;
|
|
const videoTime = studyPlan.value.videoTime;
|
|
|
|
|
|
|
@@ -94,7 +105,7 @@ const todayPlanFinish = computed(() => {
|
|
|
getValue(todayData?.videoTime) >= getValue(videoTime)) {
|
|
getValue(todayData?.videoTime) >= getValue(videoTime)) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
- return false
|
|
|
|
|
|
|
+ return false;
|
|
|
});
|
|
});
|
|
|
const tip = computed(() => {
|
|
const tip = computed(() => {
|
|
|
if (isShowToday.value) {
|
|
if (isShowToday.value) {
|
|
@@ -122,6 +133,10 @@ const handleChangeDate = (e: any) => {
|
|
|
selectDate.value = e.fulldate;
|
|
selectDate.value = e.fulldate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const formatMinutes = (val?: number) => {
|
|
|
|
|
+ return val ? val / 60 : 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
init();
|
|
init();
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|