index.vue 3.8 KB
Newer Older
C
chen-xt 已提交
1 2
<template>
  <div :class="prefixCls">
V
vben 已提交
3 4 5 6
    <a-row :class="`${prefixCls}-top`">
      <a-col :span="9" :class="`${prefixCls}-col`">
        <a-row>
          <a-col :span="8">
C
chen-xt 已提交
7
            <div :class="`${prefixCls}-top__avatar`">
8
              <img width="70" :src="avatar" />
V
Vben 已提交
9
              <span>Vben</span>
C
chen-xt 已提交
10 11
              <div>海纳百川,有容乃大</div>
            </div>
V
vben 已提交
12 13
          </a-col>
          <a-col :span="16">
C
chen-xt 已提交
14
            <div :class="`${prefixCls}-top__detail`">
V
Vben 已提交
15
              <template v-for="detail in details" :key="detail.title">
C
chen-xt 已提交
16 17 18 19 20 21
                <p>
                  <Icon :icon="detail.icon" />
                  {{ detail.title }}
                </p>
              </template>
            </div>
V
vben 已提交
22 23 24 25
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="7" :class="`${prefixCls}-col`">
C
chen-xt 已提交
26
        <CollapseContainer title="标签" :canExpan="false">
V
Vben 已提交
27
          <template v-for="tag in tags" :key="tag">
V
vben 已提交
28 29 30
            <Tag class="mb-2">
              {{ tag }}
            </Tag>
C
chen-xt 已提交
31 32
          </template>
        </CollapseContainer>
V
vben 已提交
33 34
      </a-col>
      <a-col :span="8" :class="`${prefixCls}-col`">
C
chen-xt 已提交
35 36 37 38 39 40
        <CollapseContainer :class="`${prefixCls}-top__team`" title="团队" :canExpan="false">
          <div v-for="(team, index) in teams" :key="index" :class="`${prefixCls}-top__team-item`">
            <Icon :icon="team.icon" :color="team.color" />
            <span>{{ team.title }}</span>
          </div>
        </CollapseContainer>
V
vben 已提交
41 42
      </a-col>
    </a-row>
C
chen-xt 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55
    <div :class="`${prefixCls}-bottom`">
      <Tabs>
        <template v-for="item in achieveList" :key="item.key">
          <TabPane :tab="item.name">
            <component :is="item.component" />
          </TabPane>
        </template>
      </Tabs>
    </div>
  </div>
</template>

<script lang="ts">
V
vben 已提交
56
  import { Tag, Tabs, Row, Col } from 'ant-design-vue';
57
  import { defineComponent, computed } from 'vue';
C
chen-xt 已提交
58 59 60 61 62 63 64 65
  import { CollapseContainer } from '/@/components/Container/index';
  import Icon from '/@/components/Icon/index';
  import Article from './Article.vue';
  import Application from './Application.vue';
  import Project from './Project.vue';

  import headerImg from '/@/assets/images/header.jpg';
  import { tags, teams, details, achieveList } from './data';
66
  import { useUserStore } from '/@/store/modules/user';
C
chen-xt 已提交
67 68 69 70 71 72 73 74 75 76 77

  export default defineComponent({
    components: {
      CollapseContainer,
      Icon,
      Tag,
      Tabs,
      TabPane: Tabs.TabPane,
      Article,
      Application,
      Project,
V
vben 已提交
78 79
      [Row.name]: Row,
      [Col.name]: Col,
C
chen-xt 已提交
80 81
    },
    setup() {
82 83
      const userStore = useUserStore();
      const avatar = computed(() => userStore.getUserInfo.avatar || headerImg);
C
chen-xt 已提交
84 85
      return {
        prefixCls: 'account-center',
86
        avatar,
C
chen-xt 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100
        tags,
        teams,
        details,
        achieveList,
      };
    },
  });
</script>
<style lang="less" scoped>
  .account-center {
    &-col:not(:last-child) {
      padding: 0 10px;

      &:not(:last-child) {
V
vben 已提交
101
        border-right: 1px dashed rgb(206 206 206 / 50%);
C
chen-xt 已提交
102 103 104 105 106
      }
    }

    &-top {
      padding: 10px;
V
vben 已提交
107
      margin: 16px 16px 12px;
V
Vben 已提交
108
      background-color: @component-background;
C
chen-xt 已提交
109 110 111 112 113 114
      border-radius: 3px;

      &__avatar {
        text-align: center;

        img {
115
          margin: auto;
C
chen-xt 已提交
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
          border-radius: 50%;
        }

        span {
          display: block;
          font-size: 20px;
          font-weight: 500;
        }

        div {
          margin-top: 3px;
          font-size: 12px;
        }
      }

      &__detail {
        padding-left: 20px;
        margin-top: 15px;
      }

      &__team {
        &-item {
          display: inline-block;
C
chen-xt 已提交
139
          padding: 4px 24px;
C
chen-xt 已提交
140 141 142 143 144 145 146 147 148 149
        }

        span {
          margin-left: 3px;
        }
      }
    }

    &-bottom {
      padding: 10px;
V
vben 已提交
150
      margin: 0 16px 16px;
V
Vben 已提交
151
      background-color: @component-background;
C
chen-xt 已提交
152 153 154 155
      border-radius: 3px;
    }
  }
</style>