新增内容
This commit is contained in:
@@ -8,9 +8,8 @@
|
||||
import { reactive, ref, watch, computed } from "vue"
|
||||
import { useAppStore } from "@/store"
|
||||
|
||||
import Editor from "@tinymce/tinymce-vue"
|
||||
import tinymce from "tinymce/tinymce.min.js"
|
||||
|
||||
import Editor from "@tinymce/tinymce-vue"
|
||||
import "tinymce/icons/default/icons.min.js"
|
||||
import "tinymce/models/dom/model.min.js"
|
||||
import "tinymce/themes/silver/theme.min.js"
|
||||
|
||||
@@ -5,6 +5,8 @@ import setupPermissionGuard from "@/router/guard/permisstion"
|
||||
import { setRouteTitle } from "@/utils/title"
|
||||
// 为了已登录用户直接进入login
|
||||
import { useUserStore } from "@/store"
|
||||
import NProgress from "nprogress" // progress bar
|
||||
import "nprogress/nprogress.css"
|
||||
|
||||
function setupPageGuard(router) {
|
||||
router.beforeEach(async (to) => {
|
||||
@@ -14,6 +16,7 @@ function setupPageGuard(router) {
|
||||
// 设置站点document.title
|
||||
router.afterEach((to, from) => {
|
||||
setRouteTitle(to.meta.title)
|
||||
NProgress.done()
|
||||
})
|
||||
// 设置如果已登录用户进入login页面则直接进入工作台
|
||||
router.beforeEach((to) => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { appRoutes } from "../routes"
|
||||
import { WHITE_LIST, NOT_FOUND } from "../constants"
|
||||
// 权限守卫
|
||||
export default function setupPermissionGuard(router) {
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
router.beforeEach(async (to, from) => {
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const Permission = usePermission()
|
||||
@@ -34,16 +34,18 @@ export default function setupPermissionGuard(router) {
|
||||
}
|
||||
}
|
||||
if (exist && permissionsAllow) {
|
||||
next()
|
||||
} else next(NOT_FOUND)
|
||||
return true
|
||||
} else {
|
||||
return NOT_FOUND
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line no-lonely-if
|
||||
if (permissionsAllow) next()
|
||||
else {
|
||||
if (permissionsAllow) {
|
||||
return true
|
||||
} else {
|
||||
const destination = Permission.findFirstPermissionRoute(appRoutes, userStore.role) || NOT_FOUND
|
||||
next(destination)
|
||||
return destination
|
||||
}
|
||||
}
|
||||
NProgress.done()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user