Pārlūkot izejas kodu

修改广告跳转

Limengbo 5 gadi atpakaļ
vecāks
revīzija
52fdc01ec6
2 mainītis faili ar 198 papildinājumiem un 189 dzēšanām
  1. 121 122
      android/app/src/main/assets/index.android.bundle
  2. 77 67
      pages/Splash.js

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 121 - 122
android/app/src/main/assets/index.android.bundle


+ 77 - 67
pages/Splash.js

@@ -1,74 +1,84 @@
-import React, { PureComponent } from 'react';
-import { StyleSheet, Text, View, Image, TouchableOpacity, StatusBar, ToastAndroid, TextInput } from 'react-native';
-import BasePage from './BasePage';
-import SplashScreen from 'react-native-splash-screen';
-import commonutil from './utils/commonutil';
+import React, { PureComponent } from "react";
+import {
+  StyleSheet,
+  Text,
+  View,
+  Image,
+  TouchableOpacity,
+  StatusBar,
+  ToastAndroid,
+  TextInput
+} from "react-native";
+import BasePage from "./BasePage";
+import SplashScreen from "react-native-splash-screen";
+import commonutil from "./utils/commonutil";
 export default class Splash extends BasePage {
-	state = {
-		exist: false,
-		MainPageParams: ''
-	};
-	render() {
-		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>
-		);
-	}
+  state = {
+    exist: false,
+    MainPageParams: ""
+  };
+  render() {
+    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>
+    );
+  }
 
-	componentWillMount() {
-		// global.storage.remove({ key: 'userInfo' });
-		this.getUserInfo();
-	}
+  componentWillMount() {
+    // global.storage.remove({ key: 'userInfo' });
+    this.getUserInfo();
+  }
 
-	componentDidMount() {}
+  componentDidMount() {}
 
-	async getUserInfo() {
-		//判断是否有用户
-		await global.storage
-			.load({
-				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);
-				switch (err.name) {
-					case 'NotFoundError':
-						// TODO;
-						// alert('NotFoundError');
-						this.setState({
-							exist: false
+  async getUserInfo() {
+    //判断是否有用户
+    await global.storage
+      .load({
+        key: "userInfo"
+      })
+      .then(result => {
+     
+        var usermap = commonutil.jsonToMap(result);
+        this.setState({
+          exist: true,
+          MainPageParams: usermap.get("ageGroup")
+        });
+      })
+      .catch(err => {
+        console.log(err.message);
+        switch (err.name) {
+          case "NotFoundError":
+            // TODO;
+            // alert('NotFoundError');
+            this.setState({
+              exist: false
 						});
-						break;
-					case 'ExpiredError':
-						// TODO
-						// alert('ExpiredError');
-						break;
-				}
-			});
-	}
+						SplashScreen.hide();
+            this.Advertisement();
+            break;
+          case "ExpiredError":
+            // TODO
+            // alert('ExpiredError');
+            break;
+        }
+      });
+  }
 
-	//获取用户之后的操作,或者是别的操作。
-	Advertisement() {
-		//假装3秒广告
-		setTimeout(() => {
-			if (this.state.exist) {
-				this.clearPageToNext('MainPage');
-			} else {
-				this.clearPageToNext('Login');
-			}
-		}, 3000);
-	}
+  //获取用户之后的操作,或者是别的操作。
+  Advertisement() {
+    //假装3秒广告
+    setTimeout(() => {
+      if (this.state.exist) {
+        this.clearPageToNext("MainPage");
+      } else {
+        this.clearPageToNext("Login");
+      }
+    }, 3000);
+  }
 }