InterestActivityCell.js
3.09 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
'use strict';
import React, {Component} from 'react';
import ReactNative, {
View,
Text,
Image,
ListView,
StyleSheet,
Dimensions,
Platform,
TouchableOpacity,
} from 'react-native';
import {List} from 'immutable';
import SlicedImage from '../../../common/components/SlicedImage';
import InterestHeader from './InterestHeader';
import DeleteLineText from '../../../common/components/DeleteLineText';
export default class InterestActivityCell extends Component {
constructor(props) {
super(props);
}
render() {
let {data, rowID} = this.props;
let title = data.get('activity_name', '');
let images = data.get('img', List()).toJS().slice(0, 1);
let url = '';
let jumpUrl = '';
if (images.length > 0) {
url = SlicedImage.getSlicedUrl(images[0].src, width * 2, imageHeight * 2, 2);
jumpUrl = images[0].url;
}
let pageName = 'iFP_CategoryConcern';
if (Platform.OS === 'android') {
pageName = 'aFP_CategoryConcern';
}
let params = {
P_NAME : pageName,
F_INDEX : parseInt(rowID)+1+'',
I_INDEX : '2',
ACTION_URL : jumpUrl,
exposureEnd : 1,
};
let paramFirst = {
P_NAME : pageName,
F_INDEX : parseInt(rowID)+1+'',
I_INDEX : '1',
exposureEnd : 1,
};
return (
<View style={styles.container}>
<InterestHeader
yh_exposureData={paramFirst}
data={data}
rowID={rowID}
onInterestLike={this.props.onInterestLike}
onPressBrand={this.props.onPressBrand}
/>
<TouchableOpacity
yh_exposureData={params}
activeOpacity={1}
onPress={() => {
this.props.onPressActivity && this.props.onPressActivity(jumpUrl, rowID);
}}
>
<View style={styles.products}>
<Image style={styles.image} source={{uri: url}} />
<Text style={styles.title} numberOfLines={1}>{title}</Text>
</View>
</TouchableOpacity>
<View style={styles.bottomView} />
</View>
);
}
}
let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let imageHeight = 100 * DEVICE_WIDTH_RATIO;
let rowWidth = width;
let styles = StyleSheet.create({
container: {
width: rowWidth,
backgroundColor: '#f0f0f0',
},
products: {
flexDirection: 'column',
},
image: {
width: width,
height: imageHeight,
},
title: {
fontSize: 12,
fontWeight: 'bold',
marginLeft: 15 * DEVICE_WIDTH_RATIO,
marginRight: 15 * DEVICE_WIDTH_RATIO,
marginTop: 4,
height: 20,
},
bottomView: {
width,
height: 10,
backgroundColor: '#f0f0f0',
},
});