import React, { Component } from 'react' import { StyleSheet, ScrollView, View, Image, ImageBackground, Text, TextInput, Dimensions, StatusBar, TouchableOpacity, PixelRatio, } from 'react-native' import { connect } from 'react-redux' import loginButton from '../static/images/login-button.png' import Icon from '../components/Iconfont/Iconfont' import { NavigationActions, createAction } from '../utils' import { HeaderView } from './common/HeaderView' import Toast from 'react-native-root-toast' const { width, height } = Dimensions.get('window') @connect(({ theme }) => ({ ...theme })) class LogForget extends Component { constructor(props) { super(props) this.state = { phoneNumber: '', secureEntry: true, zhColor: '#EEE', mmColor: '#EEE', newpassWord: '', confirmPassWord: '', newPwLength: false, comfirmPwLength: false, } // console.disableYellowBox = true; } render() { const { appTheme } = this.props // 修改密码 if ( this.props.navigation.state.params && this.props.navigation.state.params.comefrom == 'modify' ) { return ( {HeaderView(this.props.dispatch, '修改默认密码')} 新密码: this.setState({ zhColor: '#E70013' })} onBlur={e => { if ( this.state.newpassWord && this.state.newpassWord.length < 6 ) { this.setState({ newPwLength: true, newpassWord: '' }) clearTimeout(this.newSettime) this.newSettime = setTimeout(() => { this.setState({ newPwLength: false }) }, 3000) } this.setState({ zhColor: '#EEE' }) }} underlineColorAndroid={'transparent'} clearButtonMode="while-editing" secureTextEntry={this.state.secureEntry} onChangeText={text => this.setState({ newpassWord: text })} value={this.state.newpassWord} multiline={false} // onSubmitEditing={() => this._searchindex()} placeholder={'请输入密码'} placeholderTextColor={'#CCC'} /> {this.state.newpassWord ? ( this.setState({ secureEntry: !this.state.secureEntry }) } style={{ paddingTop: 6, marginLeft: 3, }} > {this.state.secureEntry ? ( ) : ( )} ) : null} {this.state.newPwLength ? ( 输入长度不能小于6位 ) : null} 确认密码: this.setState({ mmColor: '#E70013' })} onBlur={e => { if ( this.state.confirmPassWord && this.state.confirmPassWord.length < 6 ) { this.setState({ comfirmPwLength: true, confirmPassWord: '' }) clearTimeout(this.settime) this.settime = setTimeout(() => { this.setState({ comfirmPwLength: false }) }, 3000) } this.setState({ mmColor: '#EEE' }) }} underlineColorAndroid={'transparent'} clearButtonMode="while-editing" secureTextEntry={this.state.secureEntry} onChangeText={text => this.setState({ confirmPassWord: text })} value={this.state.confirmPassWord} multiline={false} // onSubmitEditing={() => this._searchindex()} placeholder={'请输入密码'} placeholderTextColor={'#CCC'} /> {this.state.confirmPassWord ? ( this.setState({ secureEntry: !this.state.secureEntry }) } style={{ paddingTop: 6, marginLeft: 3, }} > {this.state.secureEntry ? ( ) : ( )} ) : null} {this.state.comfirmPwLength ? ( 输入长度不能小于6位 ) : null} { if (this.toast) { Toast.hide(this.toast) } if (this.state.newpassWord && this.state.confirmPassWord) { if (this.state.newpassWord == this.state.confirmPassWord) { this.props.dispatch( createAction('app/modifyPw')({ newpassWord: this.state.newpassWord, confirmPassWord: this.state.confirmPassWord, username: this.props.navigation.state.params.username, }) ) } else { this.toast = Toast.show('两次输入不一致', { position: toastHeight, }) this.setState({ newpassWord: '', confirmPassWord: '' }) } } else { this.toast = Toast.show('密码不能为空', { position: toastHeight, }) } }} > 修改密码 ) } else { // 忘记密码 return ( {HeaderView(this.props.dispatch, '忘记密码')} this.setState({ phoneNumber: text })} value={this.state.phoneNumber} multiline={false} // onSubmitEditing={() => this._searchindex()} placeholder={'请输入手机号'} placeholderTextColor={'#CCC'} /> alert('找回密码')}> 找回密码 ) } } } const styles = StyleSheet.create({ container: { flex: 1, }, }) export default LogForget