user-info-header.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="header">
  3. <a-space :size="12" direction="vertical" align="center" class="center">
  4. <a-avatar :size="80" :imgUrl="user.avatar">
  5. <img :src="user.avatar" />
  6. </a-avatar>
  7. <a-typography-title :heading="5" style="margin: 0">
  8. {{ user.username }}
  9. </a-typography-title>
  10. <div class="user-msg">
  11. <a-space :size="18">
  12. <div>
  13. <icon-email />
  14. <a-typography-text>{{ user.email }}</a-typography-text>
  15. </div>
  16. </a-space>
  17. </div>
  18. </a-space>
  19. </div>
  20. </template>
  21. <script setup>
  22. import { useUserStore } from '@/store/modules/user'
  23. import { ref } from 'vue'
  24. const user = ref('')
  25. const getuser = async () => {
  26. const userStore = useUserStore()
  27. let userInfo = await userStore.getInfo()
  28. user.value = userInfo
  29. }
  30. getuser()
  31. </script>
  32. <style scoped lang="less">
  33. .header {
  34. display: flex;
  35. align-items: center;
  36. justify-content: center;
  37. height: 204px;
  38. color: var(--gray-10);
  39. background: url('@/assets/userinfo-background.jpg')
  40. no-repeat;
  41. background-size: cover;
  42. background-position: center;
  43. border-radius: 4px;
  44. .user-msg {
  45. max-width: 100%;
  46. :deep(.arco-space) {
  47. width: 100%;
  48. justify-content: center;
  49. }
  50. :deep(.arco-typography) {
  51. max-width: 70vw;
  52. overflow: hidden;
  53. text-overflow: ellipsis;
  54. white-space: nowrap;
  55. }
  56. .arco-icon {
  57. color: rgb(var(--gray-10));
  58. }
  59. .arco-typography {
  60. margin-left: 6px;
  61. }
  62. }
  63. }
  64. .header::after {
  65. content: '';
  66. height: 204px;
  67. width: 100%;
  68. background-color: rgba(255,255,255,0.5);
  69. }
  70. .center {
  71. position: absolute;
  72. }
  73. @media (max-width: 768px) {
  74. .header,
  75. .header::after {
  76. height: 176px;
  77. }
  78. .center {
  79. width: calc(100% - 24px);
  80. }
  81. }
  82. </style>