|
@@ -73,48 +73,47 @@ const router = new VueRouter({
|
|
|
routes,
|
|
|
})
|
|
|
//不需要token的路由
|
|
|
-const ignore = ['/404', '/legendLibrary', '/legendRules']
|
|
|
-router.beforeEach(async (to, from, next) => {
|
|
|
- if (!ignore.includes(to.path)) {
|
|
|
- const token = query().token
|
|
|
- const ssoToken = store.getters['ssoToken']
|
|
|
- if (ssoToken) {
|
|
|
- if (to.path === '/group' || to.path === '/home/overview') {
|
|
|
- next()
|
|
|
- return
|
|
|
- }
|
|
|
- store.commit('SETSSOTOKEN', ssoToken)
|
|
|
- await store.dispatch('getUserInfo', router)
|
|
|
- await store.dispatch('getFloors')
|
|
|
- await store.dispatch('getBrand')
|
|
|
- let level =store.state.accessLevel
|
|
|
- console.log(level)
|
|
|
- if (level ===0) {
|
|
|
- next('/group')
|
|
|
- } else {
|
|
|
- next('/home/overview')
|
|
|
- }
|
|
|
- } else if (token) {
|
|
|
- store.commit('SETSSOTOKEN', token)
|
|
|
- await store.dispatch('getUserInfo', router)
|
|
|
- next()
|
|
|
- } else {
|
|
|
- let lastRoute = {
|
|
|
- path: to.path,
|
|
|
- params: to.params,
|
|
|
- query: to.query,
|
|
|
- }
|
|
|
- store.commit('SETLASTROUTER', lastRoute)
|
|
|
- let ssoServer = 'http://oauth.wanda-dev.cn'
|
|
|
- let systemcode = 'CAD156',
|
|
|
- signal = new Date().getTime(),
|
|
|
- version = '1.0.0'
|
|
|
- window.location.href = `${ssoServer}/login?systemcode=${systemcode}&signal=${signal}&version=${version}`
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- next()
|
|
|
- return
|
|
|
- }
|
|
|
-})
|
|
|
+// const ignore = ['/404', '/legendLibrary', '/legendRules']
|
|
|
+// router.beforeEach(async (to, from, next) => {
|
|
|
+// if (!ignore.includes(to.path)) {
|
|
|
+// const token = query().token
|
|
|
+// const ssoToken = store.getters['ssoToken']
|
|
|
+// if (ssoToken) {
|
|
|
+// // if (to.path === '/group' || to.path === '/home/overview') {
|
|
|
+// // next()
|
|
|
+// // return
|
|
|
+// // }
|
|
|
+// store.commit('SETSSOTOKEN', ssoToken)
|
|
|
+// await store.dispatch('getUserInfo', router)
|
|
|
+// await store.dispatch('getFloors')
|
|
|
+// await store.dispatch('getBrand')
|
|
|
+// let level =store.state.accessLevel
|
|
|
+// console.log(level)
|
|
|
+// // if (level ===0) {
|
|
|
+// // next('/group')
|
|
|
+// // } else {
|
|
|
+// // next('/home/overview')
|
|
|
+// // }
|
|
|
+// } else if (token) {
|
|
|
+// store.commit('SETSSOTOKEN', token)
|
|
|
+// await store.dispatch('getUserInfo', router)
|
|
|
+// next()
|
|
|
+// } else {
|
|
|
+// let lastRoute = {
|
|
|
+// path: to.path,
|
|
|
+// params: to.params,
|
|
|
+// query: to.query,
|
|
|
+// }
|
|
|
+// store.commit('SETLASTROUTER', lastRoute)
|
|
|
+// let ssoServer = 'http://oauth.wanda-dev.cn'
|
|
|
+// let systemcode = 'CAD156',
|
|
|
+// signal = new Date().getTime(),
|
|
|
+// version = '1.0.0'
|
|
|
+// window.location.href = `${ssoServer}/login?systemcode=${systemcode}&signal=${signal}&version=${version}`
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// next()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// })
|
|
|
export default router
|