integralShop.js
2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* 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'
},
});