吉安感知网项目-前端
罗广辉
3 days ago 1d552a3bad95caae4af15322df28e6240b797693
applications/task-work-order/src/permission.js
@@ -14,11 +14,11 @@
import { getToken } from '@/utils/auth'
import { getUrlParams } from './utils/validate'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import 'nprogress/nprogress.css'
import { logOutFun } from '@/utils/util' // progress bar style
NProgress.configure({ showSpinner: false })
const lockPage = '/lock' //锁屏页
const urlParams = getUrlParams(window.location.href)
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
const env = import.meta.env.VITE_APP_ENV
function findRouteByPath (routes, targetPath) {
@@ -67,14 +67,16 @@
          //   query: firstMenu.query || {},
          //   meta: firstMenu.meta || {},
          // })
          store.commit('ADD_TAG', {
            name: toMenu.name,
            path: toMenu.path,
            fullPath: toMenu.path,
            params: toMenu.params || {},
            query: toMenu.query || {},
            meta: toMenu.meta || {},
          })
          if (toMenu && to.meta?.isTab !== false) {
            store.commit('ADD_TAG', {
              name: toMenu.name,
              path: toMenu.path,
              fullPath: toMenu.path,
              params: toMenu.params || {},
              query: toMenu.query || {},
              meta: toMenu.meta || {},
            })
          }
          next(to.fullPath)
        }
@@ -92,10 +94,7 @@
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
        // store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
            logOutFun()
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
@@ -120,8 +119,8 @@
    if (meta.isAuth === false) {
      next()
    } else {
      env === 'development' ? next('/login') : window.location.replace(`${adminUrl}#/login`)
    }
         logOutFun()
      }
  }
})
@@ -135,7 +134,7 @@
   NProgress.done()
   const isLoginPage = to.path === '/login'
   // 根据是否登录页设置标题
   const pageTitle = isLoginPage ? '任务工单平台' : '综合管理平台'
   document.title = pageTitle
   document.title = isLoginPage ? '吉安市低空经济服务一体化平台' : '吉安市低空经济服务一体化平台'
   store.commit('SET_IS_SEARCH', false)
})