change_profiles.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 {ShowToast} from '../../components/rootToast/root_toast';
  11. import {GetDataPost} from '../../data/encryption';
  12. import {RetrieveData} from '../../data/storage';
  13. import public_css from '../../source/css/public_css';
  14. export default class change_nick_name extends Component {
  15. constructor(props) {
  16. super(props);
  17. this.state = {
  18. profiles: this.props.route.params.data.state.profiles,
  19. };
  20. }
  21. render() {
  22. return (
  23. <View style={public_css.body}>
  24. <View style={{flex: 1}}>
  25. <TextInput
  26. style={{
  27. fontSize: 16,
  28. marginTop: 5,
  29. borderBottomWidth: PixelRatio.get(),
  30. borderColor: 'rgb(208,208,208)',
  31. }}
  32. placeholder="请输入客户名称"
  33. clearButtonMode="while-editing"
  34. secureTextEntry={false}
  35. autoFocus={true}
  36. value={this.state.profiles}
  37. onChangeText={text => {
  38. this.setState({
  39. profiles: text,
  40. });
  41. }}
  42. multiline={true}
  43. numberOfLines={5}
  44. textAlignVertical={'top'}
  45. />
  46. </View>
  47. <View style={[public_css.bottomStaus]}>
  48. <TouchableOpacity
  49. style={[public_css.statusBtn, public_css.statusRBtn]}
  50. onPress={() => this.submitData()}>
  51. <Image
  52. source={require('../../source/img/productImg/confirm.png')}
  53. style={{width: 32, height: 32}}
  54. />
  55. <Text style={{color: '#fff'}}>确认</Text>
  56. </TouchableOpacity>
  57. </View>
  58. </View>
  59. );
  60. }
  61. //提交开票信息
  62. submitData = async () => {
  63. let account = await RetrieveData('account');
  64. let token = await RetrieveData('token');
  65. if (token && account) {
  66. account = account.substring(1, account.length - 1);
  67. token = token.substring(1, token.length - 1);
  68. const url = 'https://app.taxbk.cn:9443/auth/comm/user/personalInfo/save';
  69. let response = await GetDataPost(
  70. url,
  71. token,
  72. {
  73. mobile: account,
  74. personalProfile: this.state.profiles,
  75. reqChannel: 3,
  76. ip: '',
  77. },
  78. false,
  79. 1,
  80. );
  81. if (response) {
  82. if (response.code == 0) {
  83. ShowToast('修改成功!');
  84. await this.props.route.params.data.getUserInformation();
  85. this.props.navigation.goBack();
  86. }
  87. } else {
  88. ShowToast('服务器故障!');
  89. }
  90. }
  91. };
  92. }