+
功能测试
@@ -173,17 +164,11 @@ class TestPageContainer extends React.Component {
上方图片,一张是img,一张是background
-
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
-
+ 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
-
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
-
+ 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
-
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"
-
+ 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"
@@ -234,10 +219,7 @@ class TestPageContainer extends React.Component {
action测试
-
-
this.handleCancel()}
- onCancel={() => this.handleCancel()}
- >
+ this.handleCancel()} onCancel={() => this.handleCancel()}>
内容...
@@ -304,17 +265,17 @@ class TestPageContainer extends React.Component {
}
}
-const FormComponent = Form.create()(TestPageContainer);
+const FormComponent = Form.create()(TestClassPageContainer);
export default connect(
state => ({
userinfo: state.app.userinfo, // 引入app model中的userinfo数据
- count: state.test.count // 引入test model中的count数据
+ count: state.test.count, // 引入test model中的count数据
}),
model => ({
actions: {
getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action
onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action
- serverFetch: model.test.serverFetch // 引入test model中的fetch异步请求action
- }
- })
+ serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action
+ },
+ }),
)(FormComponent);
diff --git a/src/container/testclass/index.less b/src/container/testclass/index.less
index c17db627..1abb7753 100644
--- a/src/container/testclass/index.less
+++ b/src/container/testclass/index.less
@@ -1,4 +1,4 @@
-.page-test {
+.page-test-class {
width: 100%;
max-width: 1200px;
margin: 0 auto;
diff --git a/webpack.dev.config.js b/webpack.dev.config.js
index d4cfef66..f87a3517 100644
--- a/webpack.dev.config.js
+++ b/webpack.dev.config.js
@@ -3,6 +3,7 @@
const path = require("path"); // 获取绝对路径用
const webpack = require("webpack"); // webpack核心
const HtmlWebpackPlugin = require("html-webpack-plugin"); // 动态生成html插件
+const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin");
const HappyPack = require("happypack"); // 多线程编译
const webpackbar = require("webpackbar");
const PUBLIC_PATH = "/"; // 基础路径
@@ -92,6 +93,7 @@ module.exports = {
plugins: [
new webpackbar(),
new webpack.HotModuleReplacementPlugin(), // 热更新插件
+ new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs
new webpack.DefinePlugin({
"process.env": JSON.stringify({
PUBLIC_URL: PUBLIC_PATH,
diff --git a/webpack.production.config.js b/webpack.production.config.js
index e4449381..347d9a81 100644
--- a/webpack.production.config.js
+++ b/webpack.production.config.js
@@ -4,6 +4,7 @@ const path = require("path");
const webpack = require("webpack"); // webpack核心
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // 为了单独打包css
const HtmlWebpackPlugin = require("html-webpack-plugin"); // 生成html
+const AntdDayjsWebpackPlugin = require("antd-dayjs-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin"); // 每次打包前清除旧的build文件夹
const SWPrecacheWebpackPlugin = require("sw-precache-webpack-plugin"); // 生成一个server-worker用于缓存
const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); // 自动生成各尺寸的favicon图标
@@ -28,7 +29,7 @@ module.exports = {
chunkFilename: "dist/[name].[chunkhash:8].chunk.js",
},
stats: {
- warningsFilter: warning => /Conflicting order between/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告
+ warningsFilter: warning => /Conflicting order/gm.test(warning), // 不输出一些警告,多为因CSS引入顺序不同导致的警告
children: false, // 不输出子模块的打包信息
},
optimization: {
@@ -115,6 +116,7 @@ module.exports = {
* **/
new CleanWebpackPlugin(),
new webpackbar(),
+ new AntdDayjsWebpackPlugin(), // dayjs 替代 momentjs
/**
* 在window环境中注入全局变量
* 这里这么做是因为src/registerServiceWorker.js中有用到,为了配置PWA
From cd7ebded3daca625ebefb006da1794f4826b20ce Mon Sep 17 00:00:00 2001
From: Logic <376693576@qq.com>
Date: Mon, 30 Dec 2019 17:48:59 +0800
Subject: [PATCH 10/98] favicons update
---
package.json | 2 +-
webpack.production.config.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 4d31f266..de385956 100644
--- a/package.json
+++ b/package.json
@@ -62,7 +62,7 @@
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^2.3.0",
"express": "^4.17.1",
- "favicons-webpack-plugin": "^1.0.2",
+ "favicons-webpack-plugin": "2.0.0",
"file-loader": "^5.0.2",
"happypack": "^5.0.1",
"html-webpack-plugin": "^3.2.0",
diff --git a/webpack.production.config.js b/webpack.production.config.js
index 347d9a81..046e0432 100644
--- a/webpack.production.config.js
+++ b/webpack.production.config.js
@@ -185,8 +185,8 @@ module.exports = {
icons: {
// 生成哪些平台需要的图标
android: true, // 安卓
- appleIcon: true, // 苹果
- appleStartup: true, // 苹果启动页
+ appleIcon: false, // 苹果
+ appleStartup: false, // 苹果启动页
coast: false, // opera
favicons: true, // web小图标
firefox: false, // 火狐
From b5e4ddc56f30087ae0635e40b08c8d2994bdc974 Mon Sep 17 00:00:00 2001
From: Logic <376693576@qq.com>
Date: Sat, 18 Jan 2020 12:31:34 +0800
Subject: [PATCH 11/98] update package.json
---
package.json | 42 +++++++++---------
src/container/routers/index.js | 34 ++++++++++-----
src/container/test/index.js | 45 +++++++++++++------
src/container/testclass/index.js | 75 +++++++++++++++++++++++---------
4 files changed, 131 insertions(+), 65 deletions(-)
diff --git a/package.json b/package.json
index de385956..36a9f9b5 100644
--- a/package.json
+++ b/package.json
@@ -24,10 +24,10 @@
},
"dependencies": {
"@rematch/core": "^1.3.0",
- "antd": "3.26.4",
- "antd-dayjs-webpack-plugin": "^0.0.7",
- "axios": "^0.19.0",
- "core-js": "^3.6.1",
+ "antd": "3.26.7",
+ "antd-dayjs-webpack-plugin": "^0.0.8",
+ "axios": "^0.19.1",
+ "core-js": "^3.6.4",
"history": "^4.10.1",
"lodash": "^4.17.15",
"react": "^16.12.0",
@@ -38,28 +38,28 @@
"redux": "^4.0.5"
},
"devDependencies": {
- "@babel/core": "^7.7.7",
- "@babel/plugin-proposal-class-properties": "^7.7.4",
- "@babel/plugin-proposal-decorators": "^7.7.4",
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
- "@babel/plugin-proposal-object-rest-spread": "^7.7.7",
- "@babel/plugin-proposal-optional-chaining": "^7.7.5",
- "@babel/plugin-syntax-dynamic-import": "^7.7.4",
- "@babel/plugin-transform-runtime": "^7.7.6",
- "@babel/preset-env": "^7.7.7",
- "@babel/preset-react": "^7.7.4",
- "@babel/runtime": "^7.7.7",
- "autoprefixer": "^9.7.3",
+ "@babel/core": "^7.8.3",
+ "@babel/plugin-proposal-class-properties": "^7.8.3",
+ "@babel/plugin-proposal-decorators": "^7.8.3",
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
+ "@babel/plugin-proposal-object-rest-spread": "^7.8.3",
+ "@babel/plugin-proposal-optional-chaining": "^7.8.3",
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
+ "@babel/plugin-transform-runtime": "^7.8.3",
+ "@babel/preset-env": "^7.8.3",
+ "@babel/preset-react": "^7.8.3",
+ "@babel/runtime": "^7.8.3",
+ "autoprefixer": "^9.7.4",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-plugin-import": "^1.13.0",
"body-parser": "^1.19.0",
"clean-webpack-plugin": "^3.0.0",
- "css-loader": "^3.4.0",
+ "css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-prettier": "^3.1.2",
- "eslint-plugin-react": "^7.17.0",
+ "eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^2.3.0",
"express": "^4.17.1",
"favicons-webpack-plugin": "2.0.0",
@@ -73,11 +73,11 @@
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0",
"prettier": "1.19.1",
- "style-loader": "1.0.1",
+ "style-loader": "1.1.3",
"sw-precache-webpack-plugin": "^0.11.5",
- "terser-webpack-plugin": "^2.3.1",
+ "terser-webpack-plugin": "^2.3.2",
"url-loader": "^3.0.0",
- "webpack": "^4.41.4",
+ "webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-middleware": "^3.7.2",
"webpack-hot-middleware": "^2.25.0",
diff --git a/src/container/routers/index.js b/src/container/routers/index.js
index 3632faf6..af42916e 100644
--- a/src/container/routers/index.js
+++ b/src/container/routers/index.js
@@ -24,23 +24,23 @@ import "./index.less";
const Home = Loadable({
loader: () => import(/* webpackChunkName:'home' */ "../home"),
loading: Loading, // 自定义的Loading动画组件
- timeout: 10000, // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息)
+ timeout: 10000 // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息)
});
const Test = Loadable({
loader: () => import(/* webpackChunkName:'test' */ "../test"),
- loading: Loading,
+ loading: Loading
});
const TestClass = Loadable({
loader: () => import(/* webpackChunkName:'testclass' */ "../testclass"),
- loading: Loading,
+ loading: Loading
});
const Features = Loadable({
loader: () => import(/* webpackChunkName:'features' */ "../features"),
- loading: Loading,
+ loading: Loading
});
const NotFound = Loadable({
loader: () => import(/* webpackChunkName:'notfound' */ "../notfound"),
- loading: Loading,
+ loading: Loading
});
const history = createHistory(); // 实例化history对象
@@ -77,10 +77,22 @@ function RootRouterContainer(props) {
- onEnter(Home, props)} />
- onEnter(Features, props)} />
- onEnter(Test, props)} />
- onEnter(TestClass, props)} />
+ onEnter(Home, props)}
+ />
+ onEnter(Features, props)}
+ />
+ onEnter(Test, props)}
+ />
+ onEnter(TestClass, props)}
+ />
@@ -98,6 +110,6 @@ function RootRouterContainer(props) {
export default connect(
state => ({}),
dispatch => ({
- actions: {},
- }),
+ actions: {}
+ })
)(RootRouterContainer);
diff --git a/src/container/test/index.js b/src/container/test/index.js
index 59107cf9..c97f3f98 100644
--- a/src/container/test/index.js
+++ b/src/container/test/index.js
@@ -22,7 +22,7 @@ function TestPageContainer({
match, // 自动注入的match对象
history, // 自动注入的history对象
actions, // 上面model中定义的actions对象,自动成为this.props.actions变量
- form, // antd的form表单高阶组件自动注入的form对象
+ form // antd的form表单高阶组件自动注入的form对象
}) {
const [visible, setVisible] = useState(false); // 模态框隐藏和显示
const [mokeFetch, setMokeFetch] = useState([]); // 用于测试fetch请求
@@ -93,11 +93,17 @@ function TestPageContainer({
上方图片,一张是img,一张是background
- 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
+
+ 请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
+
- 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
+
+ 如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
+
- 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"
+
+ 如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"
+
@@ -133,13 +139,21 @@ function TestPageContainer({
{getFieldDecorator("username", {
- rules: [{ required: true, message: "请输入用户名" }],
- })(} placeholder="用户名" />)}
+ rules: [{ required: true, message: "请输入用户名" }]
+ })(
+ } placeholder="用户名" />
+ )}
{getFieldDecorator("password", {
- rules: [{ required: true, message: "请输入密码" }],
- })(} placeholder="密码" />)}
+ rules: [{ required: true, message: "请输入密码" }]
+ })(
+ }
+ placeholder="密码"
+ />
+ )}
@@ -208,7 +222,12 @@ function TestPageContainer({
-