integralShop.js 2.82 KB
/**
 * Created by tdzl2003 on 12/18/16.
 */
import React, {Component, PropTypes} from "react";
import {
    Dimensions,
    Image,
    ScrollView,
    StyleSheet,
    Text,
    TouchableOpacity,
    View,
    Platform,
    StatusBar,
    NativeModules,
    WebView,
    ActivityIndicator
} from "react-native";
import {zoomW,zoomH} from '../../utils/getSize';
function isIphoneX() {
    let dimen = Dimensions.get('window');
    return (
        Platform.OS === 'ios' &&
        !Platform.isPad &&
        !Platform.isTVOS &&
        (dimen.height === 812 || dimen.width === 812)
    );
}
let documentJs = 'var expire=new Date((new Date()).getTime()+7*24*60*60);expire="; expires="+expire.toGMTString();document.cookie="jf-dt_MEMBER_PASSPORT_ID_production=#passportId#"+expire+\';domain=.xiniunet.com;path=/\';document.cookie="ebusiness-mb2c_MEMBER_PASSPORT_ID =#passportId#"+expire+\';domain=.xiniunet.com;path=/\';';
export default class integralShop extends Component {
    static navigationOptions = ({navigation}) => ({
        headerTitle:'积分商城',
        headerLeft:(
            <TouchableOpacity style={styles.backWrap} onPress={() => navigation.goBack()}>
                <Image source={require('../../img/back_gray.png')} resizeMode="contain" />
            </TouchableOpacity>
        ),
        headerRight:(
            <View></View>
        )
    });


    constructor(){
        super()
        this.state = {
            loading:true
        };
        documentJs = documentJs.replace('#passportId#', global.passport.id);
    }

    componentWillUnmount(){

    }

    componentDidMount(){


    }

    render(){

        return(
            <View style={styles.bg}>
                <StatusBar barStyle={'default'}/>
                <WebView

                    bounces={false}
                    style={{flex:1}}
                    source={{ uri:'http://jf-dt.xiniunet.com/mpoint/index.html'  }}
                    scalesPageToFit={true}
                    startInLoadingState={true}
                    injectedJavaScript={documentJs}
                    javaScriptEnabled={true}
                    domStorageEnabled={true}
                />
                {/*{this.state.loading && <View style={styles.loadingBg}>*/}
                    {/*<ActivityIndicator size="large" />*/}
                {/*</View>}*/}
            </View>
        )
    }
}
const styles = StyleSheet.create({
    backWrap: {
        justifyContent: 'center',
        paddingLeft: 18.5/zoomW,
        paddingRight: 18.5/zoomW,
        height: 44/zoomH,
    },
    back: {
        width: 8.5/zoomW,
        height: 15/zoomH,
    },
    bg:{
        flex:1,
        backgroundColor:'#f6f6f6',
    },
    loadingBg:{
        width:'100%',
        height:'100%',
        position:'absolute',
        display:'flex',
        alignItems:'center',
        justifyContent:'center'
    },
});