Blame view

src/views/profile/index.vue 1.45 KB
d7d9c38c2   Adam   auto commit the c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  <template>
    <div class="app-container">
      <div v-if="user">
        <el-row :gutter="20">
  
          <el-col :span="6" :xs="24">
            <user-card :user="user" />
          </el-col>
  
          <el-col :span="18" :xs="24">
            <el-card>
              <el-tabs v-model="activeTab">
                <el-tab-pane label="Activity" name="activity">
                  <activity />
                </el-tab-pane>
                <el-tab-pane label="Timeline" name="timeline">
                  <timeline />
                </el-tab-pane>
                <el-tab-pane label="Account" name="account">
                  <account :user="user" />
                </el-tab-pane>
              </el-tabs>
            </el-card>
          </el-col>
  
        </el-row>
      </div>
    </div>
  </template>
  
  <script>
  import { mapGetters } from 'vuex'
  import UserCard from './components/UserCard'
  import Activity from './components/Activity'
  import Timeline from './components/Timeline'
  import Account from './components/Account'
  
  export default {
    name: 'Profile',
    components: { UserCard, Activity, Timeline, Account },
    data() {
      return {
        user: {},
        activeTab: 'activity'
      }
    },
    computed: {
      ...mapGetters([
        'name',
        'avatar',
        'roles'
      ])
    },
    created() {
      this.getUser()
    },
    methods: {
      getUser() {
        this.user = {
          name: this.name,
          role: this.roles.join(' | '),
          email: 'admin@test.com',
          avatar: this.avatar
        }
      }
    }
  }
  </script>