diff --git a/.travis.yml b/.travis.yml index 7c2daf58..9cda51ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ node_js: - node script: - npm run build -before_install: +before_deploy: - | if [ "$TRAVIS_BRANCH" = "develop" ]; then for prefixed_envvar in ${!DEV_*}; do @@ -17,8 +17,7 @@ before_install: - openssl aes-256-cbc -K $encrypted_18b2305b78c9_key -iv $encrypted_18b2305b78c9_iv -in config/id_rsa.enc -out ~/.ssh/id_rsa -d - chmod 600 ~/.ssh/id_rsa - echo -e "Host $HOST\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config -before_deploy: - yarn global add now -after_success: +deploy: - scp -o stricthostkeychecking=no -r ./dist root@$HOST:$BUILD_DIR - cd ./docs && now -A $DOC_NOW_CONFIG -t $NOW_TOKEN && now alias -A $DOC_NOW_CONFIG -t $NOW_TOKEN diff --git a/docs/README.md b/docs/README.md index 02ce6cbe..702acb3c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,172 +1,78 @@ -# Antd Admin -[![React](https://img.shields.io/badge/react-^16.2.0-brightgreen.svg?style=flat-square)](https://github.com/facebook/react) -[![Ant Design](https://img.shields.io/badge/ant--design-^3.0.3-yellowgreen.svg?style=flat-square)](https://github.com/ant-design/ant-design) -[![dva](https://img.shields.io/badge/dva-^2.1.0-orange.svg?style=flat-square)](https://github.com/dvajs/dva) +

AntD Admin

