From defc2ab5f125fb9b5b8d4aacdc15fa50bd73faba Mon Sep 17 00:00:00 2001 From: MJ Date: Fri, 8 Aug 2025 19:19:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AD=A6=E6=83=85=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/academic-report/index.vue | 342 ++++++++-------------------- src/pages/login/index.vue | 16 +- src/pages/mine/patriarch-card.vue | 6 + src/store/study-data.ts | 12 + src/store/user.ts | 2 +- src/utils/obj.ts | 230 +++++++++++++++++-- src/utils/tool.ts | 14 ++ 7 files changed, 347 insertions(+), 275 deletions(-) create mode 100644 src/store/study-data.ts diff --git a/src/pages/academic-report/index.vue b/src/pages/academic-report/index.vue index e658672..f3f793d 100644 --- a/src/pages/academic-report/index.vue +++ b/src/pages/academic-report/index.vue @@ -8,21 +8,23 @@ import { storeToRefs } from 'pinia' import { useBadgeStore } from '@/store/badge' import { useChildStore } from '@/store/child' import hud from '@/utils/hud' -import { getStudentStudyDataApi } from '@/api' +import { useStudyDataStore } from '@/store/study-data' +import { secondsToHours } from '@/utils' const childStore = useChildStore() const { getChildren } = childStore const { children } = storeToRefs(childStore) const { refreshBadge } = useBadgeStore() +const { getStudentStudyData } = useStudyDataStore() const showChild = ref() // 展示的孩子 - +const showChildData = ref({} as any) const OSS_URL = import.meta.env.VITE_OSS_HOST const arrow = `${OSS_URL}/iconfont/down_arrow.png` const defaultAvatar = `${OSS_URL}/urm/default_avatar.png` const showAllChildren = ref(false) -const checkedId = ref() +const checkedId = ref() function handleShowChild(i: ChildrenType) { checkedId.value = i.child?.id showChild.value = i @@ -90,7 +92,13 @@ const subjectOptions = [ const subject = ref(subjectOptions[0].value) watch( - [() => dataType.value, () => timeType.value, () => timeDay.value, () => subject.value], + [ + () => dataType.value, + () => timeType.value, + () => timeDay.value, + () => subject.value, + () => checkedId.value, + ], () => { const params = { queryType: dataType.value, @@ -104,7 +112,9 @@ watch( if (dataType.value === dataTypeSubject) { params.subjectId = subject.value } - getStudentStudyDataApi(params) + getStudentStudyData(params).then(map => { + showChildData.value = map[checkedId.value] || {} + }) }, { immediate: true }, ) @@ -214,94 +224,94 @@ onMounted(() => { - - + {{ timeDay }} + - {{ 0 }} + {{ secondsToHours(showChildData.learnTime) }} 有效学习时长 - {{ 0 }} + {{ showChildData.knowledgeCount || 0 }} 知识点 - {{ 0 }} + {{ showChildData.errorCount || 0 }} 错题 - {{ 0 }} + {{ showChildData.correctCount || 0 }} 订正 - {{ 0 }} + {{ showChildData.wordStrangerCount || 0 }} 单词陌生 - {{ 0 }} + {{ showChildData.wordKnowCount || 0 }} 单词认识 - {{ 0 }} + {{ showChildData.wordKnowWellCount || 0 }} 单词熟悉 - {{ 0 }} + {{ showChildData.wordGraspCount || 0 }} 单词掌握 - {{ 0 }} + {{ showChildData.wordCount || 0 }} 单词总数 - {{ 0 }} + {{ showChildData.starCount || 0 }} 单词闯关星星 - {{ 0 }} + {{ showChildData.sentenceCount || 0 }} 语感训练句子 - {{ 0 }} + {{ showChildData.learnTime || 0 }} 有效学习时长 - {{ 0 }} + {{ showChildData.successTestCount || 0 }} 答题正确 - {{ 0 }} + {{ showChildData.errorTestCount || 0 }} 答题错误 - {{ 0 }} + {{ showChildData.allKnowledgeCount || 0 }} 知识点总数 - {{ 0 }} + {{ showChildData.allKnowledgeGraspCount || 0 }} 知识点掌握 - {{ 0 }} + {{ showChildData.allReviewCount || 0 }} 订正总数 - {{ 0 }} + {{ showChildData.successReviewCount || 0 }} 订正正确 - {{ 0 }} + {{ showChildData.learnTime || 0 }} 有效学习时长 @@ -366,251 +376,81 @@ onMounted(() => { background-color: #fff; padding: 0 30rpx 30rpx; border-radius: 20rpx; - } - .title { - margin-bottom: 30rpx; - font-size: 34rpx; - line-height: 48rpx; - color: $font-color; - font-weight: 500; - } - - .title2 { - margin: 30rpx 0 20rpx 0; - font-size: 28rpx; - font-weight: 500; - line-height: 40rpx; - text-align: center; - } - - .trend_icon { - margin-left: 10rpx; - width: 26rpx; - height: 26rpx; - } - - .study_situation { - display: flex; - - .item { - flex: 1; - padding: 42rpx 30rpx; + .children { display: flex; justify-content: space-between; - height: 119rpx; - border-radius: 20rpx; - background-color: #f7faff; - font-size: 26rpx; - font-weight: 500; - box-sizing: border-box; + padding: 30rpx 0 30rpx 0; + border-bottom: 1rpx solid $border-color; - &:first-child { - margin-right: 30rpx; - } - - .date { - color: #3fd15f; - font-size: 28rpx; - } - } - } - - .study_situation2 { - display: flex; - justify-content: space-between; - - .item { - width: calc(50% - 15rpx); - text-align: center; - font-weight: 500; - - &_label { - display: block; - height: 76rpx; - line-height: 76rpx; - background-color: #ebf2ff; - border-bottom: 1rpx solid #d9e1f2; - border-radius: 20rpx 20rpx 0 0; - font-size: 26rpx; - } - - &_date { - display: block; + .left { display: flex; - justify-content: center; align-items: center; - height: 79rpx; - line-height: 79rpx; - background-color: #f7faff; - border-radius: 0 0 20rpx 20rpx; - font-size: 28rpx; - // rgba(255, 40, 40, 1)jiang rgba(255, 141, 95, 1)ping + .children_avatar { + margin-right: 20rpx; + width: 100rpx; + height: 100rpx; + border-radius: 50%; + } + + .name_vip { + display: flex; + align-items: center; + margin-bottom: 6rpx; + + .name { + display: inline-block; + max-width: 210rpx; + font-weight: 500; + font-size: 32rpx; + line-height: 48rpx; + color: $font-color; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .vip { + margin-left: 10rpx; + width: 85rpx; + height: 32rpx; + } + } + + .time { + font-size: 24rpx; + line-height: 34rpx; + color: $font-aux-color; + } } - .keep { - color: #ff8d5f; + .icon { + width: 30rpx; + height: 30rpx; } - .down { - color: #ff2828; + .checked_icon { + margin: auto 0; } - .up { - color: #21d17a; + .rotate { + transform: rotate(-180deg); } } - } - .date_filter_box { - text-align: center; - } - - .children { - display: flex; - justify-content: space-between; - padding: 30rpx 0 30rpx 0; - border-bottom: 1rpx solid $border-color; - - .left { + .children_info { display: flex; - align-items: center; - - .children_avatar { - margin-right: 20rpx; - width: 100rpx; - height: 100rpx; - border-radius: 50%; - } - - .name_vip { - display: flex; - align-items: center; - margin-bottom: 6rpx; - - .name { - display: inline-block; - max-width: 210rpx; - font-weight: 500; - font-size: 32rpx; - line-height: 48rpx; - color: $font-color; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - .vip { - margin-left: 10rpx; - width: 85rpx; - height: 32rpx; - } - } - - .time { - font-size: 24rpx; - line-height: 34rpx; - color: $font-aux-color; - } - } - - .icon { - width: 30rpx; - height: 30rpx; - } - - .checked_icon { - margin: auto 0; - } - - .rotate { - transform: rotate(-180deg); - } - } - - .children_info { - display: flex; - padding: 30rpx 0 0 0; - - .item { - width: 50%; - font-size: 28rpx; - line-height: 40rpx; - color: $font-aux-color; - - .level { - color: $font-color; - } - } - } - - .filter_box { - padding: 30rpx 30rpx 13rpx 30rpx; - - .title { - margin-bottom: 0; - } - } - - .learning_time { - .date_filter_box { - margin: 50rpx 0 30rpx 0; - } - } - - .video_learning { - .date_filter_box { - margin: 30rpx 0; - } - } - - .exercise_statistics { - .study_situation2 { - margin: 30rpx 0 0 0; + padding: 30rpx 0 0 0; .item { - width: 210rpx; - } - } - } + width: 50%; + font-size: 28rpx; + line-height: 40rpx; + color: $font-aux-color; - .language_statistics { - .study_situation2 { - margin: 30rpx 0 50rpx 0; - } - } - - .knowledge_mapping { - .chart_label { - display: flex; - justify-content: center; - font-size: 26rpx; - color: rgba(102, 102, 102, 1); - - .iden_color { - display: inline-block; - width: 30rpx; - height: 8rpx; - margin-right: 4rpx; - } - - .increase { - display: flex; - align-items: center; - margin-right: 16rpx; - - .iden_color { - background-color: rgba(69, 203, 70, 1); - } - } - - .decrease { - display: flex; - align-items: center; - - .iden_color { - background-color: rgba(248, 104, 96, 1); + .level { + color: $font-color; } } } diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 251688d..5c85e40 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -39,7 +39,7 @@