diff --git a/.eslintrc.js b/.eslintrc.js index aeeca68fee6a891c9a1719140228cc0ef8d44598..dbe7d4d3f89575eb68f910dbeadaa919e8d38147 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,7 @@ module.exports = { jasmine: true, }, globals: { - APP_TYPE: true, + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 page: true, }, rules: { diff --git a/README.ja-JP.md b/README.ja-JP.md new file mode 100644 index 0000000000000000000000000000000000000000..04c027f6d88fecc25c80675e94bb572aa58ce59e --- /dev/null +++ b/README.ja-JP.md @@ -0,0 +1,138 @@ +[English](./README.md) | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md) | 日本語 + +

Ant Design Pro

+ +
+ +独創的な業務システムのUIを解決するためのReactボイラープレート。 + +[![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) +[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) +[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) +[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) +[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Netlify Status](https://api.netlify.com/api/v1/badges/b68e9850-a529-4364-9d3b-d70aade560f9/deploy-status)](https://app.netlify.com/sites/ant-design-pro/deploys) +![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) + +
+ + - プレビュー: http://preview.pro.ant.design + - ホームページ: http://pro.ant.design + - ドキュメント: http://pro.ant.design/docs/getting-started + - 変更ログ: http://pro.ant.design/docs/changelog + - FAQ: http://pro.ant.design/docs/faq + - 中国のミラーサイト: http://ant-design-pro.gitee.io + +## 2.0がリリースされました 🎉🎉🎉 +[Announcing Ant Design Pro 2.0.0](https://medium.com/ant-design/beautiful-and-powerful-ant-design-pro-2-0-release-51358da5af95) + +## 翻訳の募集 :loudspeaker: + +私たちはあなたの助けを必要としています。: https://github.com/ant-design/ant-design-pro/issues/120 + +## 特徴 + + - :gem: **きちんとしたデザイン**: [Ant Design specification](http://ant.design/) に従ってくださ い。 + - :triangular_ruler: **共通のテンプレート**: 業務システム用のテンプレート + - :rocket: **現状のアート開発**: `React/umi/dva/antd` の最新開発スタック + - :iphone: **レスポンシブ**: さまざまな画面サイズ用の設計 + - :art: **テーマ**: シンプルな設定でカスタマイズ可能なテーマ + - :globe_with_meridians: **国際化**: 国際化の解決策を内蔵 + - :gear: **ベストプラクティス**: コードを美しくするための正しいワークフロー + - :1234: **モック開発**: 使いやすいモック開発 + - :white_check_mark: **UIテスト**: ユニットテストとe2eテスト + +## テンプレート + +``` +- ダッシュボード + - アナリティクス + - モニター +  - ワークスペース +- 形 +  - 基本フォーム +  - ステップフォーム +  - 高度なフォーム + - リスト +  - スタンダードテーブル +  - スタンダードリスト +  - カードリスト +  - 検索リスト(プロジェクト/アプリケーション/記事) + - プロフィール +  - 簡単なプロフィール +  - 高度なプロファイル + - アカウント +  - アカウントセンター +  - アカウント設定 + - 結果 +  - 成功 +  - 失敗 + - 例外 +  - 403 +  - 404 +  - 500 + - ユーザー +  - ログイン +  - 登録 +  - 登録結果 +``` + +## 使用法 + +### bashを使う方法 + +```bash +$ git clone https://github.com/ant-design/ant-design-pro.git --depth=1 +$ cd ant-design-pro +$ npm install +$ npm start # http://localhost:8000 を開く +``` + +### Dockerを使う方法 + +```bash +# プレビュー +$ docker pull antdesign/ant-design-pro +$ docker run -p 80:80 antdesign/ant-design-pro +# http://localhost を開く + +# dev +$ npm run docker:dev + +# build +$ npm run docker:build + + +# production dev +$ npm run docker-prod:dev + +# production build +$ npm run docker-prod:build +``` + +### Gitpodを使う方法 + +Gitpod(GitHub用の無料オンライン開発環境)でプロジェクトを開き、すぐにコーディングを開始できます。 + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ant-design/ant-design-pro) + +その他の指示は [ドキュメント](http://pro.ant.design/docs/getting-started) を確認してください。 + +## サポートするブラウザー + +モダンなブラウザとIE11。 + +| [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 | +| --------- | --------- | --------- | --------- | --------- | +| IE11, Edge | 最新版から2バージョン | 最新版から2バージョン | 最新版から2バージョン | 最新版から2バージョン | + +## 貢献する + +どんな種類の貢献でも大歓迎です。あなたがこのプロジェクトに貢献できる方法のいくつかの例はここにあります。: + + - 毎日の仕事にAnt Design Proを使用すること。 + - 報告すること。 [issues](http://github.com/ant-design/ant-design-pro/issues) にバグ報告や質問をしてください。 + - 更新すること。 改善を、[pull requests](http://github.com/ant-design/ant-design-pro/pulls) で送ってください。 + +[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) diff --git a/README.md b/README.md index c6da6474c5ce12b04bd107d4eb5b3c74dd804b6d..db85e1651f98b4f1a5a356df3da1406cd0780308 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md) +English | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md) | [日本語](./README.ja-JP.md)

Ant Design Pro

diff --git a/README.ru-RU.md b/README.ru-RU.md index f820dfba2343571ac0803274109b2d989845e727..b1614842d2d0061df57a10539de09841699d6dca 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -1,4 +1,4 @@ -[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский | [Türkçe](./README.tr-TR.md) +[English](./README.md) | [简体中文](./README.zh-CN.md) | Русский | [Türkçe](./README.tr-TR.md) | [日本語](./README.ja-JP.md)

Ant Design Pro

diff --git a/README.tr-TR.md b/README.tr-TR.md index 8470cb79a41153736603c6bb92c63ebbbfdc2187..0c887ab52b5d4f620aaa9b6d549b28224d46b762 100644 --- a/README.tr-TR.md +++ b/README.tr-TR.md @@ -1,4 +1,4 @@ -[English](./README.md) | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | Türkçe +[English](./README.md) | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | Türkçe | [日本語](./README.ja-JP.md)

Ant Design Pro

diff --git a/README.zh-CN.md b/README.zh-CN.md index b4b3b722c650b12905a652c59076252129a8d897..d87f0bd95c5503275fa513c62c508fe3416cac68 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,4 +1,4 @@ -[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md) +[English](./README.md) | 简体中文 | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md) | [日本語](./README.ja-JP.md)

Ant Design Pro

diff --git a/config/config.js b/config/config.js index 9e55fe6442423e483a3f5762aa57652b0e62f696..82953b8f03f0e65a0e8443aee816951d4bf1bbf6 100644 --- a/config/config.js +++ b/config/config.js @@ -5,7 +5,8 @@ import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; const { pwa, primaryColor } = defaultSettings; -const { APP_TYPE, TEST } = process.env; +// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 +const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, TEST } = process.env; const plugins = [ [ @@ -64,8 +65,8 @@ const plugins = [ ]; // 针对 preview.pro.ant.design 的 GA 统计代码 -// 业务上不需要这个 -if (APP_TYPE === 'site') { +// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 +if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { plugins.push([ 'umi-plugin-ga', { @@ -78,7 +79,8 @@ export default { // add for transfer to umi plugins, define: { - APP_TYPE: APP_TYPE || '', + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 }, treeShaking: true, targets: { diff --git a/config/plugin.config.js b/config/plugin.config.js index 2273586e6753a24ea561f7ff8764926e3985688a..59ce550f422072f454a634ec5725b0cd1f39de35 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -24,8 +24,11 @@ function getModulePackageName(module) { } export default config => { - // pro 和 开发环境再添加这个插件 - if (process.env.APP_TYPE === 'site' || process.env.NODE_ENV !== 'production') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if ( + process.env.ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' || + process.env.NODE_ENV !== 'production' + ) { // 将所有 less 合并为一个供 themePlugin使用 const outFile = path.join(__dirname, '../.temp/ant-design-pro.less'); const stylesDir = path.join(__dirname, '../src/'); diff --git a/jest.config.js b/jest.config.js index 68a1144bcb17feb585b3725e5d323b0414dd91cc..ba22e52a5240c2991120de559355407f9c6808ef 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,7 @@ module.exports = { testURL: 'http://localhost:8000', preset: 'jest-puppeteer', + globals: { + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + }, }; diff --git a/lambda/mock/matchMock.js b/lambda/mock/matchMock.js index 94027802a6174e0bc0322a402c51d1ec51a53bd7..d74236126428dd543e48b76cbd9a1b3be1eec21a 100644 --- a/lambda/mock/matchMock.js +++ b/lambda/mock/matchMock.js @@ -14,7 +14,7 @@ function parseKey(key) { method = spliced[0].toLowerCase(); path = spliced[1]; // eslint-disable-line } - const routerBasePath = process.env.NODE_ENV === 'dev' ? `${path}` : `/.netlify/functions${path}`; + const routerBasePath = `${path}`; return { method, path: routerBasePath, diff --git a/package.json b/package.json index 362776f217fd06fd2befbbd9bb1795df855867b1..1c479b630dd3e8626a90c438fed700fe2097ee3f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "An out-of-box UI solution for enterprise applications", "scripts": { "analyze": "cross-env ANALYZE=1 umi build", - "build": "umi build && npm run functions:build", + "build": "umi build", "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./", "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build", "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up", @@ -23,7 +23,8 @@ "lint:prettier": "check-prettier lint", "lint:style": "stylelint 'src/**/*.less' --syntax less", "prettier": "node ./scripts/prettier.js", - "start": "cross-env APP_TYPE=site umi dev", + "site": "umi build && npm run functions:build", + "start": "cross-env ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION=site umi dev", "start:no-mock": "cross-env MOCK=none umi dev", "test": "umi test", "test:all": "node ./tests/run-tests.js", @@ -51,7 +52,7 @@ ], "dependencies": { "@antv/data-set": "^0.10.1", - "antd": "^3.13.0", + "antd": "^3.16.1", "bizcharts": "^3.4.3", "bizcharts-plugin-slider": "^2.1.1-beta.1", "classnames": "^2.2.6", @@ -112,19 +113,19 @@ "merge-umi-mock-data": "^1.0.4", "mockjs": "^1.0.1-beta3", "prettier": "^1.16.4", + "serverless-http": "^1.9.1", "slash2": "^2.0.0", "stylelint": "^9.10.1", "stylelint-config-css-modules": "^1.3.0", "stylelint-config-prettier": "^5.0.0", - "stylelint-config-rational-order": "^0.0.4", + "stylelint-config-rational-order": "^0.1.0", "stylelint-config-standard": "^18.2.0", "stylelint-declaration-block-no-ignored-properties": "^1.1.0", "stylelint-order": "^2.0.0", "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", - "umi-plugin-ga": "^1.1.3", - "serverless-http": "^1.9.1" + "umi-plugin-ga": "^1.1.3" }, "optionalDependencies": { "puppeteer": "^1.12.1" diff --git a/src/app.js b/src/app.js index 0f35ff9af6376bcc3c3606f219ae6bcd1af6b769..2e98b22be05fbbad59680c49876d3a67a246ecef 100644 --- a/src/app.js +++ b/src/app.js @@ -1,5 +1,3 @@ -import fetch from 'dva/fetch'; - export const dva = { config: { onError(err) { @@ -8,37 +6,6 @@ export const dva = { }, }; -let authRoutes = {}; - -function ergodicRoutes(routes, authKey, authority) { - routes.forEach(element => { - if (element.path === authKey) { - if (!element.authority) element.authority = []; // eslint-disable-line - Object.assign(element.authority, authority || []); - } else if (element.routes) { - ergodicRoutes(element.routes, authKey, authority); - } - return element; - }); -} - -export function patchRoutes(routes) { - Object.keys(authRoutes).map(authKey => - ergodicRoutes(routes, authKey, authRoutes[authKey].authority) - ); - window.g_routes = routes; -} - export function render(oldRender) { - fetch('/api/auth_routes') - .then(res => res.json()) - .then( - ret => { - authRoutes = ret; - oldRender(); - }, - () => { - oldRender(); - } - ); + oldRender(); } diff --git a/src/components/PageHeaderWrapper/breadcrumb.js b/src/components/PageHeaderWrapper/breadcrumb.js index 02fe66fd26530f68bd99e6a3c863f384a82e611d..0f25e8f724d7cfe37dc9da0c5802cd1999621125 100644 --- a/src/components/PageHeaderWrapper/breadcrumb.js +++ b/src/components/PageHeaderWrapper/breadcrumb.js @@ -1,7 +1,7 @@ import React from 'react'; import pathToRegexp from 'path-to-regexp'; import Link from 'umi/link'; -import { FormattedMessage } from 'umi-plugin-react/locale'; +import { formatMessage } from 'umi-plugin-react/locale'; import { urlToList } from '../_utils/pathTools'; // 渲染Breadcrumb 子节点 @@ -17,7 +17,7 @@ const itemRender = (route, params, routes, paths) => { const renderItemLocal = item => { if (item.locale) { - return ; + return formatMessage({ id: item.locale, defaultMessage: item.name }); } return item.name; }; @@ -61,20 +61,22 @@ const conversionFromLocation = (routerLocation, breadcrumbNameMap, props) => { // Convert the url to an array const pathSnippets = urlToList(routerLocation.pathname); // Loop data mosaic routing - const extraBreadcrumbItems = pathSnippets.map(url => { - const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url); - if (currentBreadcrumb.inherited) { - return null; - } - const name = renderItemLocal(currentBreadcrumb); - const { hideInBreadcrumb } = currentBreadcrumb; - return name && !hideInBreadcrumb - ? { - path: url, - breadcrumbName: name, - } - : null; - }); + const extraBreadcrumbItems = pathSnippets + .map(url => { + const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url); + if (currentBreadcrumb.inherited) { + return null; + } + const name = renderItemLocal(currentBreadcrumb); + const { hideInBreadcrumb } = currentBreadcrumb; + return name && !hideInBreadcrumb + ? { + path: url, + breadcrumbName: name, + } + : null; + }) + .filter(item => item !== null); // Add home breadcrumbs to your head if defined if (home) { extraBreadcrumbItems.unshift({ @@ -93,7 +95,11 @@ export const conversionBreadcrumbList = props => { const { breadcrumbList } = props; const { routes, params, routerLocation, breadcrumbNameMap } = getBreadcrumbProps(props); if (breadcrumbList && breadcrumbList.length) { - return conversionFromProps(); + return { + routes: conversionFromProps(props), + params, + itemRender, + }; } // 如果传入 routes 和 params 属性 // If pass routes and params attributes diff --git a/src/components/PageHeaderWrapper/index.js b/src/components/PageHeaderWrapper/index.js index 7a766834c4ac39cd3628409d45fe3cd09bff1fe7..a78da3d80b50a9ddc4f185bb1fafd2e829fe1a4e 100644 --- a/src/components/PageHeaderWrapper/index.js +++ b/src/components/PageHeaderWrapper/index.js @@ -16,11 +16,11 @@ const { Title } = Typography; * In order to be compatible with the old version of the PageHeader * basically all the functions are implemented. */ -const renderFooter = ({ tabList, activeKeyProps, onTabChange, tabBarExtraContent }) => { +const renderFooter = ({ tabList, tabActiveKey, onTabChange, tabBarExtraContent }) => { return tabList && tabList.length ? ( { if (onTabChange) { onTabChange(key); @@ -49,47 +49,45 @@ const PageHeaderWrapper = ({ return (
{top} - {title && content && ( - - {value => { - return ( - - {title} - - } - key="pageheader" - {...restProps} - breadcrumb={conversionBreadcrumbList({ - ...value, - ...restProps, - home: , - })} - className={styles.pageHeader} - linkElement={Link} - footer={renderFooter(restProps)} - > -
- {logo &&
{logo}
} -
-
- {content &&
{content}
} - {extraContent &&
{extraContent}
} -
+ + {value => { + return ( + + {title} + + } + key="pageheader" + {...restProps} + breadcrumb={conversionBreadcrumbList({ + ...value, + ...restProps, + home: , + })} + className={styles.pageHeader} + linkElement={Link} + footer={renderFooter(restProps)} + > +
+ {logo &&
{logo}
} +
+
+ {content &&
{content}
} + {extraContent &&
{extraContent}
}
- - ); - }} - - )} +
+
+ ); + }} +
{children ? (
{children} diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 3b4ae35c112b1f6d5ab5c2be017e85a7dd6c5973..dc070197b13f19fba1ead888b8840bd09c251c54 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -86,7 +86,11 @@ class BasicLayout extends React.Component { renderSettingDrawer = () => { // Do not render SettingDrawer in production // unless it is deployed in preview.pro.ant.design as demo - if (process.env.NODE_ENV === 'production' && APP_TYPE !== 'site') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if ( + process.env.NODE_ENV === 'production' && + ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION !== 'site' + ) { return null; } return ; diff --git a/src/locales/en-US/login.js b/src/locales/en-US/login.js index 82c1c20f87281c58357e0242b8290d7016e7a4a1..195e59ce3239c64a33ed2d676bca7371bf376369 100644 --- a/src/locales/en-US/login.js +++ b/src/locales/en-US/login.js @@ -12,6 +12,8 @@ export default { 'app.login.login': 'Login', 'app.register.register': 'Register', 'app.register.get-verification-code': 'Get code', + 'app.login.verification-code-warning': + 'This project is a demo project and will not actually send you a verification code. Please switch to the account password login interface and log in as prompted.', 'app.register.sign-in': 'Already have an account?', 'app.register-result.msg': 'Account:registered at {email}', 'app.register-result.activation-email': diff --git a/src/locales/pt-BR/login.js b/src/locales/pt-BR/login.js index 453b3dac19c7a73d7776ed8163d27a59bca65de1..5e2d86954a2c0ee5d88046ebfbb6b008c866ccc9 100644 --- a/src/locales/pt-BR/login.js +++ b/src/locales/pt-BR/login.js @@ -13,6 +13,8 @@ export default { 'app.login.login': 'Login', 'app.register.register': 'Cadastro', 'app.register.get-verification-code': 'Recuperar código', + 'app.login.verification-code-warning': + 'This project is a demo project and will not actually send you a verification code. Please switch to the account password login interface and log in as prompted.', 'app.register.sign-in': 'Já tem uma conta?', 'app.register-result.msg': 'Conta:registrada em {email}', 'app.register-result.activation-email': diff --git a/src/locales/zh-CN/login.js b/src/locales/zh-CN/login.js index eb227207334ed3ea6e765313fad1f23b3d724dfc..e211e2cf282e5db88309693255208a4cfb439e05 100644 --- a/src/locales/zh-CN/login.js +++ b/src/locales/zh-CN/login.js @@ -12,6 +12,8 @@ export default { 'app.login.login': '登录', 'app.register.register': '注册', 'app.register.get-verification-code': '获取验证码', + 'app.login.verification-code-warning': + '此项目为演示项目,并不会真的给您发送验证码。请切换到账户密码登录界面按提示登录。', 'app.register.sign-in': '使用已有账户登录', 'app.register-result.msg': '你的账户:{email} 注册成功', 'app.register-result.activation-email': diff --git a/src/locales/zh-TW/login.js b/src/locales/zh-TW/login.js index ec5706a6c26e40c5029fb80ab2390b54e483cc69..fb916603913281e88e0dce927d84ff9335d1b0ea 100644 --- a/src/locales/zh-TW/login.js +++ b/src/locales/zh-TW/login.js @@ -12,6 +12,8 @@ export default { 'app.login.login': '登錄', 'app.register.register': '註冊', 'app.register.get-verification-code': '獲取驗證碼', + 'app.login.verification-code-warning': + '此項目為演示項目,並不會真的給您發送驗證碼。請切換到賬戶密碼登錄界面按提示登錄。', 'app.register.sign-in': '使用已有賬戶登錄', 'app.register-result.msg': '妳的賬戶:{email} 註冊成功', 'app.register-result.activation-email': diff --git a/src/models/setting.js b/src/models/setting.js index 171da48d1ef5c3068f256b02ff617dae8e4a5908..3956ed3d0f95732180ee1ee1527f461f9dfc5e0f 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -4,7 +4,8 @@ import defaultSettings from '../defaultSettings'; let lessNodesAppended; const updateTheme = primaryColor => { // Don't compile less in production! - if (APP_TYPE !== 'site') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION !== 'site') { return; } // Determine if the component is remounted diff --git a/src/pages/User/Login.js b/src/pages/User/Login.js index e3498bd3e4fc9ceafae9f5e3af63a1b066ef681a..29f59c89377d4c35065cf09592105b52aa64ba59 100644 --- a/src/pages/User/Login.js +++ b/src/pages/User/Login.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; -import { Checkbox, Alert, Icon } from 'antd'; +import { Checkbox, Alert, message, Icon } from 'antd'; import Login from '@/components/Login'; import styles from './Login.less'; @@ -35,6 +35,7 @@ class LoginPage extends Component { }) .then(resolve) .catch(reject); + message.warning(formatMessage({ id: 'app.login.verification-code-warning' })); } }); }); diff --git a/src/pages/User/Register.js b/src/pages/User/Register.js index d685965f5f3da55b4a63fbce3ebc4c46a9bf0880..6aab8ffb6c70a4f286c5e3556d2828616c7bf28c 100644 --- a/src/pages/User/Register.js +++ b/src/pages/User/Register.js @@ -3,7 +3,7 @@ import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import router from 'umi/router'; -import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd'; +import { Form, Input, Button, message, Select, Row, Col, Popover, Progress } from 'antd'; import styles from './Register.less'; const FormItem = Form.Item; @@ -75,6 +75,7 @@ class Register extends Component { clearInterval(this.interval); } }, 1000); + message.warning(formatMessage({ id: 'app.login.verification-code-warning' })); }; getPasswordStatus = () => { diff --git a/src/utils/authority.js b/src/utils/authority.js index 288c1e68adc9381a821ba1032cb068791e0184ee..bb1aa23bc6156a94173a0477e1f8d45b937d2c91 100644 --- a/src/utils/authority.js +++ b/src/utils/authority.js @@ -1,6 +1,4 @@ // use localStorage to store the authority info, which might be sent from server in actual project. -const { NODE_ENV } = process.env; - export function getAuthority(str) { // return localStorage.getItem('antd-pro-authority') || ['admin', 'user']; const authorityString = @@ -15,12 +13,12 @@ export function getAuthority(str) { if (typeof authority === 'string') { return [authority]; } - if (!authority && NODE_ENV !== 'production') { + // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { return ['admin']; } return authority; } - export function setAuthority(authority) { const proAuthority = typeof authority === 'string' ? [authority] : authority; return localStorage.setItem('antd-pro-authority', JSON.stringify(proAuthority)); diff --git a/src/utils/authority.test.js b/src/utils/authority.test.js index 8a6cd41f37f9c797adaef9304f87fe3afd279123..15b3cb951465ecbbc3aa922635208895177f487a 100644 --- a/src/utils/authority.test.js +++ b/src/utils/authority.test.js @@ -2,7 +2,7 @@ import { getAuthority } from './authority'; describe('getAuthority should be strong', () => { it('empty', () => { - expect(getAuthority(null)).toEqual(['admin']); // default value + expect(getAuthority(null)).toEqual(null); // default value }); it('string', () => { expect(getAuthority('admin')).toEqual(['admin']);