|
|
@ -4,7 +4,7 @@
|
|
|
|
* @Author: JC9527
|
|
|
|
* @Author: JC9527
|
|
|
|
* @Date: 2024-01-09 23:08:15
|
|
|
|
* @Date: 2024-01-09 23:08:15
|
|
|
|
* @LastEditors: JC9527
|
|
|
|
* @LastEditors: JC9527
|
|
|
|
* @LastEditTime: 2024-09-03 20:23:09
|
|
|
|
* @LastEditTime: 2024-09-05 17:31:00
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import router from './router'
|
|
|
|
import router from './router'
|
|
|
|
import store from './store'
|
|
|
|
import store from './store'
|
|
|
@ -22,7 +22,7 @@ const whiteList = ['/login', '/register', '/bigScreen']
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
NProgress.start()
|
|
|
|
NProgress.start()
|
|
|
|
// console.log('tototo',to.path);
|
|
|
|
// console.log('tototo',to.path);
|
|
|
|
if(localStorage.getItem('accessToken') && localStorage.getItem('account')) {
|
|
|
|
if(localStorage.getItem('accessToken')) {
|
|
|
|
next()
|
|
|
|
next()
|
|
|
|
NProgress.done()
|
|
|
|
NProgress.done()
|
|
|
|
} else if (window.location.href.includes("code=")) {
|
|
|
|
} else if (window.location.href.includes("code=")) {
|
|
|
@ -33,10 +33,7 @@ router.beforeEach((to, from, next) => {
|
|
|
|
// console.log(res,"res")
|
|
|
|
// console.log(res,"res")
|
|
|
|
// setAccessToken(res.data.accessToken)
|
|
|
|
// setAccessToken(res.data.accessToken)
|
|
|
|
localStorage.setItem('accessToken',res.data.accessToken)
|
|
|
|
localStorage.setItem('accessToken',res.data.accessToken)
|
|
|
|
return getUserinfo({ accessToken: res.data.accessToken })
|
|
|
|
// return getUserinfo({ accessToken: res.data.accessToken })
|
|
|
|
}).then(el=>{
|
|
|
|
|
|
|
|
// setToken(el.data.token)
|
|
|
|
|
|
|
|
localStorage.setItem('account',el.data.account)
|
|
|
|
|
|
|
|
let url = window.location.href;
|
|
|
|
let url = window.location.href;
|
|
|
|
var modifiedUrl = url.replace(/[\?&](code)=.*?(#\/|$)/g, '');
|
|
|
|
var modifiedUrl = url.replace(/[\?&](code)=.*?(#\/|$)/g, '');
|
|
|
|
// console.log(modifiedUrl,'modifiedUrl');
|
|
|
|
// console.log(modifiedUrl,'modifiedUrl');
|
|
|
@ -44,6 +41,11 @@ router.beforeEach((to, from, next) => {
|
|
|
|
// next()
|
|
|
|
// next()
|
|
|
|
NProgress.done()
|
|
|
|
NProgress.done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
// .then(el=>{
|
|
|
|
|
|
|
|
// // setToken(el.data.token)
|
|
|
|
|
|
|
|
// // localStorage.setItem('account',el.data.account)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
// .then(res=>{
|
|
|
|
// .then(res=>{
|
|
|
|
// localStorage.setItem('AuserInfo', JSON.stringify(el.data))
|
|
|
|
// localStorage.setItem('AuserInfo', JSON.stringify(el.data))
|
|
|
|
|
|
|
|
|
|
|
|