Authored by shixiang

Merge branch 'brand_store' of http://git.yoho.cn/mobile/YH_RNComponent into brand_store

... ... @@ -41,4 +41,6 @@ android/app/libs
android/keystores/debug.keystore
!.gitkeep
android/
ios/
bundle/
... ...
'use strict';
import Platform from 'react-native';
import {Platform} from 'react-native';
import Community from './community/Community';
import Plustar from './plustar/Plustar';
import Coupon from './coupon/Coupon';
// import QRCode from './qrcode/QRCode';
import QRCode from './qrcode/QRCode';
import BrandStore from './brandStore/BrandStore';
// import Search from './search/Search';
export default function native(platform) {
if(Platform.OS === 'ios'){
if (Platform.OS === 'ios') {
Community(platform);
Plustar(platform);
Coupon(platform);
QRCode(platform);
BrandStore(platform);
BrandStoreearch(platform);
}else{
} else {
Coupon(platform);
BrandStore(platform);
}
... ...
... ... @@ -172,7 +172,7 @@ export default class BrandStore extends Component {
}
} else if (sectionID == 'storeFilter') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft, marginTop: 0} : {paddingLeft};
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
... ... @@ -184,7 +184,7 @@ export default class BrandStore extends Component {
);
} else if (sectionID == 'productList') {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft, marginTop: 0} : {paddingLeft};
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
return (
<BrandProductListCell
style={[styles.listContainer, customStyle]}
... ...
... ... @@ -34,9 +34,10 @@ export default class BrandListCell extends React.Component {
<View style={styles.row}>
<Image
source={{uri: rowData.src}}
style={{ width: 100, height: 120}}
style={{ width: itemWidth, height: itemWidth}}
resizeMode={'contain'}
></Image>
<Text style={styles.text}>
<Text style={styles.text} numberOfLines={1}>
{rowData.name}
</Text>
</View>
... ... @@ -49,7 +50,7 @@ export default class BrandListCell extends React.Component {
let data = this.props.resource.toJS();
let list = data.brands;
if (list.length == 0) {
if (!list || list.length == 0) {
return null;
}
... ... @@ -69,39 +70,41 @@ export default class BrandListCell extends React.Component {
}
};
let {width, height} = Dimensions.get('window');
let itemWidth= width/4;
let itemHeight = 50;
let styles = StyleSheet.create({
cellList:{
justifyContent: 'center',
width: Dimensions.get('window').width,
height: 200,
height: 180,
},
titleStyle:{
alignItems: 'center',
justifyContent: 'center',
height: 64,
height: 48,
width:Dimensions.get('window').width,
backgroundColor: 'white',
backgroundColor: 'white',
},
row: {
justifyContent: 'center',
marginLeft: 20,
// margin: 3,
width: 100,
height: 100,
marginLeft: 10,
width: itemWidth,
height: itemWidth,
backgroundColor: 'white',
// alignItems: 'center',
alignItems: 'center',
},
text: {
fontWeight: 'bold',
color: 'gray',
width: 100,
width: itemWidth,
textAlign: 'center',
backgroundColor:'white',
},
titleText: {
fontWeight: 'bold',
textAlign: 'center',
color: 'gray',
fontSize: 20,
fontSize: 16,
},
});
... ...
... ... @@ -106,7 +106,7 @@ export default class CouponCell extends React.Component {
let data = this.props.resource.toJS();
if (data.list.length == 0) {
if (!data.list || data.list.length == 0) {
return null;
}
... ...
... ... @@ -35,7 +35,7 @@ export default class HotProducts extends React.Component {
renderRow(rowData,sectionID,rowID,highlightRow) {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft, marginTop: 0} : {paddingLeft};
let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
return (
<BrandProductListCell
... ... @@ -60,7 +60,7 @@ export default class HotProducts extends React.Component {
}}>
<Image
source={require('../../../../image/more.png')}
style={{width: 62, height: 62}}
style={{width: 48, height: 48}}
resizeMode={'contain'}
/>
</TouchableOpacity>
... ... @@ -111,27 +111,25 @@ const styles = StyleSheet.create({
title: {
alignItems: 'center',
justifyContent: 'center',
height: 64,
height: 48,
width,
backgroundColor: 'white',
borderBottomColor: '#CCC',
borderBottomWidth: 0.5,
},
text: {
fontWeight: 'bold',
textAlign: 'left',
color: 'gray',
fontSize: 20,
fontSize: 16,
},
listContainer: {
width: width / 2,
},
thumbnail: {
position: 'absolute',
width: 60,
height: 60,
width: 48,
height: 48,
bottom: 2,
marginLeft: width - 60,
marginLeft: width - 48,
backgroundColor: 'transparent',
},
});
... ...
... ... @@ -48,20 +48,21 @@ export default class OneRowTwoColImages extends React.Component {
}
};
let width = (Dimensions.get('window').width - 45)/2;
let heigth = (9*width)/16;
const styles = StyleSheet.create({
thumbnail: {
width: 160,
height: 90,
width: width,
height: heigth,
borderRadius: 10,
marginLeft: 15,
},
viewStyle:{
padding: 10,
flexDirection: 'row',
alignItems: 'center',
alignSelf: 'flex-start',
justifyContent: 'space-around',
width: Dimensions.get('window').width,
height:130,
backgroundColor:'#f0f0f0',
height: heigth + 30,
backgroundColor: '#f0f0f0',
},
});
... ...
... ... @@ -40,7 +40,7 @@ export default class Recommend extends React.Component {
>
<View style={styles.itemTitle}>
<Text style={styles.itemText}>{rowData.get('name')}</Text>
<Text style={styles.itemText} numberOfLines={1}>{rowData.get('name')}</Text>
</View>
</Image>
</View>
... ... @@ -66,7 +66,7 @@ export default class Recommend extends React.Component {
}
let backgroundWidth = width;
let backgroundHeight = 64 + 20 + Math.ceil(list.length / 4) * itemWidth;
let backgroundHeight = 48 + 20 + Math.ceil(list.length / 4) * itemWidth;
return (
<View style={{width: backgroundWidth, height:backgroundHeight, backgroundColor:'#f0f0f0'}}>
<ListView
... ... @@ -108,7 +108,7 @@ const styles = StyleSheet.create({
title: {
alignItems: 'center',
justifyContent: 'center',
height: 64,
height: 48,
width:width,
backgroundColor: 'white',
},
... ... @@ -126,9 +126,7 @@ const styles = StyleSheet.create({
fontSize: 10,
},
text: {
fontWeight: 'bold',
textAlign: 'center',
color: 'gray',
fontSize: 20,
fontSize: 16,
},
});
... ...
... ... @@ -27,12 +27,11 @@ export default class ShopTopBanner extends React.Component {
if (backgroundImage === '') {
return null;
}
let icon = info.shop_logo.replace('{width}', 100).replace('{height}', 100); // 商品缩略图
let name = info.shop_name;
let buttonIcon = require('../../../../image/btn_gz_p.png');
if (!this.props.info.is_addFav) {
buttonIcon = require('../../../../image/btn_gz_n.png');
}
let name = info.is_show_shop_name == 'N'?info.shop_name:null;
let buttonIcon = this.props.info.is_addFav?require('../../../../image/btn_gz_p.png'):require('../../../../image/btn_gz_n.png');
return (
<View style={{width: backgroundWidth, height:backgroundHeight}}>
... ...
... ... @@ -30,8 +30,8 @@ export default class Plustar extends Component {
}
_onPressRow(url) {
this.props.onPressRow && this.props.onPressRow(url);
_onPressRow(url, index) {
this.props.onPressRow && this.props.onPressRow(url, index);
}
render() {
... ...
... ... @@ -87,7 +87,9 @@ export default class PlustarList extends Component {
<BannerView
style={styles.bannerView}
items={rowData.get('data').toJS()}
onSelectBanner={this._pressRow}
onSelectBanner={(url) => {
this.props.onPressRow && this.props.onPressRow(url, rowID);
}}
/>
{text(rowData.get('brand_title'))}
</View>
... ... @@ -95,8 +97,8 @@ export default class PlustarList extends Component {
}
_pressRow(url: string) {
this.props.onPressRow && this.props.onPressRow(url);
_pressRow(url, index=0) {
this.props.onPressRow && this.props.onPressRow(url, index);
}
render() {
... ...
'use strict'
import React, {Component} from 'react';
import {
import ReactNative, {
StyleSheet,
Dimensions,
Platform,
... ... @@ -62,6 +62,16 @@ class PlustarContainer extends Component {
this.props.actions.plustarList(0);
this.props.actions.plustarList(1);
let tabId = '';
let {plustar} = this.props;
let {segment, activeTab} = plustar;
if (segment[activeTab].type == 3) {
tabId = '1';
} else if (segment[activeTab].type == 2) {
tabId = '2';
}
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_STAR_ORIGINAL_HOME_L', {TAB_ID: tabId});
}
componentWillUnmount() {
... ... @@ -75,8 +85,24 @@ class PlustarContainer extends Component {
}
}
_onPressRow(url) {
_onPressRow(url, index) {
this.props.actions.jumpWithUrl(url);
let tabId = '';
let {plustar} = this.props;
let {segment, activeTab} = plustar;
if (segment[activeTab].type == 3) {
tabId = '1';
} else if (segment[activeTab].type == 2) {
tabId = '2';
}
let param = {
TAB_ID: tabId,
F_URL: url ? url : '',
F_INDEX: (index + 1) + '',
};
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_STAR_ORIGINAL_FLR_C', param);
}
render() {
... ...
... ... @@ -36,6 +36,8 @@ export function swithSegment(activeTab) {
return;
}
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_STAR_ORIGINAL_TAB_C', {TAB_ID: (activeTab + 1) + ''});
dispatch({
type: SWITCH_SEGMENT,
payload: activeTab
... ...