Showing
1 changed file
with
87 additions
and
7 deletions
| @@ -8,7 +8,12 @@ import { | @@ -8,7 +8,12 @@ import { | ||
| 8 | TouchableOpacity, | 8 | TouchableOpacity, |
| 9 | ScrollView, | 9 | ScrollView, |
| 10 | ListView, | 10 | ListView, |
| 11 | - Dimensions | 11 | + Dimensions, |
| 12 | + Picker, | ||
| 13 | + Modal, | ||
| 14 | + Alert, | ||
| 15 | + AlertIOS, | ||
| 16 | + TouchableHighlight | ||
| 12 | } from "react-native"; | 17 | } from "react-native"; |
| 13 | import { StackNavigator, TabNavigator } from "react-navigation"; | 18 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 14 | import post from "../../utils/fetch"; | 19 | import post from "../../utils/fetch"; |
| @@ -16,7 +21,12 @@ import post from "../../utils/fetch"; | @@ -16,7 +21,12 @@ import post from "../../utils/fetch"; | ||
| 16 | export default class Edit extends Component { | 21 | export default class Edit extends Component { |
| 17 | constructor(props) { | 22 | constructor(props) { |
| 18 | super(props); | 23 | super(props); |
| 19 | - this.state = {}; | 24 | + this.state = { |
| 25 | + customer_status: [], | ||
| 26 | + is_married: "", | ||
| 27 | + modalVisible: false, | ||
| 28 | + recommend: "" | ||
| 29 | + }; | ||
| 20 | } | 30 | } |
| 21 | componentWillMount() {} | 31 | componentWillMount() {} |
| 22 | 32 | ||
| @@ -26,6 +36,62 @@ export default class Edit extends Component { | @@ -26,6 +36,62 @@ export default class Edit extends Component { | ||
| 26 | post("/test/insurance/article", {}, res => {}, err => {}); | 36 | post("/test/insurance/article", {}, res => {}, err => {}); |
| 27 | } | 37 | } |
| 28 | 38 | ||
| 39 | + setModalVisible(visible) { | ||
| 40 | + this.setState({ modalVisible: visible }); | ||
| 41 | + } | ||
| 42 | + _renderPicker() { | ||
| 43 | + return ( | ||
| 44 | + <Modal | ||
| 45 | + animationType={"slide"} | ||
| 46 | + transparent={false} | ||
| 47 | + visible={this.state.modalVisible} | ||
| 48 | + onRequestClose={() => { | ||
| 49 | + alert("Modal has been closed."); | ||
| 50 | + }} | ||
| 51 | + > | ||
| 52 | + <Picker | ||
| 53 | + selectedValue={this.state.is_married} | ||
| 54 | + onValueChange={status => this.setState({ is_married: status })} | ||
| 55 | + > | ||
| 56 | + <Picker.Item label="是" value="yes" /> | ||
| 57 | + <Picker.Item label="否" value="no" /> | ||
| 58 | + </Picker> | ||
| 59 | + <TouchableHighlight | ||
| 60 | + onPress={() => { | ||
| 61 | + this.setModalVisible(!this.state.modalVisible); | ||
| 62 | + }} | ||
| 63 | + > | ||
| 64 | + <Text>Hide Modal</Text> | ||
| 65 | + </TouchableHighlight> | ||
| 66 | + </Modal> | ||
| 67 | + ); | ||
| 68 | + } | ||
| 69 | + Alert_select(title, tips, statusName, select1, select2) { | ||
| 70 | + Alert.alert( | ||
| 71 | + title, | ||
| 72 | + tips, | ||
| 73 | + [ | ||
| 74 | + { | ||
| 75 | + text: select1, | ||
| 76 | + onPress: () => { | ||
| 77 | + this.setState({ [statusName]: select1 }); | ||
| 78 | + } | ||
| 79 | + }, | ||
| 80 | + { | ||
| 81 | + text: select2, | ||
| 82 | + onPress: () => { | ||
| 83 | + this.setState({ [statusName]: select2 }); | ||
| 84 | + }, | ||
| 85 | + }, | ||
| 86 | + ], | ||
| 87 | + { cancelable: false } | ||
| 88 | + ); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + AlertIOS_input() { | ||
| 92 | + AlertIOS.prompt("婚姻状态", null, () => {}); | ||
| 93 | + } | ||
| 94 | + | ||
| 29 | render() { | 95 | render() { |
| 30 | const { navigate } = this.props.navigation; | 96 | const { navigate } = this.props.navigation; |
| 31 | return ( | 97 | return ( |
| @@ -91,24 +157,36 @@ export default class Edit extends Component { | @@ -91,24 +157,36 @@ export default class Edit extends Component { | ||
| 91 | /> | 157 | /> |
| 92 | </View> | 158 | </View> |
| 93 | </TouchableOpacity> | 159 | </TouchableOpacity> |
| 94 | - <TouchableOpacity style={styles.itemContainer} onPress={() => {}}> | 160 | + <TouchableOpacity |
| 161 | + style={styles.itemContainer} | ||
| 162 | + onPress={() => { | ||
| 163 | + this.AlertIOS_input(); | ||
| 164 | + }} | ||
| 165 | + > | ||
| 95 | <View style={styles.itemLeft}> | 166 | <View style={styles.itemLeft}> |
| 96 | <Text style={styles.leftTitle}>客户来源</Text> | 167 | <Text style={styles.leftTitle}>客户来源</Text> |
| 97 | </View> | 168 | </View> |
| 98 | <View style={styles.itemRight}> | 169 | <View style={styles.itemRight}> |
| 99 | - <Text style={styles.itemRightContent}>芒果钱包</Text> | 170 | + <Text style={styles.itemRightContent}> |
| 171 | + {this.state.recommend} | ||
| 172 | + </Text> | ||
| 100 | <Image | 173 | <Image |
| 101 | style={styles.itemRightImg} | 174 | style={styles.itemRightImg} |
| 102 | source={require("../../assets/Mine/rightArrow_gray.png")} | 175 | source={require("../../assets/Mine/rightArrow_gray.png")} |
| 103 | /> | 176 | /> |
| 104 | </View> | 177 | </View> |
| 105 | </TouchableOpacity> | 178 | </TouchableOpacity> |
| 106 | - <TouchableOpacity style={styles.itemContainer} onPress={() => {}}> | 179 | + <TouchableOpacity |
| 180 | + style={styles.itemContainer} | ||
| 181 | + onPress={() => { | ||
| 182 | + this.Alert_select("婚姻状态", "选一下嘛", 'is_married', "已婚", "未婚"); | ||
| 183 | + }} | ||
| 184 | + > | ||
| 107 | <View style={styles.itemLeft}> | 185 | <View style={styles.itemLeft}> |
| 108 | <Text style={styles.leftTitle}>婚姻状态</Text> | 186 | <Text style={styles.leftTitle}>婚姻状态</Text> |
| 109 | </View> | 187 | </View> |
| 110 | <View style={styles.itemRight}> | 188 | <View style={styles.itemRight}> |
| 111 | - <Text style={styles.itemRightContent}>未婚</Text> | 189 | + <Text style={styles.itemRightContent}>{this.state.is_married}</Text> |
| 112 | <Image | 190 | <Image |
| 113 | style={styles.itemRightImg} | 191 | style={styles.itemRightImg} |
| 114 | source={require("../../assets/Mine/rightArrow_gray.png")} | 192 | source={require("../../assets/Mine/rightArrow_gray.png")} |
| @@ -120,7 +198,9 @@ export default class Edit extends Component { | @@ -120,7 +198,9 @@ export default class Edit extends Component { | ||
| 120 | <Text style={styles.leftTitle}>是否生育</Text> | 198 | <Text style={styles.leftTitle}>是否生育</Text> |
| 121 | </View> | 199 | </View> |
| 122 | <View style={styles.itemRight}> | 200 | <View style={styles.itemRight}> |
| 123 | - <Text style={styles.itemRightContent}>否</Text> | 201 | + <Text style={styles.itemRightContent}> |
| 202 | + 否 | ||
| 203 | + </Text> | ||
| 124 | <Image | 204 | <Image |
| 125 | style={styles.itemRightImg} | 205 | style={styles.itemRightImg} |
| 126 | source={require("../../assets/Mine/rightArrow_gray.png")} | 206 | source={require("../../assets/Mine/rightArrow_gray.png")} |
-
Please register or login to post a comment