diff --git a/package.json b/package.json index 03ec7e393227a28dd605b263d180ec1189533f94..be450b75354c20c922c895eab8e29bcf62c1f791 100755 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "react-copy-to-clipboard": "^5.0.1", "react-document-title": "^2.0.3", "react-fittext": "^1.0.0", + "react-intl": "^2.4.0", "rollbar": "^2.3.4", "rollup": "^0.62.0", "rollup-plugin-json": "^3.0.0", diff --git a/src/locale/en-US.js b/src/locale/en-US.js new file mode 100644 index 0000000000000000000000000000000000000000..a87f05315cfeda92e7352bc367a010462a284abe --- /dev/null +++ b/src/locale/en-US.js @@ -0,0 +1,14 @@ +import appLocaleData from 'react-intl/locale-data/en'; +import antdEn from 'antd/lib/locale-provider/en_US'; +// import enMessages from '../../locales/en.json'; + +export default { + locale: 'en-US', + data: appLocaleData, + antd: antdEn, + messages: { + 'app.home.introduce': 'introduce', + 'app.analysis.test': 'Gongzhuan road No.{no} shop', + // ...enMessages, + }, +}; diff --git a/src/locale/zh-CN.js b/src/locale/zh-CN.js new file mode 100644 index 0000000000000000000000000000000000000000..9f5cb2231cec759af39077766bdc9a1d7e68661a --- /dev/null +++ b/src/locale/zh-CN.js @@ -0,0 +1,14 @@ +import appLocaleData from 'react-intl/locale-data/zh'; +import antdZh from 'antd/lib/locale-provider/zh_CN'; +// import zhMessages from '../../locales/zh.json'; + +export default { + locale: 'zh-CN', + data: appLocaleData, + antd: antdZh, + messages: { + 'app.home.introduce': '介绍', + 'app.analysis.test': '工专路 {no} 号店', + // ...zhMessages, + }, +}; diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 072f79fa900f3ce7bf1f1225b4b879b7ce3c13cb..42206e228aed52b24917bba0b4ed80d06fb5ff22 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import { connect } from 'dva'; +import { injectIntl } from 'react-intl'; import { Row, Col, @@ -47,7 +48,23 @@ for (let i = 0; i < 7; i += 1) { chart, loading: loading.effects['chart/fetch'], })) -export default class Analysis extends Component { +class Analysis extends Component { + constructor(props) { + super(props); + const { intl } = props; + this.rankingListData = []; + for (let i = 0; i < 7; i += 1) { + this.rankingListData.push({ + title: intl.formatMessage({ id: 'app.analysis.test' }, { no: i }), + total: 323234, + }); + } + this.state = { + salesType: 'all', + currentTabKey: '', + rangePickerValue: getTimeDistance('year'), + }; + } state = { salesType: 'all', currentTabKey: '', @@ -354,7 +371,7 @@ export default class Analysis extends Component {