Browse Source

注释路由拦截

zhangyu 4 years ago
parent
commit
862f6d449b
3 changed files with 40 additions and 36 deletions
  1. 36 35
      src/permission.ts
  2. 3 0
      src/views/manage/build/components/AddFloorDialog/index.vue
  3. 1 1
      vue.config.js

+ 36 - 35
src/permission.ts

@@ -14,41 +14,42 @@ router.beforeEach(async (to: Route, _: Route, next: any) => {
   NProgress.start();
 
   // Determine whether the user has logged in
-  if (UserModule.token) {
-    if (to.path === "/login") {
-      // If is logged in, redirect to the home page
-      next({ path: "/" });
-      NProgress.done();
-    } else {
-      // Check whether the user has obtained his permission roles
-      if (UserModule.roles.length === 0) {
-        try {
-          // Get user info, including roles
-          await UserModule.GetUserInfo();
-          // Set the replace: true, so the navigation will not leave a history record
-          next({ ...to, replace: true });
-        } catch (err) {
-          // Remove token and redirect to login page
-          UserModule.ResetToken();
-          Message.error(err || "Has Error");
-          next(`/login?redirect=${to.path}`);
-          NProgress.done();
-        }
-      } else {
-        next();
-      }
-    }
-  } else {
-    // Has no token
-    if (whiteList.indexOf(to.path) !== -1) {
-      // In the free login whitelist, go directly
-      next();
-    } else {
-      // Other pages that do not have permission to access are redirected to the login page.
-      next(`/login?redirect=${to.path}`);
-      NProgress.done();
-    }
-  }
+//   if (UserModule.token) {
+//     if (to.path === "/login") {
+//       // If is logged in, redirect to the home page
+//       next({ path: "/" });
+//       NProgress.done();
+//     } else {
+//       // Check whether the user has obtained his permission roles
+//       if (UserModule.roles.length === 0) {
+//         try {
+//           // Get user info, including roles
+//           await UserModule.GetUserInfo();
+//           // Set the replace: true, so the navigation will not leave a history record
+//           next({ ...to, replace: true });
+//         } catch (err) {
+//           // Remove token and redirect to login page
+//           UserModule.ResetToken();
+//           Message.error(err || "Has Error");
+//           next(`/login?redirect=${to.path}`);
+//           NProgress.done();
+//         }
+//       } else {
+//         next();
+//       }
+//     }
+//   } else {
+//     // Has no token
+//     if (whiteList.indexOf(to.path) !== -1) {
+//       // In the free login whitelist, go directly
+//       next();
+//     } else {
+//       // Other pages that do not have permission to access are redirected to the login page.
+//       next(`/login?redirect=${to.path}`);
+//       NProgress.done();
+//     }
+//   }
+    next();
 });
 
 router.afterEach((to: Route) => {

+ 3 - 0
src/views/manage/build/components/AddFloorDialog/index.vue

@@ -198,6 +198,9 @@ export default class extends Vue {
                 let data = {
                     FileName: this.form.file.name,
                     FloorName: FloorName,
+                    LocalName: FloorName,
+                    LocalId: FloorName,
+                    FloorSequenceId: this.form.floorSequenceID,
                     FolderId: this.FolderId,
                     RevitVersion: this.form.revitVersion,
                     Note: this.form.desc,

+ 1 - 1
vue.config.js

@@ -4,7 +4,7 @@ const devServerPort = 28888;
 const stageServerPort = 28889;
 module.exports = {
     // TODO: Remember to change publicPath to fit your need
-    publicPath: process.env.NODE_ENV === "production" ? "/wanda-adm/" : "/",
+    publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
     lintOnSave: process.env.NODE_ENV === "development",
     productionSourceMap: false,
     devServer: {