0.0.2版本上线

This commit is contained in:
2024-08-16 19:00:08 +08:00
parent 29e8758dc9
commit 4b73f5b68c
11 changed files with 301 additions and 299 deletions

View File

@@ -3,6 +3,8 @@ import setupUserLoginInfoGuard from "./userLoginInfo"
import setupPermissionGuard from "@/router/guard/permisstion"
// 导入设置title的工具
import { setRouteTitle } from "@/utils/title"
// 为了已登录用户直接进入login
import { useUserStore } from "@/store"
function setupPageGuard(router) {
router.beforeEach(async (to) => {
@@ -13,6 +15,17 @@ function setupPageGuard(router) {
router.afterEach((to, from) => {
setRouteTitle(to.meta.title)
})
// 设置如果已登录用户进入login页面则直接进入工作台
router.beforeEach((to) => {
const userStore = useUserStore()
if (to.name === "login") {
if (userStore.isLogin()) {
return {
name: "workplace"
}
}
}
})
}
export default function createRouteGuard(router) {

View File

@@ -5,6 +5,7 @@ export default function setupUserLoginInfoGuard(router) {
router.beforeEach(async (to, from) => {
NProgress.start()
const userStore = useUserStore()
// 如果用户已经登录
if (userStore.isLogin()) {
if (userStore.role) {
return