Commit 15e67e1a by wong.peiyi

登录页面增加查看密码功能

parent db3475ca
...@@ -8,7 +8,8 @@ import { ...@@ -8,7 +8,8 @@ import {
Image, Image,
TextInput, TextInput,
TouchableOpacity, TouchableOpacity,
NativeModules NativeModules,
TouchableWithoutFeedback
} from 'react-native'; } from 'react-native';
import {connect} from "react-redux"; import {connect} from "react-redux";
import { import {
...@@ -42,6 +43,8 @@ class LoginPage extends Component{ ...@@ -42,6 +43,8 @@ class LoginPage extends Component{
this.state = { this.state = {
username: '', // shi.ming gao.xiaoming username: '', // shi.ming gao.xiaoming
password: '', // sfrx2019 password: '', // sfrx2019
showPassword: false,
focuOnPw: false,
subTit: '登录', subTit: '登录',
subTitList: ['登录', '登录中...'], subTitList: ['登录', '登录中...'],
isSubLoding: false, isSubLoding: false,
...@@ -244,7 +247,7 @@ class LoginPage extends Component{ ...@@ -244,7 +247,7 @@ class LoginPage extends Component{
} }
render() { render() {
let {username, password, isSubLoding, subTit, isShowDomain, version_apk, isEnterHomeFlag} = this.state let {username, password, isSubLoding, subTit, isShowDomain, version_apk, isEnterHomeFlag, showPassword, focuOnPw} = this.state
let {global_domain_config} = this.props let {global_domain_config} = this.props
let tempInd = global_domain_config.indexOf('/') + 2 let tempInd = global_domain_config.indexOf('/') + 2
let tempGlobalDomain = global_domain_config.slice(tempInd) let tempGlobalDomain = global_domain_config.slice(tempInd)
...@@ -284,13 +287,26 @@ class LoginPage extends Component{ ...@@ -284,13 +287,26 @@ class LoginPage extends Component{
autoCapitalize='none' autoCapitalize='none'
placeholder="请输入您的密码" placeholder="请输入您的密码"
placeholderTextColor={placehold_text_color} placeholderTextColor={placehold_text_color}
secureTextEntry={true}
returnKeyType="done" returnKeyType="done"
style={styles.row_input} style={styles.row_input}
defaultValue={password} defaultValue={password}
secureTextEntry={!showPassword}
clearButtonMode="while-editing" clearButtonMode="while-editing"
onChangeText={(text) => this.handlePassword(text)} onChangeText={(text) => this.handlePassword(text)}
onFocus={() => this.setState({focuOnPw: true})}
onBlur={() => this.setState({focuOnPw: false})}
/> />
{!!password && focuOnPw &&
<TouchableWithoutFeedback
onPress={() => this.setState({showPassword: !showPassword})}
style={styles.view_password_btn}
>
<Image
source={require('../../images/eye.png')}
style={styles.view_password}
/>
</TouchableWithoutFeedback>
}
</View> </View>
</View> </View>
<View style={styles.cont_footer}> <View style={styles.cont_footer}>
...@@ -396,7 +412,8 @@ const styles = StyleSheet.create({ ...@@ -396,7 +412,8 @@ const styles = StyleSheet.create({
backgroundColor: '#EFEFEF', backgroundColor: '#EFEFEF',
marginBottom: '8%', marginBottom: '8%',
borderRadius: 20, borderRadius: 20,
paddingLeft: 10 paddingLeft: 10,
position: 'relative'
}, },
input_plholdco: { input_plholdco: {
color: '#919191' color: '#919191'
...@@ -404,7 +421,7 @@ const styles = StyleSheet.create({ ...@@ -404,7 +421,7 @@ const styles = StyleSheet.create({
row_input: { row_input: {
fontSize: third_text_size, fontSize: third_text_size,
height: 38, height: 38,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
cont_footer: { cont_footer: {
justifyContent: 'flex-end', justifyContent: 'flex-end',
...@@ -465,6 +482,13 @@ const styles = StyleSheet.create({ ...@@ -465,6 +482,13 @@ const styles = StyleSheet.create({
width: '100%', width: '100%',
height: '100%' height: '100%'
}, },
view_password: {
position: 'absolute',
right: pxSize(25),
top: 10,
width: 18,
height: 18,
}
}) })
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Release" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment