|
|
@@ -64,7 +64,9 @@ export default class FormAddress extends Component {
|
|
|
console.log('e',e)
|
|
|
console.log(district)
|
|
|
|
|
|
- let provinceCode=e[0],cityCode=e[0],areCode=e[0]
|
|
|
+ let provinceCode=e[0],cityCode=e[1],areaCode=e[2]
|
|
|
+
|
|
|
+
|
|
|
let province='',city='',area=''
|
|
|
|
|
|
district.map((item)=>{
|
|
|
@@ -75,8 +77,8 @@ export default class FormAddress extends Component {
|
|
|
if(item.value===cityCode){
|
|
|
console.log('city',item)
|
|
|
city=item.label
|
|
|
- item.children((item)=>{
|
|
|
- if(item.value===areCode){
|
|
|
+ item.children.map((item)=>{
|
|
|
+ if(item.value===areaCode){
|
|
|
console.log('area',item)
|
|
|
area=item.label
|
|
|
}
|
|
|
@@ -89,20 +91,22 @@ export default class FormAddress extends Component {
|
|
|
return 0
|
|
|
})
|
|
|
|
|
|
- console.log(province+city+area)
|
|
|
-
|
|
|
-
|
|
|
+ this.setState({
|
|
|
+ province,
|
|
|
+ city,
|
|
|
+ area
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
submit(){
|
|
|
let data={
|
|
|
"address": this.state.detail,
|
|
|
- "area": "",
|
|
|
- "city": "",
|
|
|
+ "area": this.state.area,
|
|
|
+ "city": this.state.city,
|
|
|
"default":0,
|
|
|
"id": new Date().getTime()+parseInt(Math.random(),10),
|
|
|
"postcode": this.state.code,
|
|
|
- "province": "",
|
|
|
+ "province": this.state.province,
|
|
|
"telephone": this.state.phone,
|
|
|
"updatedAt": "",
|
|
|
"user_id": APPID,
|
|
|
@@ -137,7 +141,7 @@ export default class FormAddress extends Component {
|
|
|
|
|
|
<div className='pickerWrap' style={this.state.areaShow ? {}:{display:""}}>
|
|
|
<List style={{ backgroundColor: 'white' }} className="picker-list">
|
|
|
- <Picker extra="请选择(可选)"
|
|
|
+ <Picker extra={this.state.province+this.state.city+this.state.area}
|
|
|
data={district}
|
|
|
title="Areas"
|
|
|
onOk={e => console.log('ok', e)}
|
|
|
@@ -145,7 +149,7 @@ export default class FormAddress extends Component {
|
|
|
onPickerChange={e=> this.areaChange(e)}
|
|
|
indicatorStyle={{position:"absolute",bottom:"0",left:"0"}}
|
|
|
>
|
|
|
- <List.Item arrow="horizontal">点击选择地区:{this.state.area}</List.Item>
|
|
|
+ <List.Item arrow="horizontal">点击选择地区</List.Item>
|
|
|
</Picker>
|
|
|
</List>
|
|
|
</div>
|