|
@@ -6,7 +6,8 @@ import 'nprogress/nprogress.css' // progress bar style
|
|
import notification from 'ant-design-vue/es/notification'
|
|
import notification from 'ant-design-vue/es/notification'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
import { generateIndexRouter } from "@/utils/util"
|
|
import { generateIndexRouter } from "@/utils/util"
|
|
-
|
|
|
|
|
|
+import warterMark from './warterMark'
|
|
|
|
+import { mapGetters, mapMutations, mapActions } from 'vuex'
|
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
|
|
|
|
|
|
|
|
|
@@ -22,9 +23,11 @@ router.beforeEach((to, from, next) => {
|
|
/* has token */
|
|
/* has token */
|
|
|
|
|
|
if (to.path === '/user/login') {
|
|
if (to.path === '/user/login') {
|
|
|
|
+ warterMark.out()
|
|
next({ path: '/dashboard/workplace' })
|
|
next({ path: '/dashboard/workplace' })
|
|
NProgress.done()
|
|
NProgress.done()
|
|
} else {
|
|
} else {
|
|
|
|
+ // warterMark.set(store.getters.userInfo.roleName)
|
|
if (store.getters.permissionList.length === 0) {
|
|
if (store.getters.permissionList.length === 0) {
|
|
store.dispatch('GetPermissionList').then(res => {
|
|
store.dispatch('GetPermissionList').then(res => {
|
|
const menuData = res.result.menu;
|
|
const menuData = res.result.menu;
|
|
@@ -54,19 +57,23 @@ router.beforeEach((to, from, next) => {
|
|
message: '系统提示',
|
|
message: '系统提示',
|
|
description: '请求用户信息失败,请重试!'
|
|
description: '请求用户信息失败,请重试!'
|
|
})*/
|
|
})*/
|
|
|
|
+ warterMark.out()
|
|
store.dispatch('Logout').then(() => {
|
|
store.dispatch('Logout').then(() => {
|
|
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
|
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
|
})
|
|
})
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
|
|
+ warterMark.set(store.getters.userInfo.realname)
|
|
next()
|
|
next()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
// 在免登录白名单,直接进入
|
|
// 在免登录白名单,直接进入
|
|
|
|
+ // warterMark.set(store.getters.userInfo.roleName)
|
|
next()
|
|
next()
|
|
} else {
|
|
} else {
|
|
|
|
+ warterMark.out()
|
|
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
|
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
|
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
|
|
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
|
|
}
|
|
}
|