罗广辉
2025-09-30 c76922f37ddeeb3344304af453dd2f8befdedb89
src/plugins/permission.js
@@ -5,7 +5,7 @@
  removeQueryString,
  routes
} from "@/router"
import { isLogin } from "@/utils/auth"
import {useUserStore} from "@/store/index.js";
// 白名单路由
const whiteList = ["/"]
@@ -28,7 +28,7 @@
    return false
  }
  // 在白名单中或有token,直接放行
  const hasPermission = whiteList.includes(removeQueryString(path)) || isLogin()
  const hasPermission = whiteList.includes(removeQueryString(path)) || useUserStore().$state.userInfo.access_token
  if (!hasPermission) {
    // 将用户的目标路径传递过去,这样可以实现用户登录之后,直接跳转到目标页面
    uni.redirectTo({