|
|
@@ -2,7 +2,7 @@ import Vue from 'vue'
|
|
|
import VueRouter from 'vue-router'
|
|
|
import Index from '@/layout/index.vue'
|
|
|
import Home from '@/views/home/index.vue'
|
|
|
-import checkPower from '@/utils/check-power.vue'
|
|
|
+// import checkPower from '@/utils/check-power.vue'
|
|
|
|
|
|
Vue.use(VueRouter)
|
|
|
const routes = [
|
|
|
@@ -232,14 +232,20 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
|
const vuexStore = router.app.$options.store
|
|
|
// router.app.$options.store 就是 this.$store
|
|
|
- if (checkPower.updateUserRole(vuexStore.state.user.userInfo)) {
|
|
|
+ /* if (checkPower.updateUserRole(vuexStore.state.user.userInfo)) {
|
|
|
vuexStore.state.user.userInfo.role = 'ROLE_USER'
|
|
|
vuexStore.commit('SET_USER_INFO', vuexStore.state.user.userInfo)
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- const date = new Date().getTime()
|
|
|
+ // const date = new Date().getTime()
|
|
|
if (vuexStore.state.user.userInfo != null) {
|
|
|
- if (vuexStore.state.user.userInfo.expireTime > date) {
|
|
|
+ if (to.path === '/login') {
|
|
|
+ return next({ path: '/' })
|
|
|
+ }
|
|
|
+ return next()
|
|
|
+
|
|
|
+ // TODO 不判断用户是否过期
|
|
|
+ /* if (vuexStore.state.user.userInfo.expireTime > date) {
|
|
|
if (to.path === '/login') {
|
|
|
return next({ path: '/' })
|
|
|
}
|
|
|
@@ -250,7 +256,7 @@ router.beforeEach((to, from, next) => {
|
|
|
path: '/login',
|
|
|
query: { redirect: to.fullPath }
|
|
|
})
|
|
|
- }
|
|
|
+ }*/
|
|
|
} else {
|
|
|
if (to.meta.requireAuth) {
|
|
|
return next({
|