perfectInfo.js
4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
* Created by xiniu on 2018/5/3.
*/
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Image,
ScrollView,
Button
} from 'react-native';
import { NavigationActions } from 'react-navigation';
import { width, height, zoomW, zoomH } from '../../utils/getSize';
import { xnToast } from '../../utils/utils';
export default class perfectInfo extends Component {
static navigationOptions = ({ navigation, screenProps }) => ({
title: '完善个人信息',
headerLeft: (
<View></View>
),
headerRight: (
<Button
onPress={() => navigation.state.params.save()}
title="保存"
color="#4b85e0"
/>
),
});
constructor(props) {
super(props);
this.state = {
politicalName:'-',
partyName:'社会志愿者',
};
}
componentWillMount() {
}
componentDidMount () {
this.props.navigation.setParams({
save: () => this.save()
});
}
save() {
if(this.state.politicalName === '-') {
xnToast('请完善个人信息');
} else {
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Root'})
]
})
this.props.navigation.dispatch(resetAction);
}
}
check(select){
if (select == 0) {
//更新政治面貌
let itemList = ['中共党员','群众','共青团员','民主党派'];
this.props.navigation.navigate('ChooseUserInfo',{title:'政治面貌',defultValue:this.state.politicalName,itemList:itemList,type:'partyMember',callback:()=>{
if(global.user.politicalStatus == 1) {
this.setState({
politicalName: '中共党员',
});
} else if(global.user.politicalStatus == 2) {
this.setState({
politicalName: '群众',
});
} else if(global.user.politicalStatus == 3) {
this.setState({
politicalName: '共青团员',
});
} else if(global.user.politicalStatus == 4) {
this.setState({
politicalName: '民主党派',
});
}
}});
}else if (select == 1) {
//更新所属单位类别
let itemList = [];
this.props.navigation.navigate('ChooseUserInfo',{title:'所属单位类别',defultValue:this.state.partyName,itemList:itemList,type:'organization',callback:()=>{
this.setState({
partyName:global.user.partyName,
})
}});
}
}
row(v,i){
return (
<TouchableOpacity style={[styles.row,{marginTop:i===0?10:0},{borderBottomWidth:i===0?1:0}]} key={i} onPress={()=>{this.check(i)}}>
<Text style={styles.title}>{v.name}</Text>
<Text style={styles.text}>{v.text}</Text>
<Image style={styles.rightIcon} source={require('../../img/arrow_right.png')} resizeMode={'contain'}/>
</TouchableOpacity>
)
}
render() {
return (
<View style={styles.background}>
<ScrollView >
{this.row({name:'政治面貌',text:this.state.politicalName},0)}
{this.row({name:'所属单位类别',text:this.state.partyName},1)}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
backWrap: {
justifyContent: 'center',
paddingLeft: 18.5 / zoomW,
paddingRight: 18.5 / zoomW,
height: 44 / zoomH,
},
background: {
flex: 1,
position: 'relative',
},
row:{
height:44/zoomH,
flexDirection:'row',
paddingHorizontal:15/zoomW,
alignItems:'center',
borderBottomColor:'#dddddd',
backgroundColor:'white'
},
title:{
fontSize:16,
color:'#4b4b4b',
flex:1
},
text:{
color:'#8c8c8c',
fontSize:14,
marginRight:14/zoomW
},
rightIcon:{
width:6/zoomW,
height:11/zoomH
},
});