Ver código fonte

登录注册流程

杜鑫 4 anos atrás
pai
commit
8e27d1308d

+ 1 - 1
js/navigator/AppNavigators.js

@@ -194,7 +194,7 @@ const MainNavigator = createStackNavigator({
     },
 })
 export default createAppContainer(createSwitchNavigator({
-    // Init:InitNavigator,
+    Init:InitNavigator,
     Main: MainNavigator
 },
     {

+ 4 - 0
js/navigator/NavigationUtil.js

@@ -3,4 +3,8 @@ export default class NavigationUtil {
         const { navigation } = params;
         navigation.navigate("Main")
     }
+    static resetToLoginPage(params) {
+        const { navigation } = params;
+        navigation.navigate("Init")
+    }
 }

+ 13 - 8
js/page/LoginPage.js

@@ -3,6 +3,7 @@ import { StyleSheet, Text, View, TextInput } from "react-native"
 import EvilIcons from "react-native-vector-icons/EvilIcons"
 import { unitWidth, unitHeight, getStatusBarHeight } from "../utils/AdapterUtil";
 import MyButtom from '../component/MyButton'
+import NavigationUtil from "../navigator/NavigationUtil"
 
 export default class Loginpage extends Component {
 	state = {
@@ -10,13 +11,16 @@ export default class Loginpage extends Component {
 		pageStatus: 0,
 		btnText: "登录"
 	};
-	componentDidMount() {
-		this.timer = setTimeout(() => {
-			// NavigationUtil.resetToHomePage(this.props)
-		}, 5000)
+	tohome=()=>{
+		NavigationUtil.resetToHomePage(this.props)
 	}
-	componentWillMount() {
-		this.timer && clearTimeout(this.timer)
+	toRegister=()=>{
+		const { navigation } = this.props;
+		navigation.navigate("Register")
+	}
+	toForgetPassWord=()=>{
+		const { navigation } = this.props;
+		navigation.navigate("ForgetPassWord")
 	}
 	render() {
 		return (
@@ -53,11 +57,12 @@ export default class Loginpage extends Component {
 					</View>
 				</View>
 				<View style={styles.forgetPassArea}>
-					<Text>手机号注册登录</Text>
-					<Text>忘记密码</Text>
+					<Text onPress={this.toRegister}>手机号注册登录</Text>
+					<Text onPress={this.toForgetPassWord}>忘记密码</Text>
 				</View>
 				<View style={styles.bottomBtn}>
 					<MyButtom
+						onPress={this.tohome}
 						text={this.state.btnText}
 						width={unitWidth * 502}
 						height={unitHeight * 84}

+ 6 - 9
js/page/forgetPassWord.js

@@ -2,20 +2,16 @@ import React, { Component } from "react"
 import { StyleSheet, Text, View, TextInput } from "react-native"
 import { unitWidth, unitHeight, getStatusBarHeight } from "../utils/AdapterUtil";
 import MyButtom from '../component/MyButton'
+import NavigationUtil from "../navigator/NavigationUtil"
 
 export default class ForgetPassWord extends Component {
     state = {
         pageTitle: "忘记密码",
         btnText: "保存"
     };
-    componentDidMount() {
-        this.timer = setTimeout(() => {
-            // NavigationUtil.resetToHomePage(this.props)
-        }, 5000)
-    }
-    componentWillMount() {
-        this.timer && clearTimeout(this.timer)
-    }
+    toLogin=()=>{
+		NavigationUtil.resetToLoginPage(this.props)
+	}
     render() {
         return (
             <View style={styles.container}>
@@ -63,6 +59,7 @@ export default class ForgetPassWord extends Component {
                 </View>
                 <View style={styles.bottomBtn}>
                     <MyButtom
+                        onPress={this.toLogin}
                         text={this.state.btnText}
                         width={unitWidth * 502}
                         height={unitHeight * 84}
@@ -108,7 +105,7 @@ const styles = StyleSheet.create({
         borderWidth: unitWidth * 1,
         borderColor: "#ccc",
         flexDirection: "row",
-        marginTop:unitHeight * 40,
+        marginTop: unitHeight * 40,
     },
     inputLeft: {
         marginTop: unitHeight * 9,

+ 5 - 0
js/page/register.js

@@ -9,6 +9,10 @@ export default class Register extends Component {
         pageTitle: "手机号登录注册",
         btnText: "下一步"
     };
+    register1=()=>{
+        const { navigation } = this.props;
+		navigation.navigate("Register1")
+    }
     render() {
         return (
             <View style={styles.container}>
@@ -54,6 +58,7 @@ export default class Register extends Component {
                 </View>
                 <View style={styles.bottomBtn}>
                     <MyButtom
+                        onPress={this.register1}
                         text={this.state.btnText}
                         width={unitWidth * 502}
                         height={unitHeight * 84}

+ 5 - 0
js/page/register1.js

@@ -23,6 +23,10 @@ export default class Register1 extends Component {
         },
 
     };
+    register2=()=>{
+        const { navigation } = this.props;
+		navigation.navigate("Register2")
+    }
     render() {
         return (
             <View style={styles.container}>
@@ -98,6 +102,7 @@ export default class Register1 extends Component {
                 </View>
                 <View style={styles.bottomBtn}>
                     <MyButtom
+                        onPress={this.register2}
                         text={"下一步"}
                         width={unitWidth * 502}
                         height={unitHeight * 84}

+ 5 - 0
js/page/register2.js

@@ -13,6 +13,10 @@ export default class Register2 extends Component {
             color: '#333333',
         }
     };
+    register3 = () => {
+        const { navigation } = this.props;
+        navigation.navigate("Register3")
+    }
     render() {
         return (
             <View style={styles.container}>
@@ -169,6 +173,7 @@ export default class Register2 extends Component {
                 </View>
                 <View style={styles.bottomBtn}>
                     <MyButtom
+                        onPress={this.register3}
                         text={"下一步"}
                         width={unitWidth * 502}
                         height={unitHeight * 84}

+ 5 - 0
js/page/register3.js

@@ -2,8 +2,12 @@ import React, { Component } from "react"
 import { StyleSheet, Text, View, Image } from "react-native"
 import { unitWidth, unitHeight, getStatusBarHeight } from "../utils/AdapterUtil";
 import MyButtom from '../component/MyButton'
+import NavigationUtil from "../navigator/NavigationUtil"
 
 export default class Register3 extends Component {
+    toLogin=()=>{
+		NavigationUtil.resetToLoginPage(this.props)
+	}
     render() {
         return (
             <View style={styles.container}>
@@ -17,6 +21,7 @@ export default class Register3 extends Component {
                 <Text style={styles.subTitle}>优质的照片,异性缘提升8.7倍</Text>
                 <View style={styles.bottomBtn}>
                     <MyButtom
+                        onPress={this.toLogin}
                         text={"下一步"}
                         width={unitWidth * 502}
                         height={unitHeight * 84}