1
|
import React, {Component } from 'react'
|
1
|
import React, {Component } from 'react'
|
2
|
import { Image ,View, StyleSheet, Text, Dimensions} from 'react-native';
|
2
|
import { Image ,View, StyleSheet, Text, Dimensions} from 'react-native';
|
|
|
3
|
+import Immutable, {Map} from 'immutable';
|
3
|
|
4
|
|
4
|
export default class RedPersonPicThree extends Component{
|
5
|
export default class RedPersonPicThree extends Component{
|
5
|
constructor(props) {
|
6
|
constructor(props) {
|
6
|
super(props);
|
7
|
super(props);
|
7
|
}
|
8
|
}
|
|
|
9
|
+
|
|
|
10
|
+ shouldComponentUpdate(nextProps){
|
|
|
11
|
+ if (Immutable.is(nextProps.resource, this.props.resource)) {
|
|
|
12
|
+ return false;
|
|
|
13
|
+ } else {
|
|
|
14
|
+ return true;
|
|
|
15
|
+ }
|
|
|
16
|
+ }
|
|
|
17
|
+
|
8
|
render() {
|
18
|
render() {
|
9
|
- let pic = {
|
|
|
10
|
- uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'
|
|
|
11
|
- };
|
|
|
12
|
- let type;
|
|
|
13
|
- switch (3) {
|
|
|
14
|
- case 1:
|
|
|
15
|
- return (
|
|
|
16
|
- <View style={styles.container}>
|
|
|
17
|
- <View style={styles.container1}>
|
|
|
18
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={styles.image}>
|
|
|
19
|
- <View style={styles.mask}>
|
|
|
20
|
- <Text numberOfLines={2} style={styles.titleText}>MADNESS22222222222</Text>
|
|
|
21
|
- <Text style={styles.price}>$ 299.0</Text>
|
|
|
22
|
- </View>
|
|
|
23
|
- </Image>
|
|
|
24
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={styles.image}>
|
|
|
25
|
- <View style={styles.mask}>
|
|
|
26
|
- <Text numberOfLines={2} style={styles.titleText}>MADNESS</Text>
|
|
|
27
|
- <Text style={styles.price}>$ 299.0</Text>
|
|
|
28
|
- </View>
|
|
|
29
|
- </Image>
|
|
|
30
|
|
19
|
|
31
|
- </View>
|
|
|
32
|
- <View style={styles.container1}>
|
|
|
33
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={styles.imageBig}>
|
|
|
34
|
- <View style={styles.mask}>
|
|
|
35
|
- <Text numberOfLines={2} style={styles.titleText}>MADNESS</Text>
|
|
|
36
|
- <Text style={styles.price}>$ 299.0</Text>
|
20
|
+ let {resource} = this.props;
|
|
|
21
|
+ if (!resource) {
|
|
|
22
|
+ return null;
|
|
|
23
|
+ }
|
|
|
24
|
+
|
|
|
25
|
+ let list = resource.get('module_data').get('data').toJS();
|
|
|
26
|
+ let properties = resource.get('module_data').get('properties').toJS();
|
|
|
27
|
+ let isModuleMargin = properties.isModuleMargin;
|
|
|
28
|
+ let displayType = properties.displayType;
|
|
|
29
|
+
|
|
|
30
|
+ let data1 = list?list[0]:null;
|
|
|
31
|
+ let backgroundImage1 = data1?data1.pic:'';
|
|
|
32
|
+ let linkType1 = data1.linkType;
|
|
|
33
|
+ let product1 = data1.product;
|
|
|
34
|
+ let salePrice1 = product1?parseFloat(product1.sales_price):0;
|
|
|
35
|
+ let originPrice1 = product1?parseFloat(product1.market_price):0;
|
|
|
36
|
+ let name1 = product1?product1.product_name:'';
|
|
|
37
|
+ let price1 = '¥' + salePrice1.toFixed(2);
|
|
|
38
|
+ let sale1 = '¥' + originPrice1.toFixed(2);
|
|
|
39
|
+ let saleAble1 = salePrice1>0?true:false;
|
|
|
40
|
+
|
|
|
41
|
+ let data2 = list?list[1]:null;
|
|
|
42
|
+ let backgroundImage2 = data2.pic;
|
|
|
43
|
+ let linkType2 = data2.linkType;
|
|
|
44
|
+ let product2 = data2.product;
|
|
|
45
|
+ let salePrice2 = product2?parseFloat(product2.sales_price):0;
|
|
|
46
|
+ let originPrice2 = product2?parseFloat(product2.market_price):0;
|
|
|
47
|
+ let name2 = product2?product2.product_name:'';
|
|
|
48
|
+ let price2 = '¥' + salePrice2.toFixed(2);
|
|
|
49
|
+ let sale2 = '¥' + originPrice2.toFixed(2);
|
|
|
50
|
+ let saleAble2 = salePrice2>0?true:false;
|
|
|
51
|
+
|
|
|
52
|
+ let data3 = list?list[2]:null;
|
|
|
53
|
+ let backgroundImage3 = data3.pic;
|
|
|
54
|
+ let linkType3 = data3.linkType;
|
|
|
55
|
+ let product3 = data3.product;
|
|
|
56
|
+ let salePrice3 = product3?parseFloat(product3.sales_price):0;
|
|
|
57
|
+ let originPrice3= product3?parseFloat(product3.market_price):0;
|
|
|
58
|
+ let name3 = product3?product3.product_name:'';
|
|
|
59
|
+ let price3 = '¥' + salePrice3.toFixed(2);
|
|
|
60
|
+ let sale3 = '¥' + originPrice3.toFixed(2);
|
|
|
61
|
+ let saleAble3 = salePrice3>0?true:false;
|
|
|
62
|
+
|
|
|
63
|
+ switch (displayType) {
|
|
|
64
|
+ case '1':
|
|
|
65
|
+ return (
|
|
|
66
|
+ <View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth4+nullHeigth:containerHeigth4,backgroundColor: 'white'}}>
|
|
|
67
|
+ <Image source={{uri: backgroundImage1}} style={styles.imagetype4}>
|
|
|
68
|
+ {saleAble1?<View style={styles.maskContainer4}>
|
|
|
69
|
+ <Text numberOfLines={1} style={styles.titleText4}>{name1}</Text>
|
|
|
70
|
+ <Text style={styles.price4}>{price1}</Text>
|
|
|
71
|
+ </View>:null}
|
|
|
72
|
+ </Image>
|
|
|
73
|
+ <Image source={{uri: backgroundImage2}} style={styles.imagetype4}>
|
|
|
74
|
+ {saleAble2?<View style={styles.maskContainer4}>
|
|
|
75
|
+ <Text numberOfLines={1} style={styles.titleText4}>{name2}</Text>
|
|
|
76
|
+ <Text style={styles.price4}>{price2}</Text>
|
|
|
77
|
+ </View>:null}
|
|
|
78
|
+ </Image>
|
|
|
79
|
+ <Image source={{uri: backgroundImage3}} style={styles.imagetype4}>
|
|
|
80
|
+ {saleAble3?<View style={styles.maskContainer4}>
|
|
|
81
|
+ <Text numberOfLines={1} style={styles.titleText4}>{name3}</Text>
|
|
|
82
|
+ <Text style={styles.price4}>{price3}</Text>
|
|
|
83
|
+ </View>:null}
|
|
|
84
|
+ </Image>
|
|
|
85
|
+ </View>
|
|
|
86
|
+ )
|
|
|
87
|
+ break;
|
|
|
88
|
+ case '2':
|
|
|
89
|
+ return (
|
|
|
90
|
+ <View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth3+nullHeigth:containerHeigth3,backgroundColor: 'white'}}>
|
|
|
91
|
+ <Image source={{uri: backgroundImage1}} style={styles.imagetype3}>
|
|
|
92
|
+ {saleAble1?<View style={styles.maskContainer3}>
|
|
|
93
|
+ <Text style={styles.price3}>{price1}</Text>
|
|
|
94
|
+ </View>:null}
|
|
|
95
|
+ </Image>
|
|
|
96
|
+ <Image source={{uri: backgroundImage2}} style={styles.imagetype3}>
|
|
|
97
|
+ {saleAble2?<View style={styles.maskContainer3}>
|
|
|
98
|
+ <Text style={styles.price3}>{price2}</Text>
|
|
|
99
|
+ </View>:null}
|
|
|
100
|
+ </Image>
|
|
|
101
|
+ <Image source={{uri: backgroundImage3}} style={styles.imagetype3}>
|
|
|
102
|
+ {saleAble3?<View style={styles.maskContainer3}>
|
|
|
103
|
+ <Text style={styles.price3}>{price3}</Text>
|
|
|
104
|
+ </View>:null}
|
|
|
105
|
+ </Image>
|
|
|
106
|
+ </View>
|
|
|
107
|
+ )
|
|
|
108
|
+ break;
|
|
|
109
|
+ case '3':
|
|
|
110
|
+ return (
|
|
|
111
|
+ <View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth+nullHeigth:containerHeigth,backgroundColor: 'white'}}>
|
|
|
112
|
+ <View style={styles.subContainer}>
|
|
|
113
|
+ <Image source={{uri: backgroundImage1}} style={styles.image}>
|
|
|
114
|
+ {saleAble1?<View style={styles.maskContainer1}>
|
|
|
115
|
+ <Text numberOfLines={2} style={styles.titleText}>{name1}</Text>
|
|
|
116
|
+ <Text style={styles.price}>{price1}</Text>
|
|
|
117
|
+ </View>:null}
|
|
|
118
|
+ </Image>
|
|
|
119
|
+ <Image source={{uri: backgroundImage2}} style={styles.image}>
|
|
|
120
|
+ {saleAble2?<View style={styles.maskContainer1}>
|
|
|
121
|
+ <Text numberOfLines={2} style={styles.titleText}>{name2}</Text>
|
|
|
122
|
+ <Text style={styles.price}>{price2}</Text>
|
|
|
123
|
+ </View>:null}
|
|
|
124
|
+ </Image>
|
37
|
</View>
|
125
|
</View>
|
38
|
- </Image>
|
|
|
39
|
- </View>
|
|
|
40
|
- </View>
|
|
|
41
|
- )
|
|
|
42
|
- break;
|
|
|
43
|
- case 2:
|
|
|
44
|
- return (
|
|
|
45
|
- <View style={styles.container}>
|
|
|
46
|
- <View style={styles.container1}>
|
|
|
47
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={styles.imageBig}>
|
|
|
48
|
- <View style={styles.mask}>
|
|
|
49
|
- <Text numberOfLines={2} style={styles.titleText}>MADNESS</Text>
|
|
|
50
|
- <Text style={styles.price}>$ 299.0</Text>
|
|
|
51
|
- </View>
|
126
|
+ <Image source={{uri: backgroundImage3}} style={styles.imageBig}>
|
|
|
127
|
+ {saleAble3?<View style={styles.maskContainer2}>
|
|
|
128
|
+ <Text numberOfLines={2} style={styles.titleText}>{name3}</Text>
|
|
|
129
|
+ <Text style={styles.price}>{price3}</Text>
|
|
|
130
|
+ </View>:null}
|
52
|
</Image>
|
131
|
</Image>
|
53
|
</View>
|
132
|
</View>
|
54
|
- <View style={styles.container1}>
|
|
|
55
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={styles.image}>
|
|
|
56
|
- <View style={styles.mask}>
|
|
|
57
|
- <Text numberOfLines={2} style={styles.titleText}>MADNESS22222222222</Text>
|
|
|
58
|
- <Text style={styles.price}>$ 299.0</Text>
|
|
|
59
|
- </View>
|
|
|
60
|
- </Image>
|
|
|
61
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={styles.image}>
|
|
|
62
|
- <View style={styles.mask}>
|
|
|
63
|
- <Text numberOfLines={2} style={styles.titleText}>MADNESS</Text>
|
|
|
64
|
- <Text style={styles.price}>$ 299.0</Text>
|
|
|
65
|
- </View>
|
|
|
66
|
- </Image>
|
133
|
+ )
|
|
|
134
|
+ break;
|
|
|
135
|
+ case '4':
|
|
|
136
|
+ return (
|
|
|
137
|
+ <View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth+nullHeigth:containerHeigth,backgroundColor: 'white'}}>
|
|
|
138
|
+ <View style={styles.subContainer}>
|
|
|
139
|
+ <Image source={{uri: backgroundImage1}} style={styles.imageBig}>
|
|
|
140
|
+ {saleAble1?<View style={styles.maskContainer2}>
|
|
|
141
|
+ <Text numberOfLines={2} style={styles.titleText}>{name1}</Text>
|
|
|
142
|
+ <Text style={styles.price}>{price1}</Text>
|
|
|
143
|
+ </View>:null}
|
|
|
144
|
+ </Image>
|
|
|
145
|
+ </View>
|
|
|
146
|
+ <View style={styles.subContainer}>
|
|
|
147
|
+ <Image source={{uri: backgroundImage2}} style={styles.image}>
|
|
|
148
|
+ {saleAble2?<View style={styles.maskContainer1}>
|
|
|
149
|
+ <Text numberOfLines={2} style={styles.titleText}>{name2}</Text>
|
|
|
150
|
+ <Text style={styles.price}>{price2}</Text>
|
|
|
151
|
+ </View>:null}
|
|
|
152
|
+ </Image>
|
|
|
153
|
+ <Image source={{uri: backgroundImage3}} style={styles.image}>
|
|
|
154
|
+ {saleAble3?<View style={styles.maskContainer1}>
|
|
|
155
|
+ <Text numberOfLines={2} style={styles.titleText}>{name3}</Text>
|
|
|
156
|
+ <Text style={styles.price}>{price3}</Text>
|
|
|
157
|
+ </View>:null}
|
|
|
158
|
+ </Image>
|
67
|
|
159
|
|
68
|
- </View>
|
|
|
69
|
- </View>
|
|
|
70
|
- )
|
|
|
71
|
- break;
|
|
|
72
|
- case 3:
|
|
|
73
|
- return (
|
|
|
74
|
- <View style={styles.container}>
|
|
|
75
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={{width:width/3 , height:containerHeigth * scale, justifyContent: 'flex-end'}}>
|
|
|
76
|
- <View style={styles.mask1}>
|
|
|
77
|
- <Text numberOfLines={2} style={styles.titleText1}>MADNESS</Text>
|
|
|
78
|
- <Text style={styles.titleText1}>$ 299.0</Text>
|
|
|
79
|
- </View>
|
|
|
80
|
- </Image>
|
|
|
81
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={{width:width/3 , height:containerHeigth * scale, justifyContent: 'flex-end'}}>
|
|
|
82
|
- <View style={styles.mask1}>
|
|
|
83
|
- <Text numberOfLines={1} style={styles.titleText1}>MADNESS22222222222</Text>
|
|
|
84
|
- <Text style={styles.titleText1}>$ 299.0</Text>
|
|
|
85
|
- </View>
|
|
|
86
|
- </Image>
|
|
|
87
|
- <Image source={require('../../../brandStore/image/coupons_l_r.png')} style={{width:width/3 , height:containerHeigth * scale, justifyContent: 'flex-end'}}>
|
|
|
88
|
- <View style={styles.mask1}>
|
|
|
89
|
- <Text numberOfLines={1} style={styles.titleText1}>MADNESS</Text>
|
|
|
90
|
- <Text style={styles.titleText1}>$ 299.0</Text>
|
|
|
91
|
- </View>
|
|
|
92
|
- </Image>
|
|
|
93
|
- </View>
|
|
|
94
|
- )
|
|
|
95
|
- break;
|
160
|
+ </View>
|
|
|
161
|
+ </View>
|
|
|
162
|
+ )
|
|
|
163
|
+ break;
|
96
|
default:
|
164
|
default:
|
|
|
165
|
+ return null;
|
97
|
}
|
166
|
}
|
98
|
}
|
167
|
}
|
99
|
}
|
168
|
}
|
100
|
|
169
|
|
101
|
let {width, height} = Dimensions.get('window');
|
170
|
let {width, height} = Dimensions.get('window');
|
102
|
-let containerHeigth = 234;
|
171
|
+let containerHeigth = Math.ceil((468/750)*width);
|
|
|
172
|
+let containerHeigth3 = Math.ceil(width/3);
|
|
|
173
|
+let containerHeigth4 = Math.ceil((333/750)*width);
|
103
|
let maskHeight = 30;
|
174
|
let maskHeight = 30;
|
104
|
-let scale = (width/375.0);
|
175
|
+let nullHeigth = 10;
|
105
|
|
176
|
|
106
|
let styles = StyleSheet.create({
|
177
|
let styles = StyleSheet.create({
|
107
|
- container:{
|
|
|
108
|
- flexDirection: 'row',
|
|
|
109
|
- width:width,
|
|
|
110
|
- height: containerHeigth * scale,
|
|
|
111
|
- },
|
|
|
112
|
- container1:{
|
|
|
113
|
- width:width / 2,
|
|
|
114
|
- flexDirection: 'column',
|
|
|
115
|
- },
|
|
|
116
|
- image:{
|
|
|
117
|
- height: containerHeigth * scale / 2,
|
|
|
118
|
- justifyContent: 'flex-end',
|
|
|
119
|
- },
|
|
|
120
|
- imageBig:{
|
|
|
121
|
- height: containerHeigth * scale,
|
|
|
122
|
- justifyContent: 'flex-end',
|
|
|
123
|
- },
|
|
|
124
|
- mask:{
|
|
|
125
|
- backgroundColor: 'black',
|
|
|
126
|
- opacity:0.3,
|
|
|
127
|
- height: maskHeight * scale,
|
|
|
128
|
- flexDirection: 'row',
|
|
|
129
|
- alignItems: 'center',
|
|
|
130
|
- // justifyContent: 'space-around',
|
|
|
131
|
- },
|
|
|
132
|
- mask1:{
|
|
|
133
|
- backgroundColor: 'black',
|
|
|
134
|
- opacity:0.3,
|
|
|
135
|
- height: maskHeight * scale,
|
|
|
136
|
- flexDirection: 'column',
|
|
|
137
|
- justifyContent: 'space-around',
|
|
|
138
|
- // alignItems: 'center',
|
|
|
139
|
- },
|
|
|
140
|
- titleText: {
|
|
|
141
|
- marginLeft: 10,
|
|
|
142
|
- color:'white',
|
|
|
143
|
- width : 80,
|
|
|
144
|
- fontSize: 12,
|
|
|
145
|
- textAlign :'left',
|
|
|
146
|
- },
|
|
|
147
|
- price: {
|
|
|
148
|
- // marginRight: 10,
|
|
|
149
|
- color:'white',
|
|
|
150
|
- width : 80,
|
|
|
151
|
- fontSize: 12,
|
|
|
152
|
- textAlign :'right',
|
|
|
153
|
- },
|
|
|
154
|
- titleText1: {
|
|
|
155
|
- width:width/3 ,
|
|
|
156
|
- height:maskHeight * scale / 2,
|
|
|
157
|
- color: 'white',
|
|
|
158
|
- marginLeft: 10,
|
|
|
159
|
- fontSize: 12,
|
|
|
160
|
- textAlign :'left',
|
|
|
161
|
- },
|
178
|
+ subContainer:{
|
|
|
179
|
+ width:width / 2,
|
|
|
180
|
+ flexDirection: 'column',
|
|
|
181
|
+ },
|
|
|
182
|
+ maskContainer1: {
|
|
|
183
|
+ width: width/2,
|
|
|
184
|
+ height: maskHeight,
|
|
|
185
|
+ backgroundColor: 'rgba(0,0,0,0.3)',
|
|
|
186
|
+ marginTop: containerHeigth/2-maskHeight,
|
|
|
187
|
+ flexDirection: 'row',
|
|
|
188
|
+ alignItems: 'center',
|
|
|
189
|
+ },
|
|
|
190
|
+ maskContainer2: {
|
|
|
191
|
+ width: width/2,
|
|
|
192
|
+ height: maskHeight,
|
|
|
193
|
+ backgroundColor: 'rgba(0,0,0,0.3)',
|
|
|
194
|
+ marginTop: containerHeigth-maskHeight,
|
|
|
195
|
+ flexDirection: 'row',
|
|
|
196
|
+ alignItems: 'center',
|
|
|
197
|
+ },
|
|
|
198
|
+ maskContainer3:{
|
|
|
199
|
+ width: width/3,
|
|
|
200
|
+ height: 24,
|
|
|
201
|
+ backgroundColor: 'rgba(0,0,0,0.3)',
|
|
|
202
|
+ marginTop: containerHeigth3-24,
|
|
|
203
|
+ flexDirection: 'row',
|
|
|
204
|
+ alignItems: 'center',
|
|
|
205
|
+ },
|
|
|
206
|
+ maskContainer4: {
|
|
|
207
|
+ width: width/3,
|
|
|
208
|
+ height: 40,
|
|
|
209
|
+ backgroundColor: 'rgba(0,0,0,0.3)',
|
|
|
210
|
+ marginTop: containerHeigth4-40,
|
|
|
211
|
+ },
|
|
|
212
|
+ imagetype3: {
|
|
|
213
|
+ width:width/3 ,
|
|
|
214
|
+ height:containerHeigth3,
|
|
|
215
|
+ },
|
|
|
216
|
+ imagetype4:{
|
|
|
217
|
+ width:width/3,
|
|
|
218
|
+ height:containerHeigth4,
|
|
|
219
|
+ },
|
|
|
220
|
+ image:{
|
|
|
221
|
+ width:width/2,
|
|
|
222
|
+ height: containerHeigth / 2,
|
|
|
223
|
+ },
|
|
|
224
|
+ imageBig:{
|
|
|
225
|
+ width:width/2,
|
|
|
226
|
+ height: containerHeigth,
|
|
|
227
|
+ },
|
|
|
228
|
+ titleText: {
|
|
|
229
|
+ marginLeft: 10,
|
|
|
230
|
+ color:'white',
|
|
|
231
|
+ width : 80,
|
|
|
232
|
+ fontSize: 12,
|
|
|
233
|
+ textAlign :'left',
|
|
|
234
|
+ },
|
|
|
235
|
+ price: {
|
|
|
236
|
+ color:'white',
|
|
|
237
|
+ width : 80,
|
|
|
238
|
+ fontSize: 12,
|
|
|
239
|
+ textAlign :'right',
|
|
|
240
|
+ },
|
|
|
241
|
+ price3: {
|
|
|
242
|
+ width:width/3 ,
|
|
|
243
|
+ height:maskHeight / 2,
|
|
|
244
|
+ color: 'white',
|
|
|
245
|
+ marginLeft: 10,
|
|
|
246
|
+ fontSize: 12,
|
|
|
247
|
+ textAlign :'left',
|
|
|
248
|
+ },
|
|
|
249
|
+ titleText4: {
|
|
|
250
|
+ width:width/3 ,
|
|
|
251
|
+ height:maskHeight / 2,
|
|
|
252
|
+ color: 'white',
|
|
|
253
|
+ marginLeft: 10,
|
|
|
254
|
+ fontSize: 12,
|
|
|
255
|
+ textAlign :'left',
|
|
|
256
|
+ marginTop: 4,
|
|
|
257
|
+ },
|
|
|
258
|
+ price4: {
|
|
|
259
|
+ width:width/3 ,
|
|
|
260
|
+ height:maskHeight / 2,
|
|
|
261
|
+ color: 'white',
|
|
|
262
|
+ marginLeft: 10,
|
|
|
263
|
+ fontSize: 12,
|
|
|
264
|
+ textAlign :'left',
|
|
|
265
|
+ marginTop: 2,
|
|
|
266
|
+ },
|
162
|
}); |
267
|
}); |