Blame view

src/views/dashboard/index.vue 1.42 KB
80a28914e   吉鹏   init
1
  <template>
d7d9c38c2   Adam   auto commit the c...
2
3
    <div class="dashboard-container">
      <component :is="currentRole" />
80a28914e   吉鹏   init
4
5
6
7
    </div>
  </template>
  
  <script>
d7d9c38c2   Adam   auto commit the c...
8
9
  import { mapGetters } from 'vuex'
  import adminDashboard from './admin'
96898eae4   Adam   auto commit the c...
10
  import runnerDashboard from './runner'
80a28914e   吉鹏   init
11
12
  
  export default {
d7d9c38c2   Adam   auto commit the c...
13
    name: 'Dashboard',
96898eae4   Adam   auto commit the c...
14
    components: { adminDashboard, runnerDashboard },
1172ebb79   Adam   auto commit the c...
15
16
    data() {
      return {
d7d9c38c2   Adam   auto commit the c...
17
18
        currentRole: 'adminDashboard'
      }
1172ebb79   Adam   auto commit the c...
19
    },
80a28914e   吉鹏   init
20
    computed: {
96898eae4   Adam   auto commit the c...
21
      ...mapGetters(['roles'])
1172ebb79   Adam   auto commit the c...
22
    },
d7d9c38c2   Adam   auto commit the c...
23
    created() {
96898eae4   Adam   auto commit the c...
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
      if (this.roles.includes('admin')) {
        this.$notify({
          title: '----admin---',
          message: 'adminadminadminadmin',
          type: 'success',
          duration: 2000
        })
        this.currentRole = 'adminDashboard'
      }
      if (this.roles.includes('assistant')) {
        this.$notify({
          title: '----assistant---',
          message: 'assistantassistantassistantassistant',
          type: 'success',
          duration: 2000
        })
        this.currentRole = 'adminDashboard'
      }
      if (this.roles.includes('runner')) {
        this.$notify({
          title: '----runner---',
          message: 'runnerrunnerrunnerrunner',
          type: 'success',
          duration: 2000
        })
        this.currentRole = 'runnerDashboard'
      }
      if (this.roles.includes('shoper')) {
        this.$notify({
          title: '----shoper---',
          message: 'shopershopershopershoper',
          type: 'success',
          duration: 2000
        })
        this.currentRole = 'runnerDashboard'
1172ebb79   Adam   auto commit the c...
59
      }
80a28914e   吉鹏   init
60
    }
1172ebb79   Adam   auto commit the c...
61
  }
d7d9c38c2   Adam   auto commit the c...
62
  </script>