From 930383f9ae17b18d697a35ef9c73ad17dbca1e13 Mon Sep 17 00:00:00 2001
From: vben <anncwb@126.com>
Date: Wed, 23 Dec 2020 22:55:14 +0800
Subject: [PATCH] feat: add mainout page demo

---
 CHANGELOG.zh_CN.md                        |  1 +
 src/components/Upload/src/UploadModal.vue |  2 +-
 src/router/helper/menuHelper.ts           |  2 +-
 src/router/menus/modules/dashboard.ts     |  4 ++--
 src/router/menus/modules/demo/feat.ts     |  1 +
 src/router/routes/index.ts                |  3 ++-
 src/router/routes/mainOut.ts              | 17 +++++++++++++++++
 src/views/demo/main-out/index.vue         | 20 ++++++++++++++++++++
 8 files changed, 45 insertions(+), 5 deletions(-)
 create mode 100644 src/router/routes/mainOut.ts
 create mode 100644 src/views/demo/main-out/index.vue

diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md
index c5dd15f..c8a728f 100644
--- a/CHANGELOG.zh_CN.md
+++ b/CHANGELOG.zh_CN.md
@@ -5,6 +5,7 @@
 - 新增 `v-ripple`水波纹指令
 - 新增左侧菜单混合模式
 - 新增 markdown 嵌入表单内示例
+- 新增主框架外页面示例
 
 ### 🐛 Bug Fixes
 
diff --git a/src/components/Upload/src/UploadModal.vue b/src/components/Upload/src/UploadModal.vue
index 840dc9f..4b0505d 100644
--- a/src/components/Upload/src/UploadModal.vue
+++ b/src/components/Upload/src/UploadModal.vue
@@ -125,7 +125,7 @@
 
         // 设置类型,则判断
         if (accept.length > 0 && !checkFileType(file, accept)) {
-          createMessage.error!(t('acomponent.upload.cceptUpload', [accept.join(',')]));
+          createMessage.error!(t('component.upload.acceptUpload', [accept.join(',')]));
           return false;
         }
         const commonItem = {
diff --git a/src/router/helper/menuHelper.ts b/src/router/helper/menuHelper.ts
index 226c12f..2481a73 100644
--- a/src/router/helper/menuHelper.ts
+++ b/src/router/helper/menuHelper.ts
@@ -23,7 +23,7 @@ function joinParentPath(list: any, node: any) {
       parentPath += /^\//.test(p) ? p : `/${p}`;
     });
   }
-  node.path = `${parentPath}${/^\//.test(node.path) ? node.path : `/${node.path}`}`.replace(
+  node.path = `${/^\//.test(node.path) ? node.path : `${parentPath}/${node.path}`}`.replace(
     /\/\//g,
     '/'
   );
diff --git a/src/router/menus/modules/dashboard.ts b/src/router/menus/modules/dashboard.ts
index 261c0be..08852fd 100644
--- a/src/router/menus/modules/dashboard.ts
+++ b/src/router/menus/modules/dashboard.ts
@@ -8,11 +8,11 @@ const menu: MenuModule = {
     path: '/dashboard',
     children: [
       {
-        path: '/workbench',
+        path: 'workbench',
         name: t('routes.dashboard.workbench'),
       },
       {
-        path: '/analysis',
+        path: 'analysis',
         name: t('routes.dashboard.analysis'),
       },
     ],
diff --git a/src/router/menus/modules/demo/feat.ts b/src/router/menus/modules/demo/feat.ts
index 0285217..ce0d283 100644
--- a/src/router/menus/modules/demo/feat.ts
+++ b/src/router/menus/modules/demo/feat.ts
@@ -62,6 +62,7 @@ const menu: MenuModule = {
         path: 'error-log',
         name: t('routes.demo.feat.errorLog'),
       },
+
       {
         name: t('routes.demo.excel.excel'),
         path: 'excel',
diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts
index dca1da7..8b049b7 100644
--- a/src/router/routes/index.ts
+++ b/src/router/routes/index.ts
@@ -3,6 +3,7 @@ import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
 import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '../constant';
 
 import modules from 'globby!/@/router/routes/modules/**/*.@(ts)';
+import { mainOutRoutes } from './mainOut';
 import { PageEnum } from '/@/enums/pageEnum';
 
 import { t } from '/@/hooks/web/useI18n';
@@ -35,4 +36,4 @@ export const LoginRoute: AppRouteRecordRaw = {
 };
 
 // 基础路由 不用权限
-export const basicRoutes = [LoginRoute, RootRoute, REDIRECT_ROUTE];
+export const basicRoutes = [LoginRoute, RootRoute, ...mainOutRoutes, REDIRECT_ROUTE];
diff --git a/src/router/routes/mainOut.ts b/src/router/routes/mainOut.ts
new file mode 100644
index 0000000..fda8d85
--- /dev/null
+++ b/src/router/routes/mainOut.ts
@@ -0,0 +1,17 @@
+import type { AppRouteModule } from '/@/router/types';
+
+// test
+// http:ip:port/main-out
+export const mainOutRoutes: AppRouteModule[] = [
+  {
+    path: '/main-out',
+    name: 'MainOut',
+    component: () => import('/@/views/demo/main-out/index.vue'),
+    meta: {
+      title: 'MainOut',
+      ignoreAuth: true,
+    },
+  },
+];
+
+export const mainOutRouteNames = mainOutRoutes.map((item) => item.name);
diff --git a/src/views/demo/main-out/index.vue b/src/views/demo/main-out/index.vue
new file mode 100644
index 0000000..09defdb
--- /dev/null
+++ b/src/views/demo/main-out/index.vue
@@ -0,0 +1,20 @@
+<template>
+  <div class="test"> 位于主框架外的页面 </div>
+</template>
+<script lang="ts">
+  import { defineComponent } from 'vue';
+
+  export default defineComponent({});
+</script>
+
+<style scoped>
+  .test {
+    position: fixed;
+    display: flex;
+    width: 100%;
+    height: 100%;
+    justify-content: center;
+    align-items: center;
+    font-size: 50px;
+  }
+</style>
--
libgit2 0.23.3