|
@@ -3,12 +3,14 @@ import store from './store'
|
|
import NProgress from 'nprogress'
|
|
import NProgress from 'nprogress'
|
|
import 'nprogress/nprogress.css'
|
|
import 'nprogress/nprogress.css'
|
|
import auth from '@/utils/auth'
|
|
import auth from '@/utils/auth'
|
|
|
|
+import { uaredirect } from '@/utils/uaredirect'
|
|
|
|
|
|
NProgress.configure({
|
|
NProgress.configure({
|
|
showSpinner: false
|
|
showSpinner: false
|
|
})
|
|
})
|
|
|
|
|
|
-const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
|
|
|
|
|
|
+const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/question/preview']
|
|
|
|
+const uaWhiteList = ['/question/preview']
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
router.beforeEach((to, from, next) => {
|
|
NProgress.start()
|
|
NProgress.start()
|
|
@@ -54,6 +56,7 @@ router.beforeEach((to, from, next) => {
|
|
// 没有token
|
|
// 没有token
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
// 在免登录白名单,直接进入
|
|
// 在免登录白名单,直接进入
|
|
|
|
+ if (!uaWhiteList.includes(to.path)) uaredirect()
|
|
next()
|
|
next()
|
|
} else {
|
|
} else {
|
|
// next()
|
|
// next()
|