change_profiles.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. TextInput,
  6. TouchableOpacity,
  7. Image,
  8. PixelRatio,
  9. } from 'react-native';
  10. import {List, TextareaItem} from '@ant-design/react-native';
  11. import {ShowToast} from '../../components/rootToast/root_toast';
  12. import {GetDataPost} from '../../data/encryption';
  13. import {RetrieveData} from '../../data/storage';
  14. import public_css from '../../source/css/public_css';
  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.state.profiles,
  20. };
  21. }
  22. render() {
  23. return (
  24. <View style={public_css.body}>
  25. <View style={{flex: 1}}>
  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. </View>
  38. <View style={[public_css.bottomStaus]}>
  39. <TouchableOpacity
  40. style={[public_css.statusBtn, public_css.statusRBtn]}
  41. onPress={() => this.submitData()}>
  42. <Image
  43. source={require('../../source/img/productImg/confirm.png')}
  44. style={{width: 32, height: 32}}
  45. />
  46. <Text style={{color: '#fff'}}>确认</Text>
  47. </TouchableOpacity>
  48. </View>
  49. </View>
  50. );
  51. }
  52. //提交开票信息
  53. submitData = async () => {
  54. let account = await RetrieveData('account');
  55. let token = await RetrieveData('token');
  56. if (token && account) {
  57. account = account.substring(1, account.length - 1);
  58. token = token.substring(1, token.length - 1);
  59. const url = '/auth/comm/user/personalInfo/save';
  60. let response = await GetDataPost(
  61. url,
  62. token,
  63. {
  64. mobile: account,
  65. personalProfile: this.state.profiles,
  66. reqChannel: 3,
  67. ip: '',
  68. },
  69. false,
  70. 1,
  71. );
  72. if (response) {
  73. if (response.code == 0) {
  74. ShowToast('修改成功!');
  75. await this.props.route.params.data.getUserInformation();
  76. this.props.navigation.goBack();
  77. }
  78. } else {
  79. ShowToast('服务器故障!');
  80. }
  81. }
  82. };
  83. }