12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import React, {Component} from 'react';
- import {
- View,
- Text,
- TextInput,
- TouchableOpacity,
- Image,
- PixelRatio,
- } from 'react-native';
- import {ShowToast} from '../../components/rootToast/root_toast';
- import {GetDataPost} from '../../data/encryption';
- import {RetrieveData} from '../../data/storage';
- import public_css from '../../source/css/public_css';
- export default class change_nick_name extends Component {
- constructor(props) {
- super(props);
- this.state = {
- nickName: this.props.route.params.data.state.nickName,
- };
- }
- render() {
- return (
- <View style={public_css.body}>
- <View style={{flex: 1}}>
- <TextInput
- style={{
- fontSize: 16,
- marginTop: 5,
- height: 40,
- borderBottomWidth: PixelRatio.get(),
- borderColor: 'rgb(208,208,208)',
- }}
- placeholder="请输入客户名称"
- clearButtonMode="while-editing"
- secureTextEntry={false}
- autoFocus={true}
- value={this.state.nickName}
- onChangeText={text => {
- this.setState({
- nickName: text,
- });
- }}
- />
- </View>
- <View style={[public_css.bottomStaus]}>
- <TouchableOpacity
- style={[public_css.statusBtn, public_css.statusRBtn]}
- onPress={() => this.submitData()}>
- <Image
- source={require('../../source/img/productImg/confirm.png')}
- style={{width: 32, height: 32}}
- />
- <Text style={{color: '#fff'}}>确认</Text>
- </TouchableOpacity>
- </View>
- </View>
- );
- }
- //提交信息
- submitData = async () => {
- let account = await RetrieveData('account');
- let token = await RetrieveData('token');
- if (token && account) {
- account = account.substring(1, account.length - 1);
- token = token.substring(1, token.length - 1);
- const url = 'https://app.taxbk.cn:9443/auth/comm/user/personalInfo/save';
- let response = await GetDataPost(
- url,
- token,
- {
- mobile: account,
- nickName: this.state.nickName,
- reqChannel: 3,
- ip: '',
- },
- false,
- 1,
- );
- if (response) {
- if (response.code == 0) {
- ShowToast('修改成功!');
- await this.props.route.params.data.getUserInformation();
- this.props.navigation.goBack();
- }
- } else {
- ShowToast('服务器故障!');
- }
- }
- };
- }
|