Przeglądaj źródła

Merge branch 'master' into v4

陈帅 6 lat temu
rodzic
commit
4dc7e7370e

+ 1 - 1
.eslintignore

@@ -1,3 +1,3 @@
-/lambda/mock/**
+/lambda/
 /scripts
 /config

Plik diff jest za duży
+ 138 - 0
README.ja-JP.md


+ 1 - 1
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)
 
 <h1 align="center">Ant Design Pro</h1>
 

+ 1 - 1
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)
 
 <h1 align="center">Ant Design Pro</h1>
 

+ 1 - 1
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)
 
 <h1 align="center">Ant Design Pro</h1>
 

+ 1 - 1
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)
 
 <h1 align="center">Ant Design Pro</h1>
 

+ 3 - 0
jest.config.js

@@ -1,4 +1,7 @@
 module.exports = {
   testURL: 'http://localhost:8000',
   preset: 'jest-puppeteer',
+  globals: {
+    APP_TYPE: false,
+  },
 };

+ 1 - 1
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]

+ 4 - 1
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",

+ 2 - 36
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();
 }

+ 0 - 138
src/components/PageHeaderWrapper/Breadcrumb.tsx

@@ -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 ? (
-    <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: [],
-  };
-};

+ 0 - 10
src/components/PageHeaderWrapper/GridContent.less

@@ -1,10 +0,0 @@
-.main {
-  width: 100%;
-  height: 100%;
-  min-height: 100%;
-  transition: 0.3s;
-  &.wide {
-    max-width: 1200px;
-    margin: 0 auto;
-  }
-}

+ 0 - 23
src/components/PageHeaderWrapper/GridContent.tsx

@@ -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 <div className={className}>{children}</div>;
-};
-
-export default connect(({ setting }: ConnectState) => ({
-  contentWidth: setting.contentWidth,
-}))(GridContent);

+ 0 - 110
src/components/PageHeaderWrapper/index.less

@@ -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;
-  }
-}

+ 0 - 146
src/components/PageHeaderWrapper/index.tsx

@@ -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<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);

+ 41 - 0
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',
+};

+ 38 - 0
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!',
+};

+ 40 - 0
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': '请输入衡量标准',
+};

+ 40 - 0
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': '請輸入衡量標淮',
+};

+ 1 - 1
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']);

+ 1 - 3
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;