Skip to content

Commit 7652e70

Browse files
authored
Update index.vue (#58)
1 parent 1cc5a3a commit 7652e70

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/views/dashboard/index.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
<div class="dashboard-container">
33
<div class="dashboard-editor-container">
44
<!-- <github-corner class="github-corner" /> -->
5-
65
<panel-group @handleSetLineChartData="handleSetLineChartData" />
7-
86
<!-- <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
97
<line-chart :chart-data="lineChartData" />
108
</el-row> -->
@@ -36,6 +34,8 @@ import LineChart from './components/LineChart'
3634
import RadarChart from '@/components/Echarts/RadarChart'
3735
import PieChart from '@/components/Echarts/PieChart'
3836
import BarChart from '@/components/Echarts/BarChart'
37+
import { mapGetters } from 'vuex'
38+
import { Message } from 'element-ui'
3939
4040
const lineChartData = {
4141
newVisitis: {
@@ -67,12 +67,25 @@ export default {
6767
PieChart,
6868
BarChart
6969
},
70+
computed: {
71+
...mapGetters(['roles'])
72+
},
7073
data() {
7174
return {
7275
lineChartData: lineChartData.newVisitis
7376
}
7477
},
75-
methods: {
78+
//普通用户登录后跳转到个人中心
79+
beforeRouteEnter(to, from, next) {
80+
next(vm => {
81+
const roles = vm.$store.getters.roles;
82+
if (roles.length > 0 && roles.includes('普通用户')) {
83+
vm.$router.push('/profile/index');
84+
}
85+
});
86+
},
87+
88+
methods: {
7689
handleSetLineChartData(type) {
7790
this.lineChartData = lineChartData[type]
7891
}
@@ -106,4 +119,3 @@ export default {
106119
}
107120
}
108121
</style>
109-

0 commit comments

Comments
 (0)