From e914ac09d15f8443ef802257a60605f4dad4d232 Mon Sep 17 00:00:00 2001
From: wkj <278599135@qq.com>
Date: Wed, 31 Aug 2022 15:12:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E7=89=88=E5=BC=95=E5=85=A5=E7=9A=84?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/template.js | 4 ++++
src/template.ts | 4 ++++
template/web/src/App.tsx | 17 +++++------------
template/web/src/AppContainer.tsx | 21 +++++++++++++++++++++
4 files changed, 34 insertions(+), 12 deletions(-)
create mode 100644 template/web/src/AppContainer.tsx
diff --git a/lib/template.js b/lib/template.js
index bbe2d22..6ec34be 100644
--- a/lib/template.js
+++ b/lib/template.js
@@ -465,9 +465,13 @@ function oakConfigContentWithWeChatMp() {
exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp;
function appJsonContentWithWeb(isDev) {
const pages = [
+ '@project/pages/store/list/index',
+ '@project/pages/store/upsert/index',
+ '@project/pages/store/detail/index',
'@project/pages/book/list/index',
'@project/pages/book/upsert/index',
'@project/pages/book/detail/index',
+ '@oak-general-business/pages/login/index',
];
return `{
"pages": ${JSON.stringify(pages, null, 4)}
diff --git a/src/template.ts b/src/template.ts
index 21907bd..0b683d2 100644
--- a/src/template.ts
+++ b/src/template.ts
@@ -476,9 +476,13 @@ export function oakConfigContentWithWeChatMp() {
export function appJsonContentWithWeb(isDev: boolean) {
const pages = [
+ '@project/pages/store/list/index',
+ '@project/pages/store/upsert/index',
+ '@project/pages/store/detail/index',
'@project/pages/book/list/index',
'@project/pages/book/upsert/index',
'@project/pages/book/detail/index',
+ '@oak-general-business/pages/login/index',
];
return `{
"pages": ${JSON.stringify(pages, null, 4)}
diff --git a/template/web/src/App.tsx b/template/web/src/App.tsx
index d178d57..f78053b 100644
--- a/template/web/src/App.tsx
+++ b/template/web/src/App.tsx
@@ -2,12 +2,11 @@ import React from 'react';
import { Routes, Route } from 'react-router-dom';
import './App.less';
-import Loading from './components/Loading';
+import AppContainer from './AppContainer';
+
const Console = React.lazy(() => import('./components/console'));
const Frontend = React.lazy(() => import('./components/frontend'));
const NotFound = React.lazy(() => import('./components/notFound'));
-const Message = React.lazy(() => import('@oak-general-business/components/message'));
-const DebugPanel = React.lazy(() => import('@oak-general-business/components/func/debugPanel'));
type Router = {
path: string;
@@ -22,11 +21,7 @@ function getRoutes(routers2: Router[], namespace?: string) {
}>
-
-
- }
+ element={}
>
);
});
@@ -36,8 +31,7 @@ let routers: Router[] = [];
function App() {
return (
-
-
+
}>
{getRoutes(routers, 'console')}
@@ -47,8 +41,7 @@ function App() {
} />
- {process.env.NODE_ENV === 'development' && }
-
+
);
}
diff --git a/template/web/src/AppContainer.tsx b/template/web/src/AppContainer.tsx
new file mode 100644
index 0000000..052d5ed
--- /dev/null
+++ b/template/web/src/AppContainer.tsx
@@ -0,0 +1,21 @@
+import React, { lazy } from 'react';
+import Loading from './components/Loading';
+const Message = lazy(() => import('@oak-general-business/components/message'));
+const DebugPanel = lazy(() => import('@oak-general-business/components/func/debugPanel'));
+
+type AppContainerProps = {
+ children?: React.ReactNode
+};
+
+const AppContainer = (props: AppContainerProps) => {
+ const { children } = props;
+ return (
+ }>
+
+ {children}
+ {process.env.NODE_ENV === 'development' && }
+
+ );
+};
+
+export default AppContainer;
\ No newline at end of file