From 663e34aba4fab2db8821b3e3591a718864c8c6e4 Mon Sep 17 00:00:00 2001 From: ddcat1115 Date: Thu, 8 Mar 2018 14:43:57 +0800 Subject: [PATCH] base framework --- package.json | 1 + src/locale/en-US.js | 14 +++++++++++ src/locale/zh-CN.js | 14 +++++++++++ src/pages/Dashboard/Analysis.js | 25 ++++++++++++++++--- src/router.js | 43 +++++++++++++++++++++------------ 5 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 src/locale/en-US.js create mode 100644 src/locale/zh-CN.js diff --git a/package.json b/package.json index 03ec7e39..be450b75 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 00000000..a87f0531 --- /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 00000000..9f5cb223 --- /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 072f79fa..42206e22 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 {

门店销售额排名