header-banner.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <script setup lang="ts">
  2. import { computed } from 'vue';
  3. import { useAppStore } from '@/store/modules/app';
  4. import { useAuthStore } from '@/store/modules/auth';
  5. import { $t } from '@/locales';
  6. defineOptions({
  7. name: 'HeaderBanner'
  8. });
  9. const appStore = useAppStore();
  10. const authStore = useAuthStore();
  11. const gap = computed(() => (appStore.isMobile ? 0 : 16));
  12. interface StatisticData {
  13. id: number;
  14. label: string;
  15. value: string;
  16. }
  17. const statisticData = computed<StatisticData[]>(() => [
  18. {
  19. id: 0,
  20. label: $t('page.home.projectCount'),
  21. value: '25'
  22. },
  23. {
  24. id: 1,
  25. label: $t('page.home.todo'),
  26. value: '4/16'
  27. },
  28. {
  29. id: 2,
  30. label: $t('page.home.message'),
  31. value: '12'
  32. }
  33. ]);
  34. // console.log(authStore.userInfo);
  35. </script>
  36. <template>
  37. <NCard :bordered="false" class="card-wrapper">
  38. <NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
  39. <NGi span="24 s:24 m:18">
  40. <div class="flex-y-center">
  41. <div class="size-72px shrink-0 overflow-hidden rd-1/2">
  42. <img src="@/assets/imgs/soybean.jpg" class="size-full" />
  43. </div>
  44. <div class="pl-12px">
  45. <h3 class="text-18px font-semibold">
  46. {{ $t('page.home.greeting', { username: authStore.userInfo.username }) }}
  47. </h3>
  48. <p class="text-#999 leading-30px">{{ $t('page.home.weatherDesc') }}</p>
  49. </div>
  50. </div>
  51. </NGi>
  52. <NGi span="24 s:24 m:6">
  53. <NSpace :size="24" justify="end">
  54. <NStatistic v-for="item in statisticData" :key="item.id" class="whitespace-nowrap" v-bind="item" />
  55. </NSpace>
  56. </NGi>
  57. </NGrid>
  58. </NCard>
  59. </template>
  60. <style scoped></style>