index.js
7.44 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/**
* Created by Cassie on 2018/03/21
*/
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
Image,
TextInput,
Animated,
ActivityIndicator,
NativeModules,
NativeEventEmitter,
DeviceEventEmitter,
Alert,
Modal,
Platform,
AsyncStorage,
StatusBar,
Dimensions
} from 'react-native';
import moment from 'moment';
import {zoomW,zoomH} from '../../utils/getSize';
import {clock,xnToast,timeReduce,timePlus,timeEvery,getDay} from '../../utils/utils';
const StatusHeight = Platform.OS == 'ios' ?isIphoneX()?44+10/zoomH:20+10/zoomH:StatusBar.currentHeight;
export default class PersonCenter extends Component {
static navigationOptions = ({navigation}) => ({
header:null,
});
constructor(props){
super(props);
this.state = {
};
};
componentWillMount(){
};
componentDidMount(){
}
render(){
return (
<View style={styles.background}>
<StatusBar barStyle={'light-content'}/>
{/*顶部信息*/}
<View style={{width:375/zoomW,height:260/zoomH,alignItems:'center'}}>
<Image source={require('../../img/bg_image.png')} style={{width:'100%',height:'100%',position:'absolute', top:0, left:0}} resizeMode="cover" />
<Text style={{marginTop:StatusHeight,textAlign:"center",backgroundColor:'transparent',color:'white',fontSize:17,fontFamily:'PingFangSC-Medium'}}>个人中心</Text>
{/*头像*/}
<View style={{marginTop:27/zoomH,backgroundColor:'#efefef',borderRadius:4,padding:3/zoomW}}>
<Image defaultSource={require('../../img/defultIcon.png')} style={{width:74/zoomW,height:74/zoomW,}}></Image>
</View>
{/*昵称*/}
<Text style={{marginTop:13/zoomH,textAlign:"center",backgroundColor:'transparent',color:'#fcfcfc',fontSize:16,fontFamily:'PingFangSC-Regular'}}>{global.user.nickName?global.user.nickName:global.user.mobilePhone}</Text>
{/*等级|头衔*/}
<View style={{flexDirection:'row',justifyContent:'center',alignItems:'center'}}>
<Text style={{flex:1,textAlign:"right",marginRight:25/zoomW,backgroundColor:'transparent',color:'#fcfcfc'}}>等级:12</Text>
<View style={{width:1,height:14/zoomH,backgroundColor:'#f6f6f6'}} />
<Text style={{flex:1,textAlign:"left",marginLeft:25/zoomW,backgroundColor:'transparent',color:'#fcfcfc'}}>头衔:头衔名</Text>
</View>
<TouchableOpacity style={{width:20,height:20,position:'absolute',left:20,top:StatusHeight}} onPress={()=>this.props.navigation.goBack()}>
<Image style={{flex:1,width:18/zoomW,height:26/zoomH}} source={require('../../img/back.png')} resizeMode='contain'></Image>
</TouchableOpacity>
</View>
{/*个人信息*/}
<TouchableOpacity style={[styles.itemLine,{marginTop:16/zoomH}]} onPress={()=>this.props.navigation.navigate('Info')}>
<View style={{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'space-between'}}>
<Image source={require('../../img/personInfo.png')} resizeMode='contain'/>
<Text style={{flex:1,fontSize:16,color:'#5b5b5b',paddingLeft:28/zoomW}}>个人信息</Text>
<Image source={require('../../img/arrow_right.png')}/>
</View>
<View style={{height:1,backgroundColor:'#f6f6f6'}}></View>
</TouchableOpacity>
{/*我的消息*/}
<TouchableOpacity style={[styles.itemLine,{paddingLeft:13/zoomW,}]} onPress={()=>this.props.navigation.navigate('myMessage')}>
<View style={{flex:1,flexDirection:'row',alignItems:'center'}}>
<Image source={require('../../img/message.png')} resizeMode='contain'/>
<Text style={{flex:1,fontSize:16,color:'#5b5b5b',paddingLeft:26/zoomW}}>我的消息</Text>
<Image source={require('../../img/arrow_right.png')}/>
</View>
<View style={{height:1,backgroundColor:'#f6f6f6'}}></View>
</TouchableOpacity>
{/*我的贡献*/}
<TouchableOpacity style={[styles.itemLine,{paddingLeft:14/zoomW,}]}>
<View style={{flex:1,flexDirection:'row',alignItems:'center'}}>
<Image source={require('../../img/myContribution.png')} resizeMode='contain'/>
<Text style={{flex:1,fontSize:16,color:'#5b5b5b',paddingLeft:26/zoomW}}>我的贡献</Text>
<Image source={require('../../img/arrow_right.png')}/>
</View>
<View style={{height:1,backgroundColor:'#f6f6f6'}}></View>
</TouchableOpacity>
{/*智能机器人*/}
<TouchableOpacity style={[styles.itemLine]}>
<View style={{flex:1,flexDirection:'row',alignItems:'center'}}>
<Image source={require('../../img/robot.png')} resizeMode='contain'/>
<Text style={{flex:1,fontSize:16,color:'#5b5b5b',paddingLeft:28/zoomW}}>智能机器人</Text>
<Image source={require('../../img/arrow_right.png')}/>
</View>
<View style={{height:1,backgroundColor:'#f6f6f6'}}></View>
</TouchableOpacity>
{/*积分商城*/}
<TouchableOpacity style={[styles.itemLine]}>
<View style={{flex:1,flexDirection:'row',alignItems:'center'}}>
<Image source={require('../../img/robot.png')} resizeMode='contain'/>
<Text style={{flex:1,fontSize:16,color:'#5b5b5b',paddingLeft:28/zoomW}}>积分商城</Text>
<Image source={require('../../img/arrow_right.png')}/>
</View>
<View style={{height:1,backgroundColor:'#f6f6f6'}}></View>
</TouchableOpacity>
{/*关于我们*/}
<TouchableOpacity style={styles.itemLine}>
<View style={{flex:1,flexDirection:'row',alignItems:'center'}}>
<Image source={require('../../img/about.png')} resizeMode='contain'/>
<Text style={{flex:1,fontSize:16,color:'#5b5b5b',paddingLeft:30/zoomW}}>关于我们</Text>
<Image source={require('../../img/arrow_right.png')}/>
</View>
<View style={{height:1,backgroundColor:'#f6f6f6'}}></View>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
background:{
flex:1,
backgroundColor:'#f6f6f6',
display:'flex',
alignItems:'center',
},
itemLine:{
height:44/zoomH,
width:'100%',
backgroundColor:'white',
paddingLeft:15/zoomW,
paddingRight:15/zoomW
}
});
// 是否 isIphoneX
export function isIphoneX() {
const dimen = Dimensions.get('window');
return (
Platform.OS === 'ios' &&
!Platform.isPad &&
!Platform.isTVOS &&
(dimen.height === 812 || dimen.width === 812)
);
}