修复秒杀bug 与UI review by chenlin
Showing
10 changed files
with
101 additions
and
126 deletions
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | import React, {Component} from "react"; | 3 | import React, {Component} from "react"; |
4 | import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity} from "react-native"; | 4 | import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity} from "react-native"; |
5 | import SlicedImage from "../../../common/components/SlicedImage"; | 5 | import SlicedImage from "../../../common/components/SlicedImage"; |
6 | -import DeleteLineText from "../../../common/components/DeleteLineText"; | ||
7 | 6 | ||
8 | 7 | ||
9 | export default class ProductListView extends Component { | 8 | export default class ProductListView extends Component { |
@@ -26,7 +25,7 @@ export default class ProductListView extends Component { | @@ -26,7 +25,7 @@ export default class ProductListView extends Component { | ||
26 | let tipState = ''; | 25 | let tipState = ''; |
27 | let btnBgColor = '#d30018'; | 26 | let btnBgColor = '#d30018'; |
28 | let btnTextcolor = 'white'; | 27 | let btnTextcolor = 'white'; |
29 | - let url = rowData.url; | 28 | + let url = rowData.shopUrl; |
30 | if (rowData.over) { | 29 | if (rowData.over) { |
31 | tipState = '已抢光'; | 30 | tipState = '已抢光'; |
32 | btnBgColor = '#b2b2b2'; | 31 | btnBgColor = '#b2b2b2'; |
@@ -47,64 +46,48 @@ export default class ProductListView extends Component { | @@ -47,64 +46,48 @@ export default class ProductListView extends Component { | ||
47 | this.props.onPressProductItem && this.props.onPressProductItem(rowData); | 46 | this.props.onPressProductItem && this.props.onPressProductItem(rowData); |
48 | }}> | 47 | }}> |
49 | <View style={styles.rowContainer}> | 48 | <View style={styles.rowContainer}> |
50 | - <View style = { | ||
51 | - styles.leftImage | ||
52 | - } > | ||
53 | - <Image style={ | ||
54 | - { | ||
55 | - flex: 1, | ||
56 | - } | ||
57 | - } | ||
58 | - source={ | ||
59 | - { | ||
60 | - uri: brandIconUrl | ||
61 | - } | ||
62 | - }/> | 49 | + <View style={styles.leftImage}> |
50 | + <Image style={{flex: 1,}} | ||
51 | + source={{uri: brandIconUrl}}/> | ||
63 | {tipState == '已抢光' ? | 52 | {tipState == '已抢光' ? |
64 | - <View style={ | ||
65 | - [styles.imageBottomTag, { | ||
66 | - backgroundColor: btnBgColor, | ||
67 | - position: 'absolute', | ||
68 | - }] | ||
69 | - } > | ||
70 | - <Text style={{color: btnTextcolor}} > {tipState} </Text> | 53 | + <View style={styles.soldOutContainer}> |
54 | + <Image source={require('../../images/yqg.png')}/> | ||
71 | </View> | 55 | </View> |
72 | - :null } | 56 | + : null } |
73 | 57 | ||
74 | </View> | 58 | </View> |
75 | 59 | ||
76 | 60 | ||
77 | - | ||
78 | <View style={styles.rowRight}> | 61 | <View style={styles.rowRight}> |
79 | - <View style={styles.productTitlePrice}> | ||
80 | <Text style={styles.productTitle} | 62 | <Text style={styles.productTitle} |
81 | numberOfLines={2}>{rowData.productName}</Text> | 63 | numberOfLines={2}>{rowData.productName}</Text> |
82 | - <View style={[styles.secKillMarketPriceContainer, {marginTop: 5}]}> | 64 | + |
65 | + <View style={{ | ||
66 | + flexDirection: 'row', | ||
67 | + flex: 1, | ||
68 | + alignItems: 'flex-end', | ||
69 | + justifyContent: 'space-between' | ||
70 | + }}> | ||
71 | + <View style={{}}> | ||
83 | <Text | 72 | <Text |
84 | - style={styles.seckillPrice}>¥{rowData.secKillPrice}</Text> | ||
85 | - <DeleteLineText style={{top: 3, left: 8}} text={'¥' + rowData.marketPrice}/> | ||
86 | - </View> | 73 | + style={styles.seckillPrice}>¥{parseFloat(rowData.secKillPrice + "").toFixed(2)}</Text> |
74 | + <Text style={styles.originPrice}> | ||
75 | + {'¥' + parseFloat(rowData.marketPrice + '').toFixed(2)}</Text> | ||
87 | </View> | 76 | </View> |
88 | - <View style={styles.priceClickTipView}> | ||
89 | - <View style={styles.priceClickTipViewLeft}> | ||
90 | - {rowData.wait ? | ||
91 | - <View style={[styles.secKillMarketPriceContainer, {marginTop: 2}]}> | ||
92 | - <Image style={{top: 1.5, marginRight: 2}} | ||
93 | - source={require('../../images/time_icon.png')}/> | ||
94 | - <Text style={styles.seckillBeginTimeTip}>{rowData.readableTime}开始</Text> | ||
95 | - </View> | ||
96 | - : null } | ||
97 | - </View> | ||
98 | - | ||
99 | - {tipState == '已抢光' && url && url.length? | ||
100 | - <View onPress={()=>{ | 77 | + <View style={{justifyContent: 'center'}}> |
78 | + {tipState == '已抢光' && url && url.length ? | ||
79 | + <TouchableOpacity onPress={()=> { | ||
101 | this.props.onPressGuangShopWithURL && this.props.onPressGuangShopWithURL(url); | 80 | this.props.onPressGuangShopWithURL && this.props.onPressGuangShopWithURL(url); |
102 | - }} style={[styles.priceClickTipViewRight, {backgroundColor: 'white', borderColor:'black', borderWidth: 1}]}> | 81 | + }} style={[styles.priceClickTipViewRight, { |
82 | + backgroundColor: 'white', | ||
83 | + borderColor: 'black', | ||
84 | + borderWidth: 1 | ||
85 | + }]}> | ||
103 | <Text style={{color: 'black'}}>进店逛逛</Text> | 86 | <Text style={{color: 'black'}}>进店逛逛</Text> |
104 | - </View> | ||
105 | - :null} | 87 | + </TouchableOpacity> |
88 | + : null} | ||
106 | 89 | ||
107 | - {tipState != '已抢光'? <TouchableOpacity onPress={() => { | 90 | + {tipState != '已抢光' ? <TouchableOpacity onPress={() => { |
108 | if (this.tipMessage == '') { | 91 | if (this.tipMessage == '') { |
109 | if (rowData.wait) { | 92 | if (rowData.wait) { |
110 | this.props.onPressRemindBtn && this.props.onPressRemindBtn(rowData); | 93 | this.props.onPressRemindBtn && this.props.onPressRemindBtn(rowData); |
@@ -128,8 +111,12 @@ export default class ProductListView extends Component { | @@ -128,8 +111,12 @@ export default class ProductListView extends Component { | ||
128 | </View> | 111 | </View> |
129 | } | 112 | } |
130 | 113 | ||
131 | - </TouchableOpacity>:null | 114 | + </TouchableOpacity> : null |
132 | } | 115 | } |
116 | + {rowData.wait && | ||
117 | + <Text style={styles.seckillBeginTimeTip}>{rowData.readableTime + ' 开始'}</Text>} | ||
118 | + | ||
119 | + </View> | ||
133 | </View> | 120 | </View> |
134 | </View> | 121 | </View> |
135 | <View style={styles.separator}/> | 122 | <View style={styles.separator}/> |
@@ -162,30 +149,30 @@ let styles = StyleSheet.create({ | @@ -162,30 +149,30 @@ let styles = StyleSheet.create({ | ||
162 | leftImage: { | 149 | leftImage: { |
163 | width: adjustPx(imageWidth), | 150 | width: adjustPx(imageWidth), |
164 | height: adjustPx(imageHeight), | 151 | height: adjustPx(imageHeight), |
165 | - marginRight: adjustPx(10), | ||
166 | - resizeMode: 'cover', | ||
167 | 152 | ||
168 | }, | 153 | }, |
169 | - imageBottomTag: { | ||
170 | - width: adjustPx(imageWidth), | ||
171 | - height: 30, | ||
172 | - marginRight: 10, | ||
173 | - marginTop: adjustPx(imageHeight) - 30, | 154 | + soldOutContainer: { |
155 | + backgroundColor: '#0000007F', | ||
156 | + position: 'absolute', | ||
157 | + left: 0, | ||
158 | + right: 0, | ||
159 | + bottom: 0, | ||
160 | + top: 0, | ||
174 | alignItems: 'center', | 161 | alignItems: 'center', |
175 | justifyContent: 'center', | 162 | justifyContent: 'center', |
176 | - borderRadius: 3, | ||
177 | - backgroundColor: '#d0021b', | ||
178 | }, | 163 | }, |
179 | rowRight: { | 164 | rowRight: { |
180 | flexDirection: 'column', | 165 | flexDirection: 'column', |
166 | + marginLeft: 10, | ||
181 | justifyContent: 'space-between', | 167 | justifyContent: 'space-between', |
168 | + flex: 1, | ||
182 | }, | 169 | }, |
183 | priceClickTipView: { | 170 | priceClickTipView: { |
184 | flexDirection: 'row', | 171 | flexDirection: 'row', |
185 | justifyContent: 'space-between', | 172 | justifyContent: 'space-between', |
186 | width: width - imageWidth - 35, | 173 | width: width - imageWidth - 35, |
187 | height: 50, | 174 | height: 50, |
188 | - // backgroundColor: 'white', | 175 | + backgroundColor: 'yellow', |
189 | }, | 176 | }, |
190 | priceClickTipViewLeft: { | 177 | priceClickTipViewLeft: { |
191 | top: 25, | 178 | top: 25, |
@@ -200,10 +187,7 @@ let styles = StyleSheet.create({ | @@ -200,10 +187,7 @@ let styles = StyleSheet.create({ | ||
200 | borderRadius: 3, | 187 | borderRadius: 3, |
201 | backgroundColor: '#d0021b', | 188 | backgroundColor: '#d0021b', |
202 | }, | 189 | }, |
203 | - productTitlePrice: { | ||
204 | - width: width - imageWidth - 30, | ||
205 | - flexDirection: 'column', | ||
206 | - }, | 190 | + |
207 | secKillMarketPriceContainer: { | 191 | secKillMarketPriceContainer: { |
208 | flexDirection: 'row', | 192 | flexDirection: 'row', |
209 | alignItems: 'center' | 193 | alignItems: 'center' |
@@ -227,11 +211,20 @@ let styles = StyleSheet.create({ | @@ -227,11 +211,20 @@ let styles = StyleSheet.create({ | ||
227 | }, | 211 | }, |
228 | seckillPrice: { | 212 | seckillPrice: { |
229 | fontSize: 18, | 213 | fontSize: 18, |
214 | + lineHeight: 21, | ||
215 | + fontWeight: 'bold', | ||
230 | color: '#d0021b', | 216 | color: '#d0021b', |
231 | }, | 217 | }, |
218 | + originPrice: { | ||
219 | + textDecorationLine: 'line-through', | ||
220 | + color: '#B0B0B0', | ||
221 | + fontSize: 12, | ||
222 | + lineHeight: 17 | ||
223 | + }, | ||
232 | seckillBeginTimeTip: { | 224 | seckillBeginTimeTip: { |
233 | - fontSize: 11, | ||
234 | - color: '#b0b0b0', | 225 | + fontSize: 9, |
226 | + marginTop: 6, | ||
227 | + color: '#D0021B', | ||
235 | }, | 228 | }, |
236 | separator: { | 229 | separator: { |
237 | position: 'absolute', | 230 | position: 'absolute', |
@@ -19,9 +19,8 @@ import Immutable from "immutable"; | @@ -19,9 +19,8 @@ import Immutable from "immutable"; | ||
19 | import ProductListView from "./ProductListView"; | 19 | import ProductListView from "./ProductListView"; |
20 | import TimeListView from "./TimeListView"; | 20 | import TimeListView from "./TimeListView"; |
21 | import Prompt from "../../../coupon/components/coupon/Prompt"; | 21 | import Prompt from "../../../coupon/components/coupon/Prompt"; |
22 | -import YH_PtrRefresh from "../../../common/components/YH_PtrRefresh"; | ||
23 | import ProductListCell from "../../../common/components/ListCell/ProductListCell"; | 22 | import ProductListCell from "../../../common/components/ListCell/ProductListCell"; |
24 | -import LoadingIndicator from '../../../common/components/LoadingIndicator'; | 23 | +import LoadingIndicator from "../../../common/components/LoadingIndicator"; |
25 | 24 | ||
26 | const SECTION_TYPE_SECKILL = 1; | 25 | const SECTION_TYPE_SECKILL = 1; |
27 | const SECTION_TYPE_DISCOUNT = 2; | 26 | const SECTION_TYPE_DISCOUNT = 2; |
@@ -82,7 +81,7 @@ export default class Seckill extends Component { | @@ -82,7 +81,7 @@ export default class Seckill extends Component { | ||
82 | } else if (this.queryActivityInfo.secKillProductVoList.size == 0 && !this.firstLaunch) { | 81 | } else if (this.queryActivityInfo.secKillProductVoList.size == 0 && !this.firstLaunch) { |
83 | return ( | 82 | return ( |
84 | <View style={styles.seckillEndView}> | 83 | <View style={styles.seckillEndView}> |
85 | - <Text style={{fontSize: 16,color:'black'}}>来晚啦~秒杀已结束</Text> | 84 | + <Text style={{fontSize: 16, color: 'black'}}>来晚啦~秒杀已结束</Text> |
86 | </View> | 85 | </View> |
87 | ); | 86 | ); |
88 | } else { | 87 | } else { |
@@ -153,7 +152,7 @@ export default class Seckill extends Component { | @@ -153,7 +152,7 @@ export default class Seckill extends Component { | ||
153 | renderDiscountSection({item}) { | 152 | renderDiscountSection({item}) { |
154 | return <FlatList | 153 | return <FlatList |
155 | data={item} | 154 | data={item} |
156 | - style={{backgroundColor:'white'}} | 155 | + style={{backgroundColor: 'white'}} |
157 | numColumns={2} | 156 | numColumns={2} |
158 | renderItem={this.renderDiscountProduct} | 157 | renderItem={this.renderDiscountProduct} |
159 | /> | 158 | /> |
@@ -178,6 +177,17 @@ export default class Seckill extends Component { | @@ -178,6 +177,17 @@ export default class Seckill extends Component { | ||
178 | this.tipMessage = tipMessage; | 177 | this.tipMessage = tipMessage; |
179 | diff = localServerTimeDiff; | 178 | diff = localServerTimeDiff; |
180 | let isPullToRefresh = ptr && isFetching; | 179 | let isPullToRefresh = ptr && isFetching; |
180 | + let sections = [ | ||
181 | + {title: null, type: SECTION_TYPE_SECKILL, data: queryProductList ? queryProductList : []}, | ||
182 | + ]; | ||
183 | + if (discountProduct.list && discountProduct.list.length > 0) { | ||
184 | + sections.push({ | ||
185 | + title: '限时热促', | ||
186 | + type: SECTION_TYPE_DISCOUNT, | ||
187 | + data: discountProduct.list ? [discountProduct.list] : [[]], | ||
188 | + renderItem: this.renderDiscountSection | ||
189 | + }) | ||
190 | + } | ||
181 | return ( | 191 | return ( |
182 | <View style={styles.container}> | 192 | <View style={styles.container}> |
183 | <SectionList | 193 | <SectionList |
@@ -191,17 +201,9 @@ export default class Seckill extends Component { | @@ -191,17 +201,9 @@ export default class Seckill extends Component { | ||
191 | onEndReached={() => { | 201 | onEndReached={() => { |
192 | this.props.onEndReached && this.props.onEndReached(); | 202 | this.props.onEndReached && this.props.onEndReached(); |
193 | }} | 203 | }} |
194 | - sections={[ | ||
195 | - {title: null, type: SECTION_TYPE_SECKILL, data: queryProductList ? queryProductList : []}, | ||
196 | - { | ||
197 | - title: '限时热促', | ||
198 | - type: SECTION_TYPE_DISCOUNT, | ||
199 | - data: discountProduct.list ? [discountProduct.list] : [[]], | ||
200 | - renderItem: this.renderDiscountSection | ||
201 | - }, | ||
202 | - ]} | 204 | + sections={sections} |
203 | /> | 205 | /> |
204 | - <LoadingIndicator isVisible={isPullToRefresh} /> | 206 | + <LoadingIndicator isVisible={isPullToRefresh}/> |
205 | {tipMessage != '' ? | 207 | {tipMessage != '' ? |
206 | <Prompt | 208 | <Prompt |
207 | text={tipMessage} | 209 | text={tipMessage} |
@@ -240,7 +242,7 @@ let styles = StyleSheet.create({ | @@ -240,7 +242,7 @@ let styles = StyleSheet.create({ | ||
240 | }, | 242 | }, |
241 | listContainer: { | 243 | listContainer: { |
242 | width: width / 2, | 244 | width: width / 2, |
243 | - backgroundColor:'white' | 245 | + backgroundColor: 'white' |
244 | }, | 246 | }, |
245 | brandFilterContainer: { | 247 | brandFilterContainer: { |
246 | marginLeft: -1, | 248 | marginLeft: -1, |
@@ -35,12 +35,9 @@ export default class TimeForFocus extends Component { | @@ -35,12 +35,9 @@ export default class TimeForFocus extends Component { | ||
35 | let TimeComponent = null; | 35 | let TimeComponent = null; |
36 | if (now) { | 36 | if (now) { |
37 | TimeComponent = TimeForNow; | 37 | TimeComponent = TimeForNow; |
38 | - } | ||
39 | - // else if (over) { | ||
40 | - // TimeComponent = TimeForOver; | ||
41 | - // } else | ||
42 | - | ||
43 | - if (wait) { | 38 | + } else if (over) { |
39 | + TimeComponent = TimeForOver; | ||
40 | + } else if (wait) { | ||
44 | TimeComponent = TimeForWait; | 41 | TimeComponent = TimeForWait; |
45 | } | 42 | } |
46 | 43 |
@@ -29,14 +29,14 @@ export default class TimeForLostFocus extends Component { | @@ -29,14 +29,14 @@ export default class TimeForLostFocus extends Component { | ||
29 | if (now) { | 29 | if (now) { |
30 | text = '抢购中'; | 30 | text = '抢购中'; |
31 | } else if (over) { | 31 | } else if (over) { |
32 | - text = '已开抢'; | 32 | + text = '已结束'; |
33 | } else if (wait && !specialState) { | 33 | } else if (wait && !specialState) { |
34 | text = '即将开抢'; | 34 | text = '即将开抢'; |
35 | } else if (specialState) { | 35 | } else if (specialState) { |
36 | if (specialState == 1) { | 36 | if (specialState == 1) { |
37 | text = '明天开抢'; | 37 | text = '明天开抢'; |
38 | } else { | 38 | } else { |
39 | - text = '2天后开抢'; | 39 | + text = specialState + '天后开抢'; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 |
@@ -24,8 +24,8 @@ export default class TimeForOver extends Component { | @@ -24,8 +24,8 @@ export default class TimeForOver extends Component { | ||
24 | 24 | ||
25 | return ( | 25 | return ( |
26 | <View style={styles.rowContainerFocus}> | 26 | <View style={styles.rowContainerFocus}> |
27 | - <Text style={[colorStyle, {fontSize: 13, marginTop: 15, fontWeight: 'bold'}]}>{time} 已开抢</Text> | ||
28 | - <Text style={[colorStyle,{fontSize: 10, marginTop: 1}]}>还有商品可以继续抢购</Text> | 27 | + <Text style={[colorStyle, {fontSize: 13, marginTop: 15, fontWeight: 'bold'}]}>{time} 已结束</Text> |
28 | + <Text style={[colorStyle,{fontSize: 10, marginTop: 1}]}>数量有限 抢完为止</Text> | ||
29 | </View> | 29 | </View> |
30 | ); | 30 | ); |
31 | } | 31 | } |
@@ -73,21 +73,12 @@ export default class SeckillTimeListView extends Component { | @@ -73,21 +73,12 @@ export default class SeckillTimeListView extends Component { | ||
73 | } | 73 | } |
74 | 74 | ||
75 | _caculateTimerState() { | 75 | _caculateTimerState() { |
76 | - if (this.curFocusActivity.get('index') == this.secKillProductVoList.length - 1 && this.curFocusActivity.has('now')) { | ||
77 | - if (!this.state.tickTimeOut) { | ||
78 | - this.setState({ | ||
79 | - tickHour: '', | ||
80 | - tickMinute: '', | ||
81 | - tickSecond: '', | ||
82 | - tickTimeOut: true, | ||
83 | - }); | ||
84 | - this.props.onRefresh && this.props.onRefresh(); | 76 | + let nextActivity = undefined; |
77 | + if (this.curFocusActivity.get('index') < this.secKillProductVoList.length - 1) { | ||
78 | + nextActivity = this.secKillProductVoList[this.curFocusActivity.get('index') + 1]; | ||
85 | } | 79 | } |
86 | - } else { | ||
87 | - | ||
88 | - let nextActivity = this.secKillProductVoList[this.curFocusActivity.get('index') + 1]; | ||
89 | let nowTime = Date.parse(new Date()) / 1000 + diffTime; | 80 | let nowTime = Date.parse(new Date()) / 1000 + diffTime; |
90 | - let time = this.curFocusActivity.has('now') ? nextActivity.get('startTime')/1000: this.curFocusActivity.get('startTime') / 1000; | 81 | + let time = this.curFocusActivity.has('now') ? this.curFocusActivity.get('endTime') / 1000 : this.curFocusActivity.get('startTime') / 1000; |
91 | let offsetTime = time - nowTime; | 82 | let offsetTime = time - nowTime; |
92 | let hour = parseInt(offsetTime / (60 * 60), 10); | 83 | let hour = parseInt(offsetTime / (60 * 60), 10); |
93 | let minute = parseInt(offsetTime % (60 * 60) / 60, 10); | 84 | let minute = parseInt(offsetTime % (60 * 60) / 60, 10); |
@@ -101,10 +92,10 @@ export default class SeckillTimeListView extends Component { | @@ -101,10 +92,10 @@ export default class SeckillTimeListView extends Component { | ||
101 | tickSecond: '', | 92 | tickSecond: '', |
102 | tickTimeOut: true, | 93 | tickTimeOut: true, |
103 | }); | 94 | }); |
104 | - if (this.curFocusActivity.has('now')) { | 95 | + if (this.curFocusActivity.has('now') && nextActivity != undefined) { |
105 | nextActivity = nextActivity.toJS(); | 96 | nextActivity = nextActivity.toJS(); |
106 | nextActivity.focus = true; | 97 | nextActivity.focus = true; |
107 | - this.curFocusActivity= Immutable.fromJS(nextActivity); | 98 | + this.curFocusActivity = Immutable.fromJS(nextActivity); |
108 | this._scrollToFocusActivity(); | 99 | this._scrollToFocusActivity(); |
109 | this.props.onFocusToCurStartedActivity && this.props.onFocusToCurStartedActivity(nextActivity); | 100 | this.props.onFocusToCurStartedActivity && this.props.onFocusToCurStartedActivity(nextActivity); |
110 | 101 | ||
@@ -120,7 +111,7 @@ export default class SeckillTimeListView extends Component { | @@ -120,7 +111,7 @@ export default class SeckillTimeListView extends Component { | ||
120 | tickTimeOut: false, | 111 | tickTimeOut: false, |
121 | }); | 112 | }); |
122 | } | 113 | } |
123 | - } | 114 | + |
124 | 115 | ||
125 | } | 116 | } |
126 | 117 | ||
@@ -167,6 +158,7 @@ export default class SeckillTimeListView extends Component { | @@ -167,6 +158,7 @@ export default class SeckillTimeListView extends Component { | ||
167 | {rowData.focus ? <TimeForFocus | 158 | {rowData.focus ? <TimeForFocus |
168 | key={'row' + rowID} | 159 | key={'row' + rowID} |
169 | time={rowData.time} | 160 | time={rowData.time} |
161 | + endTime={rowData.endTime} | ||
170 | now={rowData.now} | 162 | now={rowData.now} |
171 | over={rowData.over} | 163 | over={rowData.over} |
172 | wait={rowData.wait} | 164 | wait={rowData.wait} |
@@ -174,14 +166,14 @@ export default class SeckillTimeListView extends Component { | @@ -174,14 +166,14 @@ export default class SeckillTimeListView extends Component { | ||
174 | tickHour={this.state.tickHour} | 166 | tickHour={this.state.tickHour} |
175 | tickMinute={this.state.tickMinute} | 167 | tickMinute={this.state.tickMinute} |
176 | tickSecond={this.state.tickSecond} | 168 | tickSecond={this.state.tickSecond} |
177 | - lastNowTime={(rowID == this.secKillProductVoList.length -1) ? true : false} | 169 | + lastNowTime={false} |
178 | /> : <TimeForLostFocus | 170 | /> : <TimeForLostFocus |
179 | key={'row' + rowID} | 171 | key={'row' + rowID} |
180 | time={rowData.time} | 172 | time={rowData.time} |
181 | now={rowData.now} | 173 | now={rowData.now} |
182 | over={rowData.over} | 174 | over={rowData.over} |
183 | wait={rowData.wait} | 175 | wait={rowData.wait} |
184 | - specialState = { | 176 | + specialState={ |
185 | rowData.specialState | 177 | rowData.specialState |
186 | } | 178 | } |
187 | /> | 179 | /> |
@@ -213,9 +205,9 @@ export default class SeckillTimeListView extends Component { | @@ -213,9 +205,9 @@ export default class SeckillTimeListView extends Component { | ||
213 | 205 | ||
214 | return ( | 206 | return ( |
215 | <View style={[styles.container]}> | 207 | <View style={[styles.container]}> |
216 | - <View style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/> | 208 | + <View style={{width: width, height: 0.5, backgroundColor: '#e5e5e5',}}/> |
217 | <ListView | 209 | <ListView |
218 | - ref={(ref)=>this.listView=ref} | 210 | + ref={(ref)=>this.listView = ref} |
219 | contentContainerStyle={[styles.contentContainer]} | 211 | contentContainerStyle={[styles.contentContainer]} |
220 | enableEmptySections={true} | 212 | enableEmptySections={true} |
221 | dataSource={this.dataSource.cloneWithRows(resource)} | 213 | dataSource={this.dataSource.cloneWithRows(resource)} |
@@ -226,14 +218,14 @@ export default class SeckillTimeListView extends Component { | @@ -226,14 +218,14 @@ export default class SeckillTimeListView extends Component { | ||
226 | horizontal={true} | 218 | horizontal={true} |
227 | scrollsToTop={false} | 219 | scrollsToTop={false} |
228 | /> | 220 | /> |
229 | - <View style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/> | 221 | + <View style={{width: width, height: 0.5, backgroundColor: '#e5e5e5',}}/> |
230 | </View> | 222 | </View> |
231 | ); | 223 | ); |
232 | } | 224 | } |
233 | } | 225 | } |
234 | 226 | ||
235 | let {width, height} = Dimensions.get('window'); | 227 | let {width, height} = Dimensions.get('window'); |
236 | -let backgroundWidth= width; | 228 | +let backgroundWidth = width; |
237 | let backgroundHeight = 61; | 229 | let backgroundHeight = 61; |
238 | let diffTime; | 230 | let diffTime; |
239 | let rowContainerWidth = Math.ceil((223 * width) / 750); | 231 | let rowContainerWidth = Math.ceil((223 * width) / 750); |
@@ -245,11 +237,11 @@ let styles = StyleSheet.create({ | @@ -245,11 +237,11 @@ let styles = StyleSheet.create({ | ||
245 | marginLeft: -1, | 237 | marginLeft: -1, |
246 | width: backgroundWidth + 2, | 238 | width: backgroundWidth + 2, |
247 | height: backgroundHeight, | 239 | height: backgroundHeight, |
248 | - backgroundColor:'white', | 240 | + backgroundColor: 'white', |
249 | }, | 241 | }, |
250 | contentContainer: { | 242 | contentContainer: { |
251 | flexDirection: 'row', | 243 | flexDirection: 'row', |
252 | - backgroundColor:'white', | 244 | + backgroundColor: 'white', |
253 | }, | 245 | }, |
254 | bottomToolBar: { | 246 | bottomToolBar: { |
255 | top: 200, | 247 | top: 200, |
js/seckill/images/yqg@2x.png
0 → 100755
9.61 KB
js/seckill/images/yqg@3x.png
0 → 100755
15.4 KB
@@ -456,6 +456,7 @@ function parseActivityTimeLsit(json, focusTime=0) { | @@ -456,6 +456,7 @@ function parseActivityTimeLsit(json, focusTime=0) { | ||
456 | minute = 0; | 456 | minute = 0; |
457 | 457 | ||
458 | activityTimeItem.startTime *= 1000; | 458 | activityTimeItem.startTime *= 1000; |
459 | + activityTimeItem.endTime *= 1000; | ||
459 | activityTimeItem.index = i; | 460 | activityTimeItem.index = i; |
460 | date = new Date(activityTimeItem.startTime); | 461 | date = new Date(activityTimeItem.startTime); |
461 | hour = date.getHours(); | 462 | hour = date.getHours(); |
@@ -468,24 +469,15 @@ function parseActivityTimeLsit(json, focusTime=0) { | @@ -468,24 +469,15 @@ function parseActivityTimeLsit(json, focusTime=0) { | ||
468 | let startDays = Math.floor(now / 1000 / 60 / 60 / 24); | 469 | let startDays = Math.floor(now / 1000 / 60 / 60 / 24); |
469 | let endDate = Math.floor(activityTimeItem.startTime / 1000 / 60 / 60 / 24); | 470 | let endDate = Math.floor(activityTimeItem.startTime / 1000 / 60 / 60 / 24); |
470 | let offsetDate = endDate - startDays; | 471 | let offsetDate = endDate - startDays; |
471 | - | ||
472 | - if (offsetDate <= 2) { | ||
473 | - activityTimeItem.specialState = offsetDate; | ||
474 | - } | 472 | + activityTimeItem.specialState = offsetDate < 0 ? 0 : offsetDate; |
475 | 473 | ||
476 | 474 | ||
477 | 475 | ||
478 | if (currentTime > activityTimeItem.startTime) { | 476 | if (currentTime > activityTimeItem.startTime) { |
479 | - if (i < newActivityTimeList.length - 1) { | ||
480 | - let nextTime = newActivityTimeList[i + 1].startTime * 1000; | ||
481 | 477 | ||
482 | - if (currentTime < nextTime) { // 下一个时间段与当前时间来区别是否正在抢购 | ||
483 | - activityTimeItem.now = true; | ||
484 | - focusIndex || (activityTimeItem.focus = focusIndex = true); | ||
485 | - } else { | 478 | + if(currentTime > activityTimeItem.endTime){ |
486 | activityTimeItem.over = true; | 479 | activityTimeItem.over = true; |
487 | - } | ||
488 | - } else {// 大于这个时间段但是后面没有秒抢时间端了,则依然显示抢购中 | 480 | + }else{ |
489 | activityTimeItem.now = true; | 481 | activityTimeItem.now = true; |
490 | focusIndex || (activityTimeItem.focus = focusIndex = true); | 482 | focusIndex || (activityTimeItem.focus = focusIndex = true); |
491 | } | 483 | } |
@@ -60,7 +60,6 @@ export default function seckillReducer(state=initialState, action) { | @@ -60,7 +60,6 @@ export default function seckillReducer(state=initialState, action) { | ||
60 | .set('error', null); | 60 | .set('error', null); |
61 | } | 61 | } |
62 | case QUERY_PRODUCT_LIST_SUCCESS: { | 62 | case QUERY_PRODUCT_LIST_SUCCESS: { |
63 | - console.log('wwwwwwwwww'); | ||
64 | 63 | ||
65 | console.log(action.payload); | 64 | console.log(action.payload); |
66 | 65 | ||
@@ -101,7 +100,7 @@ export default function seckillReducer(state=initialState, action) { | @@ -101,7 +100,7 @@ export default function seckillReducer(state=initialState, action) { | ||
101 | case UPDATE_SECKILL_PRODUCT_VO_LIST: { | 100 | case UPDATE_SECKILL_PRODUCT_VO_LIST: { |
102 | return state.setIn(['queryActivityInfo', 'secKillProductVoList'], Immutable.fromJS(action.payload.secKillProductVoList)) | 101 | return state.setIn(['queryActivityInfo', 'secKillProductVoList'], Immutable.fromJS(action.payload.secKillProductVoList)) |
103 | .set('ptr', true) | 102 | .set('ptr', true) |
104 | - .set('isFetching', true) | 103 | + .set('isFetching', false) |
105 | .set('curActivity', Immutable.fromJS(action.payload.curActivity)) | 104 | .set('curActivity', Immutable.fromJS(action.payload.curActivity)) |
106 | .set('error', null); | 105 | .set('error', null); |
107 | } | 106 | } |
-
Please register or login to post a comment