diff --git a/packages/fes-plugin-layout/src/index.js b/packages/fes-plugin-layout/src/index.js
index 1870e1e6..cc55ae20 100644
--- a/packages/fes-plugin-layout/src/index.js
+++ b/packages/fes-plugin-layout/src/index.js
@@ -80,14 +80,31 @@ export default (api) => {
},
]);
- // 把BaseLayout插入到路由配置中,作为根路由
- api.modifyRoutes((routes) => [
- {
- path: '/',
- component: winPath(join(api.paths.absTmpPath || '', absFilePath)),
- children: routes,
- },
- ]);
+ // 把 BaseLayout插入到路由配置中,作为根路由
+ // 添加 403 和 404 路由
+ api.modifyRoutes((routes) => {
+ if (!routes.find((item) => item.path === '/403')) {
+ routes.push({
+ path: '/403',
+ name: 'Exception403',
+ component: winPath(join(api.paths.absTmpPath, join(namespace, 'views/403.vue'))),
+ });
+ }
+ if (!routes.find((item) => item.path === '/404')) {
+ routes.push({
+ path: '/404',
+ name: 'Exception404',
+ component: winPath(join(api.paths.absTmpPath, join(namespace, 'views/404.vue'))),
+ });
+ }
+ return [
+ {
+ path: '/',
+ component: winPath(join(api.paths.absTmpPath || '', absFilePath)),
+ children: routes,
+ },
+ ];
+ });
api.addConfigType(() => ({
source: name,
diff --git a/packages/fes-plugin-layout/src/runtime/assets/403.png b/packages/fes-plugin-layout/src/runtime/assets/403.png
new file mode 100644
index 00000000..73e54154
Binary files /dev/null and b/packages/fes-plugin-layout/src/runtime/assets/403.png differ
diff --git a/packages/fes-plugin-layout/src/runtime/assets/404.png b/packages/fes-plugin-layout/src/runtime/assets/404.png
new file mode 100644
index 00000000..96944031
Binary files /dev/null and b/packages/fes-plugin-layout/src/runtime/assets/404.png differ
diff --git a/packages/fes-plugin-layout/src/runtime/runtime.js b/packages/fes-plugin-layout/src/runtime/runtime.js
index 2e087953..de9ab180 100644
--- a/packages/fes-plugin-layout/src/runtime/runtime.js
+++ b/packages/fes-plugin-layout/src/runtime/runtime.js
@@ -1,32 +1,16 @@
// eslint-disable-next-line import/extensions
import { access as accessApi } from '../plugin-access/core';
-import Exception404 from './views/404.vue';
-import Exception403 from './views/403.vue';
// eslint-disable-next-line import/extensions
import getConfig from './helpers/getConfig';
if (!accessApi) {
- throw new Error('[plugin-layout]: pLugin-layout depends on plugin-access,please install plugin-access first!');
+ throw new Error('[plugin-layout]: plugin-layout depends on plugin-access,please install plugin-access first!');
}
-const handle = (type, router) => {
- const accessIds = accessApi.getAccess();
- const path = `/${type}`;
- const name = `Exception${type}`;
- const components = {
- 404: Exception404,
- 403: Exception403,
- };
- if (!accessIds.includes(path)) {
- accessApi.setAccess(accessIds.concat([path]));
- }
- if (!router.hasRoute(name)) {
- router.addRoute({ path, name, component: components[type] });
- }
-};
-
export const access = (memo) => {
const runtimeConfig = getConfig();
+ const accessIds = accessApi.getAccess();
+ accessApi.setAccess(accessIds.concat(['/403', '/404']));
return {
unAccessHandler({ router, to, from, next }) {
if (runtimeConfig.unAccessHandler && typeof runtimeConfig.unAccessHandler === 'function') {
@@ -37,11 +21,6 @@ export const access = (memo) => {
next,
});
}
- if (to.path === '/404') {
- handle(404, router);
- return next('/404');
- }
- handle(403, router);
next('/403');
},
noFoundHandler({ router, to, from, next }) {
@@ -53,11 +32,6 @@ export const access = (memo) => {
next,
});
}
- if (to.path === '/403') {
- handle(403, router);
- return next('/403');
- }
- handle(404, router);
next('/404');
},
...memo,
diff --git a/packages/fes-plugin-layout/src/runtime/views/403.vue b/packages/fes-plugin-layout/src/runtime/views/403.vue
index 0da87747..78a2b93c 100644
--- a/packages/fes-plugin-layout/src/runtime/views/403.vue
+++ b/packages/fes-plugin-layout/src/runtime/views/403.vue
@@ -1,241 +1,19 @@
-
-
-
对不起,您没有权限访问此页面。
-
上一页
-
+
-
diff --git a/packages/fes-plugin-layout/src/runtime/views/404.vue b/packages/fes-plugin-layout/src/runtime/views/404.vue
index 470845fc..16fda346 100644
--- a/packages/fes-plugin-layout/src/runtime/views/404.vue
+++ b/packages/fes-plugin-layout/src/runtime/views/404.vue
@@ -1,266 +1,19 @@
-
-
-
对不起,您访问的页面不存在。
-
上一页
-
+
-
diff --git a/packages/fes-plugin-layout/src/runtime/views/components/Wrapper.vue b/packages/fes-plugin-layout/src/runtime/views/components/Wrapper.vue
new file mode 100644
index 00000000..6839e25c
--- /dev/null
+++ b/packages/fes-plugin-layout/src/runtime/views/components/Wrapper.vue
@@ -0,0 +1,76 @@
+
+
+
![]()
+
{{ title }}
+
{{ subTitle }}
+
+ 返回上一页
+
+
+
+
+
diff --git a/packages/fes-template-vite/src/app.jsx b/packages/fes-template-vite/src/app.jsx
index ece05860..7ef089ee 100644
--- a/packages/fes-template-vite/src/app.jsx
+++ b/packages/fes-template-vite/src/app.jsx
@@ -23,5 +23,8 @@ export const beforeRender = {
};
export const layout = {
- renderCustom: () => ,
+ renderCustom: (props) => {
+ console.log(props);
+ return ;
+ },
};