eight
2024-11-07 9e188fa816e204f8a02d032e55e2bd63168a77ec
src/permission.ts
@@ -6,6 +6,7 @@
import { useNProgress } from '@/hooks/web/useNProgress'
import { usePageLoading } from '@/hooks/web/usePageLoading'
import { useDictStoreWithOut } from '@/store/modules/dict'
import { useCheckTypeStoreWithOut } from '@/store/modules/checkType'
import { useUserStoreWithOut } from '@/store/modules/user'
import { usePermissionStoreWithOut } from '@/store/modules/permission'
@@ -53,7 +54,9 @@
  '/auth-redirect',
  '/bind',
  '/register',
  '/oauthLogin/gitee'
  '/oauthLogin/gitee',
  '/calling-screen-big',
  '/calling-screen-room'
]
// 路由加载前
@@ -61,14 +64,15 @@
  console.info("router.beforeEach to: " + to.fullPath + " from: " + from.fullPath)
  start()
  loadStart()
  if (whiteList.indexOf(to.path) !== -1) {
    next()
    return
  }
  if (!getAccessToken()) {
      if (whiteList.indexOf(to.path) !== -1) {
          next()
          return
      } else {
          next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
          return
      }
    next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
    return
  }
  if (to.path === '/login') {
@@ -79,10 +83,14 @@
  // 获取所有字典
  const dictStore = useDictStoreWithOut()
  const userStore = useUserStoreWithOut()
  const checkTypeStore = useCheckTypeStoreWithOut()
  const permissionStore = usePermissionStoreWithOut()
  if (!dictStore.getIsSetDict) {
    await dictStore.setDictMap()
  }
  if (!checkTypeStore.getIsSetCheckType) {
    await checkTypeStore.setCheckTypeMap()
  }
  if (userStore.getIsSetUser ) {