-[![GitHub issues](https://img.shields.io/github/issues/zuiidea/antd-admin.svg?style=flat-square)](https://github.com/zuiidea/antd-admin) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/zuiidea/antd-admin/pulls) -[![MIT](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)](http://opensource.org/licenses/MIT) -[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com) - -演示地址 - -## 特性 - -* 基于[react](https://github.com/facebook/react),[ant-design](https://github.com/ant-design/ant-design),[dva](https://github.com/dvajs/dva),[Mock](https://github.com/nuysoft/Mock) 企业级后台管理系统最佳实践。 -* 基于 Antd UI 设计语言,提供后台管理系统常见使用场景。 -* 基于[dva](https://github.com/dvajs/dva)动态加载 Model 和路由,按需加载。 -* 使用[umi](https://github.com/umijs/umi)本地调试和构建,其中 Mock 功能实现脱离后端独立开发。 -* 浅度响应式设计。 - -## 更新日志 - -### 5.0.0-beta - -`2018-6-20` - - * 感谢@sorrycc、@xiaohuoni [PR](https://github.com/zuiidea/antd-admin/pull/770) - - * 更新`roadhog`至`umi` - 详见 [使用 umi 改进 dva 项目开发](https://github.com/sorrycc/blog/issues/66#issuecomment-408596579) | [umi model 用法](https://github.com/umijs/umi/issues/171) - -### 4.3.9 - -`2017-12-27` - -* 更新`antd`至`3.0.3`,以及其它主要库,并解决升级带来的兼容问题。 -* 尽可能的保持`antd`的设计语言。 - -### 4.3.7 - -`2017-10-30` - -* 更新`chart`,新增[ECharts](https://github.com/ecomfe/echarts),[highCharts](https://github.com/highcharts/highcharts),[Recharts](https://github.com/recharts/recharts)演示。 - -### 4.3.5 +
-`2017-09-04` +A excellent front-end solution for enterprise applications. -* 更新[dva](https://github.com/dvajs/dva)至`2.0.1`,感谢[@yangbin1994](https://github.com/yangbin1994)的[PR](https://github.com/zuiidea/antd-admin/pull/567)。 - -### 4.3.4 - -`2017-09-04` +[![antd](https://img.shields.io/badge/antd-^3.10.0-blue.svg?style=flat-square)](https://github.com/ant-design/ant-design) +[![umi](https://img.shields.io/badge/umi-^2.2.1-orange.svg?style=flat-square)](https://github.com/umijs/umi) +[![GitHub issues](https://img.shields.io/github/issues/zuiidea/antd-admin.svg?style=flat-square)](https://github.com/zuiidea/antd-admin/issues) +[![MIT](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)](http://opensource.org/licenses/MIT) +![Travis (.org)](https://img.shields.io/travis/zuiidea/antd-admin.svg) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/zuiidea/antd-admin/pulls) +[![Gitter](https://img.shields.io/gitter/room/antd-admin/antd-admin.svg)](https://gitter.im/antd-admin/antd-admin) -* 更新[roadhog](https://github.com/sorrycc/roadhog)至`1.2.1`,修复闪屏问题。 -* 修复 build css 未压缩[#529](https://github.com/zuiidea/antd-admin/issues/529),classname 未 Hash[#477](https://github.com/zuiidea/antd-admin/issues/477)。 -* 更新登录成功使用 router 跳转[#479](https://github.com/zuiidea/antd-admin/issues/479)。 +
-### 4.3.0 +- Preview - [https://antd-admin.zuiidea.com](https://antd-admin.zuiidea.com) +- Documentation - [https://doc.antd-admin.zuiidea.com](https://doc.antd-admin.zuiidea.com) +- FAQ - [https://doc.antd-admin.zuiidea.com/#/faq](https://doc.antd-admin.zuiidea.com/#/faq) +- ChangeLog - [https://doc.antd-admin.zuiidea.com/#/change-log](https://doc.antd-admin.zuiidea.com/#/change-log) -`2017-07-30` +## Features -* 更新[roadhog](https://github.com/sorrycc/roadhog)至`1.0.0-beta.7`,得益于`webpack@3.4`,编译速度不减。 -* 基于使用 roadhog 的 dll 插件,开发时编译耗时减半。 -* 新增打包时按项目版本号生成文件目录。[#449](https://github.com/zuiidea/antd-admin/issues/449) -* 更新`eslint`,并适当修改了`.eslintrc`。 +- Internationalization, extracting translation fields from source code, loading language packs on demand +- Dynamic permissions, different permissions for different menus +- Elegant and beautiful, Ant Design system +- Mock data, local data debugging -[More Change Log](https://github.com/zuiidea/antd-admin/wiki/Change-Log) -## 开发构建 +## Usage -### 目录结构 +1. Clone project code. ```bash -├── /dist/ # 项目输出目录 -├── /mock/ # 数据mock -├── /public/ # 公共文件,编译时copy至dist目录 -├── /src/ # 项目源码目录 -│ ├── /components/ # UI组件及UI相关方法 -│ ├── /layouts/ # 全局组件 -│ │ └── app.js # 页面入口 -│ │ └── index.js # 入口文件 -│ ├── /models/ # 数据模型 -│ ├── /pages/ # 页面组件 -│ │ └── document.ejs # html模版 -│ ├── /services/ # 数据接口 -│ ├── /themes/ # 项目样式 -│ │ ├── default.less # 全局样式 -│ │ └── vars.less # 全局样式变量 -│ ├── /utils/ # 工具函数 -│ │ ├── config.js # 项目常规配置 -│ │ ├── menu.js # 菜单及面包屑配置 -│ │ ├── config.js # 项目常规配置 -│ │ ├── request.js # 异步请求函数(axios) -│ │ └── theme.js # 项目需要在js中使用到样式变量 -├── package.json # 项目信息 -├── .eslintrc # Eslint配置 -└── .umirc.js # umi配置 -└── .umirc.mock.js # mock配置 -└── .theme.config.js # 主题less编译配置 +git clone https://github.com/zuiidea/antd-admin.git my-project +cd my-project ``` -pages中可参考 [duck 模式](https://medium.freecodecamp.org/scaling-your-redux-app-with-ducks-6115955638be) -文件夹命名说明: - -* components:组件(方法)为单位以文件夹保存,文件夹名组件首字母大写(如`DataTable`),方法首字母小写(如`layer`),文件夹内主文件与文件夹同名,多文件以`index.js`导出对象(如`./src/components/Layout`)。 -* routes:页面为单位以文件夹保存,文件夹名首字母小写(特殊除外,如`UIElement`),文件夹内主文件以`index.js`导出,多文件时可建立`components`文件夹(如`./src/routes/dashboard`),如果有子路由,依次按照路由层次建立文件夹(如`./src/routes/UIElement`)。 - -### 快速开始 - -克隆项目文件: +2. Installation dependence. ```bash -git clone https://github.com/zuiidea/antd-admin.git +yarn install ``` -进入目录安装依赖: +Or ```bash -#开始前请确保没有安装roadhog、webpack到NPM全局目录, 国内用户推荐yarn或者cnpm -npm i 或者 yarn install +npm install ``` -开发: +3. Start local server. ```bash npm run start -打开 http://localhost:8000 #端口在package.json中cross-env后加上 PORT=8000指定 ``` -构建: -[详情](https://github.com/zuiidea/antd-admin/issues/269) - -代码检测: - -```bash -npm run lint -``` - -## FAQ - -* 项目打包后如何部署? [#269](https://github.com/zuiidea/antd-admin/issues/269) -* 如何做权限管理? [#384](https://github.com/zuiidea/antd-admin/issues/384) -* 如何使用 mock.js 模拟接口,怎么使用线上接口? [#348](https://github.com/zuiidea/antd-admin/issues/348) -* 如何使用 Iconfont,如何使用本地的 svg 图标? [#270](https://github.com/zuiidea/antd-admin/issues/270) -* 怎么按版本打包,上线时不影响正在访问的用户? [#449](https://github.com/zuiidea/antd-admin/issues/449) -* windows 处理 CRLF?[参考](http://blog.csdn.net/lysc_forever/article/details/42835203) - - ```bash - git config --global core.autocrlf false - ``` - -## 参考 +4. After the startup is complete, open a browser and visit [http://localhost:7000](http://localhost:7000), If you need to change the startup port, you can configure it in the `.env` file. -用户列表: -dashboard 设计稿: (已征得作者同意) +> More instructions at [documentation](https://doc.antd-admin.zuiidea.com)。 -## 截屏 -web +## Browsers support -![](https://user-images.githubusercontent.com/8142164/43032162-37db46e2-8ce3-11e8-9c7e-73a773bc0545.gif) +Modern browsers and IE9. -移动 +| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | +| --------- | --------- | --------- | --------- | --------- | +| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions -![](https://user-images.githubusercontent.com/8142164/43032163-3a1f2838-8ce3-11e8-89c5-8e1ae077d34a.gif) +## Contributing -效果图 +We very much welcome your contribution, you can build together with us in the following ways :smiley: -![](https://user-images.githubusercontent.com/8142164/43032165-5d151bae-8ce3-11e8-9bfd-8a121620ea78.jpg) +- Use Ant Design Pro in your daily work. +- Submit [GitHub issues](http://github.com/zuiidea/antd-admin/issues)s to report bugs or ask questions. +- Propose [Pull Request](http://github.com/zuiidea/antd-admin/pulls) to improve our code. diff --git a/docs/_sidebar.md b/docs/_sidebar.md index b3236207..e4ce764b 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,5 +1,5 @@ - Getting started - - [Quick Start](quickstart.md) + - [Quick Start](getting-started.md) - Customization - [Configuration](configuration.md) - Guide diff --git a/docs/configuration.md b/docs/configuration.md index e69de29b..5aa10cf8 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -0,0 +1,102 @@ +# Configuration + +You can do some custom configuration in `/src/utils/config.js`: + +## siteName + +- Type `String` + + Configure the site name, apply it to the login box, and display the title text at the top of the sidebar. + +## copyright + +- Type: `String` + + Configure the copyright notice to apply to the login page, at the bottom of the `Primay` layout. + +## logoPath + +- Type: `String` + + Configure the site logo to apply to the login box and the Logo display at the top of the sidebar. + +## apiPrefix + +- Type: `String` + + Configure the prefix of the interface in the project. The interface related documents can be viewed [API configuration]() + +## fixedHeader + +- Type: `String` + + Under the `Primary` layout, whether the top of the page is fixed when scrolling。 + +## layouts + +- Type: `Array` + + Configuration? Which routes use which layout, unspecified route uses the default layout `Public`, the project currently has `Primary` and `Public` layouts, +     The default configuration is as follows: + + ```js + layouts: [ + { + name: 'primary', + include: [/.*/], + exlude: [/(\/(en|zh))*\/login/], + }, + ], + ``` + + The object properties for each layout are as follows: + + - `name` - The name of the layout; + + - `include` - Specifies a list of routing rules that use this layout, which can be a regular expression or a string; + + - `exlude` - Specifies a list of routing rules that do not use this layout, which can be a regular expression or a string. + + > Note: `exlude` takes precedence over `include`, and the layout behind it has a higher priority than the previous layout. The development process may need to be combined with the layout in the `src/layouts` directory. For details, see [Using Layout](). + +## i18n + +- Type: `Object` + + Configure internationalization, the default configuration is as follows: + + ```js + i18n: { + languages: [ + { + key: 'en', + title: 'English', + flag: '/america.svg', + }, + { + key: 'zh', + title: '中文', + flag: '/china.svg', + }, + ], + defaultLanguage: 'en', + } + ``` + + ### i18n.languages + + - Type: `Array` + + Specify which languages the app supports, and the object properties for each language are as follows: + + - `key` - The `key` of the language is applied to the page url to distinguish the language, and also corresponds to the language package folder name in the `src/locales` directory; + + - `title` - The name of the language, at the bottom of the login page, at the top of the `Primay` layout, the language switch is displayed; + + - `flag` - The path of the flag icon of the language, the language switching display at the top of the `Primay` layout. + + ### i18n.defaultLanguage + + - Type: `String` + + Configure the default language. diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 00000000..9a9c90f4 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,73 @@ +# Quick Start + +> Before delving into Ant Design React, a good knowledge base of [React](http://facebook.github.io/react/) 、 [ES2015+](http://es6.ruanyifeng.com/) 、 [Antd Design](https://ant.design/docs/react/introduce-cn) . Learn about [UmiJS](https://umijs.org/) , [Dva](http://github.com/dvajs/dva) . And properly installed and configured [Node.js](https://nodejs.org/) v8 or above, [Git](https://git-scm.com/). It would be helpful if you have pre-existing knowledge on those. + +## Installation + +```bash +git clone https://github.com/zuiidea/antd-admin.git my-project +cd my-project +``` + +## Scaffolding + +The project layout is as follows: + +```bash +├── dist/ # Default build output directory +├── mock/ # Mock files +├── public/ # Static resource +├── src/ # Source code +│ ├── components/ # Components +│ ├── e2e/ # Integrated Test Case +│ ├── layouts/ # Common Layouts +│ ├── locales/ # i18n resources +│ ├── models/ # Global dva Model +│ ├── pages/ # Sub-pages and templates +│ ├── services/ # Backend Services +│ │ ├── api.js # API configuration +│ │ └── index.js # API export +│ ├── themes/ # Themes +│ │ ├── default.less # Less variable +│ │ ├── index.less # Global style +│ │ ├── mixin.less # Less mixin +│ │ └── vars.less # Less variable and mixin +│ ├── utils/ # Utility +│ │ ├── config.js # Application configuration +│ │ ├── constant.js # Static constant +│ │ ├── index.js # Utility methods +│ │ ├── request.js # Request function(axios) +│ │ └── theme.js # Style variables used in js +├── .editorconfig +├── .env +├── .eslintrc +├── .gitignore +├── .prettierignore +├── .prettierrc +├── .stylelintrc.json +├── .travis.yml +└── .umirc.js +└── package.json +``` + +## Development + +1. Install Dependencies. + +```bash +yarn install +``` + +Or + +```bash +npm install +``` + +2. Start local server. + +```bash +npm run start +``` + +3. After the startup is complete, open a browser and visit [http://localhost:7000](http://localhost:7000), If you need to change the startup port, you can configure it in the `.env` file. diff --git a/docs/quickstart.md b/docs/quickstart.md deleted file mode 100644 index 21b5e034..00000000 --- a/docs/quickstart.md +++ /dev/null @@ -1 +0,0 @@ -# getting-started diff --git a/docs/zh-cn/configuration.md b/docs/zh-cn/configuration.md index 21bac25d..69450fa5 100644 --- a/docs/zh-cn/configuration.md +++ b/docs/zh-cn/configuration.md @@ -99,4 +99,4 @@ - 类型: `String` - 配置默认使用哪种语言。 + 配置默认语言。 diff --git a/docs/zh-cn/getting-started.md b/docs/zh-cn/getting-started.md index 649ab5ce..b9d11839 100644 --- a/docs/zh-cn/getting-started.md +++ b/docs/zh-cn/getting-started.md @@ -13,7 +13,7 @@ cd my-project 应用的目录结构如下 -```text +```bash ├── dist/ # 默认build输出目录 ├── mock/ # Mock文件目录 ├── public/ # 静态资源文件目录