ソースを参照

修改自动登录

dengrui 1 ヶ月 前
コミット
4d9b111220
2 ファイル変更8 行追加6 行削除
  1. 5 2
      src/layout/components/Sidebar/index.vue
  2. 3 4
      src/plugins/permission.ts

+ 5 - 2
src/layout/components/Sidebar/index.vue

@@ -81,9 +81,12 @@ const setTitle = () => {
     case "planprocess":
       title.value = "生产计划";
       break;
-      case "outsource":
+    case "outsource":
       title.value = "质量管理";
-      break;  
+      break;
+    case "production":
+      title.value = "工序管理";
+      break;
   }
 };
 onMounted(() => {

+ 3 - 4
src/plugins/permission.ts

@@ -12,8 +12,6 @@ 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");
 
@@ -52,7 +50,8 @@ export function setupPermission() {
               accessRoutes.forEach((route) => {
                 router.addRoute(route);
               });
-              next({ path: path ? path : "" });
+
+              next({ path: to.fullPath });
             } catch (error) {
               console.error("beforeEach error", error);
               // 移除 token 并跳转登录页
@@ -80,7 +79,7 @@ export function setupPermission() {
           accessRoutes.forEach((route) => {
             router.addRoute(route);
           });
-          next({ path: path });
+          next({ path: to.fullPath });
         } catch (error) {
           console.error("beforeEach error", error);
           // 移除 token 并跳转登录页