Commit 4dc7e737 authored by 陈帅's avatar 陈帅

Merge branch 'master' into v4

parents 8045b844 7e2500c7
/lambda/mock/** /lambda/
/scripts /scripts
/config /config
[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> <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> <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> <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> <h1 align="center">Ant Design Pro</h1>
......
module.exports = { module.exports = {
testURL: 'http://localhost:8000', testURL: 'http://localhost:8000',
preset: 'jest-puppeteer', preset: 'jest-puppeteer',
globals: {
APP_TYPE: false,
},
}; };
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[[redirects]] [[redirects]]
from = "/api/*" from = "/api/*"
to = "/.netlify/functions/api/:splat" to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat"
status = 200 status = 200
force = true force = true
[redirects.headers] [redirects.headers]
......
...@@ -57,7 +57,10 @@ ...@@ -57,7 +57,10 @@
], ],
"dependencies": { "dependencies": {
"@ant-design/pro-layout": "^4.0.3", "@ant-design/pro-layout": "^4.0.3",
"antd": "^3.15.0", "@antv/data-set": "^0.10.1",
"antd": "^3.16.1",
"bizcharts": "^3.4.3",
"bizcharts-plugin-slider": "^2.1.1-beta.1",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"dva": "^2.4.0", "dva": "^2.4.0",
"express": "^4.16.4", "express": "^4.16.4",
......
import fetch from 'dva/fetch';
import { IRoute } from 'umi-types';
export const dva = { export const dva = {
config: { config: {
onError(err: ErrorEvent) { onError(err: ErrorEvent) {
...@@ -9,37 +6,6 @@ export const dva = { ...@@ -9,37 +6,6 @@ export const dva = {
}, },
}; };
let authRoutes = {}; export function render(oldRender) {
oldRender();
function ergodicRoutes(routes: IRoute[], authKey: string, authority: string | string[]) {
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: IRoute[]) {
Object.keys(authRoutes).map(authKey =>
ergodicRoutes(routes, authKey, authRoutes[authKey].authority),
);
(window as any).g_routes = routes;
}
export function render(oldRender: Function) {
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 { formatMessage } from 'umi-plugin-react/locale';
import { urlToList } from '../_utils/pathTools';
import { PageHeaderWrapperProps } from '.';
import { MenuDataItem } from '../SiderMenu';
import { BreadcrumbProps as AntdBreadcrumbProps } from 'antd/lib/breadcrumb';
type BreadcrumbProps = PageHeaderWrapperProps;
// 渲染Breadcrumb 子节点
// Render the Breadcrumb child node
const itemRender: AntdBreadcrumbProps['itemRender'] = (route, params, routes, paths) => {
const last = routes.indexOf(route) === routes.length - 1;
return last || !route.component ? (
<span>{route.breadcrumbName}</span>
) : (
<Link to={paths.join('/')}>{route.breadcrumbName}</Link>
);
};
const renderItemLocal = (item: MenuDataItem): string => {
if (item.locale) {
return formatMessage({
id: item.locale,
defaultMessage: item.name,
});
}
return item.name as string;
};
export const getBreadcrumb = (
breadcrumbNameMap: PageHeaderWrapperProps['breadcrumbNameMap'],
url: string,
): MenuDataItem => {
if (!breadcrumbNameMap) {
return {
path: '',
};
}
let breadcrumb = breadcrumbNameMap[url];
if (!breadcrumb) {
Object.keys(breadcrumbNameMap).forEach(item => {
if (pathToRegexp(item).test(url)) {
breadcrumb = breadcrumbNameMap[item];
}
});
}
return breadcrumb || { path: '' };
};
export const getBreadcrumbProps = (props: BreadcrumbProps): PageHeaderWrapperProps => {
const { location, breadcrumbNameMap } = props;
return {
location,
breadcrumbNameMap,
};
};
// Generated according to props
const conversionFromProps = (props: BreadcrumbProps): AntdBreadcrumbProps['routes'] => {
const { breadcrumbList = [] } = props;
return breadcrumbList
.map(item => {
const { title, href } = item;
return {
path: href,
breadcrumbName: title,
};
})
.filter(item => item.path);
};
const conversionFromLocation = (
routerLocation: PageHeaderWrapperProps['location'],
breadcrumbNameMap: PageHeaderWrapperProps['breadcrumbNameMap'],
props: BreadcrumbProps,
): AntdBreadcrumbProps['routes'] => {
if (!routerLocation) {
return [];
}
const { home } = props;
// Convert the url to an array
const pathSnippets = urlToList(routerLocation.pathname);
// Loop data mosaic routing
const extraBreadcrumbItems: AntdBreadcrumbProps['routes'] = pathSnippets
.map(url => {
const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url);
if (currentBreadcrumb.inherited) {
return { path: '', breadcrumbName: '' };
}
const name = renderItemLocal(currentBreadcrumb);
const { hideInBreadcrumb } = currentBreadcrumb;
return name && !hideInBreadcrumb
? {
path: url,
breadcrumbName: name,
}
: { path: '', breadcrumbName: '' };
})
.filter(item => item && item.path);
// Add home breadcrumbs to your head if defined
if (home) {
extraBreadcrumbItems.unshift({
path: '/',
breadcrumbName: home,
});
}
return extraBreadcrumbItems;
};
/**
* 将参数转化为面包屑
* Convert parameters into breadcrumbs
*/
export const conversionBreadcrumbList = (props: BreadcrumbProps): AntdBreadcrumbProps => {
const { breadcrumbList } = props;
const { location, breadcrumbNameMap } = getBreadcrumbProps(props);
if (breadcrumbList && breadcrumbList.length) {
return {
routes: conversionFromProps(props),
itemRender,
};
}
// 根据 location 生成 面包屑
// Generate breadcrumbs based on location
if (location && location.pathname) {
return {
routes: conversionFromLocation(location, breadcrumbNameMap, props),
itemRender,
};
}
return {
routes: [],
};
};
.main {
width: 100%;
height: 100%;
min-height: 100%;
transition: 0.3s;
&.wide {
max-width: 1200px;
margin: 0 auto;
}
}
import React from 'react';
import { connect } from 'dva';
import styles from './GridContent.less';
import ConnectState from '@/models/connect';
import { ContentWidth } from 'config/defaultSettings';
interface GridContentProps {
contentWidth: ContentWidth;
children: React.ReactNode;
}
const GridContent = (props: GridContentProps) => {
const { contentWidth, children } = props;
let className = `${styles.main}`;
if (contentWidth === 'Fixed') {
className = `${styles.main} ${styles.wide}`;
}
return <div className={className}>{children}</div>;
};
export default connect(({ setting }: ConnectState) => ({
contentWidth: setting.contentWidth,
}))(GridContent);
@import '~antd/lib/style/themes/default.less';
.children-content {
margin: 24px 24px 0;
}
.main {
:global {
.ant-page-header {
padding: 16px 32px 0;
background: #fff;
border-bottom: 1px solid #e8e8e8;
}
}
.wide {
max-width: 1200px;
margin: auto;
}
.detail {
display: flex;
}
.row {
display: flex;
width: 100%;
}
.logo {
flex: 0 1 auto;
margin-right: 16px;
padding-top: 1px;
> img {
display: block;
width: 28px;
height: 28px;
border-radius: @border-radius-base;
}
}
.title-content {
margin-bottom: 16px;
}
@media screen and (max-width: @screen-sm) {
.content {
margin: 24px 0 0;
}
}
.title,
.content {
flex: auto;
}
.extraContent,
.main {
flex: 0 1 auto;
}
.main {
width: 100%;
}
.title {
margin-bottom: 16px;
}
.logo,
.content,
.extraContent {
margin-bottom: 16px;
}
.extraContent {
min-width: 242px;
margin-left: 88px;
text-align: right;
}
}
@media screen and (max-width: @screen-xl) {
.extraContent {
margin-left: 44px;
}
}
@media screen and (max-width: @screen-lg) {
.extraContent {
margin-left: 20px;
}
}
@media screen and (max-width: @screen-md) {
.row {
display: block;
}
.action,
.extraContent {
margin-left: 0;
text-align: left;
}
}
@media screen and (max-width: @screen-sm) {
.detail {
display: block;
}
}
import React from 'react';
import { formatMessage } from 'umi-plugin-react/locale';
import { PageHeader, Tabs, Typography } from 'antd';
import { connect } from 'dva';
import classNames from 'classnames';
import GridContent from './GridContent';
import ConnectState from '@/models/connect';
import { ContentWidth } from 'config/defaultSettings';
import styles from './index.less';
import { conversionBreadcrumbList } from './Breadcrumb';
import { MenuDataItem } from '../SiderMenu';
import * as H from 'history';
const { Title } = Typography;
/**
* render Footer tabList
* In order to be compatible with the old version of the PageHeader
* basically all the functions are implemented.
*/
const renderFooter = ({
tabList,
onTabChange,
tabBarExtraContent,
}: Partial<PageHeaderWrapperProps>) => {
return tabList && tabList.length ? (
<Tabs
className={styles.tabs}
onChange={key => {
if (onTabChange) {
onTabChange(key);
}
}}
tabBarExtraContent={tabBarExtraContent}
>
{tabList.map(item => (
<Tabs.TabPane tab={item.tab} key={item.key} />
))}
</Tabs>
) : null;
};
export interface PageHeaderWrapperProps {
title?: React.ReactNode | string | number;
logo?: React.ReactNode | string;
action?: React.ReactNode | string;
content?: React.ReactNode;
extraContent?: React.ReactNode;
breadcrumbList?: Array<{ title: string; href: string }>;
tabList?: Array<{ key: string; tab: React.ReactNode }>;
tabActiveKey?: string;
onTabChange?: (key: string) => void;
tabBarExtraContent?: React.ReactNode;
style?: React.CSSProperties;
home?: string;
wide?: boolean;
contentWidth?: ContentWidth;
className?: string;
children?: React.ReactNode;
wrapperClassName?: string;
top?: React.ReactNode;
location?: H.Location;
breadcrumbNameMap?: { [path: string]: MenuDataItem };
}
class PageHeaderWrapper extends React.Component<PageHeaderWrapperProps> {
mergePropsAndChildren = (): PageHeaderWrapperProps => {
return {
...this.props,
};
};
renderPageHeader = () => {
const {
children,
contentWidth,
wrapperClassName,
top,
title,
content,
logo,
extraContent,
...restProps
} = this.mergePropsAndChildren();
let pageTitle = title;
const breadcrumb = conversionBreadcrumbList({
...restProps,
home: formatMessage({
id: 'menu.home',
defaultMessage: 'Home',
}),
});
if (!title && breadcrumb.routes) {
const router = breadcrumb.routes[breadcrumb.routes.length - 1];
if (router) {
pageTitle = router.breadcrumbName;
}
}
if (!pageTitle && !content) {
return;
}
return (
<PageHeader
title={
<Title
level={4}
style={{
marginBottom: 0,
}}
>
{pageTitle}
</Title>
}
{...restProps}
breadcrumb={breadcrumb}
className={styles.pageHeader}
footer={renderFooter(restProps)}
>
<div className={styles.detail}>
{logo && <div className={styles.logo}>{logo}</div>}
<div className={styles.main}>
<div className={styles.row}>
{content && <div className={styles.content}>{content}</div>}
{extraContent && <div className={styles.extraContent}>{extraContent}</div>}
</div>
</div>
</div>
</PageHeader>
);
};
render() {
const { children } = this.mergePropsAndChildren();
return (
<div style={{ margin: '-24px -24px 0' }} className={classNames(classNames, styles.main)}>
{children ? (
<div className={styles['children-content']}>
<GridContent>{children}</GridContent>
</div>
) : null}
</div>
);
}
}
export default connect(({ setting }: ConnectState) => ({
contentWidth: setting.contentWidth,
}))(PageHeaderWrapper);
export default {
'app.login.userName': 'userName',
'app.login.password': 'password',
'app.login.message-invalid-credentials': 'Invalid username or password(admin/ant.design)',
'app.login.message-invalid-verification-code': 'Invalid verification code',
'app.login.tab-login-credentials': 'Credentials',
'app.login.tab-login-mobile': 'Mobile number',
'app.login.remember-me': 'Remember me',
'app.login.forgot-password': 'Forgot your password?',
'app.login.sign-in-with': 'Sign in with',
'app.login.signup': 'Sign up',
'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':
'The activation email has been sent to your email address and is valid for 24 hours. Please log in to the email in time and click on the link in the email to activate the account.',
'app.register-result.back-home': 'Back to home',
'app.register-result.view-mailbox': 'View mailbox',
'validation.email.required': 'Please enter your email!',
'validation.email.wrong-format': 'The email address is in the wrong format!',
'validation.userName.required': 'Please enter your userName!',
'validation.password.required': 'Please enter your password!',
'validation.password.twice': 'The passwords entered twice do not match!',
'validation.password.strength.msg':
"Please enter at least 6 characters and don't use passwords that are easy to guess.",
'validation.password.strength.strong': 'Strength: strong',
'validation.password.strength.medium': 'Strength: medium',
'validation.password.strength.short': 'Strength: too short',
'validation.confirm-password.required': 'Please confirm your password!',
'validation.phone-number.required': 'Please enter your phone number!',
'validation.phone-number.wrong-format': 'Malformed phone number!',
'validation.verification-code.required': 'Please enter the verification code!',
'validation.title.required': 'Please enter a title',
'validation.date.required': 'Please select the start and end date',
'validation.goal.required': 'Please enter a description of the goal',
'validation.standard.required': 'Please enter a metric',
};
export default {
'app.login.userName': 'Nome de usuário',
'app.login.password': 'Sua senha',
'app.login.message-invalid-credentials':
'Nome de usuário ou senha inválidosd(admin/ant.design)',
'app.login.message-invalid-verification-code': 'Código de verificação inválido',
'app.login.tab-login-credentials': 'Credenciais',
'app.login.tab-login-mobile': 'Telefone',
'app.login.remember-me': 'Lembre-me',
'app.login.forgot-password': 'Esqueceu sua senha?',
'app.login.sign-in-with': 'Login com',
'app.login.signup': 'Cadastre-se',
'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':
'Um email de ativação foi enviado para o seu email e é válido por 24 horas. Por favor entre no seu email e clique no link de ativação da conta.',
'app.register-result.back-home': 'Voltar ao Início',
'app.register-result.view-mailbox': 'Visualizar a caixa de email',
'validation.email.required': 'Por favor insira seu email!',
'validation.email.wrong-format': 'O email está errado!',
'validation.userName.required': 'Por favor insira nome de usuário!',
'validation.password.required': 'Por favor insira sua senha!',
'validation.password.twice': 'As senhas não estão iguais!',
'validation.password.strength.msg':
'Por favor insira pelo menos 6 caracteres e não use senhas fáceis de adivinhar.',
'validation.password.strength.strong': 'Força: forte',
'validation.password.strength.medium': 'Força: média',
'validation.password.strength.short': 'Força: curta',
'validation.confirm-password.required': 'Por favor confirme sua senha!',
'validation.phone-number.required': 'Por favor insira seu telefone!',
'validation.phone-number.wrong-format': 'Formato de telefone errado!',
'validation.verification-code.required': 'Por favor insira seu código de verificação!',
};
export default {
'app.login.userName': '用户名',
'app.login.password': '密码',
'app.login.message-invalid-credentials': '账户或密码错误(admin/ant.design)',
'app.login.message-invalid-verification-code': '验证码错误',
'app.login.tab-login-credentials': '账户密码登录',
'app.login.tab-login-mobile': '手机号登录',
'app.login.remember-me': '自动登录',
'app.login.forgot-password': '忘记密码',
'app.login.sign-in-with': '其他登录方式',
'app.login.signup': '注册账户',
'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':
'激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。',
'app.register-result.back-home': '返回首页',
'app.register-result.view-mailbox': '查看邮箱',
'validation.email.required': '请输入邮箱地址!',
'validation.email.wrong-format': '邮箱地址格式错误!',
'validation.userName.required': '请输入用户名!',
'validation.password.required': '请输入密码!',
'validation.password.twice': '两次输入的密码不匹配!',
'validation.password.strength.msg': '请至少输入 6 个字符。请不要使用容易被猜到的密码。',
'validation.password.strength.strong': '强度:强',
'validation.password.strength.medium': '强度:中',
'validation.password.strength.short': '强度:太短',
'validation.confirm-password.required': '请确认密码!',
'validation.phone-number.required': '请输入手机号!',
'validation.phone-number.wrong-format': '手机号格式错误!',
'validation.verification-code.required': '请输入验证码!',
'validation.title.required': '请输入标题',
'validation.date.required': '请选择起止日期',
'validation.goal.required': '请输入目标描述',
'validation.standard.required': '请输入衡量标准',
};
export default {
'app.login.userName': '賬戶',
'app.login.password': '密碼',
'app.login.message-invalid-credentials': '賬戶或密碼錯誤(admin/ant.design)',
'app.login.message-invalid-verification-code': '驗證碼錯誤',
'app.login.tab-login-credentials': '賬戶密碼登錄',
'app.login.tab-login-mobile': '手機號登錄',
'app.login.remember-me': '自動登錄',
'app.login.forgot-password': '忘記密碼',
'app.login.sign-in-with': '其他登錄方式',
'app.login.signup': '註冊賬戶',
'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':
'激活郵件已發送到妳的郵箱中,郵件有效期為24小時。請及時登錄郵箱,點擊郵件中的鏈接激活帳戶。',
'app.register-result.back-home': '返回首頁',
'app.register-result.view-mailbox': '查看郵箱',
'validation.email.required': '請輸入郵箱地址!',
'validation.email.wrong-format': '郵箱地址格式錯誤!',
'validation.userName.required': '請輸入賬戶!',
'validation.password.required': '請輸入密碼!',
'validation.password.twice': '兩次輸入的密碼不匹配!',
'validation.password.strength.msg': '請至少輸入 6 個字符。請不要使用容易被猜到的密碼。',
'validation.password.strength.strong': '強度:強',
'validation.password.strength.medium': '強度:中',
'validation.password.strength.short': '強度:太短',
'validation.confirm-password.required': '請確認密碼!',
'validation.phone-number.required': '請輸入手機號!',
'validation.phone-number.wrong-format': '手機號格式錯誤!',
'validation.verification-code.required': '請輸入驗證碼!',
'validation.title.required': '請輸入標題',
'validation.date.required': '請選擇起止日期',
'validation.goal.required': '請輸入目標描述',
'validation.standard.required': '請輸入衡量標淮',
};
...@@ -3,7 +3,7 @@ import { getAuthority } from './authority'; ...@@ -3,7 +3,7 @@ import { getAuthority } from './authority';
describe('getAuthority should be strong', () => { describe('getAuthority should be strong', () => {
it('empty', () => { it('empty', () => {
expect(getAuthority(null!)).toEqual(['admin']); // default value expect(getAuthority(null)).toEqual(null); // default value
}); });
it('string', () => { it('string', () => {
expect(getAuthority('admin')).toEqual(['admin']); expect(getAuthority('admin')).toEqual(['admin']);
......
// use localStorage to store the authority info, which might be sent from server in actual project. // 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?: string): any { export function getAuthority(str?: string): any {
// return localStorage.getItem('antd-pro-authority') || ['admin', 'user']; // return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
const authorityString = const authorityString =
...@@ -15,7 +13,7 @@ export function getAuthority(str?: string): any { ...@@ -15,7 +13,7 @@ export function getAuthority(str?: string): any {
if (typeof authority === 'string') { if (typeof authority === 'string') {
return [authority]; return [authority];
} }
if (!authority && NODE_ENV !== 'production') { if (!authority && APP_TYPE === 'site') {
return ['admin']; return ['admin'];
} }
return authority; return authority;
......
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