diff --git a/.webpackrc.js b/.webpackrc.js
deleted file mode 100755
index 1e02e9fdf1c882e0ffc4f38ddb035ef162631795..0000000000000000000000000000000000000000
--- a/.webpackrc.js
+++ /dev/null
@@ -1,47 +0,0 @@
-const path = require('path');
-
-export default {
- entry: 'src/index.js',
- extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]],
- env: {
- development: {
- extraBabelPlugins: ['dva-hmr'],
- },
- },
- externals: {
- '@antv/data-set': 'DataSet',
- bizcharts: 'BizCharts',
- rollbar: 'rollbar',
- },
- alias: {
- components: path.resolve(__dirname, 'src/components/'),
- },
- ignoreMomentLocale: true,
- theme: './src/theme.js',
- html: {
- template: './src/index.ejs',
- },
- publicPath: '/',
- hash: true,
- lessLoaderOptions: {
- javascriptEnabled: true,
- },
- disableDynamicImport: true,
- cssLoaderOptions: {
- modules: true,
- getLocalIdent: (context, localIdentName, localName) => {
- if (
- context.resourcePath.includes('node_modules') ||
- context.resourcePath.includes('ant.design.pro.less')
- ) {
- return localName;
- }
- const antdProPath = context.resourcePath.match(/src(.*)/)[1].replace('.less', '');
- const arr = antdProPath
- .split('/')
- .map(a => a.replace(/([A-Z])/g, '-$1'))
- .map(a => a.toLowerCase());
- return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
- },
- },
-};
diff --git a/config/config.js b/config/config.js
index b5e9a89d068b5d51b43a3ac1598b8d69f2ae6768..142710c4976fc564c77ebe81dafcd6aa94b242a2 100644
--- a/config/config.js
+++ b/config/config.js
@@ -9,6 +9,7 @@ export default {
// add for transfer to umi
plugins: [
'umi-plugin-dva',
+ 'umi-plugin-locale',
// TODO 决定是否使用约定路由,如果使用配置路由那么 umi-plugin-routes 可以去掉了
// [
// 'umi-plugin-routes',
@@ -21,7 +22,12 @@ export default {
// ],
],
disableServiceWorker: true,
-
+ locale: {
+ enable: true, // default false
+ default: 'zh-CN', // default zh-CN
+ baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default
+ antd: true, // use antd, default is true
+ },
// 路由配置
routes: [
// user
@@ -173,4 +179,5 @@ export default {
return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
},
},
+ disableFastClick: true,
};
diff --git a/package.json b/package.json
index 5ae7c96602c71b5073357296b0f0f17cfeea1919..bd8c9031144bed32844b1a3c210b83cc3b39e6d4 100755
--- a/package.json
+++ b/package.json
@@ -30,8 +30,8 @@
"lodash": "^4.17.4",
"lodash-decorators": "^6.0.0",
"lodash.isequal": "^4.5.0",
- "moment": "^2.22.2",
"memoize-one": "^3.1.1",
+ "moment": "^2.22.2",
"numeral": "^2.0.6",
"omit.js": "^1.0.0",
"path-to-regexp": "^2.1.0",
@@ -42,11 +42,12 @@
"react-copy-to-clipboard": "^5.0.1",
"react-document-title": "^2.0.3",
"react-fittext": "^1.0.0",
- "react-intl": "^2.4.0",
+ "umi/locale": "^2.4.0",
"rollbar": "^2.3.4",
"rollup": "^0.62.0",
"rollup-plugin-json": "^3.0.0",
"setprototypeof": "^1.1.0",
+ "umi-plugin-locale": "^1.0.1",
"url-polyfill": "^1.0.10"
},
"devDependencies": {
@@ -84,8 +85,8 @@
"stylelint-config-prettier": "^3.0.4",
"stylelint-config-standard": "^18.0.0",
"umi": "^1.3.13",
- "umi-plugin-routes": "^0.1.5",
- "umi-plugin-dva": "^0.9.1"
+ "umi-plugin-dva": "^0.9.1",
+ "umi-plugin-routes": "^0.1.5"
},
"optionalDependencies": {
"puppeteer": "^1.5.0"
diff --git a/src/common/menu.js b/src/common/menu.js
index fc6ae8ccd5c4e491e48e911219a638ef6bcc6d3f..1b25572800cf4fa86bb8dcbd1ab37e35563a3f3b 100644
--- a/src/common/menu.js
+++ b/src/common/menu.js
@@ -231,13 +231,9 @@ const menuData = [
path: 'step-form',
},
{
-<<<<<<< HEAD
- name: '高级表单',
// authority: 'admin',
-=======
name: 'advancedform',
authority: 'admin',
->>>>>>> add meun Intl
path: 'advanced-form',
},
],
diff --git a/src/components/GlobalHeader/RightContent.js b/src/components/GlobalHeader/RightContent.js
index d856d435d1fc866ecc08de8934ab651adaddbcdc..4373a3d64a2cea1f6c94c3db09418bf7144260b0 100644
--- a/src/components/GlobalHeader/RightContent.js
+++ b/src/components/GlobalHeader/RightContent.js
@@ -1,9 +1,8 @@
import React, { PureComponent } from 'react';
-import { FormattedMessage } from 'react-intl';
+import { FormattedMessage, setLocale, getLocale } from 'umi/locale';
import { Spin, Tag, Menu, Icon, Dropdown, Avatar, Tooltip, Button } from 'antd';
import moment from 'moment';
import groupBy from 'lodash/groupBy';
-import LocaleContext from '../../locale/localeContext';
import NoticeIcon from '../NoticeIcon';
import HeaderSearch from '../HeaderSearch';
import styles from './index.less';
@@ -42,11 +41,11 @@ export default class GlobalHeaderRight extends PureComponent {
}
changLang = () => {
- const locale = localStorage.getItem('locale');
+ const locale = getLocale();
if (!locale || locale === 'zh-CN') {
- localStorage.setItem('locale', 'en-US');
+ setLocale('en-US');
} else {
- localStorage.setItem('locale', 'zh-CN');
+ setLocale('zh-CN');
}
};
@@ -153,21 +152,14 @@ export default class GlobalHeaderRight extends PureComponent {
) : (
)}
-
- {context => {
- return (
-
- );
+
+ >
+
+
);
}
diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js
index 5539f49dc73ce4456c14f17ae4c5d22b766e5e98..aba8f863b04083a0a6bd5185774a4c949b608bb2 100644
--- a/src/components/SiderMenu/BaseMenu.js
+++ b/src/components/SiderMenu/BaseMenu.js
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import { Menu, Icon } from 'antd';
import { Link } from 'dva/router';
-import { FormattedMessage } from 'react-intl';
+import { FormattedMessage } from 'umi/locale';
import pathToRegexp from 'path-to-regexp';
import { urlToList } from '../_utils/pathTools';
import styles from './index.less';
diff --git a/src/components/SiderMenu/SliderMenu.js b/src/components/SiderMenu/SliderMenu.js
index cee42b131b75b5106a4c1df826f3d11b74acf09f..ae7cb05417673018ebc023121b9ee6c0102c77f5 100644
--- a/src/components/SiderMenu/SliderMenu.js
+++ b/src/components/SiderMenu/SliderMenu.js
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { Layout, Menu, Icon } from 'antd';
import pathToRegexp from 'path-to-regexp';
import { Link } from 'dva/router';
-import { FormattedMessage } from 'react-intl';
+import { FormattedMessage } from 'umi/locale';
import styles from './index.less';
import BaseMenu, { getMenuMatches } from './BaseMenu';
import { urlToList } from '../_utils/pathTools';
diff --git a/src/locale/en-US.js b/src/locale/en-US.js
deleted file mode 100644
index 95407f0af89e11577b9f5bf5c754992c6f756763..0000000000000000000000000000000000000000
--- a/src/locale/en-US.js
+++ /dev/null
@@ -1,134 +0,0 @@
-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: {
- 'navbar.lang': 'English',
- 'menu.home': 'Home',
- 'menu.dashboard': 'Dashboard',
- 'menu.dashboard.analysis': 'Analysis',
- 'menu.dashboard.monitor': 'Monitor',
- 'menu.dashboard.workplace': 'Workplace',
- 'menu.form': 'Form',
- 'menu.form.basicform': 'Basic Form',
- 'menu.form.stepform': 'Step Form',
- 'menu.form.advancedform': 'Advanced Form',
- 'menu.list': 'List',
- 'menu.list.searchlist': 'Search List',
- 'menu.list.basiclist': 'Basic List',
- 'menu.list.cardlist': 'Card List',
- 'menu.list.searchlist.articles': 'Search List(articles)',
- 'menu.list.searchlist.projects': 'Search List(projects)',
- 'menu.list.searchlist.applications': 'Search List(applications)',
- 'menu.profile': 'Profile',
- 'menu.profile.basic': 'Basic',
- 'menu.profile.advanced': 'Advanced',
- 'menu.result': 'Result',
- 'menu.result.success': 'Success',
- 'menu.result.fail': 'Fail',
- 'menu.exception': 'Exception',
- 'menu.exception.not-permission': '403',
- 'menu.exception.not-find': '404',
- 'menu.exception.server-error': '500',
- 'menu.exception.trigger': 'Trigger',
- 'menu.account': 'Account',
- 'menu.account.center': 'Account Center',
- 'menu.account.settings': 'Account Settings',
- 'menu.account.trigger': 'Trigger Error',
- 'app.home.introduce': 'introduce',
- 'app.analysis.test': 'Gongzhuan road No.{no} shop',
- 'app.analysis.introduce': 'Introduce',
- 'app.analysis.total-sales': 'total sales',
- 'app.analysis.day-sales': 'Day Sales',
- 'app.analysis.visits': 'Visits',
- 'app.analysis.visits-trend': 'Visits Trend',
- 'app.analysis.visits-ranking': 'Visits Ranking',
- 'app.analysis.day-visits': 'Day Visits',
- 'app.analysis.week': 'week ratio',
- 'app.analysis.day': 'day ratio',
- 'app.analysis.payments': 'Payments',
- 'app.analysis.conversion-rate': 'Conversion Rate',
- 'app.analysis.operational-effect': 'Operational Effect',
- 'app.analysis.sales-trend': 'Stores Sales Trend',
- 'app.analysis.sales-ranking': 'sales ranking',
- 'app.analysis.all-year': 'All Year',
- 'app.analysis.all-month': 'All Month',
- 'app.analysis.all-week': 'All Week',
- 'app.analysis.all-day': 'All day',
- 'app.analysis.search-users': 'Search Users',
- 'app.analysis.per-capita-search': 'Per Capita Search',
- 'app.analysis.online-top-search': 'Online Top Search',
- 'app.analysis.the-proportion-of-sales': 'The Proportion Of Sales',
- 'app.analysis.channel.all': 'ALL',
- 'app.analysis.channel.online': 'Online',
- 'app.analysis.channel.stores': 'Stores',
- 'app.analysis.sales': 'Sales',
- 'app.analysis.traffic': 'Traffic',
- 'app.analysis.table.rank': 'Rank',
- 'app.analysis.table.search-keyword': 'Keyword',
- 'app.analysis.table.users': 'Users',
- 'app.analysis.table.weekly-range': 'Weekly Range',
- 'app.settings.menuMap.basic': 'Basic Settings',
- 'app.settings.menuMap.security': 'Security Settings',
- 'app.settings.menuMap.binding': 'Account Binding',
- 'app.settings.menuMap.notification': 'New Message Notification',
- 'app.settings.basic.avatar': 'Change avatar',
- 'app.settings.basic.email': 'Email',
- 'app.settings.basic.email-message': 'Please input your email!',
- 'app.settings.basic.nickname': 'Nickname',
- 'app.settings.basic.nickname-message': 'Please input your Nickname!',
- 'app.settings.basic.profile': 'Personal profile',
- 'app.settings.basic.profile-message': 'Please input your personal profile!',
- 'app.settings.basic.profile-placeholder': 'Brief introduction to yourself',
- 'app.settings.basic.country': 'Country/Region',
- 'app.settings.basic.country-message': 'Please input your country!',
- 'app.settings.basic.geographic': 'Province or city',
- 'app.settings.basic.geographic-message': 'Please input your geographic info!',
- 'app.settings.basic.address': 'Street Address',
- 'app.settings.basic.address-message': 'Please input your address!',
- 'app.settings.basic.phone': 'Phone Number',
- 'app.settings.basic.phone-message': 'Please input your phone!',
- 'app.settings.basic.update': 'Update Information',
- 'app.settings.security.strong': 'Strong',
- 'app.settings.security.medium': 'Medium',
- 'app.settings.security.weak': 'Weak',
- 'app.settings.security.password': 'Account Password',
- 'app.settings.security.password-description': 'Current password strength:',
- 'app.settings.security.phone': 'Security Phone',
- 'app.settings.security.phone-description': 'Bound phone:',
- 'app.settings.security.question': 'Security Question',
- 'app.settings.security.question-description':
- 'The security question is not set, and the security policy can effectively protect the account security',
- 'app.settings.security.email': 'Backup Email',
- 'app.settings.security.email-description': 'Bound Email:',
- 'app.settings.security.mfa': 'MFA Device',
- 'app.settings.security.mfa-description':
- 'Unbound MFA device, after binding, can be confirmed twice',
- 'app.settings.security.modify': 'Modify',
- 'app.settings.security.set': 'Set',
- 'app.settings.security.bind': 'Bind',
- 'app.settings.binding.taobao': 'Binding Taobao',
- 'app.settings.binding.taobao-description': 'Currently unbound Taobao account',
- 'app.settings.binding.alipay': 'Binding Alipay',
- 'app.settings.binding.alipay-description': 'Currently unbound Alipay account',
- 'app.settings.binding.dingding': 'Binding DingTalk',
- 'app.settings.binding.dingding-description': 'Currently unbound DingTalk account',
- 'app.settings.binding.bind': 'Bind',
- 'app.settings.notification.password': 'Account Password',
- 'app.settings.notification.password-description':
- 'Messages from other users will be notified in the form of a station letter',
- 'app.settings.notification.messages': 'System Messages',
- 'app.settings.notification.messages-description':
- 'System messages will be notified in the form of a station letter',
- 'app.settings.notification.todo': 'To-do Notification',
- 'app.settings.notification.todo-description':
- 'The to-do list will be notified in the form of a letter from the station',
- 'app.settings.open': 'Open',
- 'app.settings.close': 'Close',
- // ...enMessages,
- },
-};
diff --git a/src/locale/zh-CN.js b/src/locale/zh-CN.js
deleted file mode 100644
index 059c53144cab87c6d117e5f2cc287b6f435b9a23..0000000000000000000000000000000000000000
--- a/src/locale/zh-CN.js
+++ /dev/null
@@ -1,129 +0,0 @@
-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: {
- 'navbar.lang': '中文',
- 'menu.home': '首页',
- 'menu.dashboard': 'Dashboard',
- 'menu.dashboard.analysis': '分析页',
- 'menu.dashboard.monitor': '监控页',
- 'menu.dashboard.workplace': '工作台',
- 'menu.form': '表单页',
- 'menu.form.basicform': '基础表单',
- 'menu.form.stepform': '分布表单',
- 'menu.form.advancedform': '高级表单',
- 'menu.list': '列表页',
- 'menu.list.searchlist': '搜索列表',
- 'menu.list.basiclist': '标准列表',
- 'menu.list.cardlist': '卡片列表',
- 'menu.list.searchlist.articles': '搜索列表(文章)',
- 'menu.list.searchlist.projects': '搜索列表(项目)',
- 'menu.list.searchlist.applications': '搜索列表(应用)',
- 'menu.profile': '详情页',
- 'menu.profile.basic': '详情页',
- 'menu.profile.advanced': '详情页',
- 'menu.result': '结果页',
- 'menu.result.success': '成功页',
- 'menu.result.fail': '失败页',
- 'menu.exception': '异常页',
- 'menu.exception.not-permission': '403',
- 'menu.exception.not-find': '404',
- 'menu.exception.server-error': '500',
- 'menu.exception.trigger': '触发错误',
- 'menu.account': '个人页',
- 'menu.account.center': '个人中心',
- 'menu.account.settings': '个人设置',
- 'menu.account.trigger': '触发报错',
- 'app.home.introduce': '介绍',
- 'app.analysis.test': '工专路 {no} 号店',
- 'app.analysis.introduce': '指标说明',
- 'app.analysis.total-sales': '总销售额',
- 'app.analysis.day-sales': '日销售额',
- 'app.analysis.visits': '访问量',
- 'app.analysis.visits-trend': '访问量趋势',
- 'app.analysis.visits-ranking': '门店访问量排名',
- 'app.analysis.day-visits': '日访问量',
- 'app.analysis.week': '周同比',
- 'app.analysis.day': '日同比',
- 'app.analysis.payments': '支付笔数',
- 'app.analysis.conversion-rate': '转化率',
- 'app.analysis.operational-effect': '运营活动效果',
- 'app.analysis.sales-trend': '销售趋势',
- 'app.analysis.sales-ranking': '门店销售额排名',
- 'app.analysis.all-year': '全年',
- 'app.analysis.all-month': '本月',
- 'app.analysis.all-week': '本周',
- 'app.analysis.all-day': '今日',
- 'app.analysis.search-users': '搜索用户数',
- 'app.analysis.per-capita-search': '人均搜索次数',
- 'app.analysis.online-top-search': '线上热门搜索',
- 'app.analysis.the-proportion-of-sales': '销售额类别占比',
- 'app.analysis.channel.all': '全部渠道',
- 'app.analysis.channel.online': '线上',
- 'app.analysis.channel.stores': '门店',
- 'app.analysis.sales': '销售额',
- 'app.analysis.traffic': '客流量',
- 'app.analysis.table.rank': '排名',
- 'app.analysis.table.search-keyword': '搜索关键词',
- 'app.analysis.table.users': '用户数',
- 'app.analysis.table.weekly-range': '周涨幅',
- 'app.settings.menuMap.basic': '基本设置',
- 'app.settings.menuMap.security': '安全设置',
- 'app.settings.menuMap.binding': '账号绑定',
- 'app.settings.menuMap.notification': '新消息通知',
- 'app.settings.basic.avatar': '更换头像',
- 'app.settings.basic.email': '邮箱',
- 'app.settings.basic.email-message': '请输入您的邮箱!',
- 'app.settings.basic.nickname': '昵称',
- 'app.settings.basic.nickname-message': '请输入您的昵称!',
- 'app.settings.basic.profile': '个人简介',
- 'app.settings.basic.profile-message': '请输入个人简介!',
- 'app.settings.basic.profile-placeholder': '个人简介',
- 'app.settings.basic.country': '国家/地区',
- 'app.settings.basic.country-message': '请输入您的国家或地区!',
- 'app.settings.basic.geographic': '所在省市',
- 'app.settings.basic.geographic-message': '请输入您的所在省市!',
- 'app.settings.basic.address': '街道地址',
- 'app.settings.basic.address-message': '请输入您的街道地址!',
- 'app.settings.basic.phone': '联系电话',
- 'app.settings.basic.phone-message': '请输入您的联系电话!',
- 'app.settings.security.strong': '强',
- 'app.settings.security.medium': '中',
- 'app.settings.security.weak': '弱',
- 'app.settings.security.password': '账户密码',
- 'app.settings.security.password-description': '当前密码强度:',
- 'app.settings.security.phone': '密保手机',
- 'app.settings.security.phone-description': '已绑定手机:',
- 'app.settings.security.question': '密保问题',
- 'app.settings.security.question-description': '未设置密保问题,密保问题可有效保护账户安全',
- 'app.settings.security.email': '备用邮箱',
- 'app.settings.security.email-description': '已绑定邮箱:',
- 'app.settings.security.mfa': 'MFA 设备',
- 'app.settings.security.mfa-description': '未绑定 MFA 设备,绑定后,可以进行二次确认',
- 'app.settings.security.modify': '修改',
- 'app.settings.security.set': '设置',
- 'app.settings.security.bind': '绑定',
- 'app.settings.binding.taobao': '绑定淘宝',
- 'app.settings.binding.taobao-description': '当前未绑定淘宝账号',
- 'app.settings.binding.alipay': '绑定支付宝',
- 'app.settings.binding.alipay-description': '当前未绑定支付宝账号',
- 'app.settings.binding.dingding': '绑定钉钉',
- 'app.settings.binding.dingding-description': '当前未绑定钉钉账号',
- 'app.settings.binding.bind': '绑定',
- 'app.settings.notification.password': '账户密码',
- 'app.settings.notification.password-description': '其他用户的消息将以站内信的形式通知',
- 'app.settings.notification.messages': '系统消息',
- 'app.settings.notification.messages-description': '系统消息将以站内信的形式通知',
- 'app.settings.notification.todo': '账户密码',
- 'app.settings.notification.todo-description': '账户密码',
- 'app.settings.open': '开',
- 'app.settings.close': '关',
-
- // ...zhMessages,
- },
-};
diff --git a/src/locales/en-US.js b/src/locales/en-US.js
new file mode 100644
index 0000000000000000000000000000000000000000..6540955af5bbc33541d6aef6ba7c6f5aac4f9f2c
--- /dev/null
+++ b/src/locales/en-US.js
@@ -0,0 +1,124 @@
+export default {
+ 'navbar.lang': 'English',
+ 'menu.home': 'Home',
+ 'menu.dashboard': 'Dashboard',
+ 'menu.dashboard.analysis': 'Analysis',
+ 'menu.dashboard.monitor': 'Monitor',
+ 'menu.dashboard.workplace': 'Workplace',
+ 'menu.form': 'Form',
+ 'menu.form.basicform': 'Basic Form',
+ 'menu.form.stepform': 'Step Form',
+ 'menu.form.advancedform': 'Advanced Form',
+ 'menu.list': 'List',
+ 'menu.list.searchlist': 'Search List',
+ 'menu.list.basiclist': 'Basic List',
+ 'menu.list.cardlist': 'Card List',
+ 'menu.list.searchlist.articles': 'Search List(articles)',
+ 'menu.list.searchlist.projects': 'Search List(projects)',
+ 'menu.list.searchlist.applications': 'Search List(applications)',
+ 'menu.profile': 'Profile',
+ 'menu.profile.basic': 'Basic',
+ 'menu.profile.advanced': 'Advanced',
+ 'menu.result': 'Result',
+ 'menu.result.success': 'Success',
+ 'menu.result.fail': 'Fail',
+ 'menu.exception': 'Exception',
+ 'menu.exception.not-permission': '403',
+ 'menu.exception.not-find': '404',
+ 'menu.exception.server-error': '500',
+ 'menu.exception.trigger': 'Trigger',
+ 'menu.account': 'Account',
+ 'menu.account.center': 'Account Center',
+ 'menu.account.settings': 'Account Settings',
+ 'menu.account.trigger': 'Trigger Error',
+ 'app.home.introduce': 'introduce',
+ 'app.analysis.test': 'Gongzhuan road No.{no} shop',
+ 'app.analysis.introduce': 'Introduce',
+ 'app.analysis.total-sales': 'total sales',
+ 'app.analysis.day-sales': 'Day Sales',
+ 'app.analysis.visits': 'Visits',
+ 'app.analysis.visits-trend': 'Visits Trend',
+ 'app.analysis.visits-ranking': 'Visits Ranking',
+ 'app.analysis.day-visits': 'Day Visits',
+ 'app.analysis.week': 'week ratio',
+ 'app.analysis.day': 'day ratio',
+ 'app.analysis.payments': 'Payments',
+ 'app.analysis.conversion-rate': 'Conversion Rate',
+ 'app.analysis.operational-effect': 'Operational Effect',
+ 'app.analysis.sales-trend': 'Stores Sales Trend',
+ 'app.analysis.sales-ranking': 'sales ranking',
+ 'app.analysis.all-year': 'All Year',
+ 'app.analysis.all-month': 'All Month',
+ 'app.analysis.all-week': 'All Week',
+ 'app.analysis.all-day': 'All day',
+ 'app.analysis.search-users': 'Search Users',
+ 'app.analysis.per-capita-search': 'Per Capita Search',
+ 'app.analysis.online-top-search': 'Online Top Search',
+ 'app.analysis.the-proportion-of-sales': 'The Proportion Of Sales',
+ 'app.analysis.channel.all': 'ALL',
+ 'app.analysis.channel.online': 'Online',
+ 'app.analysis.channel.stores': 'Stores',
+ 'app.analysis.sales': 'Sales',
+ 'app.analysis.traffic': 'Traffic',
+ 'app.analysis.table.rank': 'Rank',
+ 'app.analysis.table.search-keyword': 'Keyword',
+ 'app.analysis.table.users': 'Users',
+ 'app.analysis.table.weekly-range': 'Weekly Range',
+ 'app.settings.menuMap.basic': 'Basic Settings',
+ 'app.settings.menuMap.security': 'Security Settings',
+ 'app.settings.menuMap.binding': 'Account Binding',
+ 'app.settings.menuMap.notification': 'New Message Notification',
+ 'app.settings.basic.avatar': 'Change avatar',
+ 'app.settings.basic.email': 'Email',
+ 'app.settings.basic.email-message': 'Please input your email!',
+ 'app.settings.basic.nickname': 'Nickname',
+ 'app.settings.basic.nickname-message': 'Please input your Nickname!',
+ 'app.settings.basic.profile': 'Personal profile',
+ 'app.settings.basic.profile-message': 'Please input your personal profile!',
+ 'app.settings.basic.profile-placeholder': 'Brief introduction to yourself',
+ 'app.settings.basic.country': 'Country/Region',
+ 'app.settings.basic.country-message': 'Please input your country!',
+ 'app.settings.basic.geographic': 'Province or city',
+ 'app.settings.basic.geographic-message': 'Please input your geographic info!',
+ 'app.settings.basic.address': 'Street Address',
+ 'app.settings.basic.address-message': 'Please input your address!',
+ 'app.settings.basic.phone': 'Phone Number',
+ 'app.settings.basic.phone-message': 'Please input your phone!',
+ 'app.settings.basic.update': 'Update Information',
+ 'app.settings.security.strong': 'Strong',
+ 'app.settings.security.medium': 'Medium',
+ 'app.settings.security.weak': 'Weak',
+ 'app.settings.security.password': 'Account Password',
+ 'app.settings.security.password-description': 'Current password strength:',
+ 'app.settings.security.phone': 'Security Phone',
+ 'app.settings.security.phone-description': 'Bound phone:',
+ 'app.settings.security.question': 'Security Question',
+ 'app.settings.security.question-description':
+ 'The security question is not set, and the security policy can effectively protect the account security',
+ 'app.settings.security.email': 'Backup Email',
+ 'app.settings.security.email-description': 'Bound Email:',
+ 'app.settings.security.mfa': 'MFA Device',
+ 'app.settings.security.mfa-description':
+ 'Unbound MFA device, after binding, can be confirmed twice',
+ 'app.settings.security.modify': 'Modify',
+ 'app.settings.security.set': 'Set',
+ 'app.settings.security.bind': 'Bind',
+ 'app.settings.binding.taobao': 'Binding Taobao',
+ 'app.settings.binding.taobao-description': 'Currently unbound Taobao account',
+ 'app.settings.binding.alipay': 'Binding Alipay',
+ 'app.settings.binding.alipay-description': 'Currently unbound Alipay account',
+ 'app.settings.binding.dingding': 'Binding DingTalk',
+ 'app.settings.binding.dingding-description': 'Currently unbound DingTalk account',
+ 'app.settings.binding.bind': 'Bind',
+ 'app.settings.notification.password': 'Account Password',
+ 'app.settings.notification.password-description':
+ 'Messages from other users will be notified in the form of a station letter',
+ 'app.settings.notification.messages': 'System Messages',
+ 'app.settings.notification.messages-description':
+ 'System messages will be notified in the form of a station letter',
+ 'app.settings.notification.todo': 'To-do Notification',
+ 'app.settings.notification.todo-description':
+ 'The to-do list will be notified in the form of a letter from the station',
+ 'app.settings.open': 'Open',
+ 'app.settings.close': 'Close',
+};
diff --git a/src/locale/localeContext.js b/src/locales/localeContext.js
similarity index 95%
rename from src/locale/localeContext.js
rename to src/locales/localeContext.js
index 4f1e782b8fe077b96f887c1af4d22652e2233f52..6f848dbb69504eb5b6099eed3464c3ef0c99116f 100644
--- a/src/locale/localeContext.js
+++ b/src/locales/localeContext.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { addLocaleData, IntlProvider } from 'react-intl';
+import { addLocaleData, IntlProvider } from 'umi/locale';
import { LocaleProvider } from 'antd';
import enLocale from './en-US';
import cnLocale from './zh-CN';
diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js
new file mode 100644
index 0000000000000000000000000000000000000000..84d7b5e0e450dbd57fefff85d1c5c96d705ee0a7
--- /dev/null
+++ b/src/locales/zh-CN.js
@@ -0,0 +1,120 @@
+// import zhMessages from '../../locales/zh.json';
+
+export default {
+ 'navbar.lang': '中文',
+ 'menu.home': '首页',
+ 'menu.dashboard': 'Dashboard',
+ 'menu.dashboard.analysis': '分析页',
+ 'menu.dashboard.monitor': '监控页',
+ 'menu.dashboard.workplace': '工作台',
+ 'menu.form': '表单页',
+ 'menu.form.basicform': '基础表单',
+ 'menu.form.stepform': '分布表单',
+ 'menu.form.advancedform': '高级表单',
+ 'menu.list': '列表页',
+ 'menu.list.searchlist': '搜索列表',
+ 'menu.list.basiclist': '标准列表',
+ 'menu.list.cardlist': '卡片列表',
+ 'menu.list.searchlist.articles': '搜索列表(文章)',
+ 'menu.list.searchlist.projects': '搜索列表(项目)',
+ 'menu.list.searchlist.applications': '搜索列表(应用)',
+ 'menu.profile': '详情页',
+ 'menu.profile.basic': '详情页',
+ 'menu.profile.advanced': '详情页',
+ 'menu.result': '结果页',
+ 'menu.result.success': '成功页',
+ 'menu.result.fail': '失败页',
+ 'menu.exception': '异常页',
+ 'menu.exception.not-permission': '403',
+ 'menu.exception.not-find': '404',
+ 'menu.exception.server-error': '500',
+ 'menu.exception.trigger': '触发错误',
+ 'menu.account': '个人页',
+ 'menu.account.center': '个人中心',
+ 'menu.account.settings': '个人设置',
+ 'menu.account.trigger': '触发报错',
+ 'app.home.introduce': '介绍',
+ 'app.analysis.test': '工专路 {no} 号店',
+ 'app.analysis.introduce': '指标说明',
+ 'app.analysis.total-sales': '总销售额',
+ 'app.analysis.day-sales': '日销售额',
+ 'app.analysis.visits': '访问量',
+ 'app.analysis.visits-trend': '访问量趋势',
+ 'app.analysis.visits-ranking': '门店访问量排名',
+ 'app.analysis.day-visits': '日访问量',
+ 'app.analysis.week': '周同比',
+ 'app.analysis.day': '日同比',
+ 'app.analysis.payments': '支付笔数',
+ 'app.analysis.conversion-rate': '转化率',
+ 'app.analysis.operational-effect': '运营活动效果',
+ 'app.analysis.sales-trend': '销售趋势',
+ 'app.analysis.sales-ranking': '门店销售额排名',
+ 'app.analysis.all-year': '全年',
+ 'app.analysis.all-month': '本月',
+ 'app.analysis.all-week': '本周',
+ 'app.analysis.all-day': '今日',
+ 'app.analysis.search-users': '搜索用户数',
+ 'app.analysis.per-capita-search': '人均搜索次数',
+ 'app.analysis.online-top-search': '线上热门搜索',
+ 'app.analysis.the-proportion-of-sales': '销售额类别占比',
+ 'app.analysis.channel.all': '全部渠道',
+ 'app.analysis.channel.online': '线上',
+ 'app.analysis.channel.stores': '门店',
+ 'app.analysis.sales': '销售额',
+ 'app.analysis.traffic': '客流量',
+ 'app.analysis.table.rank': '排名',
+ 'app.analysis.table.search-keyword': '搜索关键词',
+ 'app.analysis.table.users': '用户数',
+ 'app.analysis.table.weekly-range': '周涨幅',
+ 'app.settings.menuMap.basic': '基本设置',
+ 'app.settings.menuMap.security': '安全设置',
+ 'app.settings.menuMap.binding': '账号绑定',
+ 'app.settings.menuMap.notification': '新消息通知',
+ 'app.settings.basic.avatar': '更换头像',
+ 'app.settings.basic.email': '邮箱',
+ 'app.settings.basic.email-message': '请输入您的邮箱!',
+ 'app.settings.basic.nickname': '昵称',
+ 'app.settings.basic.nickname-message': '请输入您的昵称!',
+ 'app.settings.basic.profile': '个人简介',
+ 'app.settings.basic.profile-message': '请输入个人简介!',
+ 'app.settings.basic.profile-placeholder': '个人简介',
+ 'app.settings.basic.country': '国家/地区',
+ 'app.settings.basic.country-message': '请输入您的国家或地区!',
+ 'app.settings.basic.geographic': '所在省市',
+ 'app.settings.basic.geographic-message': '请输入您的所在省市!',
+ 'app.settings.basic.address': '街道地址',
+ 'app.settings.basic.address-message': '请输入您的街道地址!',
+ 'app.settings.basic.phone': '联系电话',
+ 'app.settings.basic.phone-message': '请输入您的联系电话!',
+ 'app.settings.security.strong': '强',
+ 'app.settings.security.medium': '中',
+ 'app.settings.security.weak': '弱',
+ 'app.settings.security.password': '账户密码',
+ 'app.settings.security.password-description': '当前密码强度:',
+ 'app.settings.security.phone': '密保手机',
+ 'app.settings.security.phone-description': '已绑定手机:',
+ 'app.settings.security.question': '密保问题',
+ 'app.settings.security.question-description': '未设置密保问题,密保问题可有效保护账户安全',
+ 'app.settings.security.email': '备用邮箱',
+ 'app.settings.security.email-description': '已绑定邮箱:',
+ 'app.settings.security.mfa': 'MFA 设备',
+ 'app.settings.security.mfa-description': '未绑定 MFA 设备,绑定后,可以进行二次确认',
+ 'app.settings.security.modify': '修改',
+ 'app.settings.security.set': '设置',
+ 'app.settings.security.bind': '绑定',
+ 'app.settings.binding.taobao': '绑定淘宝',
+ 'app.settings.binding.taobao-description': '当前未绑定淘宝账号',
+ 'app.settings.binding.alipay': '绑定支付宝',
+ 'app.settings.binding.alipay-description': '当前未绑定支付宝账号',
+ 'app.settings.binding.dingding': '绑定钉钉',
+ 'app.settings.binding.dingding-description': '当前未绑定钉钉账号',
+ 'app.settings.binding.bind': '绑定',
+ 'app.settings.notification.password': '账户密码',
+ 'app.settings.notification.password-description': '其他用户的消息将以站内信的形式通知',
+ 'app.settings.notification.messages': '系统消息',
+ 'app.settings.notification.messages-description': '系统消息将以站内信的形式通知',
+ 'app.settings.notification.todo': '账户密码',
+ 'app.settings.notification.todo-description': '账户密码',
+ 'app.settings.open': '开',
+ 'app.settings.close': '关',
+};
diff --git a/src/pages/Account/Settings/BaseView.js b/src/pages/Account/Settings/BaseView.js
index 38b00980091889d8bcb4f7417c0f8b428ce3193b..32721e145628fb0c0582463f04bf6a9eeb2c7e68 100644
--- a/src/pages/Account/Settings/BaseView.js
+++ b/src/pages/Account/Settings/BaseView.js
@@ -1,5 +1,5 @@
import React, { Component, Fragment } from 'react';
-import { injectIntl, FormattedMessage } from 'react-intl';
+import { formatMessage, FormattedMessage } from 'umi/locale';
import { Form, Input, Upload, Select, Button } from 'antd';
import { connect } from 'dva';
import styles from './BaseView.less';
@@ -83,56 +83,52 @@ class BaseView extends Component {
render() {
const {
form: { getFieldDecorator },
- intl,
} = this.props;
return (