├── .gitignore
├── LICENSE
├── README.md
├── config
├── env.js
├── jest
│ ├── cssTransform.js
│ └── fileTransform.js
├── paths.js
├── webpack.config.dev.js
├── webpack.config.prod.js
└── webpackDevServer.config.js
├── doc
├── 10.第十章 员工管理
│ └── 10 员工管理.md
├── 11.第十一章 车辆地图
│ └── 11 车辆地图.md
├── 12.第十二章 Echarts图表
│ └── 12 Echarts图表.md
├── 13.第十三章 权限模块
│ ├── 13.1 权限设置.md
│ ├── 13.2 菜单调整.md
│ └── 13.3 用户授权.md
├── 14.第十四章 redux集成
│ └── 14 redux项目集成.md
├── 15.第十五章 登录模块
│ ├── 15.1 登录部分.md
│ ├── 15.2登录部分封装redux.md
│ └── 15.3 页面刷新面包屑.md
├── 4.第四章 UI组件
│ ├── 4.1- 按钮+Modal组件.md
│ ├── 4.2-Spin组件.md
│ ├── 4.3 Notification 通知提醒框.md
│ ├── 4.4 Message全局提示.md
│ ├── 4.5 Tabs标签页.md
│ ├── 4.6 gallery图片画廊.md
│ └── 4.7 Carousel轮播图.md
├── 5.第五章 Form表单
│ ├── 5.1 From组件登录页面.md
│ └── 5.2 From组件注册页面.md
├── 6.第六章 Table表格
│ ├── 6.1 Table表格.md
│ └── 6.2 高级表格.md
├── 7.第七章 富文本编辑器
│ └── 7 富文本编辑器.md
├── 8.第八章 城市管理和订单管理
│ ├── 8.1 城市管理.md
│ └── 8.2 订单管理.md
├── 9.第九章 项目工程化
│ └── 9 项目工程化.md
├── README.md
├── react 单车
│ ├── 2-项目主页工程搭建.pdf
│ ├── 2.2-页面主页结构开发.pdf
│ ├── 2.6-头部组件实现(上).pdf
│ └── 第三章
│ │ └── pdf
│ │ ├── 3-1.React Router 4.0 基本概念的介绍.pdf
│ │ ├── 3-2 4.0基本路由功能DEMO实现-配置化.pdf
│ │ ├── 3.1-1 React Router4.0 Demo介绍.pdf
│ │ ├── 3.3 获取路由的id(获取url的id值).pdf
│ │ └── 3.4 项目路由实战开发.pdf
├── 接口列表.txt
├── 搭建React开发环境之前的准备工作.md
└── 项目地址.txt
├── package.json
├── public
├── assets
│ ├── bike.jpg
│ ├── end_point.png
│ ├── imooc.png
│ ├── logo-ant.svg
│ ├── start_point.png
│ └── user_location.png
├── carousel-img
│ ├── carousel-1.jpg
│ ├── carousel-2.jpg
│ └── carousel-3.jpg
├── favicon.ico
├── gallery
│ ├── 1.png
│ ├── 10.png
│ ├── 11.png
│ ├── 12.png
│ ├── 13.png
│ ├── 14.png
│ ├── 15.png
│ ├── 16.png
│ ├── 17.png
│ ├── 18.png
│ ├── 19.png
│ ├── 2.png
│ ├── 20.png
│ ├── 21.png
│ ├── 22.png
│ ├── 23.png
│ ├── 24.png
│ ├── 25.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── 6.png
│ ├── 7.png
│ ├── 8.png
│ └── 9.png
├── index.html
└── manifest.json
├── scripts
├── build.js
├── start.js
└── test.js
├── src
├── App.css
├── App.js
├── App.test.js
├── admin.js
├── axios
│ └── index.js
├── common.js
├── components
│ ├── BaseForm
│ │ └── index.js
│ ├── ETable
│ │ ├── index.js
│ │ └── index.less
│ ├── Footer
│ │ ├── index.js
│ │ └── index.less
│ ├── Header
│ │ ├── index.js
│ │ └── index.less
│ └── NavLeft
│ │ ├── index.js
│ │ └── index.less
├── config
│ └── menuConfig.js
├── index.css
├── index.js
├── logo.svg
├── pages
│ ├── city
│ │ └── index.js
│ ├── demo
│ │ ├── Child.js
│ │ ├── Life.js
│ │ └── index.less
│ ├── echarts
│ │ ├── bar
│ │ │ └── index.js
│ │ ├── echartTheme.js
│ │ ├── line
│ │ │ └── index.js
│ │ ├── pie
│ │ │ └── index.js
│ │ └── themeLight.js
│ ├── form
│ │ ├── login.js
│ │ └── register.js
│ ├── home
│ │ ├── index.js
│ │ └── index.less
│ ├── login
│ │ ├── index.js
│ │ └── index.less
│ ├── map
│ │ └── bikeMap.js
│ ├── nomatch
│ │ └── index.js
│ ├── order
│ │ ├── detail.js
│ │ ├── detail.less
│ │ └── index.js
│ ├── permission
│ │ └── index.js
│ ├── rich
│ │ └── index.js
│ ├── route_demo
│ │ ├── router1
│ │ │ ├── About.js
│ │ │ ├── Home.js
│ │ │ ├── Main.js
│ │ │ └── Topic.js
│ │ ├── router2
│ │ │ ├── Home.js
│ │ │ └── router.js
│ │ ├── router3
│ │ │ ├── Home.js
│ │ │ ├── Main.js
│ │ │ └── router.js
│ │ ├── router4
│ │ │ ├── Home.js
│ │ │ ├── Main.js
│ │ │ ├── info.js
│ │ │ └── router.js
│ │ └── router5
│ │ │ ├── Home.js
│ │ │ ├── Main.js
│ │ │ ├── NoMatch.js
│ │ │ ├── info.js
│ │ │ └── router.js
│ ├── table
│ │ ├── basicTable.js
│ │ └── highTable.js
│ ├── ui
│ │ ├── buttons.js
│ │ ├── carousel.js
│ │ ├── gallery.js
│ │ ├── loadings.js
│ │ ├── messages.js
│ │ ├── modals.js
│ │ ├── notice.js
│ │ ├── tabs.js
│ │ └── ui.less
│ └── user
│ │ └── index.js
├── redux
│ ├── action
│ │ └── index.js
│ ├── reducer
│ │ └── index.js
│ └── store
│ │ └── configureStore.js
├── resources
│ ├── assets
│ │ ├── bike.jpg
│ │ ├── carousel-img
│ │ │ ├── carousel-1.jpg
│ │ │ ├── carousel-2.jpg
│ │ │ └── carousel-3.jpg
│ │ ├── end_point.png
│ │ ├── imooc.png
│ │ ├── logo-ant.svg
│ │ ├── start_point.png
│ │ └── user_location.png
│ ├── menuConfig.js
│ └── resource
│ │ ├── api
│ │ ├── .json
│ │ ├── city
│ │ │ ├── list.json
│ │ │ └── open.json
│ │ ├── info_alarm.json
│ │ ├── map
│ │ │ └── bike_list.json
│ │ ├── mock.json
│ │ ├── open_city.json
│ │ ├── order
│ │ │ ├── detail.json
│ │ │ ├── ebike_info.json
│ │ │ ├── finish_order.json
│ │ │ └── list.json
│ │ ├── permission
│ │ │ └── edit.json
│ │ ├── proxy.json
│ │ ├── query.json
│ │ ├── restful
│ │ │ └── _id
│ │ │ │ └── list.json
│ │ ├── role
│ │ │ ├── create.json
│ │ │ ├── list.json
│ │ │ ├── user_list.json
│ │ │ └── user_role_edit.json
│ │ ├── table
│ │ │ ├── high
│ │ │ │ └── list.json
│ │ │ ├── list.json
│ │ │ └── list1.json
│ │ ├── upload.json
│ │ └── user
│ │ │ ├── add.json
│ │ │ ├── delete.json
│ │ │ └── edit.json
│ │ ├── assets
│ │ ├── bike.jpg
│ │ ├── carousel-img
│ │ │ ├── carousel-1.jpg
│ │ │ ├── carousel-2.jpg
│ │ │ └── carousel-3.jpg
│ │ ├── end_point.png
│ │ ├── imooc.png
│ │ ├── logo-ant.svg
│ │ ├── start_point.png
│ │ └── user_location.png
│ │ ├── carousel-img
│ │ ├── carousel-1.jpg
│ │ ├── carousel-2.jpg
│ │ └── carousel-3.jpg
│ │ ├── common.less
│ │ ├── default.less
│ │ ├── doc.js
│ │ ├── favicon.ico
│ │ ├── gallery
│ │ ├── 1.png
│ │ ├── 10.png
│ │ ├── 11.png
│ │ ├── 12.png
│ │ ├── 13.png
│ │ ├── 14.png
│ │ ├── 15.png
│ │ ├── 16.png
│ │ ├── 17.png
│ │ ├── 18.png
│ │ ├── 19.png
│ │ ├── 2.png
│ │ ├── 20.png
│ │ ├── 21.png
│ │ ├── 22.png
│ │ ├── 23.png
│ │ ├── 24.png
│ │ ├── 25.png
│ │ ├── 3.png
│ │ ├── 4.png
│ │ ├── 5.png
│ │ ├── 6.png
│ │ ├── 7.png
│ │ ├── 8.png
│ │ └── 9.png
│ │ ├── header
│ │ └── index.less
│ │ ├── image
│ │ └── demo.png
│ │ ├── loading.html
│ │ ├── loading.less
│ │ ├── menuConfig.js
│ │ ├── order
│ │ └── detail.less
│ │ └── ui.less
├── router.js
├── serviceWorker.js
├── style
│ ├── common.less
│ ├── default.less
│ └── loading.less
└── utils
│ └── utils.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Editor directories and files
9 | .idea
10 | .vscode
11 | *.suo
12 | *.ntvs*
13 | *.njsproj
14 | *.sln
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 lenvo222
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # React全家桶+AntD框架开发共享单车后台管理系统
4 |
5 | ### 使用介绍
6 |
7 | #### npm install 安装项目
8 |
9 | #### npm start 运行项目
10 |
11 | ------
12 |
13 |
14 |
15 |
16 | 大家好,我是河畔一角,目前在一家共享单车公司担任前端架构师职位,作为一名前端工程师,我非常渴望能够讲自己多年来汲取的精华知识传授给大家,非常渴望能够去解决大家在开发过程中的痛点。经过一段时间的调研,我总结出了其中一个非常重要的结论,大家在开发后台管理系统的时候,往往举足不定,因为工作经验不足,技术有壁垒。本次借此机会,我耗时几个月给大家做了一次针对后台管理系统的课程:[React全家桶+AntD框架开发共享单车后台管理系统](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)
17 |
18 | [ 这门课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)从几个维度进行刨析:
19 |
20 | 第一:使用目前最流行的前端MV*框架开发,React全家桶一应俱全,技术不落伍。
21 |
22 | 第二:好马配好鞍,有了技术框架,对于后台系统来说,必然需要有一把利剑,那就是AntD. AntD是蚂蚁金服公司出品的一款React UI框架,极大便利了我们的前端React开发者。可能有的同学会说,React UI框架有很多,并不止这一个,这样说确实没有问题,UI框架有很多,我们要从很多方面去综合评估,比如star数量、社区活跃度、github的issue解决数量、版本更新周期、公司平台规模等各个方面进行考察,千万别一失足成千古恨。 当然elementUI也是一款不错的UI框架,根据自己的喜好进行自由选择。
23 |
24 | 第三:后台管理系统必然需要在架构层面,做到坚如磐石,能扛起一个公司的业务,要让新入职的同事莫名的喜欢,觉得我们的系统做的非常好,工作及其有动力。
25 |
26 | 第四:对于后台管理系统来说,各个公司业务不尽相同,但是也会有业务上的差异,比如传统公司的后台会有各种报表、普通的互联网公司后台通常会有权限、增删改查的功能、单车公司的后台通常会有各种地图业务等等,面对这样的需求点,[本门实战课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)将以上功能全部进行汇聚,根据自身业务,选择性套用,一旦掌握,就可以以不变应万变,理解知识、学以致用。
27 |
28 | 第五:从技术层来讲,[本次实战课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)包括了各种公共机制的封装,比如:Loading封装、错误拦截、Ajax请求封装、Promise的使用、Modal封装、分页封装、日期金额格式化、Notice组件、message组件的使用等,对于后台管理系统来说是极大的福利。
29 |
30 | 第六:项目架构设计。 一个优秀的后台系统必然有一个优秀的后台架构。[本次实战课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)在页面结构设计上可以说涵盖了多个层次,登录页面、主页面、订单详情页面作为一级窗口,但在架构设计上又不完全相同。主页面本身又分为多级视图,因此次页面设计已经能够符合我们主流的后台管理系统设计开发。
31 |
32 | 以上是我对[本次实战课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)的6条总结,接下来我们看一下页面的内容:
33 |
34 | 1. 登录页面
35 |
36 | 
37 |
38 | 登录页面并未在[本次实战课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)做详细介绍,目前课程源码已经包含了此页面,主要是一张大背景,外加AntD设计的登录框功能,风格简单,功能实用。
39 |
40 | \2. 项目主页面
41 |
42 | 
43 |
44 | 主页面会根据当前登录用户的权限进行动态加载菜单。
45 |
46 | 3.AntD的Button页面
47 |
48 | 
49 |
50 | 4.Echart图表页面
51 |
52 | 
53 |
54 | 5.城市管理页面
55 |
56 | 
57 |
58 | 6.Echart饼形图页面
59 |
60 | 
61 |
62 | 7.UI轮播图,包含文字轮播和图片轮播
63 |
64 | 
65 |
66 | 8.车辆地图页面
67 |
68 | 
69 |
70 | 9.用户授权页面
71 |
72 | 
73 |
74 | 10.高级表格页面
75 |
76 | 
77 |
78 | 11.菜单权限页面
79 |
80 | 
81 |
82 | 12.员工管理页面
83 |
84 | 
85 |
86 | 13.表单页面
87 |
88 | 
89 |
90 | 14.订单详情页面
91 |
92 | 
93 |
94 | 从页面分布来看,[实战课程](https://coding.imooc.com/class/236.html?mc_marking=6ad933461923d016d2d2682dbe41158f&mc_channel=shouji)内容非常丰富,从UI框架到共享单车的核心模块,一应俱全。从React全家桶知识介绍到项目架构、项目工程化等非常详细的讲解了后台管理系统的开发流程和前端工程师的进阶之路。
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/config/env.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const fs = require('fs');
4 | const path = require('path');
5 | const paths = require('./paths');
6 |
7 | // Make sure that including paths.js after env.js will read .env variables.
8 | delete require.cache[require.resolve('./paths')];
9 |
10 | const NODE_ENV = process.env.NODE_ENV;
11 | if (!NODE_ENV) {
12 | throw new Error(
13 | 'The NODE_ENV environment variable is required but was not specified.'
14 | );
15 | }
16 |
17 | // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18 | var dotenvFiles = [
19 | `${paths.dotenv}.${NODE_ENV}.local`,
20 | `${paths.dotenv}.${NODE_ENV}`,
21 | // Don't include `.env.local` for `test` environment
22 | // since normally you expect tests to produce the same
23 | // results for everyone
24 | NODE_ENV !== 'test' && `${paths.dotenv}.local`,
25 | paths.dotenv,
26 | ].filter(Boolean);
27 |
28 | // Load environment variables from .env* files. Suppress warnings using silent
29 | // if this file is missing. dotenv will never modify any environment variables
30 | // that have already been set. Variable expansion is supported in .env files.
31 | // https://github.com/motdotla/dotenv
32 | // https://github.com/motdotla/dotenv-expand
33 | dotenvFiles.forEach(dotenvFile => {
34 | if (fs.existsSync(dotenvFile)) {
35 | require('dotenv-expand')(
36 | require('dotenv').config({
37 | path: dotenvFile,
38 | })
39 | );
40 | }
41 | });
42 |
43 | // We support resolving modules according to `NODE_PATH`.
44 | // This lets you use absolute paths in imports inside large monorepos:
45 | // https://github.com/facebook/create-react-app/issues/253.
46 | // It works similar to `NODE_PATH` in Node itself:
47 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
50 | // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
51 | // We also resolve them to make sure all tools using them work consistently.
52 | const appDirectory = fs.realpathSync(process.cwd());
53 | process.env.NODE_PATH = (process.env.NODE_PATH || '')
54 | .split(path.delimiter)
55 | .filter(folder => folder && !path.isAbsolute(folder))
56 | .map(folder => path.resolve(appDirectory, folder))
57 | .join(path.delimiter);
58 |
59 | // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
60 | // injected into the application via DefinePlugin in Webpack configuration.
61 | const REACT_APP = /^REACT_APP_/i;
62 |
63 | function getClientEnvironment(publicUrl) {
64 | const raw = Object.keys(process.env)
65 | .filter(key => REACT_APP.test(key))
66 | .reduce(
67 | (env, key) => {
68 | env[key] = process.env[key];
69 | return env;
70 | },
71 | {
72 | // Useful for determining whether we’re running in production mode.
73 | // Most importantly, it switches React into the correct mode.
74 | NODE_ENV: process.env.NODE_ENV || 'development',
75 | // Useful for resolving the correct path to static assets in `public`.
76 | // For example, .
77 | // This should only be used as an escape hatch. Normally you would put
78 | // images into the `src` and `import` them in code to get their paths.
79 | PUBLIC_URL: publicUrl,
80 | }
81 | );
82 | // Stringify all values so we can feed into Webpack DefinePlugin
83 | const stringified = {
84 | 'process.env': Object.keys(raw).reduce((env, key) => {
85 | env[key] = JSON.stringify(raw[key]);
86 | return env;
87 | }, {}),
88 | };
89 |
90 | return { raw, stringified };
91 | }
92 |
93 | module.exports = getClientEnvironment;
94 |
--------------------------------------------------------------------------------
/config/jest/cssTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // This is a custom Jest transformer turning style imports into empty objects.
4 | // http://facebook.github.io/jest/docs/en/webpack.html
5 |
6 | module.exports = {
7 | process() {
8 | return 'module.exports = {};';
9 | },
10 | getCacheKey() {
11 | // The output is always the same.
12 | return 'cssTransform';
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/config/jest/fileTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 |
5 | // This is a custom Jest transformer turning file imports into filenames.
6 | // http://facebook.github.io/jest/docs/en/webpack.html
7 |
8 | module.exports = {
9 | process(src, filename) {
10 | const assetFilename = JSON.stringify(path.basename(filename));
11 |
12 | if (filename.match(/\.svg$/)) {
13 | return `module.exports = {
14 | __esModule: true,
15 | default: ${assetFilename},
16 | ReactComponent: (props) => ({
17 | $$typeof: Symbol.for('react.element'),
18 | type: 'svg',
19 | ref: null,
20 | key: null,
21 | props: Object.assign({}, props, {
22 | children: ${assetFilename}
23 | })
24 | }),
25 | };`;
26 | }
27 |
28 | return `module.exports = ${assetFilename};`;
29 | },
30 | };
31 |
--------------------------------------------------------------------------------
/config/paths.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 | const fs = require('fs');
5 | const url = require('url');
6 |
7 | // Make sure any symlinks in the project folder are resolved:
8 | // https://github.com/facebook/create-react-app/issues/637
9 | const appDirectory = fs.realpathSync(process.cwd());
10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11 |
12 | const envPublicUrl = process.env.PUBLIC_URL;
13 |
14 | function ensureSlash(inputPath, needsSlash) {
15 | const hasSlash = inputPath.endsWith('/');
16 | if (hasSlash && !needsSlash) {
17 | return inputPath.substr(0, inputPath.length - 1);
18 | } else if (!hasSlash && needsSlash) {
19 | return `${inputPath}/`;
20 | } else {
21 | return inputPath;
22 | }
23 | }
24 |
25 | const getPublicUrl = appPackageJson =>
26 | envPublicUrl || require(appPackageJson).homepage;
27 |
28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer
29 | // "public path" at which the app is served.
30 | // Webpack needs to know it to put the right
26 |
27 |
28 |