Authored by 于良

轮播banner优化 review by 孙凯

... ... @@ -73,7 +73,7 @@ export default class BrandStore extends Component {
break;
case 'productList': {
return (
<BrandStoreFilter
<BrandProductFilter
onPressFilter={this.props.onPressFilter}
/>
);
... ... @@ -176,7 +176,7 @@ export default class BrandStore extends Component {
}
}
render() {
let {info, resource, coupon,productList} = this.props;
let {info, resource, coupon, productList} = this.props;
let {
shopTopBanner_APP,
oneRowTwoColImages_APP,
... ... @@ -192,6 +192,11 @@ export default class BrandStore extends Component {
productList: productList.list.toArray(),
};
// console.log(coupon.toJS())
// console.log(brandBrowse.toJS())
// console.log(largeSlideImg_APP.toJS())
// console.log(oneRowTwoColImages_APP.toJS())
return (
<ListView
contentContainerStyle={styles.contentContainer}
... ...
... ... @@ -18,12 +18,6 @@ export default class BrandSwiper extends React.Component {
constructor(props) {
super (props);
this.state = {
duration: 1,
width: Dimensions.get('window').width,
height: Math.ceil((310 / 640) * Dimensions.get('window').width),
};
this.dot = <View
style={{
backgroundColor:'rgba(0,0,0,.2)',
... ... @@ -52,29 +46,26 @@ export default class BrandSwiper extends React.Component {
render() {
if (this.props.resource.size == 0) {
let {resource} = this.props;
if (!resource || resource.size == 0) {
return null;
}
let width = this.state.width;
let height = this.state.height;
let data = this.props.resource.toJS();
if (data.length == 1) {
return (
<TouchableOpacity
activeOpacity={1}
style={{width: width, height: swiperHeight}}
onPress={() => {
this.props.onPressBrandItem(data[0].url)
this.props.onPressBrandItem && this.props.onPressBrandItem(data[0].url);
}}
>
<Image
source={{uri: data[0].src}}
style={{ width: width, height: height}}
resizeMode={'cover'}
></Image>
<Image
source={{uri: data[0].src}}
style={{ width: width, height: swiperHeight}}
/>
</TouchableOpacity>
);
} else {
... ... @@ -84,11 +75,12 @@ export default class BrandSwiper extends React.Component {
showsButtons={false}
loop={true}
autoplay={true}
autoplayTimeout={this.state.duration}
autoplayTimeout={2}
paginationStyle={{bottom: 8}}
dot={this.dot}
activeDot={this.activeDot}
height={height}
width={width}
height={swiperHeight}
>
{data.map((item, i) => {
return (
... ... @@ -96,15 +88,13 @@ export default class BrandSwiper extends React.Component {
key={i}
activeOpacity={1}
onPress={() => {
this.props.onPressBrandItem(item.url)
this.props.onPressBrandItem && this.props.onPressBrandItem(item.url);
}}
>
<Image
source={{uri:item.src}}
style={{ width: width, height: height - 20}}
resizeMode={'cover'}
></Image>
source={{uri: item.src}}
style={{width: width, height: swiperHeight - 20}}
/>
</TouchableOpacity>
);
})}
... ... @@ -114,6 +104,9 @@ export default class BrandSwiper extends React.Component {
}
}
let {width, height} = Dimensions.get('window');
let swiperHeight = Math.ceil((310 / 640) * width);
let styles = StyleSheet.create({
banner: {
... ...
... ... @@ -96,7 +96,7 @@ class BrandStoreContainer extends Component {
render() {
let {info, resource, coupon,productList} = this.props.brandStore;
console.log(this.props.brandStore);
return (
<BrandStore
info={info}
... ...
... ... @@ -52,7 +52,7 @@ export function onPressCollection() {
export function setShopId(shopId) {
return {
type: SET_SHOP_ID,
payload: 1284,
payload: 860,
};
}
... ...
... ... @@ -5,7 +5,7 @@ import Request from '../../common/services/Request';
export default class BrandStoreService {
constructor () {
let baseURL = 'http://api.yoho.cn';
let baseURL = 'http://api-test3.yohops.com:9999';
this.api = new Request(baseURL);
}
... ...