WeChatPublic.js
2.54 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
'use strict';
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import {getSlicedUrl} from '../../../classify/utils/Utils';
const {
AppRegistry,
StyleSheet,
Text,
View,
Image,
ListView,
Dimensions,
TouchableOpacity,
} = ReactNative;
export default class WeChatPublic extends React.Component {
constructor(props) {
super(props);
}
render() {
let {resource} = this.props;
let data = resource?resource.toJS():null;
let wechatAtten = data?data.wechatAtten:'';
let wechatAttenSub = data?data.wechatAttenSub:'';
let wechatCopy = data?data.wechatCopy:'';
let error = data?data.error:'';
if (!data || error) {
return null;
}
return (
<View style={styles.container}>
<View style={{width: width,height: 15,backgroundColor: '#e5e5e5',}}/>
<View style={styles.subContainer}>
<Image style={styles.icon} source={require('../../image/wechart.png')}/>
<View style={styles.rightView}>
<Text style={styles.rightTitle} numberOfLines={1}>
{wechatAtten}
</Text>
<Text style={styles.rightDetail} numberOfLines={1}>
{wechatAttenSub}
</Text>
</View>
</View>
<TouchableOpacity style={styles.button} activeOpacity={0.5} onPress={() => {
this.props.onPressWeixin && this.props.onPressWeixin(wechatCopy);
}}>
<Text style={styles.buttonText} numberOfLines={1}>
复制
</Text>
</TouchableOpacity>
</View>
);
}
};
let {width, height} = Dimensions.get('window');
let backgroundHeight = 90;
let styles = StyleSheet.create({
container: {
width: width,
height: backgroundHeight,
backgroundColor: 'white',
},
subContainer: {
width: width,
height: backgroundHeight - 15,
backgroundColor: 'white',
flexDirection: 'row',
},
icon: {
width: 60,
height: 60,
backgroundColor: 'white',
marginTop: 10,
},
rightView: {
width: width - 60,
height: backgroundHeight,
backgroundColor: 'white',
},
rightTitle: {
width: width - 60 - 40,
fontSize: 14,
fontWeight: 'bold',
color: 'black',
backgroundColor: 'white',
marginTop: 17,
},
rightDetail: {
fontSize: 13,
color: 'gray',
backgroundColor: 'white',
marginTop: 10,
},
button: {
position: 'absolute',
right: 10,
top: 32,
width: 35,
height: 18,
backgroundColor: 'black',
justifyContent: 'center',
},
buttonText: {
fontSize: 13,
color: 'white',
textAlign: 'center',
}
});