diff --git a/.eslintignore b/.eslintignore index c1fcbb8a79c1eb2990b138469a6d86f8e02eefda..966421f4778a6a847aa6f666e1ab3d8df649f084 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ -/lambda/mock/** +/lambda/ /scripts /config 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/jest.config.js b/jest.config.js index 68a1144bcb17feb585b3725e5d323b0414dd91cc..a1d8c22c46eb9e2af27371cbda86fc9d70fd7ea2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,7 @@ module.exports = { testURL: 'http://localhost:8000', preset: 'jest-puppeteer', + globals: { + APP_TYPE: false, + }, }; diff --git a/netlify.toml b/netlify.toml index 9d3438c4aff06f5a644d10167b5c7133f5175e45..5ecaa9640ddcfa44e69b09a66fda260740f87a3b 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ [[redirects]] from = "/api/*" - to = "/.netlify/functions/api/:splat" + to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat" status = 200 force = true [redirects.headers] diff --git a/package.json b/package.json index c2a9cccb30622b20aed0010e15c720e7e2dd2772..c7a6f6a494da9611fbe53b7389dd281a8675f039 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,10 @@ ], "dependencies": { "@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", "dva": "^2.4.0", "express": "^4.16.4", diff --git a/src/app.ts b/src/app.ts index c2bb1b1bc86d4194a7007aa915e6516ebfb09fcd..faaa39659a813fca1fa681986435ebaa4095f106 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,6 +1,3 @@ -import fetch from 'dva/fetch'; -import { IRoute } from 'umi-types'; - export const dva = { config: { onError(err: ErrorEvent) { @@ -9,37 +6,6 @@ export const dva = { }, }; -let authRoutes = {}; - -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(); - }, - ); +export function render(oldRender) { + oldRender(); } diff --git a/src/components/PageHeaderWrapper/Breadcrumb.tsx b/src/components/PageHeaderWrapper/Breadcrumb.tsx deleted file mode 100644 index 7c869136fb807de1b970aa3160a5b21d6944cbbf..0000000000000000000000000000000000000000 --- a/src/components/PageHeaderWrapper/Breadcrumb.tsx +++ /dev/null @@ -1,138 +0,0 @@ -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 ? ( - {route.breadcrumbName} - ) : ( - {route.breadcrumbName} - ); -}; - -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: [], - }; -}; diff --git a/src/components/PageHeaderWrapper/GridContent.less b/src/components/PageHeaderWrapper/GridContent.less deleted file mode 100644 index d5496e9ecb95318c38a30f1369d35e8fcf583758..0000000000000000000000000000000000000000 --- a/src/components/PageHeaderWrapper/GridContent.less +++ /dev/null @@ -1,10 +0,0 @@ -.main { - width: 100%; - height: 100%; - min-height: 100%; - transition: 0.3s; - &.wide { - max-width: 1200px; - margin: 0 auto; - } -} diff --git a/src/components/PageHeaderWrapper/GridContent.tsx b/src/components/PageHeaderWrapper/GridContent.tsx deleted file mode 100644 index 88e0284b197bf9efae2fddeae2565ff07ac6430a..0000000000000000000000000000000000000000 --- a/src/components/PageHeaderWrapper/GridContent.tsx +++ /dev/null @@ -1,23 +0,0 @@ -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
{children}
; -}; - -export default connect(({ setting }: ConnectState) => ({ - contentWidth: setting.contentWidth, -}))(GridContent); diff --git a/src/components/PageHeaderWrapper/index.less b/src/components/PageHeaderWrapper/index.less deleted file mode 100644 index 119585bbaef2af9a3a3f4dd90ce882a50a5a98e8..0000000000000000000000000000000000000000 --- a/src/components/PageHeaderWrapper/index.less +++ /dev/null @@ -1,110 +0,0 @@ -@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; - } -} diff --git a/src/components/PageHeaderWrapper/index.tsx b/src/components/PageHeaderWrapper/index.tsx deleted file mode 100644 index ff0083424ce8e2c997412c8d933e26934c073325..0000000000000000000000000000000000000000 --- a/src/components/PageHeaderWrapper/index.tsx +++ /dev/null @@ -1,146 +0,0 @@ -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) => { - return tabList && tabList.length ? ( - { - if (onTabChange) { - onTabChange(key); - } - }} - tabBarExtraContent={tabBarExtraContent} - > - {tabList.map(item => ( - - ))} - - ) : 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 { - 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 ( - - {pageTitle} - - } - {...restProps} - breadcrumb={breadcrumb} - className={styles.pageHeader} - footer={renderFooter(restProps)} - > -
- {logo &&
{logo}
} -
-
- {content &&
{content}
} - {extraContent &&
{extraContent}
} -
-
-
-
- ); - }; - render() { - const { children } = this.mergePropsAndChildren(); - return ( -
- {children ? ( -
- {children} -
- ) : null} -
- ); - } -} - -export default connect(({ setting }: ConnectState) => ({ - contentWidth: setting.contentWidth, -}))(PageHeaderWrapper); diff --git a/src/locales/en-US/login.js b/src/locales/en-US/login.js new file mode 100644 index 0000000000000000000000000000000000000000..195e59ce3239c64a33ed2d676bca7371bf376369 --- /dev/null +++ b/src/locales/en-US/login.js @@ -0,0 +1,41 @@ +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', +}; diff --git a/src/locales/pt-BR/login.js b/src/locales/pt-BR/login.js new file mode 100644 index 0000000000000000000000000000000000000000..5e2d86954a2c0ee5d88046ebfbb6b008c866ccc9 --- /dev/null +++ b/src/locales/pt-BR/login.js @@ -0,0 +1,38 @@ +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!', +}; diff --git a/src/locales/zh-CN/login.js b/src/locales/zh-CN/login.js new file mode 100644 index 0000000000000000000000000000000000000000..e211e2cf282e5db88309693255208a4cfb439e05 --- /dev/null +++ b/src/locales/zh-CN/login.js @@ -0,0 +1,40 @@ +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': '请输入衡量标准', +}; diff --git a/src/locales/zh-TW/login.js b/src/locales/zh-TW/login.js new file mode 100644 index 0000000000000000000000000000000000000000..fb916603913281e88e0dce927d84ff9335d1b0ea --- /dev/null +++ b/src/locales/zh-TW/login.js @@ -0,0 +1,40 @@ +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': '請輸入衡量標淮', +}; diff --git a/src/utils/authority.test.ts b/src/utils/authority.test.ts index 69e39a84a2308f143ea5fb807118e9624f1521ed..6401291775e9f32016fbb83f3948e1f606af56b8 100644 --- a/src/utils/authority.test.ts +++ b/src/utils/authority.test.ts @@ -3,7 +3,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']); diff --git a/src/utils/authority.ts b/src/utils/authority.ts index a9694a5c5a12344764694659094151ed0178c4dc..a87ac378e8a168a2d976cfaa1aabfb229b14fd04 100644 --- a/src/utils/authority.ts +++ b/src/utils/authority.ts @@ -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?: string): any { // return localStorage.getItem('antd-pro-authority') || ['admin', 'user']; const authorityString = @@ -15,7 +13,7 @@ export function getAuthority(str?: string): any { if (typeof authority === 'string') { return [authority]; } - if (!authority && NODE_ENV !== 'production') { + if (!authority && APP_TYPE === 'site') { return ['admin']; } return authority;