diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d055600644912e1af5010c0461808caa7b756b96..13e12db8ba687fce09dd6f93556b24959fceb41e 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,9 +1,9 @@ -version: "3.5" +version: '3.5' services: ant-design-pro_build: build: ../ - container_name: "ant-design-pro_build" + container_name: 'ant-design-pro_build' volumes: - dist:/usr/src/app/dist @@ -11,7 +11,7 @@ services: image: nginx ports: - 80:80 - container_name: "ant-design-pro_web" + container_name: 'ant-design-pro_web' restart: unless-stopped volumes: - dist:/usr/share/nginx/html:ro diff --git a/package.json b/package.json index 924a704ad8fc5df58a5262e4107b94928d6c465c..22ab8b09660fc04ad29b9626c0586350033654da 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@antv/data-set": "^0.10.1", "ant-design-pro": "^2.1.1", "antd": "^3.16.1", - "bizcharts": "^3.4.3", + "bizcharts": "3.5.2-beta", "bizcharts-plugin-slider": "^2.1.1-beta.1", "classnames": "^2.2.6", "dva": "^2.4.0", @@ -81,7 +81,7 @@ "react-fittext": "^1.0.0", "react-media": "^1.9.2", "react-media-hook2": "^1.0.2", - "umi": "^2.6.10", + "umi": "^2.6.17", "umi-plugin-pro-block": "^1.3.0", "umi-plugin-react": "^1.7.2", "umi-request": "^1.0.5" @@ -111,7 +111,7 @@ "eslint-plugin-markdown": "^1.0.0", "eslint-plugin-react": "^7.12.4", "gh-pages": "^2.0.1", - "husky": "^1.3.1", + "husky": "^2.2.0", "jest-puppeteer": "^4.1.0", "jsdom-global": "^3.0.2", "less": "^3.9.0", @@ -139,7 +139,7 @@ "puppeteer": "^1.12.1" }, "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" }, "checkFiles": [ "src/**/*.js*", diff --git a/src/components/Authorized/CheckPermissions.test.js b/src/components/Authorized/CheckPermissions.test.js deleted file mode 100644 index 3988d85a18fcfe7412bb72f672ffdf7c2501d8c2..0000000000000000000000000000000000000000 --- a/src/components/Authorized/CheckPermissions.test.js +++ /dev/null @@ -1,55 +0,0 @@ -import { checkPermissions } from './CheckPermissions'; - -const target = 'ok'; -const error = 'error'; - -describe('test CheckPermissions', () => { - it('Correct string permission authentication', () => { - expect(checkPermissions('user', 'user', target, error)).toEqual('ok'); - }); - it('Correct string permission authentication', () => { - expect(checkPermissions('user', 'NULL', target, error)).toEqual('error'); - }); - it('authority is undefined , return ok', () => { - expect(checkPermissions(null, 'NULL', target, error)).toEqual('ok'); - }); - it('currentAuthority is undefined , return error', () => { - expect(checkPermissions('admin', null, target, error)).toEqual('error'); - }); - it('Wrong string permission authentication', () => { - expect(checkPermissions('admin', 'user', target, error)).toEqual('error'); - }); - it('Correct Array permission authentication', () => { - expect(checkPermissions(['user', 'admin'], 'user', target, error)).toEqual('ok'); - }); - it('Wrong Array permission authentication,currentAuthority error', () => { - expect(checkPermissions(['user', 'admin'], 'user,admin', target, error)).toEqual('error'); - }); - it('Wrong Array permission authentication', () => { - expect(checkPermissions(['user', 'admin'], 'guest', target, error)).toEqual('error'); - }); - it('Wrong Function permission authentication', () => { - expect(checkPermissions(() => false, 'guest', target, error)).toEqual('error'); - }); - it('Correct Function permission authentication', () => { - expect(checkPermissions(() => true, 'guest', target, error)).toEqual('ok'); - }); - it('authority is string, currentAuthority is array, return ok', () => { - expect(checkPermissions('user', ['user'], target, error)).toEqual('ok'); - }); - it('authority is string, currentAuthority is array, return ok', () => { - expect(checkPermissions('user', ['user', 'admin'], target, error)).toEqual('ok'); - }); - it('authority is array, currentAuthority is array, return ok', () => { - expect(checkPermissions(['user', 'admin'], ['user', 'admin'], target, error)).toEqual('ok'); - }); - it('Wrong Function permission authentication', () => { - expect(checkPermissions(() => false, ['user'], target, error)).toEqual('error'); - }); - it('Correct Function permission authentication', () => { - expect(checkPermissions(() => true, ['user'], target, error)).toEqual('ok'); - }); - it('authority is undefined , return ok', () => { - expect(checkPermissions(null, ['user'], target, error)).toEqual('ok'); - }); -}); diff --git a/src/locales/en-US/login.js b/src/locales/en-US/login.js deleted file mode 100644 index 195e59ce3239c64a33ed2d676bca7371bf376369..0000000000000000000000000000000000000000 --- a/src/locales/en-US/login.js +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index 5e2d86954a2c0ee5d88046ebfbb6b008c866ccc9..0000000000000000000000000000000000000000 --- a/src/locales/pt-BR/login.js +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index e211e2cf282e5db88309693255208a4cfb439e05..0000000000000000000000000000000000000000 --- a/src/locales/zh-CN/login.js +++ /dev/null @@ -1,40 +0,0 @@ -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-CN/menu.ts b/src/locales/zh-CN/menu.ts index 25d28e42ab112762420dae70194acc8b7926ea5d..550dfed14a56b821f21ed81950f38157f45b9666 100644 --- a/src/locales/zh-CN/menu.ts +++ b/src/locales/zh-CN/menu.ts @@ -1,7 +1,6 @@ export default { 'menu.welcome': '欢迎', 'menu.more-blocks': '更多区块', - 'menu.account.center': '个人中心', 'menu.account.settings': '个人设置', 'menu.account.trigger': '触发报错', diff --git a/src/locales/zh-TW/login.js b/src/locales/zh-TW/login.js deleted file mode 100644 index fb916603913281e88e0dce927d84ff9335d1b0ea..0000000000000000000000000000000000000000 --- a/src/locales/zh-TW/login.js +++ /dev/null @@ -1,40 +0,0 @@ -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/pages/Authorized.tsx b/src/pages/Authorized.tsx index 80cb73a6b173bdbc957d2a5d9c43747aea100303..e0f9d916542d6bb40a94c579ea7969f64cd7e8b9 100644 --- a/src/pages/Authorized.tsx +++ b/src/pages/Authorized.tsx @@ -1,5 +1,5 @@ import Authorized from '@/utils/Authorized'; -import { Route } from '@/components/SiderMenu'; +import { Route } from '@/models/connect'; import { ConnectProps, ConnectState, UserModelState } from '@/models/connect'; import { connect } from 'dva'; import pathToRegexp from 'path-to-regexp'; diff --git a/src/pages/analysis/components/Charts/Bar/index.tsx b/src/pages/analysis/components/Charts/Bar/index.tsx index 1eaa6454a9957d3e3dbb0f00c6db286c654cc098..b5507fe6ad898a2f19b8f5a5ae45b932db94ae86 100644 --- a/src/pages/analysis/components/Charts/Bar/index.tsx +++ b/src/pages/analysis/components/Charts/Bar/index.tsx @@ -2,8 +2,8 @@ import React, { Component } from 'react'; import { Chart, Axis, Tooltip, Geom } from 'bizcharts'; import Debounce from 'lodash-decorators/debounce'; import Bind from 'lodash-decorators/bind'; -import autoHeight from '../autoHeight'; import styles from '../index.less'; +import autoHeight from '../autoHeight'; export interface IBarProps { title: React.ReactNode; @@ -29,6 +29,7 @@ class Bar extends Component< node: HTMLDivElement | undefined; state = { + height: 0, autoHideXLabels: false, }; @@ -76,7 +77,7 @@ class Bar extends Component< render() { const { - height = 1, + height: propsHeight = 1, title, forceFit = true, data, @@ -102,7 +103,8 @@ class Bar extends Component< value: y, }), ]; - + const { height: stateHeight } = this.state; + const height = propsHeight || stateHeight; return (
diff --git a/src/pages/analysis/components/Charts/Pie/index.tsx b/src/pages/analysis/components/Charts/Pie/index.tsx index 9ed8a9a3956c6ea0b9f4590188c0370881f7c32f..1b18f8a24900823147467bbb830c54c76d7df102 100644 --- a/src/pages/analysis/components/Charts/Pie/index.tsx +++ b/src/pages/analysis/components/Charts/Pie/index.tsx @@ -6,9 +6,8 @@ import classNames from 'classnames'; import ReactFitText from 'react-fittext'; import Debounce from 'lodash-decorators/debounce'; import Bind from 'lodash-decorators/bind'; -import autoHeight from '../autoHeight'; - import styles from './index.less'; +import autoHeight from '../autoHeight'; export interface IPieProps { animate?: boolean; color?: string; @@ -279,7 +278,6 @@ class Pie extends Component { )}
- {hasLegend && (