dengrui 1 mese fa
parent
commit
604d49c0db

+ 3 - 0
src/layout/components/Sidebar/components/SidebarMixTopMenu.vue

@@ -88,6 +88,9 @@ onMounted(() => {
   if (routePath == "/deviceList") {
     routePath = "/device";
   }
+  if (routePath == "/planprocess") {
+    routePath = "/plan";
+  }
   handleMenuSelect(routePath);
 });
 </script>

+ 0 - 4
src/layout/components/Sidebar/index.vue

@@ -74,14 +74,10 @@ const toExitApp = () => {
 };
 const setTitle = () => {
   const path = route.fullPath.split("/")[1];
-  console.log(path);
   switch (path) {
     case "deviceList":
       title.value = "设备列表";
       break;
-    case "plan":
-      title.value = "生产计划";
-      break;
     case "planprocess":
       title.value = "生产计划";
       break;

+ 1 - 2
src/main.ts

@@ -19,7 +19,6 @@ import "animate.css";
 // avue
 import { setupEleAvue } from "@/plugins";
 import VueQrcode from "vue-qrcode";
-
 const app = createApp(App);
 // 全局注册 自定义指令(directive)
 setupDirective(app);
@@ -30,7 +29,7 @@ setupElIcons(app);
 // 国际化
 setupI18n(app);
 // 注册动态路由
-setupPermission("/plan/order");
+setupPermission();
 
 setupEleAvue(app);
 

+ 4 - 4
src/plugins/permission.ts

@@ -7,11 +7,13 @@ import NProgress from "@/utils/nprogress";
 import { getUserDicts } from "@/api/auth";
 import { ElStep } from "element-plus";
 
-export function setupPermission(path: string) {
+export function setupPermission() {
   // 白名单路由
   const whiteList = [""];
 
   router.beforeEach(async (to, from, next) => {
+    const path = to.fullPath.split("/")[1];
+    console.log(to.fullPath, path, "2222");
     NProgress.start();
     const hasToken = localStorage.getItem("token");
 
@@ -50,9 +52,7 @@ export function setupPermission(path: string) {
               accessRoutes.forEach((route) => {
                 router.addRoute(route);
               });
-              console.log(router, path);
-
-              next({ path: path });
+              next({ path: path ? path : "" });
             } catch (error) {
               console.error("beforeEach error", error);
               // 移除 token 并跳转登录页