|
@@ -9,10 +9,10 @@ import {
|
|
|
} from "@/api/public.js"
|
|
|
Vue.use(VueRouter)
|
|
|
const routes = [
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ {
|
|
|
+ path: '/',
|
|
|
+ redirect: '/home/overview',
|
|
|
+ },
|
|
|
{
|
|
|
path: "/404",
|
|
|
name: "404页面",
|
|
@@ -87,99 +87,99 @@ const router = new VueRouter({
|
|
|
})
|
|
|
const ignore = ["/404"]
|
|
|
|
|
|
-router.beforeEach(async (to, from, next) => {
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- let plazaId = to.query.plazaId ?to.query.plazaId:''
|
|
|
- if (plazaId) {
|
|
|
- localStorage.setItem('PLAZAID', plazaId)
|
|
|
- store.commit('STOREPLAZAID', plazaId);
|
|
|
- }
|
|
|
- let previewUrl = to.query.isPreview ? to.query.isPreview : '';
|
|
|
- if (previewUrl) {
|
|
|
- sessionStorage.setItem("SETISPREVIEW", previewUrl)
|
|
|
- store.commit('SETISPREVIEW', previewUrl)
|
|
|
- }
|
|
|
-
|
|
|
- let beforeunload = localStorage.getItem("beforeunload"),
|
|
|
- __token = null
|
|
|
- beforeunload && (__token = JSON.parse(beforeunload).ssoToken)
|
|
|
- if (!ignore.includes(to.path)) {
|
|
|
-
|
|
|
- let token = null
|
|
|
- if (to.query.token) {
|
|
|
- store.commit("SETSSOTOKEN", to.query.token)
|
|
|
- sessionStorage.setItem("SSOTOKEN", to.query.token)
|
|
|
- token = to.query.token
|
|
|
- } else {
|
|
|
- if (store.getters["ssoToken"]) {
|
|
|
- token = store.getters["ssoToken"]
|
|
|
- } else if (sessionStorage.getItem("SSOTOKEN")) {
|
|
|
- token = sessionStorage.getItem("SSOTOKEN")
|
|
|
- store.commit("SETSSOTOKEN", sessionStorage.getItem("SSOTOKEN"))
|
|
|
- } else {
|
|
|
- redirectGetToken(to,from)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (token) {
|
|
|
-
|
|
|
- store.commit('SETISPREVIEW', sessionStorage.getItem("SETISPREVIEW"))
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if(to.path !='/group' && to.path !='/home/homepage' && to.path !='/' ){
|
|
|
- if(!store.state.permissions || store.state.permissions.length ==0){
|
|
|
-
|
|
|
- await store.dispatch("getUserInfoNoPath", router)
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if (sessionStorage.getItem("TOURL")) {
|
|
|
-
|
|
|
- if (sessionStorage.getItem("TOURL") == to.path) {
|
|
|
- sessionStorage.setItem("TOURL", '')
|
|
|
- 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 {
|
|
|
- next(sessionStorage.getItem("TOURL"))
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (to.path == "/") {
|
|
|
- next("/group")
|
|
|
- }
|
|
|
- if (to.path == "/group" || to.path == "/home/homepage") {
|
|
|
- if (store.state.accessLevel == -1) {
|
|
|
- await store.dispatch("getUserInfo", router)
|
|
|
- console.log('getUserInfo', 4)
|
|
|
- await store.dispatch("getBrand")
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- await store.dispatch("getFloors")
|
|
|
- await store.dispatch("getBrand")
|
|
|
- next()
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
- } else {
|
|
|
- redirectGetToken(to,from)
|
|
|
- }
|
|
|
- } else {
|
|
|
- next()
|
|
|
- return
|
|
|
- }
|
|
|
-})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
router.afterEach((to) => {
|
|
|
let postParams = {
|