page-header.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="relative">
  3. <ie-image :is-oss="true" src="/study-bg5.png" customClass="w-full h-[555rpx] absolute top-0 left-0 z-0" />
  4. <ie-image :is-oss="true" src="/study-bg6.png" customClass="w-220 h-205 absolute top-83 right-38 z-1" />
  5. <view class="relative z-2">
  6. <view class="pt-122 ml-43">
  7. <ie-image :is-oss="true" src="/study-title2.png" customClass="w-240 h-52" />
  8. <view class="mt-22 text-24 text-fore-light"> 每天按计划学习,让进步看得见~</view>
  9. </view>
  10. <view class="mt-32 mx-30 px-40 py-28 rounded-10 bg-white flex items-center justify-between">
  11. <view v-for="(item, index) in stat" :key="item.desc" class="text-start">
  12. <view class="">
  13. <text class="text-36 text-fore-title font-bold">{{ item.data }}</text>
  14. <text class="ml-8 text-24 text-fore-light">{{ item.unit }}</text>
  15. </view>
  16. <view class="mt-8 text-24 text-fore-light">{{ item.desc }}</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script lang="ts" setup>
  23. import { STUDY_PLAN_STATS, STUDY_PLAN } from '@/types/injectionSymbols';
  24. const studyPlan = inject(STUDY_PLAN);
  25. const studyPlanStatsRef = inject(STUDY_PLAN_STATS);
  26. const stat = computed(() => {
  27. const studyPlanStats = studyPlanStatsRef?.value;
  28. return [
  29. {
  30. data: getValue(studyPlanStats?.doneDay),
  31. unit: '天',
  32. desc: '本月已完成'
  33. },
  34. {
  35. data: getValue(studyPlanStats?.undoneDay),
  36. unit: '天',
  37. desc: '本月未完成'
  38. },
  39. {
  40. data: getValue(studyPlanStats?.videoTimes),
  41. unit: 'h',
  42. desc: '学习时长'
  43. },
  44. {
  45. data: getValue(studyPlanStats?.questionCnt),
  46. unit: '题',
  47. desc: '答题总数'
  48. }
  49. ]
  50. });
  51. const getValue = (val?: number) => {
  52. return val || 0;
  53. }
  54. </script>
  55. <style lang="scss" scoped></style>