Showing
2 changed files
with
119 additions
and
13 deletions
| @@ -43,7 +43,7 @@ export default class Login extends Component { | @@ -43,7 +43,7 @@ export default class Login extends Component { | ||
| 43 | _that.setState({ | 43 | _that.setState({ |
| 44 | IS_LOGIN: result | 44 | IS_LOGIN: result |
| 45 | }); | 45 | }); |
| 46 | - console.log("Login页面的AsyncStorage", result); | 46 | + // console.log("Login页面的AsyncStorage", result); |
| 47 | }); | 47 | }); |
| 48 | } | 48 | } |
| 49 | componentDidMount() { | 49 | componentDidMount() { |
| @@ -9,7 +9,8 @@ import { | @@ -9,7 +9,8 @@ import { | ||
| 9 | Alert, | 9 | Alert, |
| 10 | AlertIOS, | 10 | AlertIOS, |
| 11 | AsyncStorage, | 11 | AsyncStorage, |
| 12 | - Button | 12 | + Button, |
| 13 | + ScrollView | ||
| 13 | } from "react-native"; | 14 | } from "react-native"; |
| 14 | import { StackNavigator, TabNavigator } from "react-navigation"; | 15 | import { StackNavigator, TabNavigator } from "react-navigation"; |
| 15 | 16 | ||
| @@ -20,7 +21,9 @@ export default class Mine extends Component { | @@ -20,7 +21,9 @@ export default class Mine extends Component { | ||
| 20 | IS_LOGIN: "", | 21 | IS_LOGIN: "", |
| 21 | USER_ID: "", | 22 | USER_ID: "", |
| 22 | NICKNAME: "", | 23 | NICKNAME: "", |
| 23 | - PROFESSION: "" | 24 | + PROFESSION: "", |
| 25 | + PHONT: "", | ||
| 26 | + COMPONY: "" | ||
| 24 | }; | 27 | }; |
| 25 | this.saveResponse1 = this.saveResponse1.bind(this); | 28 | this.saveResponse1 = this.saveResponse1.bind(this); |
| 26 | this.saveResponse2 = this.saveResponse2.bind(this); | 29 | this.saveResponse2 = this.saveResponse2.bind(this); |
| @@ -99,10 +102,10 @@ export default class Mine extends Component { | @@ -99,10 +102,10 @@ export default class Mine extends Component { | ||
| 99 | if (respJson.enmsg != "ok") { | 102 | if (respJson.enmsg != "ok") { |
| 100 | alert(respJson.cnmsg); | 103 | alert(respJson.cnmsg); |
| 101 | } else { | 104 | } else { |
| 102 | - AsyncStorage.setItem("NICKNAME",d).then(() => { | 105 | + AsyncStorage.setItem("NICKNAME", d).then(() => { |
| 103 | console.log("保存修改成功"); | 106 | console.log("保存修改成功"); |
| 104 | that.setState({ NICKNAME: d }); | 107 | that.setState({ NICKNAME: d }); |
| 105 | - }) | 108 | + }); |
| 106 | } | 109 | } |
| 107 | }) | 110 | }) |
| 108 | .catch(err => console.error(err)); | 111 | .catch(err => console.error(err)); |
| @@ -136,18 +139,20 @@ export default class Mine extends Component { | @@ -136,18 +139,20 @@ export default class Mine extends Component { | ||
| 136 | if (respJson.enmsg != "ok") { | 139 | if (respJson.enmsg != "ok") { |
| 137 | Alert.alert(respJson.cnmsg); | 140 | Alert.alert(respJson.cnmsg); |
| 138 | } else { | 141 | } else { |
| 139 | - AsyncStorage.setItem("PROFESSION",d).then(() => { | 142 | + AsyncStorage.setItem("PROFESSION", d).then(() => { |
| 140 | console.log("保存修改成功"); | 143 | console.log("保存修改成功"); |
| 141 | that.setState({ PROFESSION: d }); | 144 | that.setState({ PROFESSION: d }); |
| 142 | - }) | 145 | + }); |
| 143 | } | 146 | } |
| 144 | }) | 147 | }) |
| 145 | .catch(err => console.error(err)); | 148 | .catch(err => console.error(err)); |
| 146 | } | 149 | } |
| 150 | + | ||
| 147 | render() { | 151 | render() { |
| 148 | const { navigate } = this.props.navigation; | 152 | const { navigate } = this.props.navigation; |
| 149 | return ( | 153 | return ( |
| 150 | <View style={styles.container}> | 154 | <View style={styles.container}> |
| 155 | + <ScrollView> | ||
| 151 | {/* 头部头像 */} | 156 | {/* 头部头像 */} |
| 152 | <View style={styles.header}> | 157 | <View style={styles.header}> |
| 153 | {this.state.IS_LOGIN == "yes" ? ( | 158 | {this.state.IS_LOGIN == "yes" ? ( |
| @@ -161,9 +166,13 @@ export default class Mine extends Component { | @@ -161,9 +166,13 @@ export default class Mine extends Component { | ||
| 161 | style={styles.mineIcon} | 166 | style={styles.mineIcon} |
| 162 | /> | 167 | /> |
| 163 | )} | 168 | )} |
| 169 | + {this.state.IS_LOGIN == "yes" ? null : ( | ||
| 170 | + <Text style={styles.headerText}>登录可享更多特权</Text> | ||
| 171 | + )} | ||
| 164 | </View> | 172 | </View> |
| 165 | 173 | ||
| 166 | {/* 设置昵称和职业 */} | 174 | {/* 设置昵称和职业 */} |
| 175 | + {this.state.IS_LOGIN == "yes" ? ( | ||
| 167 | <View style={styles.midContainer}> | 176 | <View style={styles.midContainer}> |
| 168 | {/* 更改昵称 */} | 177 | {/* 更改昵称 */} |
| 169 | <TouchableOpacity | 178 | <TouchableOpacity |
| @@ -172,7 +181,7 @@ export default class Mine extends Component { | @@ -172,7 +181,7 @@ export default class Mine extends Component { | ||
| 172 | if (this.state.IS_LOGIN == "yes") { | 181 | if (this.state.IS_LOGIN == "yes") { |
| 173 | AlertIOS.prompt("更改昵称", null, this.saveResponse1); | 182 | AlertIOS.prompt("更改昵称", null, this.saveResponse1); |
| 174 | } else { | 183 | } else { |
| 175 | - Alert.alert("请先登录账号") | 184 | + Alert.alert("请先登录账号"); |
| 176 | } | 185 | } |
| 177 | }} | 186 | }} |
| 178 | > | 187 | > |
| @@ -198,7 +207,7 @@ export default class Mine extends Component { | @@ -198,7 +207,7 @@ export default class Mine extends Component { | ||
| 198 | if (this.state.IS_LOGIN == "yes") { | 207 | if (this.state.IS_LOGIN == "yes") { |
| 199 | AlertIOS.prompt("更改职业", null, this.saveResponse2); | 208 | AlertIOS.prompt("更改职业", null, this.saveResponse2); |
| 200 | } else { | 209 | } else { |
| 201 | - Alert.alert("请先登录账号") | 210 | + Alert.alert("请先登录账号"); |
| 202 | } | 211 | } |
| 203 | }} | 212 | }} |
| 204 | > | 213 | > |
| @@ -206,12 +215,61 @@ export default class Mine extends Component { | @@ -206,12 +215,61 @@ export default class Mine extends Component { | ||
| 206 | <Text style={styles.leftTitle}>职业</Text> | 215 | <Text style={styles.leftTitle}>职业</Text> |
| 207 | </View> | 216 | </View> |
| 208 | <View style={styles.itemRight}> | 217 | <View style={styles.itemRight}> |
| 218 | + {this.state.IS_LOGIN === "yes" ? ( | ||
| 209 | <Text style={styles.itemRightContent}> | 219 | <Text style={styles.itemRightContent}> |
| 210 | {this.state.PROFESSION} | 220 | {this.state.PROFESSION} |
| 211 | </Text> | 221 | </Text> |
| 222 | + ) : null} | ||
| 223 | + <Image | ||
| 224 | + style={styles.itemRightImg} | ||
| 225 | + source={require("../../assets/Mine/rightArrow_gray.png")} | ||
| 226 | + /> | ||
| 227 | + </View> | ||
| 228 | + </TouchableOpacity> | ||
| 229 | + {/* 公司 */} | ||
| 230 | + <TouchableOpacity | ||
| 231 | + style={styles.itemContainer} | ||
| 232 | + onPress={() => { | ||
| 233 | + if (this.state.IS_LOGIN == "yes") { | ||
| 234 | + AlertIOS.prompt("更改手机", null, this.saveResponse2); | ||
| 235 | + } else { | ||
| 236 | + Alert.alert("请先登录账号"); | ||
| 237 | + } | ||
| 238 | + }} | ||
| 239 | + > | ||
| 240 | + <View style={styles.itemLeft}> | ||
| 241 | + <Text style={styles.leftTitle}>手机</Text> | ||
| 242 | + </View> | ||
| 243 | + <View style={styles.itemRight}> | ||
| 244 | + {this.state.IS_LOGIN === "yes" ? ( | ||
| 245 | + <Text style={styles.itemRightContent}> | ||
| 246 | + {this.state.PHONT} | ||
| 247 | + </Text> | ||
| 248 | + ) : null} | ||
| 249 | + <Image | ||
| 250 | + style={styles.itemRightImg} | ||
| 251 | + source={require("../../assets/Mine/rightArrow_gray.png")} | ||
| 252 | + /> | ||
| 253 | + </View> | ||
| 254 | + </TouchableOpacity> | ||
| 255 | + {/* 手机 */} | ||
| 256 | + <TouchableOpacity | ||
| 257 | + style={styles.itemContainer} | ||
| 258 | + onPress={() => { | ||
| 259 | + if (this.state.IS_LOGIN == "yes") { | ||
| 260 | + AlertIOS.prompt("更改公司", null, this.saveResponse2); | ||
| 261 | + } else { | ||
| 262 | + Alert.alert("请先登录账号"); | ||
| 263 | + } | ||
| 264 | + }} | ||
| 265 | + > | ||
| 266 | + <View style={styles.itemLeft}> | ||
| 267 | + <Text style={styles.leftTitle}>公司</Text> | ||
| 268 | + </View> | ||
| 269 | + <View style={styles.itemRight}> | ||
| 212 | {this.state.IS_LOGIN === "yes" ? ( | 270 | {this.state.IS_LOGIN === "yes" ? ( |
| 213 | <Text style={styles.itemRightContent}> | 271 | <Text style={styles.itemRightContent}> |
| 214 | - {this.state.identity} | 272 | + {this.state.COMPONY} |
| 215 | </Text> | 273 | </Text> |
| 216 | ) : null} | 274 | ) : null} |
| 217 | <Image | 275 | <Image |
| @@ -221,6 +279,46 @@ export default class Mine extends Component { | @@ -221,6 +279,46 @@ export default class Mine extends Component { | ||
| 221 | </View> | 279 | </View> |
| 222 | </TouchableOpacity> | 280 | </TouchableOpacity> |
| 223 | </View> | 281 | </View> |
| 282 | + ) : null} | ||
| 283 | + | ||
| 284 | + <View style={styles.midContainer}> | ||
| 285 | + <TouchableOpacity style={styles.itemContainer}> | ||
| 286 | + <View style={styles.itemLeft}> | ||
| 287 | + <Text style={styles.leftTitle}>评价我们</Text> | ||
| 288 | + </View> | ||
| 289 | + <View style={styles.itemRight}> | ||
| 290 | + <Image | ||
| 291 | + style={styles.itemRightImg} | ||
| 292 | + source={require("../../assets/Mine/rightArrow_gray.png")} | ||
| 293 | + /> | ||
| 294 | + </View> | ||
| 295 | + </TouchableOpacity> | ||
| 296 | + <TouchableOpacity style={styles.itemContainer}> | ||
| 297 | + <View style={styles.itemLeft}> | ||
| 298 | + <Text style={styles.leftTitle}>客服电话</Text> | ||
| 299 | + </View> | ||
| 300 | + <View style={styles.itemRight}> | ||
| 301 | + <Text style={styles.itemRightContent}>4001-608876</Text> | ||
| 302 | + <Image | ||
| 303 | + style={styles.itemRightImg} | ||
| 304 | + source={require("../../assets/Mine/rightArrow_gray.png")} | ||
| 305 | + /> | ||
| 306 | + </View> | ||
| 307 | + </TouchableOpacity> | ||
| 308 | + </View> | ||
| 309 | + | ||
| 310 | + <View style={styles.midContainer}> | ||
| 311 | + <TouchableOpacity style={styles.itemContainer}> | ||
| 312 | + <View style={styles.itemLeft}> | ||
| 313 | + <Text style={styles.leftTitle}>当前版本</Text> | ||
| 314 | + </View> | ||
| 315 | + <View style={styles.itemRight}> | ||
| 316 | + <Text style={styles.itemRightContent}> | ||
| 317 | + V1.0.0 | ||
| 318 | + </Text> | ||
| 319 | + </View> | ||
| 320 | + </TouchableOpacity> | ||
| 321 | + </View> | ||
| 224 | 322 | ||
| 225 | {/* 登录 */} | 323 | {/* 登录 */} |
| 226 | <TouchableOpacity | 324 | <TouchableOpacity |
| @@ -246,6 +344,7 @@ export default class Mine extends Component { | @@ -246,6 +344,7 @@ export default class Mine extends Component { | ||
| 246 | {this.state.IS_LOGIN == "yes" ? "退出登录" : "登录"} | 344 | {this.state.IS_LOGIN == "yes" ? "退出登录" : "登录"} |
| 247 | </Text> | 345 | </Text> |
| 248 | </TouchableOpacity> | 346 | </TouchableOpacity> |
| 347 | + </ScrollView> | ||
| 249 | </View> | 348 | </View> |
| 250 | ); | 349 | ); |
| 251 | } | 350 | } |
| @@ -266,6 +365,11 @@ const styles = StyleSheet.create({ | @@ -266,6 +365,11 @@ const styles = StyleSheet.create({ | ||
| 266 | alignItems: "center", | 365 | alignItems: "center", |
| 267 | marginBottom: 10 | 366 | marginBottom: 10 |
| 268 | }, | 367 | }, |
| 368 | + headerText: { | ||
| 369 | + fontSize: 15, | ||
| 370 | + color: "#fff", | ||
| 371 | + marginLeft: 22 | ||
| 372 | + }, | ||
| 269 | mineIcon: { | 373 | mineIcon: { |
| 270 | width: 86, | 374 | width: 86, |
| 271 | height: 86 | 375 | height: 86 |
| @@ -279,7 +383,9 @@ const styles = StyleSheet.create({ | @@ -279,7 +383,9 @@ const styles = StyleSheet.create({ | ||
| 279 | width: 14, | 383 | width: 14, |
| 280 | height: 14 | 384 | height: 14 |
| 281 | }, | 385 | }, |
| 282 | - midContainer: {}, | 386 | + midContainer: { |
| 387 | + marginBottom: 10 | ||
| 388 | + }, | ||
| 283 | itemContainer: { | 389 | itemContainer: { |
| 284 | height: 46, | 390 | height: 46, |
| 285 | paddingLeft: 16, | 391 | paddingLeft: 16, |
| @@ -315,7 +421,7 @@ const styles = StyleSheet.create({ | @@ -315,7 +421,7 @@ const styles = StyleSheet.create({ | ||
| 315 | height: 14 | 421 | height: 14 |
| 316 | }, | 422 | }, |
| 317 | loginOut: { | 423 | loginOut: { |
| 318 | - marginTop: 10, | 424 | + marginBottom: 10, |
| 319 | height: 46, | 425 | height: 46, |
| 320 | backgroundColor: "#fff", | 426 | backgroundColor: "#fff", |
| 321 | justifyContent: "center" | 427 | justifyContent: "center" |
| @@ -323,5 +429,5 @@ const styles = StyleSheet.create({ | @@ -323,5 +429,5 @@ const styles = StyleSheet.create({ | ||
| 323 | loginOutText: { | 429 | loginOutText: { |
| 324 | textAlign: "center", | 430 | textAlign: "center", |
| 325 | fontSize: 15 | 431 | fontSize: 15 |
| 326 | - }, | 432 | + } |
| 327 | }); | 433 | }); |
-
Please register or login to post a comment