From 0ea57d14c920047245611b95b169ed51cc6c0bbd Mon Sep 17 00:00:00 2001 From: Baorong Li Date: Sun, 7 Jul 2019 23:01:20 +0800 Subject: [PATCH 1/5] fix #980 cannot read property 'map' of null --- src/pages/dashboard/components/completed.js | 2 +- src/pages/dashboard/components/sales.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/dashboard/components/completed.js b/src/pages/dashboard/components/completed.js index 2dc62cd..02ad904 100644 --- a/src/pages/dashboard/components/completed.js +++ b/src/pages/dashboard/components/completed.js @@ -73,7 +73,7 @@ function Completed({ data }) { return (

{content.label}

- + {content.payload && }
) }} diff --git a/src/pages/dashboard/components/sales.js b/src/pages/dashboard/components/sales.js index d155239..0c6e78d 100644 --- a/src/pages/dashboard/components/sales.js +++ b/src/pages/dashboard/components/sales.js @@ -73,7 +73,7 @@ function Sales({ data }) { return (

{content.label}

- + {content.payload && }
) }} From 597064a07d1a52d3da11003154313a151e8e77d6 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 25 Jul 2019 11:47:32 +0800 Subject: [PATCH 2/5] [fix] add notification popup to #primaryLayout instead of #layoutHeader --- src/components/Layout/Header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout/Header.js b/src/components/Layout/Header.js index d2796a6..a2a65b5 100644 --- a/src/components/Layout/Header.js +++ b/src/components/Layout/Header.js @@ -85,7 +85,7 @@ class Header extends PureComponent { trigger="click" key="notifications" overlayClassName={styles.notificationPopover} - getPopupContainer={() => document.querySelector('#layoutHeader')} + getPopupContainer={() => document.querySelector('#primaryLayout')} content={
Date: Thu, 1 Aug 2019 23:12:42 +0800 Subject: [PATCH 3/5] fix 404 when path = '/' --- src/models/app.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/models/app.js b/src/models/app.js index 0157f3e..bfba377 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -11,6 +11,14 @@ import config from 'config' const { queryRouteList, logoutUser, queryUserInfo } = api +const goDashboard = () => { + if (pathMatchRegexp(['/', '/login'], window.location.pathname)) { + router.push({ + pathname: '/dashboard', + }) + } +} + export default { namespace: 'app', state: { @@ -71,7 +79,10 @@ export default { *query({ payload }, { call, put, select }) { // store isInit to prevent query trigger by refresh const isInit = store.get('isInit') - if (isInit) return + if (isInit) { + goDashboard() + return + } const { locationPathname } = yield select(_ => _.app) const { success, user } = yield call(queryUserInfo, payload) if (success && user) { @@ -99,11 +110,7 @@ export default { store.set('permissions', permissions) store.set('user', user) store.set('isInit', true) - if (pathMatchRegexp(['/', '/login'], window.location.pathname)) { - router.push({ - pathname: '/dashboard', - }) - } + goDashboard() } else if (queryLayout(config.layouts, locationPathname) !== 'public') { router.push({ pathname: '/login', From b2b3fcd4a3684887667aa045b36a832218715d67 Mon Sep 17 00:00:00 2001 From: zuiidea Date: Wed, 9 Oct 2019 20:20:11 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8=20=20Support=20disable=20i18n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.js | 4 ++-- src/layouts/index.js | 4 ++-- src/utils/index.js | 52 +++++++++++++++++++++++++++++--------------- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.umirc.js b/.umirc.js index 05a0fab..999104d 100644 --- a/.umirc.js +++ b/.umirc.js @@ -60,9 +60,9 @@ export default { }, pwa: { manifestOptions: { - srcPath: 'manifest.json' + srcPath: 'manifest.json', }, - } + }, }, ], ], diff --git a/src/layouts/index.js b/src/layouts/index.js index 55ea725..8c40b0e 100644 --- a/src/layouts/index.js +++ b/src/layouts/index.js @@ -26,7 +26,7 @@ class Layout extends Component { componentDidMount() { const language = langFromPath(this.props.location.pathname) this.language = language - this.loadCatalog(language) + language && this.loadCatalog(language) } shouldComponentUpdate(nextProps, nextState) { @@ -35,7 +35,7 @@ class Layout extends Component { const { catalogs } = nextState if (preLanguage !== language && !catalogs[language]) { - this.loadCatalog(language) + language && this.loadCatalog(language) this.language = language return false } diff --git a/src/utils/index.js b/src/utils/index.js index 3bac7db..015f00c 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -10,8 +10,10 @@ export config from './config' export request from './request' export { Color } from './theme' -export const { defaultLanguage } = i18n -export const languages = i18n.languages.map(item => item.key) +// export const { defaultLanguage } = i18n +// export const languages = i18n.languages.map(item => item.key) +export const languages = i18n ? i18n.languages.map(item => item.key) : [] +export const defaultLanguage = i18n ? i18n.defaultLanguage : '' /** * Query objects that specify keys and values in an array where all values are objects. @@ -61,23 +63,32 @@ export function arrayToTree( return result } -export const langFromPath = curry( - /** - * Query language from pathname. - * @param {array} languages Specify which languages are currently available. - * @param {string} defaultLanguage Specify the default language. - * @param {string} pathname Pathname to be queried. - * @return {string} Return the queryed language. - */ - (languages, defaultLanguage, pathname) => { - for (const item of languages) { - if (pathname.startsWith(`/${item}/`)) { - return item - } +// export const langFromPath = curry( +// /** +// * Query language from pathname. +// * @param {array} languages Specify which languages are currently available. +// * @param {string} defaultLanguage Specify the default language. +// * @param {string} pathname Pathname to be queried. +// * @return {string} Return the queryed language. +// */ +// (languages, defaultLanguage, pathname) => { +// for (const item of languages) { +// if (pathname.startsWith(`/${item}/`)) { +// return item +// } +// } +// return defaultLanguage +// } +// )(languages)(defaultLanguage) + +export const langFromPath = pathname => { + for (const item of languages) { + if (pathname.startsWith(`/${item}/`)) { + return item } - return defaultLanguage } -)(languages)(defaultLanguage) + return defaultLanguage +} export const deLangPrefix = curry( /** @@ -106,11 +117,18 @@ export const deLangPrefix = curry( * @return {string} Return the pathname after adding the language prefix. */ export function addLangPrefix(pathname) { + if (!i18n) { + return pathname + } + const prefix = langFromPath(window.location.pathname) return `/${prefix}${deLangPrefix(pathname)}` } const routerAddLangPrefix = params => { + if (!i18n) { + return params + } if (isString(params)) { params = addLangPrefix(params) } else { From c878425fd01c34c990f32812c1efac44db9755df Mon Sep 17 00:00:00 2001 From: Baorong Li Date: Tue, 22 Oct 2019 10:30:04 +0800 Subject: [PATCH 5/5] upgrade antd@3.24.x --- package.json | 26 +++++++++++++------------- src/themes/index.less | 4 ++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index d3bbd52..8c6c518 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dependencies": { "@lingui/react": "^2.8.0", "ant-design-pro": "^2.3.0", - "antd": "^3.19.0", + "antd": "^3.24.0", "axios": "^0.19.0", "classnames": "^2.2.6", "d3-shape": "^1.3.0", @@ -14,8 +14,8 @@ "draftjs-to-markdown": "^0.5.1", "dva": "2.4.1", "dva-model-extend": "^0.1.2", - "echarts": "^4.2.0", - "echarts-for-react": "^2.0.15-beta.0", + "echarts": "^4.4.0", + "echarts-for-react": "^2.0.15-beta.1", "echarts-gl": "^1.1.1", "echarts-liquidfill": "^2.0.2", "enquire-js": "^0.2.1", @@ -25,16 +25,16 @@ "lodash": "^4.17.11", "md5": "^2.2.1", "nprogress": "^0.2.0", - "path-to-regexp": "^3.0.0", + "path-to-regexp": "^3.1.0", "prop-types": "^15.7.0", - "qs": "^6.7.0", + "qs": "^6.9.0", "react-adsense": "^0.1.0", - "react-countup": "^4.1.0", + "react-countup": "^4.2.0", "react-draft-wysiwyg": "^1.13.0", "react-helmet": "^5.2.0", - "react-highcharts": "^16.0.2", + "react-highcharts": "^16.1.0", "react-perfect-scrollbar": "^1.5.0", - "recharts": "^1.6.0", + "recharts": "^1.8.0", "store": "^2.0.0" }, "devDependencies": { @@ -45,9 +45,9 @@ "babel-eslint": "^10.0.1", "babel-plugin-dev-expression": "^0.2.1", "babel-plugin-import": "^1.12.0", - "babel-plugin-macros": "^2.5.0", + "babel-plugin-macros": "^2.6.0", "babel-plugin-module-resolver": "^3.2.0", - "cross-env": "^5.2.0", + "cross-env": "^6.0.0", "eslint": "^5.15.0", "eslint-config-react-app": "^4.0.0", "eslint-plugin-flowtype": "^3.11.0", @@ -60,12 +60,12 @@ "lint-staged": "^8.1.0", "mockjs": "^1.0.1-beta3", "module": "^1.2.5", - "prettier": "^1.16.0", + "prettier": "^1.18.0", "stylelint": "^10.0.0", "stylelint-config-prettier": "^5.2.0", "stylelint-config-standard": "^18.3.0", - "umi": "^2.8.9", - "umi-plugin-react": "^1.9.6" + "umi": "^2.10.0", + "umi-plugin-react": "^1.12.0" }, "lint-staged": { "src/**/*.js": [ diff --git a/src/themes/index.less b/src/themes/index.less index 9863f69..e98163e 100644 --- a/src/themes/index.less +++ b/src/themes/index.less @@ -86,6 +86,10 @@ body { a:focus { text-decoration: none; } + + .ant-table-layout-fixed table { + table-layout: auto; + } } @media (min-width: 1600px) { :global {