Prechádzať zdrojové kódy

1.增加模拟广告活动方法

zhangmengjie 5 rokov pred
rodič
commit
a6b44cc919
1 zmenil súbory, kde vykonal 19 pridanie a 10 odobranie
  1. 19 10
      pages/Splash.js

+ 19 - 10
pages/Splash.js

@@ -12,6 +12,10 @@ export default class Splash extends BasePage {
 		return (
 			<View style={{ flex: 1 }}>
 				<StatusBar backgroundColor={'transparent'} translucent={true} />
+				<View style={{ flex: 1 }} />
+				<View style={{ flex: 5 }}>
+					<Text style={{ fontSize: 30 }}>模拟活动广告。。。。</Text>
+				</View>
 			</View>
 		);
 	}
@@ -21,16 +25,7 @@ export default class Splash extends BasePage {
 		this.getUserInfo();
 	}
 
-	componentDidMount() {
-		setTimeout(() => {
-			SplashScreen.hide();
-			if (this.state.exist) {
-				this.clearPageToNext('MainPage');
-			} else {
-				this.clearPageToNext('Login');
-			}
-		}, 3000);
-	}
+	componentDidMount() {}
 
 	async getUserInfo() {
 		//判断是否有用户
@@ -39,11 +34,13 @@ export default class Splash extends BasePage {
 				key: 'userInfo'
 			})
 			.then((result) => {
+				SplashScreen.hide();
 				var usermap = commonutil.jsonToMap(result);
 				this.setState({
 					exist: true,
 					MainPageParams: usermap.get('ageGroup')
 				});
+				this.Advertisement();
 			})
 			.catch((err) => {
 				console.log(err.message);
@@ -62,4 +59,16 @@ export default class Splash extends BasePage {
 				}
 			});
 	}
+
+	//获取用户之后的操作,或者是别的操作。
+	Advertisement() {
+		//假装3秒广告
+		setTimeout(() => {
+			if (this.state.exist) {
+				this.clearPageToNext('MainPage');
+			} else {
+				this.clearPageToNext('Login');
+			}
+		}, 3000);
+	}
 }