change_profiles.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. TouchableOpacity,
  6. Image,
  7. SafeAreaView,
  8. ScrollView,
  9. } from 'react-native';
  10. import {WingBlank, WhiteSpace, TextareaItem} from '@ant-design/react-native';
  11. import {RequestNetwork} from '../../data/encryption';
  12. import {RetrieveData} from '../../data/storage';
  13. import public_css from '../../source/css/public_css';
  14. import {ToastShow} from '../../components/toast/toast';
  15. export default class change_nick_name extends Component {
  16. constructor(props) {
  17. super(props);
  18. this.state = {
  19. profiles: this.props.route.params.data,
  20. };
  21. }
  22. render() {
  23. return (
  24. <SafeAreaView style={public_css.body}>
  25. <ScrollView>
  26. <TextareaItem
  27. rows={15}
  28. placeholder="请输入简介信息"
  29. value={this.state.profiles}
  30. onChange={(text) => {
  31. this.setState({
  32. profiles: text,
  33. });
  34. }}
  35. count={200}
  36. />
  37. </ScrollView>
  38. <WingBlank>
  39. <View style={[public_css.bottomStatus]}>
  40. <TouchableOpacity
  41. style={[public_css.statusBtn, public_css.statusRBtn]}
  42. onPress={() => this.submitData()}>
  43. <Image
  44. source={require('../../source/img/productImg/confirm.png')}
  45. style={{width: 32, height: 32}}
  46. />
  47. <Text style={{color: '#fff'}}>确认</Text>
  48. </TouchableOpacity>
  49. </View>
  50. </WingBlank>
  51. <WhiteSpace />
  52. </SafeAreaView>
  53. );
  54. }
  55. //提交信息
  56. submitData = async () => {
  57. let account = await RetrieveData('account');
  58. let token = await RetrieveData('token');
  59. if (token && account) {
  60. const url = '/auth/comm/user/personalInfo/save';
  61. let response = await RequestNetwork(
  62. url,
  63. token,
  64. {
  65. mobile: account,
  66. personalProfile: this.state.profiles,
  67. reqChannel: 3,
  68. ip: '',
  69. },
  70. false,
  71. 1,
  72. );
  73. if (response) {
  74. if (response.code === 0) {
  75. ToastShow(1, '编辑成功!');
  76. this.props.route.params.isRefresh();
  77. this.props.navigation.goBack();
  78. } else {
  79. ToastShow(1, '编辑失败!');
  80. }
  81. }
  82. }
  83. };
  84. }