index.vue
1.42 KB
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
<template>
<div class="dashboard-container">
<component :is="currentRole" />
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import adminDashboard from './admin'
import runnerDashboard from './runner'
export default {
name: 'Dashboard',
components: { adminDashboard, runnerDashboard },
data() {
return {
currentRole: 'adminDashboard'
}
},
computed: {
...mapGetters(['roles'])
},
created() {
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'
}
}
}
</script>