Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
XieZhiXiong
jinfa-platform
Commits
e762209b
Commit
e762209b
authored
Feb 15, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 补充国际化 defaultValue
parent
db739775
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
index.tsx
src/components/AddressSelect/index.tsx
+15
-14
No files found.
src/components/AddressSelect/index.tsx
View file @
e762209b
...
...
@@ -7,6 +7,7 @@
*/
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
Select
,
Button
,
Drawer
,
Divider
,
message
}
from
'antd'
;
import
{
useIntl
}
from
'umi'
;
import
{
createFormActions
,
FormEffectHooks
,
...
...
@@ -34,8 +35,6 @@ import { AddressSelectContextProvider } from './context';
import
{
AddressItemType
,
AddressValueType
}
from
'./components/AddressRadioGroup'
;
import
AddressRadioGroup
from
'./components/AddressRadioGroupFormilyItem'
;
import
styles
from
'./index.less'
;
import
{
getIntl
}
from
'umi'
;
const
intl
=
getIntl
();
const
formActions
=
createFormActions
();
const
{
...
...
@@ -198,6 +197,8 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
// 记录是否是新增或编辑操作
const
actionFlagRef
=
useRef
<
boolean
>
(
false
);
const
intl
=
useIntl
();
const
triggerChange
=
(
value
:
AddressValueType
)
=>
{
if
(
onChange
)
{
onChange
(
value
);
...
...
@@ -295,7 +296,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
return
fieldState
.
originData
;
});
if
(
!
provinceCodeOriginData
)
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaoshengjixinxi'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaoshengjixinxi'
},
{
default
:
'未找到省级信息'
}));
return
;
}
const
currentProvince
=
provinceCodeOriginData
.
find
((
item
)
=>
item
.
code
===
values
.
provinceCode
);
...
...
@@ -304,7 +305,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
return
fieldState
.
originData
;
});
if
(
!
cityCodeOriginData
)
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaoshijixinxi'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaoshijixinxi'
},
{
default
:
'未找到市级信息'
}));
return
;
}
const
currentCity
=
cityCodeOriginData
.
find
((
item
)
=>
item
.
code
===
values
.
cityCode
);
...
...
@@ -313,7 +314,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
return
fieldState
.
originData
;
});
if
(
!
districtCodeOriginData
)
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaoqujixinxi'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaoqujixinxi'
},
{
default
:
'未找到区级信息'
}));
return
;
}
const
currentDistrict
=
districtCodeOriginData
.
find
((
item
)
=>
item
.
code
===
values
.
districtCode
);
...
...
@@ -322,7 +323,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
return
fieldState
.
originData
;
});
if
(
!
streetCodeOriginData
)
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaojiedaoxinxi'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.weizhaodaojiedaoxinxi'
},
{
default
:
'未找到街道信息'
}));
return
;
}
const
currentStreet
=
streetCodeOriginData
.
find
((
item
)
=>
item
.
code
===
values
.
streetCode
);
...
...
@@ -504,7 +505,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
});
if
(
areaRes
.
code
!==
1000
)
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.huoqushengjixinxishibai'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.huoqushengjixinxishibai'
},
{
default
:
'获取省级信息失败'
}));
return
;
}
const
{
data
}
=
areaRes
;
...
...
@@ -523,7 +524,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
return
(
<
div
>
<
Button
onClick=
{
handleAddAddress
}
>
{
flag
?
`${intl.formatMessage({
id: 'components.xinzeng'})}${addressType === 2 ? intl.formatMessage({id: 'components.fahuo'}) : intl.formatMessage({id: 'components.shouhuo'})}${intl.formatMessage({id: 'components.dizhi'})}`
:
intl
.
formatMessage
({
id
:
'components.quxiao'
})
}
{
flag
?
`${intl.formatMessage({
id: 'components.xinzeng' }, { default: '新增' })}${addressType === 2 ? intl.formatMessage({ id: 'components.fahuo' }, { default: '发货' }) : intl.formatMessage({ id: 'components.shouhuo' }, { default: '收货' })}${intl.formatMessage({ id: 'components.dizhi' }, { default: '地址' })}`
:
intl
.
formatMessage
({
id
:
'components.quxiao'
},
{
default
:
'取消'
})
}
</
Button
>
<
Divider
style=
{
{
marginBottom
:
4
}
}
/>
</
div
>
...
...
@@ -549,7 +550,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
});
if
(
areaRes
.
code
!==
1000
)
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.huoqushengjixinxishibai'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.huoqushengjixinxishibai'
},
{
default
:
'获取省级信息失败'
}));
return
;
}
const
{
data
}
=
areaRes
;
...
...
@@ -584,7 +585,7 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
editAddressId
.
current
=
id
;
}
else
{
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.huoqudizhixinxishibai'
}));
message
.
warn
(
intl
.
formatMessage
({
id
:
'components.huoqudizhixinxishibai'
},
{
default
:
'获取地址信息失败'
}));
}
}
catch
(
error
)
{
console
.
warn
(
error
);
...
...
@@ -648,12 +649,12 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
className=
{
styles
[
'address-select-action'
]
}
disabled=
{
disabled
}
>
{
intl
.
formatMessage
({
id
:
'components.genggai'
})
}
{
intl
.
formatMessage
({
id
:
'components.genggai'
},
{
default
:
'更改'
})
}
</
Button
>
</
div
>
<
Drawer
title=
{
intl
.
formatMessage
({
id
:
'components.genggaishouhuodizhixinxi'
})
}
title=
{
intl
.
formatMessage
({
id
:
'components.genggaishouhuodizhixinxi'
},
{
default
:
'更改收货地址信息'
})
}
width=
{
800
}
onClose=
{
()
=>
handleVisibleDrawer
(
false
)
}
visible=
{
visibleDrawer
}
...
...
@@ -665,14 +666,14 @@ const AddressSelect: React.FC<AddressSelectProps> = (props) => {
}
}
>
<
Button
onClick=
{
()
=>
handleVisibleDrawer
(
false
)
}
style=
{
{
marginRight
:
16
}
}
>
{
intl
.
formatMessage
({
id
:
'components.quxiao'
})
}
{
intl
.
formatMessage
({
id
:
'components.quxiao'
},
{
default
:
'取消'
})
}
</
Button
>
<
Button
onClick=
{
()
=>
formActions
.
submit
()
}
type=
"primary"
loading=
{
submitLoading
}
>
{
intl
.
formatMessage
({
id
:
'components.queding'
})
}
{
intl
.
formatMessage
({
id
:
'components.queding'
},
{
default
:
'确定'
})
}
</
Button
>
</
div
>
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment