This commit is contained in:
oneao committed 2026-03-25 17:31:22 +08:00
1 parent 11bcef03e1
commit a4e59dd5d1
39 files changed
+2333 -459

No files matched your search

+19 -6
View File
@@ -4,6 +4,7 @@ import { useUserStore } from "@/store/user";
import { ElMessage } from "element-plus";
import { useTabStore } from "@/store/tab";
import NProgress from "nprogress";
import { usePermissionStore } from "@/store/permission";
NProgress.configure({ easing: "ease", speed: 500 });
@@ -12,19 +13,31 @@ const router = createRouter({
routes,
});
router.beforeEach((to) => {
router.beforeEach(async (to) => {
NProgress?.start?.();
const userStore = useUserStore();
const permissionStore = usePermissionStore();
// if (!userStore.isLogined() && to.path !== "/login") {
// ElMessage.warning("登录已过期,请先登录");
// return "/login";
// }
if (!userStore.isLogined() && to.path !== "/login") {
ElMessage.warning("登录已过期,请先登录");
return "/login";
}
if (to.meta.moduleId) {
await permissionStore.init();
const hasPermission = permissionStore.hasModulePermission(to.meta.moduleId);
if (!hasPermission) {
ElMessage.warning("您没有权限访问此页面");
return "/";
}
}
handleTabPath(to);
return;
return true;
});
router.afterEach(() => {
@@ -7,27 +7,20 @@ export const routes = [
children: [
{
path: "/",
component: () => import("@/views/index.vue"),
component: () => import("@/views/home/index.vue"),
meta: {
title: "首页",
keepAlive: true,
},
},
// ==================== 业务管理 ====================
{
path: "/business",
component: () => import("@/views/business/index.vue"),
meta: {
title: "海运业务",
keepAlive: true,
},
},
{
path: "/container",
component: () => import("@/views/container/index.vue"),
meta: {
title: "集装箱管理",
keepAlive: true,
moduleId: "v_container",
},
},
// ==================== 系统管理 ====================
@@ -45,6 +38,7 @@ export const routes = [
meta: {
title: "权限管理",
keepAlive: true,
moduleId: "s_SetQX",
},
},
{
@@ -53,6 +47,7 @@ export const routes = [
meta: {
title: "模块设置",
keepAlive: true,
moduleId: "s_module",
},
},
{
@@ -61,6 +56,7 @@ export const routes = [
meta: {
title: "企业公告",
keepAlive: true,
moduleId: "oa_notices",
},
},
{
@@ -69,6 +65,7 @@ export const routes = [
meta: {
title: "用户提醒",
keepAlive: true,
moduleId: "s_awokemodule",
},
},
// ==================== 个人中心 ====================