Browse Source

1.修改TextInput样式
2.修改个人信息,个人中心物理返回不改变用户信息

zhangmengjie 5 years ago
parent
commit
c824db7b34
5 changed files with 43 additions and 26 deletions
  1. 9 6
      pages/Login.js
  2. 2 0
      pages/PersonalInfo.js
  3. 18 17
      pages/PhoneBind.js
  4. 3 1
      pages/Splash.js
  5. 11 2
      pages/userCenter.js

+ 9 - 6
pages/Login.js

@@ -43,12 +43,14 @@ export default class Login extends BasePage {
 					<View style={styles.signNumberBox}>
 						<Text style={styles.phoneNumber}>验证码</Text>
 						<View style={styles.signNumberLine2}>
-							<TextInput
-								style={styles.signText}
-								onChangeText={(text) => this.setState({ verification_code: text })}
-								value={this.state.verification_code}
-								placeholder={'请输入验证码'}
-							/>
+							<View style={styles.signText}>
+								<TextInput
+									style={{ marginLeft: 20, width: '100%', height: '100%' }}
+									onChangeText={(text) => this.setState({ verification_code: text })}
+									value={this.state.verification_code}
+									placeholder={'请输入验证码'}
+								/>
+							</View>
 							<TouchableOpacity onPress={this.getVerification.bind(this)}>
 								<Text style={styles.getSign}> {this.state.verification_text}</Text>
 							</TouchableOpacity>
@@ -308,6 +310,7 @@ const styles = StyleSheet.create({
 		width: '54%',
 		height: Dimensions.getHeight(50),
 		backgroundColor: '#f3f3f3',
+		borderRadius: 25,
 		marginRight: 9
 	},
 	getSign: {

+ 2 - 0
pages/PersonalInfo.js

@@ -752,6 +752,7 @@ export default class PersonalInfo extends BasePage {
 				show_bind_phone: false
 			});
 		} else {
+			DeviceEventEmitter.emit('infoback');
 			this.goBack();
 		}
 		return true;
@@ -984,6 +985,7 @@ export default class PersonalInfo extends BasePage {
 					photo_uri: { uri: res.data }
 				});
 				this.updateUserInfo({ avatar: res.data });
+				this.Toast('上传成功');
 			} else {
 				this.Toast('上传失败:' + res.message);
 			}

+ 18 - 17
pages/PhoneBind.js

@@ -53,24 +53,28 @@ export default class PhoneBind extends BasePage {
 					</View>
 					<View style={styles.phoneNumberBox}>
 						<Text style={styles.phoneNumber}>手机号</Text>
-						<TextInput
-							style={styles.phoneText}
-							maxLength={11}
-							onChangeText={(text) => this.setState({ phone_num: text })}
-							value={this.state.phone_num}
-							placeholder={'请输入手机号'}
-						/>
+						<View style={styles.phoneText}>
+							<TextInput
+								style={{ marginLeft: 20, width: '100%', height: '100%' }}
+								maxLength={11}
+								onChangeText={(text) => this.setState({ phone_num: text })}
+								value={this.state.phone_num}
+								placeholder={'请输入手机号'}
+							/>
+						</View>
 					</View>
 					<View style={styles.signNumberBox}>
 						<Text style={styles.phoneNumber}>验证码</Text>
 						<View style={styles.signNumberLine2}>
-							<TextInput
-								style={styles.signText}
-								maxLength={4}
-								onChangeText={(text) => this.setState({ verification_code: text })}
-								value={this.state.verification_code}
-								placeholder={'请输入验证码'}
-							/>
+							<View style={styles.signText}>
+								<TextInput
+									style={{ marginLeft: 20, width: '100%', height: '100%' }}
+									maxLength={4}
+									onChangeText={(text) => this.setState({ verification_code: text })}
+									value={this.state.verification_code}
+									placeholder={'请输入验证码'}
+								/>
+							</View>
 							<TouchableOpacity>
 								<Text style={styles.getSign} onPress={this.getVerification.bind(this)}>
 									{this.state.verification_text}
@@ -133,9 +137,6 @@ export default class PhoneBind extends BasePage {
 						ToastAndroid.show(result.message, ToastAndroid.SHORT);
 						return;
 					} else {
-						console.log('====================================');
-						console.log(result.data);
-						console.log('====================================');
 						this.setState({
 							http_verification_code: result.data
 						});

+ 3 - 1
pages/Splash.js

@@ -14,7 +14,9 @@ export default class Splash extends BasePage {
 		return (
 			<View style={{ flex: 1 }}>
 				<StatusBar backgroundColor={'transparent'} translucent={true} />
-				<Image source={this.state.boothContent} style={{ width: '100%', height: '100%' }} />
+				{this.state.boothContent.uri.length > 0 ? (
+					<Image source={this.state.boothContent} style={{ width: '100%', height: '100%' }} />
+				) : null}
 			</View>
 		);
 	}

+ 11 - 2
pages/userCenter.js

@@ -15,7 +15,8 @@ import {
 	Modal,
 	TouchableHighlight,
 	DeviceEventEmitter,
-	ScrollView
+	ScrollView,
+	BackHandler
 } from 'react-native';
 import BasePage from './BasePage';
 import Dimensions from './utils/dimensions';
@@ -50,6 +51,7 @@ export default class userCenter extends BasePage {
 				});
 			});
 		});
+		BackHandler.addEventListener('hardwareBackPress', this.onBackAndroid);
 		DeviceEventEmitter.emit('infoback');
 	}
 	componentWillUnmount() {
@@ -93,7 +95,7 @@ export default class userCenter extends BasePage {
 		],
 		discount: {
 			title: '限时秒杀',
-			icon: { uri: '' }
+			icon: { uri: 'null' }
 		},
 		favoritesList: [],
 		playLogList: [],
@@ -215,6 +217,13 @@ export default class userCenter extends BasePage {
 			this.toNextPage(index);
 		}
 	}
+	componentWillUnmount() {
+		BackHandler.removeEventListener('hardwareBackPress', this.onBackAndroid);
+	}
+	onBackAndroid = () => {
+		this.goBack();
+		return true;
+	};
 }
 
 const styles = StyleSheet.create({