Sfoglia il codice sorgente

工时管家——动态路由

ZhouRuiTing 5 anni fa
parent
commit
96a81f78f5

+ 4 - 3
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -52,19 +52,20 @@ router.beforeEach((to, from, next) => {
         next({ path: '/login' })
     } else {
         if (!addRouFlag) {
-            addRouFlag = true
             if(user != null) {
+                addRouFlag = true
+                console.log()
                 if(user.role == 0) {
                     var getRoutes = baseRoleGetRouters(staffRouter, 1);
                     global.antRouter = fixedRouter.concat(getRoutes);
-                    router.options.routes = fixedRouter.concat(getRoutes);
                     router.addRoutes(fixedRouter.concat(getRoutes));
+                    router.options.routes = fixedRouter.concat(getRoutes);
                     router.push({ path: to.path })
                 } else {
                     var getRoutes = baseRoleGetRouters(manageRouter, 1);
                     global.antRouter = fixedRouter.concat(getRoutes);
-                    router.options.routes = fixedRouter.concat(getRoutes);
                     router.addRoutes(fixedRouter.concat(getRoutes));
+                    router.options.routes = fixedRouter.concat(getRoutes);
                     router.push({ path: to.path })
                 }
             }

+ 0 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/Login.vue

@@ -70,7 +70,6 @@
                                 } else {
                                     this.$router.push({ path: '/desktop' });
                                 }
-                                location.reload();
                             } else {
                                 this.$message({
                                     message: res.msg,