Commit e5c70208 authored by xiaohuoni's avatar xiaohuoni

Merge branch 'master' of https://github.com/ant-design/ant-design-pro into Conventional-Routing

# Conflicts:
#	.eslintignore
#	mock/route.js
parents 6429f8a2 123f46d7
......@@ -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: {
......
[English](./README.md) | [简体中文](./README.zh-CN.md) | [Русский](./README.ru-RU.md) | [Türkçe](./README.tr-TR.md) | 日本語
<h1 align="center">Ant Design Pro</h1>
<div align="center">
独創的な業務システムの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)
</div>
- プレビュー: 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。
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>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)
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)
<h1 align="center">Ant Design Pro</h1>
......
[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)
<h1 align="center">Ant Design Pro</h1>
......
[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)
<h1 align="center">Ant Design Pro</h1>
......
[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)
<h1 align="center">Ant Design Pro</h1>
......
......@@ -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: {
......
......@@ -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/');
......
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 专用环境变量,请不要在你的项目中使用它。
},
};
......@@ -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,
......
......@@ -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"
......
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();
}
);
}
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 <FormattedMessage id={item.locale} defaultMessage={item.name} />;
return formatMessage({ id: item.locale, defaultMessage: item.name });
}
return item.name;
};
......@@ -61,7 +61,8 @@ 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 extraBreadcrumbItems = pathSnippets
.map(url => {
const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url);
if (currentBreadcrumb.inherited) {
return null;
......@@ -74,7 +75,8 @@ const conversionFromLocation = (routerLocation, breadcrumbNameMap, props) => {
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
......
......@@ -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 ? (
<Tabs
className={styles.tabs}
{...activeKeyProps}
activeKey={tabActiveKey}
onChange={key => {
if (onTabChange) {
onTabChange(key);
......@@ -49,7 +49,6 @@ const PageHeaderWrapper = ({
return (
<div style={{ margin: '-24px -24px 0' }} className={classNames(classNames, styles.main)}>
{top}
{title && content && (
<MenuContext.Consumer>
{value => {
return (
......@@ -89,7 +88,6 @@ const PageHeaderWrapper = ({
);
}}
</MenuContext.Consumer>
)}
{children ? (
<div className={styles['children-content']}>
<GridContent>{children}</GridContent>
......
......@@ -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 <SettingDrawer />;
......
......@@ -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':
......
......@@ -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':
......
......@@ -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':
......
......@@ -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':
......
......@@ -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
......
......@@ -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' }));
}
});
});
......
......@@ -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 = () => {
......
// 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));
......
......@@ -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']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment