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 http_showcase from '../pages/services/showcase'; export default class Splash extends BasePage { state = { boothContent: { uri: '' } }; render() { return ( {this.state.boothContent.uri.length > 0 ? ( ) : null} ); } componentWillMount() { commonutil.getFileUserInfo().then((res) => { if (global.userInfo == undefined || global.userInfo == null) { this.getShowCase(); this.Advertisement(false); } else { console.log('===================================='); console.log('assfsafdasas', global.userInfo); console.log('===================================='); this.getShowCase(); this.Advertisement(true); } }); } getShowCase() { http_showcase.getSTARTING_UP_RECOMMEND().then((res) => { this.setState({ boothContent: { uri: res.data[0].boothContent } }); SplashScreen.hide(); }); } //获取用户之后的操作,或者是别的操作。 Advertisement(bool) { //假装3秒广告 setTimeout(() => { if (bool) { this.clearPageToNext('MainPage'); } else { this.clearPageToNext('Login'); } }, 5000); } }