Sfoglia il codice sorgente

feat: 增加路由获取子菜单功能

louhangfei 1 anno fa
parent
commit
d555f36ca1
5 ha cambiato i file con 19 aggiunte e 7 eliminazioni
  1. 1 2
      .gitignore
  2. 14 0
      public/app.config.js
  3. 0 2
      src/enums/pageEnum.ts
  4. 2 2
      src/router/router-guards.ts
  5. 2 1
      vite.config.ts

+ 1 - 2
.gitignore

@@ -27,6 +27,5 @@ pnpm-debug.log*
 pnpm-lock.yaml
 vite.config.ts.timestamp*
 pnpm-lock.yaml
-public/app.config.js
-public-dev/app.config.js
+ 
 .history

+ 14 - 0
public/app.config.js

@@ -0,0 +1,14 @@
+window.__PRODUCTION__SKYEYEADMIN__CONF__ = {
+
+  // document的title,以及显示在左侧导航栏的title,一般是项目的名称
+  VITE_GLOB_APP_TITLE: '上飞院大安全项目',
+  // 接口前缀
+  VITE_GLOB_API_URL_PREFIX: './eye_api_bak/api',
+
+};
+
+Object.freeze(window.__PRODUCTION__SKYEYEADMIN__CONF__);
+Object.defineProperty(window, '__PRODUCTION__SKYEYEADMIN__CONF__', {
+  configurable: false,
+  writable: false,
+});

+ 0 - 2
src/enums/pageEnum.ts

@@ -8,8 +8,6 @@ export enum PageEnum {
   // 首页
   BASE_HOME = '/home',
 
-  HOME_PAGE = '/home',
-
   //首页跳转默认路由
   BASE_HOME_REDIRECT = '/home',
   // 错误

+ 2 - 2
src/router/router-guards.ts

@@ -11,7 +11,7 @@ import { getRedirectUrl } from '@/utils/getRedirectUrl';
 
 const LOGIN_PATH = PageEnum.BASE_LOGIN;
 
-const whitePathList = [LOGIN_PATH, PageEnum.HOME_PAGE]; // no redirect whitelist
+const whitePathList = [LOGIN_PATH, PageEnum.BASE_HOME]; // no redirect whitelist
 
 export function createRouterGuards(router: Router) {
   const userStore = useUserStoreWidthOut();
@@ -69,7 +69,7 @@ export function createRouterGuards(router: Router) {
       });
     } catch (err) {
       console.log('login error', err);
-      window.location.href = getRedirectUrl();
+      // window.location.href = getRedirectUrl();
     }
 
     //添加404

+ 2 - 1
vite.config.ts

@@ -34,7 +34,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
   const isBuild = command === 'build';
   return {
     base: './',
-    publicDir: isBuild ? 'public' : 'public-dev',
+    publicDir: 'public',
+    esbuild: {},
     resolve: {
       alias: {
         '@': resolve(__dirname, './src'),