|
@@ -5,10 +5,10 @@ import { query } from '@/utils/query'
|
|
|
|
|
|
Vue.use(VueRouter)
|
|
|
const routes = [
|
|
|
- {
|
|
|
- path: '/',
|
|
|
- redirect: '/home/overview', // 只有区域,及区域以上用户才能进入总部首页这一套
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // path: '/',
|
|
|
+ // redirect: '/home/overview', // 只有区域,及区域以上用户才能进入总部首页这一套
|
|
|
+ // },
|
|
|
{
|
|
|
path: '/404',
|
|
|
component: () => import('../components/404'),
|
|
@@ -72,40 +72,40 @@ const router = new VueRouter({
|
|
|
routes,
|
|
|
})
|
|
|
//不需要token的路由
|
|
|
-// const ignore = ['/404', '/home/legendLibrary', '/home/legendRules']
|
|
|
-// router.beforeEach(async (to, from, next) => {
|
|
|
-// if (!ignore.includes(to.path)) {
|
|
|
-// const token = store.getters['ssoToken'] || query().token
|
|
|
-// if (token) {
|
|
|
-// store.commit('SETSSOTOKEN', token)
|
|
|
-// if (to.path == '/') {
|
|
|
-// next('/group')
|
|
|
-// }
|
|
|
-// if (to.path == '/group' || to.path == '/home/homepage') {
|
|
|
-// if (store.state.accessLevel == -1) {
|
|
|
-// await store.dispatch('getUserInfo', router)
|
|
|
-// await store.dispatch('getBrand')
|
|
|
-// }
|
|
|
-// }
|
|
|
-// await store.dispatch('getFloors')
|
|
|
-// await store.dispatch('getBrand')
|
|
|
-// 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', '/home/legendLibrary', '/home/legendRules']
|
|
|
+router.beforeEach(async (to, from, next) => {
|
|
|
+ if (!ignore.includes(to.path)) {
|
|
|
+ const token = store.getters['ssoToken'] || query().token
|
|
|
+ if (token) {
|
|
|
+ store.commit('SETSSOTOKEN', token)
|
|
|
+ if (to.path == '/') {
|
|
|
+ next('/group')
|
|
|
+ }
|
|
|
+ if (to.path == '/group' || to.path == '/home/homepage') {
|
|
|
+ if (store.state.accessLevel == -1) {
|
|
|
+ await store.dispatch('getUserInfo', router)
|
|
|
+ await store.dispatch('getBrand')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ await store.dispatch('getFloors')
|
|
|
+ await store.dispatch('getBrand')
|
|
|
+ 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
|