From ac17ede7fb78753cc7e2625df3cf244a24e116bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 29 Mar 2019 11:00:30 +0800 Subject: [PATCH] AccountSettings is finsh --- AccountCenter/.umirc.js | 13 -- AccountCenter/src/model.ts | 2 +- AccountSettings/.umirc.js | 18 --- AccountSettings/jsconfig.json | 10 -- AccountSettings/src/{_mock.js => _mock.ts} | 7 +- .../{GeographicView.js => GeographicView.tsx} | 116 ++++++++++++------ .../{PhoneView.js => PhoneView.tsx} | 11 +- .../src/components/{base.js => base.tsx} | 38 ++++-- .../components/{binding.js => binding.tsx} | 2 +- .../{notification.js => notification.tsx} | 9 +- .../components/{security.js => security.tsx} | 22 ++-- AccountSettings/src/data.d.ts | 56 +++++++++ AccountSettings/src/{index.js => index.tsx} | 2 +- .../src/locales/{en-US.js => en-US.ts} | 0 .../src/locales/{zh-CN.js => zh-CN.ts} | 0 .../src/locales/{zh-TW.js => zh-TW.ts} | 0 AccountSettings/src/{model.js => model.ts} | 0 .../src/{service.js => service.ts} | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- Analysis/src/components/IntroduceRow.js | 2 +- Analysis/src/components/OfflineData.js | 2 +- Analysis/src/components/ProportionSales.js | 2 +- Analysis/src/components/SalesCard.js | 2 +- Analysis/src/components/TopSearch.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- BasicForm/src/index.js | 2 +- BasicList/src/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- Monitor/src/index.js | 2 +- ResultFail/src/index.js | 2 +- ResultSuccess/src/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- UserLogin/src/index.js | 2 +- UserRegister/src/index.js | 2 +- UserRegisterResult/src/index.js | 2 +- .../src/components/PageHeaderWrapper/index.js | 2 +- tsconfig.json | 1 + 42 files changed, 221 insertions(+), 134 deletions(-) delete mode 100644 AccountCenter/.umirc.js delete mode 100644 AccountSettings/.umirc.js delete mode 100644 AccountSettings/jsconfig.json rename AccountSettings/src/{_mock.js => _mock.ts} (87%) rename AccountSettings/src/components/{GeographicView.js => GeographicView.tsx} (51%) rename AccountSettings/src/components/{PhoneView.js => PhoneView.tsx} (69%) rename AccountSettings/src/components/{base.js => base.tsx} (85%) rename AccountSettings/src/components/{binding.js => binding.tsx} (95%) rename AccountSettings/src/components/{notification.js => notification.tsx} (87%) rename AccountSettings/src/components/{security.js => security.tsx} (88%) create mode 100644 AccountSettings/src/data.d.ts rename AccountSettings/src/{index.js => index.tsx} (98%) rename AccountSettings/src/locales/{en-US.js => en-US.ts} (100%) rename AccountSettings/src/locales/{zh-CN.js => zh-CN.ts} (100%) rename AccountSettings/src/locales/{zh-TW.js => zh-TW.ts} (100%) rename AccountSettings/src/{model.js => model.ts} (100%) rename AccountSettings/src/{service.js => service.ts} (87%) diff --git a/AccountCenter/.umirc.js b/AccountCenter/.umirc.js deleted file mode 100644 index 6f5bf056..00000000 --- a/AccountCenter/.umirc.js +++ /dev/null @@ -1,13 +0,0 @@ -export default { - plugins: [ - ['umi-plugin-block-dev', { layout: 'ant-design-pro' }], - [ - 'umi-plugin-react', - { - dva: true, - locale: true, - antd: true, - }, - ], - ], -}; diff --git a/AccountCenter/src/model.ts b/AccountCenter/src/model.ts index 2cbf4a3f..37454d35 100644 --- a/AccountCenter/src/model.ts +++ b/AccountCenter/src/model.ts @@ -22,7 +22,7 @@ export default { call, put, }: { - call: callType>; + call: callType>; put: Dispatch; } ) { diff --git a/AccountSettings/.umirc.js b/AccountSettings/.umirc.js deleted file mode 100644 index 70ab1e9b..00000000 --- a/AccountSettings/.umirc.js +++ /dev/null @@ -1,18 +0,0 @@ -export default { - plugins: [ - [ - 'umi-plugin-block-dev', - { - layout: 'ant-design-pro', - }, - ], - [ - 'umi-plugin-react', - { - dva: true, - locale: true, - antd: true, - }, - ], - ], -}; diff --git a/AccountSettings/jsconfig.json b/AccountSettings/jsconfig.json deleted file mode 100644 index f87334d4..00000000 --- a/AccountSettings/jsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "baseUrl": ".", - "paths": { - "@/*": ["./src/*"] - } - } -} diff --git a/AccountSettings/src/_mock.js b/AccountSettings/src/_mock.ts similarity index 87% rename from AccountSettings/src/_mock.js rename to AccountSettings/src/_mock.ts index 6533a338..6612cabf 100644 --- a/AccountSettings/src/_mock.js +++ b/AccountSettings/src/_mock.ts @@ -1,11 +1,14 @@ import city from './geographic/city.json'; import province from './geographic/province.json'; -function getProvince(req, res) { +function getProvince(req: any, res: { json: (arg0: { name: string; id: string }[]) => void }) { return res.json(province); } -function getCity(req, res) { +function getCity( + req: { params: { province: string | number } }, + res: { json: (arg: any) => void } +) { return res.json(city[req.params.province]); } // 代码中会兼容本地 service mock 以及部署站点的静态数据 diff --git a/AccountSettings/src/components/GeographicView.js b/AccountSettings/src/components/GeographicView.tsx similarity index 51% rename from AccountSettings/src/components/GeographicView.js rename to AccountSettings/src/components/GeographicView.tsx index c5274b7c..a5a5e4a3 100644 --- a/AccountSettings/src/components/GeographicView.js +++ b/AccountSettings/src/components/GeographicView.tsx @@ -1,53 +1,89 @@ -import React, { PureComponent } from 'react'; +import React, { Component } from 'react'; import { Select, Spin } from 'antd'; import { connect } from 'dva'; import styles from './GeographicView.less'; - +import { Dispatch } from 'redux'; +import { ProvinceData, CityData } from '../data'; const { Option } = Select; -const nullSlectItem = { +interface SelectItem { + label: string; + key: string; +} +const nullSlectItem: SelectItem = { label: '', key: '', }; -@connect(({ BLOCK_NAME_CAMEL_CASE, loading }) => { - const { province, city } = BLOCK_NAME_CAMEL_CASE; - return { - province, - city, - loading: loading.models.BLOCK_NAME_CAMEL_CASE, +interface GeographicViewProps { + dispatch?: Dispatch; + province?: ProvinceData[]; + city?: CityData[]; + value?: { + province: SelectItem; + city: SelectItem; }; -}) -class GeographicView extends PureComponent { + loading?: boolean; + onChange?: (value: { province: SelectItem; city: SelectItem }) => void; +} + +@connect( + ({ + BLOCK_NAME_CAMEL_CASE, + loading, + }: { + BLOCK_NAME_CAMEL_CASE: { + province: ProvinceData[]; + city: CityData[]; + }; + loading: any; + }) => { + const { province, city } = BLOCK_NAME_CAMEL_CASE; + return { + province, + city, + loading: loading.models.BLOCK_NAME_CAMEL_CASE, + }; + } +) +class GeographicView extends Component { componentDidMount = () => { const { dispatch } = this.props; - dispatch({ - type: 'BLOCK_NAME_CAMEL_CASE/fetchProvince', - }); + dispatch && + dispatch({ + type: 'BLOCK_NAME_CAMEL_CASE/fetchProvince', + }); }; - componentDidUpdate(props) { + componentDidUpdate(props: GeographicViewProps) { const { dispatch, value } = this.props; if (!props.value && !!value && !!value.province) { - dispatch({ - type: 'BLOCK_NAME_CAMEL_CASE/fetchCity', - payload: value.province.key, - }); + dispatch && + dispatch({ + type: 'BLOCK_NAME_CAMEL_CASE/fetchCity', + payload: value.province.key, + }); } } getProvinceOption() { const { province } = this.props; - return this.getOption(province); + if (province) { + return this.getOption(province); + } + return []; } getCityOption = () => { const { city } = this.props; - return this.getOption(city); + if (city) { + return this.getOption(city); + } + return []; }; - getOption = list => { + getOption = (list: CityData[] | ProvinceData[]) => { if (!list || list.length < 1) { return ( ); } - return list.map(item => ( + return (list as CityData[]).map(item => ( )); }; - selectProvinceItem = item => { + selectProvinceItem = (item: SelectItem) => { const { dispatch, onChange } = this.props; - dispatch({ - type: 'BLOCK_NAME_CAMEL_CASE/fetchCity', - payload: item.key, - }); - onChange({ - province: item, - city: nullSlectItem, - }); + + dispatch && + dispatch({ + type: 'BLOCK_NAME_CAMEL_CASE/fetchCity', + payload: item.key, + }); + + onChange && + onChange({ + province: item, + city: nullSlectItem, + }); }; - selectCityItem = item => { + selectCityItem = (item: SelectItem) => { const { value, onChange } = this.props; - onChange({ - province: value.province, - city: item, - }); + if (value && onChange) { + onChange({ + province: value.province, + city: item, + }); + } }; conversionObject() { diff --git a/AccountSettings/src/components/PhoneView.js b/AccountSettings/src/components/PhoneView.tsx similarity index 69% rename from AccountSettings/src/components/PhoneView.js rename to AccountSettings/src/components/PhoneView.tsx index 26655276..c48358c2 100644 --- a/AccountSettings/src/components/PhoneView.js +++ b/AccountSettings/src/components/PhoneView.tsx @@ -2,7 +2,12 @@ import React, { Fragment, PureComponent } from 'react'; import { Input } from 'antd'; import styles from './PhoneView.less'; -class PhoneView extends PureComponent { +interface PhoneViewProps { + value?: string; + onChange?: (value: string) => void; +} + +class PhoneView extends PureComponent { render() { const { value, onChange } = this.props; let values = ['', '']; @@ -15,13 +20,13 @@ class PhoneView extends PureComponent { className={styles.area_code} value={values[0]} onChange={e => { - onChange(`${e.target.value}-${values[1]}`); + onChange && onChange(`${e.target.value}-${values[1]}`); }} /> { - onChange(`${values[0]}-${e.target.value}`); + onChange && onChange(`${values[0]}-${e.target.value}`); }} value={values[1]} /> diff --git a/AccountSettings/src/components/base.js b/AccountSettings/src/components/base.tsx similarity index 85% rename from AccountSettings/src/components/base.js rename to AccountSettings/src/components/base.tsx index 85764515..f9e663b8 100644 --- a/AccountSettings/src/components/base.js +++ b/AccountSettings/src/components/base.tsx @@ -1,16 +1,17 @@ import React, { Component, Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Form, Input, Upload, Select, Button } from 'antd'; +import { FormComponentProps } from 'antd/lib/form'; import { connect } from 'dva'; import styles from './BaseView.less'; import GeographicView from './GeographicView'; import PhoneView from './PhoneView'; - +import { CurrentUser } from '../data'; const FormItem = Form.Item; const { Option } = Select; // 头像组件 方便以后独立,增加裁剪之类的功能 -const AvatarView = ({ avatar }) => ( +const AvatarView = ({ avatar }: { avatar: string }) => (
@@ -27,8 +28,19 @@ const AvatarView = ({ avatar }) => ( ); +interface SelectItem { + label: string; + key: string; +} -const validatorGeographic = (rule, value, callback) => { +const validatorGeographic = ( + _: any, + value: { + province: SelectItem; + city: SelectItem; + }, + callback: (message?: string) => void +) => { const { province, city } = value; if (!province.key) { callback('Please input your province!'); @@ -39,7 +51,7 @@ const validatorGeographic = (rule, value, callback) => { callback(); }; -const validatorPhone = (rule, value, callback) => { +const validatorPhone = (rule: any, value: string, callback: (message?: string) => void) => { const values = value.split('-'); if (!values[0]) { callback('Please input your area code!'); @@ -50,11 +62,14 @@ const validatorPhone = (rule, value, callback) => { callback(); }; -@connect(({ BLOCK_NAME_CAMEL_CASE }) => ({ +interface BaseViewProps extends FormComponentProps { + currentUser: CurrentUser; +} + +@connect(({ BLOCK_NAME_CAMEL_CASE }: { BLOCK_NAME_CAMEL_CASE: { currentUser: CurrentUser } }) => ({ currentUser: BLOCK_NAME_CAMEL_CASE.currentUser, })) -@Form.create() -class BaseView extends Component { +class BaseView extends Component { componentDidMount() { this.setBaseInfo(); } @@ -76,8 +91,9 @@ class BaseView extends Component { const url = 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'; return url; } + view: HTMLDivElement | undefined; - getViewDom = ref => { + getViewDom = (ref: HTMLDivElement) => { this.view = ref; }; @@ -88,7 +104,7 @@ class BaseView extends Component { return (
-
+ {getFieldDecorator('email', { rules: [ @@ -185,4 +201,4 @@ class BaseView extends Component { } } -export default BaseView; +export default Form.create()(BaseView); diff --git a/AccountSettings/src/components/binding.js b/AccountSettings/src/components/binding.tsx similarity index 95% rename from AccountSettings/src/components/binding.js rename to AccountSettings/src/components/binding.tsx index c95eca62..d78a765c 100644 --- a/AccountSettings/src/components/binding.js +++ b/AccountSettings/src/components/binding.tsx @@ -1,5 +1,5 @@ import React, { Component, Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Icon, List } from 'antd'; class BindingView extends Component { diff --git a/AccountSettings/src/components/notification.js b/AccountSettings/src/components/notification.tsx similarity index 87% rename from AccountSettings/src/components/notification.js rename to AccountSettings/src/components/notification.tsx index b61eac3e..e06f54d6 100644 --- a/AccountSettings/src/components/notification.js +++ b/AccountSettings/src/components/notification.tsx @@ -1,7 +1,9 @@ import React, { Component, Fragment } from 'react'; -import { formatMessage } from 'umi/locale'; +import { formatMessage } from 'umi-plugin-react/locale'; import { Switch, List } from 'antd'; +type Unpacked = T extends (infer U)[] ? U : T; + class NotificationView extends Component { getData = () => { const Action = ( @@ -31,11 +33,12 @@ class NotificationView extends Component { }; render() { + const data = this.getData(); return ( - > itemLayout="horizontal" - dataSource={this.getData()} + dataSource={data} renderItem={item => ( diff --git a/AccountSettings/src/components/security.js b/AccountSettings/src/components/security.tsx similarity index 88% rename from AccountSettings/src/components/security.js rename to AccountSettings/src/components/security.tsx index 96685c0f..6a15f412 100644 --- a/AccountSettings/src/components/security.js +++ b/AccountSettings/src/components/security.tsx @@ -1,24 +1,25 @@ import React, { Component, Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { List } from 'antd'; -// import { getTimeDistance } from '@/utils/utils'; + +type Unpacked = T extends (infer U)[] ? U : T; const passwordStrength = { strong: ( - + - + ), medium: ( - + - + ), weak: ( - + Weak - + ), }; @@ -83,11 +84,12 @@ class SecurityView extends Component { ]; render() { + const data = this.getData(); return ( - > itemLayout="horizontal" - dataSource={this.getData()} + dataSource={data} renderItem={item => ( diff --git a/AccountSettings/src/data.d.ts b/AccountSettings/src/data.d.ts new file mode 100644 index 00000000..afc53e51 --- /dev/null +++ b/AccountSettings/src/data.d.ts @@ -0,0 +1,56 @@ +export interface ITag { + key: string; + label: string; +} + +export interface Province { + label: string; + key: string; +} + +export interface City { + label: string; + key: string; +} + +export interface Geographic { + province: Province; + city: City; +} +export interface ProvinceData { + name: string; + id: string; +} +export interface CityData { + province: string; + name: string; + id: string; +} +export interface Notice { + id: string; + title: string; + logo: string; + description: string; + updatedAt: string; + member: string; + href: string; + memberLink: string; +} + +export interface CurrentUser { + name: string; + avatar: string; + userid: string; + notice: Notice[]; + email: string; + signature: string; + title: string; + group: string; + tags: ITag[]; + notifyCount: number; + unreadCount: number; + country: string; + geographic: Geographic; + address: string; + phone: string; +} diff --git a/AccountSettings/src/index.js b/AccountSettings/src/index.tsx similarity index 98% rename from AccountSettings/src/index.js rename to AccountSettings/src/index.tsx index 32985cfe..52e91652 100644 --- a/AccountSettings/src/index.js +++ b/AccountSettings/src/index.tsx @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { connect } from 'dva'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import { Menu } from 'antd'; import styles from './style.less'; import BaseView from './components/base'; diff --git a/AccountSettings/src/locales/en-US.js b/AccountSettings/src/locales/en-US.ts similarity index 100% rename from AccountSettings/src/locales/en-US.js rename to AccountSettings/src/locales/en-US.ts diff --git a/AccountSettings/src/locales/zh-CN.js b/AccountSettings/src/locales/zh-CN.ts similarity index 100% rename from AccountSettings/src/locales/zh-CN.js rename to AccountSettings/src/locales/zh-CN.ts diff --git a/AccountSettings/src/locales/zh-TW.js b/AccountSettings/src/locales/zh-TW.ts similarity index 100% rename from AccountSettings/src/locales/zh-TW.js rename to AccountSettings/src/locales/zh-TW.ts diff --git a/AccountSettings/src/model.js b/AccountSettings/src/model.ts similarity index 100% rename from AccountSettings/src/model.js rename to AccountSettings/src/model.ts diff --git a/AccountSettings/src/service.js b/AccountSettings/src/service.ts similarity index 87% rename from AccountSettings/src/service.js rename to AccountSettings/src/service.ts index 104bb1e9..309f0665 100644 --- a/AccountSettings/src/service.js +++ b/AccountSettings/src/service.ts @@ -8,7 +8,7 @@ export async function queryProvince() { return request('/api/BLOCK_NAME/province'); } -export async function queryCity(province) { +export async function queryCity(province: string) { return request(`/api/BLOCK_NAME/city/${province}`); } diff --git a/AdvancedForm/src/components/PageHeaderWrapper/index.js b/AdvancedForm/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/AdvancedForm/src/components/PageHeaderWrapper/index.js +++ b/AdvancedForm/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/AdvancedProfile/src/components/PageHeaderWrapper/index.js b/AdvancedProfile/src/components/PageHeaderWrapper/index.js index 165ae252..9e839c45 100644 --- a/AdvancedProfile/src/components/PageHeaderWrapper/index.js +++ b/AdvancedProfile/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/Analysis/src/components/IntroduceRow.js b/Analysis/src/components/IntroduceRow.js index 1485c417..720c40f8 100755 --- a/Analysis/src/components/IntroduceRow.js +++ b/Analysis/src/components/IntroduceRow.js @@ -1,6 +1,6 @@ import React, { memo } from 'react'; import { Row, Col, Icon, Tooltip } from 'antd'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import { Charts, Trend } from 'ant-design-pro'; import numeral from 'numeral'; import styles from '../style.less'; diff --git a/Analysis/src/components/OfflineData.js b/Analysis/src/components/OfflineData.js index 44a75d3c..bac3d62d 100755 --- a/Analysis/src/components/OfflineData.js +++ b/Analysis/src/components/OfflineData.js @@ -1,6 +1,6 @@ import React, { memo } from 'react'; import { Card, Tabs, Row, Col } from 'antd'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Charts, NumberInfo } from 'ant-design-pro'; import styles from '../style.less'; diff --git a/Analysis/src/components/ProportionSales.js b/Analysis/src/components/ProportionSales.js index 51d44be2..6c5a89f6 100755 --- a/Analysis/src/components/ProportionSales.js +++ b/Analysis/src/components/ProportionSales.js @@ -1,7 +1,7 @@ import React, { memo } from 'react'; import { Card, Radio } from 'antd'; import { Charts } from 'ant-design-pro'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import styles from '../style.less'; import Yuan from '../utils/Yuan'; diff --git a/Analysis/src/components/SalesCard.js b/Analysis/src/components/SalesCard.js index 893314eb..0121e794 100755 --- a/Analysis/src/components/SalesCard.js +++ b/Analysis/src/components/SalesCard.js @@ -1,6 +1,6 @@ import React, { memo } from 'react'; import { Row, Col, Card, Tabs, DatePicker } from 'antd'; -import { FormattedMessage, formatMessage } from 'umi/locale'; +import { FormattedMessage, formatMessage } from 'umi-plugin-react/locale'; import numeral from 'numeral'; import { Charts } from 'ant-design-pro'; import styles from '../style.less'; diff --git a/Analysis/src/components/TopSearch.js b/Analysis/src/components/TopSearch.js index faf7f557..4e19176c 100755 --- a/Analysis/src/components/TopSearch.js +++ b/Analysis/src/components/TopSearch.js @@ -1,6 +1,6 @@ import React, { memo } from 'react'; import { Row, Col, Table, Tooltip, Card, Icon } from 'antd'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import { Trend, NumberInfo, Charts } from 'ant-design-pro'; import numeral from 'numeral'; import styles from '../style.less'; diff --git a/BasicForm/src/components/PageHeaderWrapper/index.js b/BasicForm/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/BasicForm/src/components/PageHeaderWrapper/index.js +++ b/BasicForm/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/BasicForm/src/index.js b/BasicForm/src/index.js index 69235e57..a140e9be 100644 --- a/BasicForm/src/index.js +++ b/BasicForm/src/index.js @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Form, Input, diff --git a/BasicList/src/index.js b/BasicList/src/index.js index d75d6e4d..054d9636 100644 --- a/BasicList/src/index.js +++ b/BasicList/src/index.js @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import { findDOMNode } from 'react-dom'; import moment from 'moment'; import { connect } from 'dva'; diff --git a/BasicProfile/src/components/PageHeaderWrapper/index.js b/BasicProfile/src/components/PageHeaderWrapper/index.js index 165ae252..9e839c45 100644 --- a/BasicProfile/src/components/PageHeaderWrapper/index.js +++ b/BasicProfile/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/CardList/src/components/PageHeaderWrapper/index.js b/CardList/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/CardList/src/components/PageHeaderWrapper/index.js +++ b/CardList/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/Monitor/src/index.js b/Monitor/src/index.js index cd48ebb7..35b18fb4 100644 --- a/Monitor/src/index.js +++ b/Monitor/src/index.js @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Row, Col, Card, Tooltip } from 'antd'; import { NumberInfo, Charts } from 'ant-design-pro'; import CountDown from 'ant-design-pro/lib/CountDown'; diff --git a/ResultFail/src/index.js b/ResultFail/src/index.js index 6077ce97..e5b77eb2 100644 --- a/ResultFail/src/index.js +++ b/ResultFail/src/index.js @@ -1,5 +1,5 @@ import React, { Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Button, Icon, Card } from 'antd'; import { Result } from 'ant-design-pro'; diff --git a/ResultSuccess/src/index.js b/ResultSuccess/src/index.js index 615be181..a15594e2 100644 --- a/ResultSuccess/src/index.js +++ b/ResultSuccess/src/index.js @@ -1,5 +1,5 @@ import React, { Fragment } from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Button, Row, Col, Icon, Steps, Card } from 'antd'; import { Result } from 'ant-design-pro'; diff --git a/SearchListApplications/src/components/PageHeaderWrapper/index.js b/SearchListApplications/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/SearchListApplications/src/components/PageHeaderWrapper/index.js +++ b/SearchListApplications/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/SearchListArticles/src/components/PageHeaderWrapper/index.js b/SearchListArticles/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/SearchListArticles/src/components/PageHeaderWrapper/index.js +++ b/SearchListArticles/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/SearchListProjects/src/components/PageHeaderWrapper/index.js b/SearchListProjects/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/SearchListProjects/src/components/PageHeaderWrapper/index.js +++ b/SearchListProjects/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/StepForm/src/components/PageHeaderWrapper/index.js b/StepForm/src/components/PageHeaderWrapper/index.js index c11873f2..1a40e25d 100644 --- a/StepForm/src/components/PageHeaderWrapper/index.js +++ b/StepForm/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/UserLogin/src/index.js b/UserLogin/src/index.js index 0c4480bb..b255a8ba 100644 --- a/UserLogin/src/index.js +++ b/UserLogin/src/index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { connect } from 'dva'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { Checkbox, Alert, Icon } from 'antd'; import { Login } from 'ant-design-pro'; diff --git a/UserRegister/src/index.js b/UserRegister/src/index.js index b5bcd413..eb49b457 100644 --- a/UserRegister/src/index.js +++ b/UserRegister/src/index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { connect } from 'dva'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import router from 'umi/router'; import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd'; diff --git a/UserRegisterResult/src/index.js b/UserRegisterResult/src/index.js index 3a342532..9bd63060 100644 --- a/UserRegisterResult/src/index.js +++ b/UserRegisterResult/src/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { formatMessage, FormattedMessage } from 'umi/locale'; +import { formatMessage, FormattedMessage } from 'umi-plugin-react/locale'; import { Button } from 'antd'; import Link from 'umi/link'; import { Result } from 'ant-design-pro'; diff --git a/Workplace/src/components/PageHeaderWrapper/index.js b/Workplace/src/components/PageHeaderWrapper/index.js index db0daf45..d121b2c4 100644 --- a/Workplace/src/components/PageHeaderWrapper/index.js +++ b/Workplace/src/components/PageHeaderWrapper/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'umi/locale'; +import { FormattedMessage } from 'umi-plugin-react/locale'; import Link from 'umi/link'; import { PageHeader } from 'ant-design-pro'; import styles from './index.less'; diff --git a/tsconfig.json b/tsconfig.json index b753726e..c9377ebc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "suppressImplicitAnyIndexErrors": true, "noUnusedLocals": true, "allowJs": true, + "resolveJsonModule": true, "experimentalDecorators": true, "strict": true, "paths": { -- GitLab