|
|
|
@ -3,17 +3,26 @@ import store from './store'
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
import NProgress from 'nprogress'
|
|
|
|
|
import 'nprogress/nprogress.css'
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
import { getToken, setAccessToken } from '@/utils/auth'
|
|
|
|
|
import { isRelogin } from '@/utils/request'
|
|
|
|
|
import { getAccesstoken } from "@/api/bigScreenApi/index"
|
|
|
|
|
|
|
|
|
|
NProgress.configure({ showSpinner: false })
|
|
|
|
|
|
|
|
|
|
const whiteList = ['/login', '/register', '/bigScreen']
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
console.log('tototo',to.path);
|
|
|
|
|
NProgress.start()
|
|
|
|
|
next()
|
|
|
|
|
// console.log('tototo',to.path);
|
|
|
|
|
if (window.location.href.includes("code=")) {
|
|
|
|
|
var reg = new RegExp(/[?&]code=([^&#]+)/);
|
|
|
|
|
var c = window.location.href.match(reg);
|
|
|
|
|
const code = c && c[1];
|
|
|
|
|
getAccesstoken({code:code}).then(res=>{
|
|
|
|
|
setAccessToken(res.data.accessToken)
|
|
|
|
|
})
|
|
|
|
|
NProgress.start()
|
|
|
|
|
next()
|
|
|
|
|
}
|
|
|
|
|
// if (getToken()) {
|
|
|
|
|
// to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
|
|
|
|
// /* has token*/
|
|
|
|
|