Authored by LakeR

秒杀细节优化 review by chenlin

... ... @@ -3,7 +3,7 @@
import React, {Component} from "react";
import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity} from "react-native";
import SlicedImage from "../../../common/components/SlicedImage";
import YH_Image from '../../../common/components/YH_Image';
export default class ProductListView extends Component {
... ... @@ -47,8 +47,7 @@ export default class ProductListView extends Component {
}}>
<View style={styles.rowContainer}>
<View style={styles.leftImage}>
<Image style={{flex: 1,}}
source={{uri: brandIconUrl}}/>
<YH_Image style={{flex:1}} url={brandIconUrl} />
{tipState == '已抢光' ?
<View style={styles.soldOutContainer}>
<Image source={require('../../images/yqg.png')}/>
... ... @@ -74,7 +73,7 @@ export default class ProductListView extends Component {
<Text style={styles.originPrice}>
{'¥' + parseFloat(rowData.marketPrice + '').toFixed(2)}</Text>
</View>
<View style={{justifyContent: 'center'}}>
<View style={{justifyContent: 'center', alignItems: 'flex-end'}}>
{tipState == '已抢光' && url && url.length ?
<TouchableOpacity onPress={()=> {
this.props.onPressGuangShopWithURL && this.props.onPressGuangShopWithURL(url);
... ... @@ -180,7 +179,6 @@ let styles = StyleSheet.create({
priceClickTipViewRight: {
width: 80,
height: 30,
marginRight: 10,
marginTop: 10,
alignItems: 'center',
justifyContent: 'center',
... ... @@ -228,7 +226,7 @@ let styles = StyleSheet.create({
},
separator: {
position: 'absolute',
left: 0,
left: 15,
right: 0,
bottom: 0,
height: 0.5,
... ...
... ... @@ -92,8 +92,11 @@ export default class Seckill extends Component {
renderSectionHeader({section: {type, title}}) {
if (type == SECTION_TYPE_DISCOUNT) {
return <View style={styles.sectionHeaderContainer}>
<View style={styles.sectionLine}/>
<Text style={styles.sectionHeaderText}>{title}</Text>
<View style={{position:'absolute',left:0,right:0,bottom:0,height:0.5,backgroundColor:'#E0E0E0'}}/>
</View>
}
return null
}
... ... @@ -182,7 +185,7 @@ export default class Seckill extends Component {
];
if (discountProduct.list && discountProduct.list.length > 0) {
sections.push({
title: '限时热促',
title: '限时促销',
type: SECTION_TYPE_DISCOUNT,
data: discountProduct.list ? [discountProduct.list] : [[]],
renderItem: this.renderDiscountSection
... ... @@ -257,21 +260,25 @@ let styles = StyleSheet.create({
paddingBottom: 10,
paddingLeft: 15,
paddingRight: 15,
backgroundColor: 'white'
},
descriptionText: {
color: 'black',
color: '#b0b0b0',
fontSize: 12,
},
sectionHeaderContainer: {
width: width,
paddingTop: 15,
paddingBottom: 15,
paddingTop: 10,
paddingBottom: 10,
paddingLeft:15,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
flexDirection:'row'
},
sectionHeaderText: {
color: 'black',
fontWeight: 'bold'
}
fontSize: 14,
marginLeft:10,
color: '#444444',
fontFamily: 'PingFang-SC-Medium'
},
sectionLine: {width: 2, height: 15, backgroundColor: '#444444', marginLeft: 2}
});
... ...
'use strict';
import React, {Component} from "react";
import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity} from "react-native";
import {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity, Platform} from "react-native";
import Immutable from "immutable";
import TimeForFocus from "./TimeForFocus";
import TimeForLostFocus from "./TimeForLostFocus";
... ... @@ -41,11 +41,18 @@ export default class SeckillTimeListView extends Component {
let scrollX;
let currentScrollX = this.listView ? this.listView.scrollProperties.offset : 0;
scrollX = (this.curFocusActivity.get('index') - 1) * (rowContainerWidth + separatorWidth);
if (Platform.OS == 'ios') {
if (scrollX < 0) {
scrollX = 0
} else if (this.listView && (scrollX > this.listView.scrollProperties.contentLength - this.listView.scrollProperties.visibleLength)) {
scrollX = this.listView.scrollProperties.contentLength - this.listView.scrollProperties.visibleLength
}
}
if (this.scrollX == scrollX && ((Math.floor(scrollX) == Math.floor(currentScrollX)) || scrollX != 0)) {
return;
}
this.scrollX = scrollX;
this.scrollX = scrollX;
this.listView && this.listView.scrollTo({x: scrollX, y: 0, animated: true});
}
}
... ... @@ -178,6 +185,10 @@ export default class SeckillTimeListView extends Component {
}
_renderSeparator(sectionID, rowID, adjacentRowHighlighted) {
let listLength = this.secKillProductVoList.length;
if (listLength - 1 == rowID) {
return null;
}
return (
<View key={'sep' + rowID} style={styles.separator}>
</View>
... ... @@ -224,7 +235,7 @@ let backgroundHeight = 61;
let diffTime;
let rowContainerWidth = Math.ceil((223 * width) / 750);
let rowContainerFocusWidth = Math.ceil((294 * width) / 750);
let separatorWidth = 1.5;
let separatorWidth = 1;
let styles = StyleSheet.create({
container: {
... ...