ItemHeaderInfo.js
3.94 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
import React, {Component} from "react";
import {Image, StyleSheet, Text, TouchableOpacity, View} from "react-native";
import _ from "lodash";
import {dateToMsgTime,NoDoublePress} from "../../../utils/utils";
import StashHead from '../../../widget/StashHead';
import { height, width,zoomW,zoomH } from "../../../utils/getSize";
import {scaleHeight, scaleSize, setSpText} from "../../../utils/ScreenUtil";
//图片资源
const defaultIcon = require("../../../img/defaultIcon.png");
/**
* 图集列表item 中个人信息部分
* 调用者需要传入的参数 personInfoData : 个人信息数据源
*/
export default class itemHeaderInfo extends Component {
// 构造
constructor(props) {
super(props);
}
//点击事件,跳到个人详情
_onPress() {
NoDoublePress.onPress(()=>{
let id = this.props.item.user.id;
if (id == global.userId) {
//自己
this.props.nav.navigate("MyPage", { id: id });
return;
}
this.props.nav.navigate("PersonalHomePage", { userId: id });
})
}
//个人信息
render() {
let identifyTypeNames = this.state.userInfo.identifyTypeNames?(this.state.userInfo.identifyTypeNames!=''?
this.state.userInfo.identifyTypeNames.replace(/\,/g,' '):global.defaultInentifyTypeName):
global.defaultInentifyTypeName;
return (
<View
style={{
width: "100%",
flexDirection: "row",
alignItems: "center",
paddingLeft: scaleSize(15),
marginTop: scaleHeight(17)
}}
>
<TouchableOpacity
onPress={() => {
this._onPress();
}}
>
<Image
style={styles.avatar}
source={
this.props.item.user.avatar &&
!!!_.isEmpty(this.props.item.user.avatar) &&
this.props.item.user.avatar.indexOf("http") != -1
? { uri: this.props.item.user.avatar }
: defaultIcon
}
resizeMode="cover"
/>
</TouchableOpacity>
<View
style={{
width: "100%",
flex: 1,
display: "flex",
marginLeft: 8/zoomW
}}
>
<View
style={{
width: "100%",
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center"
}}
>
<View>
<Text style={styles.userNameBlack} numberOfLines={1}>
{this.props.item.user.name}
</Text>
<View
style={{ flex: 1, flexDirection: "row", alignItems: "center" }}
>
{this.props.item.isBoardTop ? (
<StashHead />
) : null}
<Text style={{ fontSize: setSpText(12), color: 'rgba(0,0,0,0.45)' }}>
{dateToMsgTime(this.props.item.creationTime)}
</Text>
<View
style={{
height: 2,
width: 2,
borderRadius: 1,
backgroundColor: "rgba(0,0,0,0.45)",
opacity: 0.55,
marginLeft: 5,
marginRight: 5
}}
/>
<Text style={{ fontSize: setSpText(12), color: 'rgba(0,0,0,0.45)' }}>
{this.props.item.user.isAuthented ? identifyTypeNames : "未认证"}
</Text>
</View>
</View>
</View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
avatar: {
width: scaleHeight(36),
height: scaleHeight(36),
borderRadius: scaleHeight(18)
},
userNameBlack: {
flex: 1,
fontSize: setSpText(14),
color: 'rgba(0,0,0,0.85)',
},
time: {
fontSize: setSpText(12),
color: 'rgba(0,0,0,0.45)',
}
});