Authored by 鹿亮亮

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

... ... @@ -12,10 +12,10 @@ import ReactNative, {
TouchableOpacity,
} from 'react-native';
import SlicedImage from '../SlicedImage';
import Tags from './Tags';
import GPTags from './GPTags';
import DeleteLineText from '../DeleteLineText';
import YH_Image from '../YH_Image';
export default class ProductListCell extends Component {
... ... @@ -52,9 +52,8 @@ export default class ProductListCell extends Component {
}
_renderImages() {
let {data, sourceType} = this.props;
let url = data.get('default_images', '').replace('{width}', rowWidth).replace('{height}', imageHeight); // 商品缩略图
// url = SlicedImage.getSlicedUrl(data.get('default_images'), 290, 386, 2);
let {data, sourceType} = this.props;
let url = YH_Image.getSlicedUrl(data.get('default_images', ''), 290, 386, 2); // 商品缩略图
let isGlobalProduct = data.get('is_global') && data.get('is_global') == 'Y'; // 是否全球购商品
... ... @@ -68,12 +67,12 @@ export default class ProductListCell extends Component {
return (
<View style={styles.imageContainer}>
<Image style={styles.image} source={{uri: url}}>
<YH_Image style={styles.image} url={url}>
{showAlmostSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_jjsq.png')}/> : null}
{showOutletSoldOut ? <Image style={styles.soldOutImage} source={require('../../images/tag/outlet_sellout_bg.png')}/> : null}
{showGPSoldOut ? <Image style={styles.gpSoldOutImage} source={require('../../images/tag/gp_tip_SQ.png')}/> : null}
{showSoldOut ? <Image style={styles.almostSoldOutImage} source={require('../../images/tag/tip_ysq.png')}/> : null}
</Image>
</YH_Image>
</View>
);
}
... ...
... ... @@ -19,18 +19,21 @@ export default class HeadTitleCell extends Component{
}
render(){
render() {
let {title, moreUrl} = this.props;
return(
return (
<View style={styles.container}>
<Text style={styles.headerText}>{title}</Text>
{
(moreUrl && moreUrl != "") ?
<TouchableOpacity activeOpacity={1} style={styles.headerMoreContainer}
onPress={() => {this.props.onPressTitleMore && this.props.onPressTitleMore(moreUrl, 0)}}>
<Image source={require("../../images/head_title_more.png")}/>
<TouchableOpacity
activeOpacity={1}
style={styles.headerMoreContainer}
onPress={() => {this.props.onPressTitleMore && this.props.onPressTitleMore(moreUrl, 0)}}
>
<Image source={require("../../images/btn_more_n.png")}/>
</TouchableOpacity>
: null
}
... ... @@ -57,18 +60,17 @@ let styles = StyleSheet.create({
headerText:{
flex: 1,
fontSize: 14,
fontSize: 16,
color: '#444444',
textAlign: 'center',
fontWeight: 'bold',
},
headerMoreContainer:{
position: 'absolute',
top: 0,
right: 0,
width:40,
right: 10,
width: 40,
height: 40,
justifyContent: 'center',
alignItems: 'center',
... ...
... ... @@ -23,7 +23,7 @@ export default class ImageSlider extends React.Component {
this.dot = <View
style={{
backgroundColor:'#ededed',
backgroundColor:'rgba(237, 237, 237, 0.5)',
width: 5,
height: 5,
borderRadius: 2.5,
... ... @@ -94,7 +94,7 @@ export default class ImageSlider extends React.Component {
width={sliderWidth}
height={sliderHeight}
paginationStyle={{
backgroundColor: '#dadada',
backgroundColor: 'rgba(68, 68, 68, 0.2)',
bottom: 10,
height: 10,
width: data.length * 12,
... ...
... ... @@ -56,8 +56,6 @@ export default class Announcement extends React.Component {
autoplay={true}
autoplayTimeout={duration}
showsPagination={false}
dot={this.dot}
activeDot={this.activeDot}
height={containerHeight}
scrollEnabled={false}
>
... ...
... ... @@ -51,7 +51,7 @@ export default class AppHotBrands extends React.Component {
let url = YH_Image.getSlicedUrl(item.get('src'), width, imageHeight, 2);
return (
<TouchableOpacity key={i} style={styles.commonImage} onPress={() => {
<TouchableOpacity key={i} activeOpacity={1} style={styles.commonImage} onPress={() => {
this.props.onPressHotBrandItem && this.props.onPressHotBrandItem(item.get('url'), i);
}}>
<YH_Image url={url} style={styles.commonImage}/>
... ... @@ -59,7 +59,7 @@ export default class AppHotBrands extends React.Component {
)
})}
<TouchableOpacity style={styles.lastImage} onPress={() => {
<TouchableOpacity style={styles.lastImage} activeOpacity={1} onPress={() => {
this.props.onPressHotBrandItem && this.props.onPressHotBrandItem(image.get('url'), list.length - 1);
}}>
<YH_Image url={moreUrl} style={styles.lastImage}/>
... ...
... ... @@ -3,6 +3,7 @@
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
const {
AppRegistry,
... ... @@ -38,14 +39,16 @@ export default class AppIconList extends React.Component {
title = title&&title.length?title:'';
let cellStyle = styles.cell;
let imgStyle = styles.cellImg;
let titleStyle = styles.cellTitle;
if (this.props.number == '4') {
cellStyle = styles.cell4;
imgStyle = styles.cellImg4;
titleStyle = styles.cellTitle4;
}
return (
<TouchableOpacity style={cellStyle} onPress={()=>{this.props.onPressAppIconItem && this.props.onPressAppIconItem(url, rowID)}}>
<Image style={imgStyle} source={{uri:src}} resizeMode={'contain'}/>
<Text style={styles.cellTitle}>{title}</Text>
<TouchableOpacity activeOpacity={1} style={cellStyle} onPress={()=>{this.props.onPressAppIconItem && this.props.onPressAppIconItem(url, rowID)}}>
<YH_Image style={imgStyle} url={src} />
<Text style={titleStyle}>{title}</Text>
</TouchableOpacity>
);
}
... ... @@ -55,19 +58,20 @@ export default class AppIconList extends React.Component {
if (!data.length) {
return null;
}
let count = parseInt(this.props.number);
let tail = (data.length%count != 0) ? 1 : 0;
let tail = (data.length % count != 0) ? 1 : 0;
let lineNumber = data.length/count + tail;
let padding = count == 4 ? padding4 : padding5;
let containerHeight = (count == 4 ? 84 : 75) * lineNumber + padding * (lineNumber - 1) + 12*width/320 + 19;
let containerHeight = (count == 4 ? 84 : 75) * lineNumber + padding * (lineNumber - 1) + 12;
let listContainerStyle = styles.brandContainer;
if (this.props.number == '4') {
listContainerStyle = styles.brandContainer4
}
return(
<Image style={[styles.container, {height: containerHeight}]} source={{uri:this.props.backImage}}>
<YH_Image style={[styles.container, {height: containerHeight}]} url={this.props.backImage}>
<ListView
contentContainerStyle={listContainerStyle}
enableEmptySections={true}
... ... @@ -77,7 +81,7 @@ export default class AppIconList extends React.Component {
scrollEnabled={false}
scrollsToTop={false}
/>
</Image>
</YH_Image>
);
return null;
}
... ... @@ -90,12 +94,10 @@ let padding4 = (width - 51*4)/10;
let styles = StyleSheet.create({
container: {
backgroundColor: '#f0f0f0',
backgroundColor: 'white',
},
brandContainer: {
backgroundColor: 'white',
borderColor: 'rgb(215, 215, 215)',
borderBottomWidth: 0.5,
flexDirection: 'row',
flexWrap: 'wrap',
width: width,
... ... @@ -157,4 +159,15 @@ let styles = StyleSheet.create({
height: 51,
},
cellTitle4: {
backgroundColor: 'white',
fontSize: 11,
fontWeight: 'bold',
color: '#444444',
textAlign: 'center',
marginTop: 6*width/320,
marginLeft: 0,
marginRight: 0,
},
});
... ...
... ... @@ -25,7 +25,7 @@ export default class DivideImage extends Component{
render(){
let data = this.props.data ;
let data = this.props.data;
let url = data && data.get(0,{}).get("src",'');
let imageUrl = SlicedImage.getSlicedUrl(url, width, height, 2);
... ... @@ -41,14 +41,14 @@ export default class DivideImage extends Component{
let {width} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;
let height = Math.ceil(15 * DEVICE_WIDTH_RATIO);
let height = 15;
let styles = StyleSheet.create({
container: {
width: width,
height: height,
backgroundColor: "#e5e5e5",
backgroundColor: "#f0f0f0",
},
immage: {
... ...
... ... @@ -37,18 +37,25 @@ export default class PopularSingleProduct extends Component{
let goodsImageUrl = rowData.get('default_images');
goodsImageUrl = SlicedImage.getSlicedUrl(goodsImageUrl, goodsImageWidth, goodsImageHeight, 2);
let goodsPrice = "¥" + rowData.get('sales_price');
let goodsPrice = "¥" + parseFloat(rowData.get('sales_price', 0)).toFixed(2);
let goodsLookNum = rowData.get('sales_num') + "人";
return(
<TouchableOpacity activeOpacity={1}
onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(rowData.toJS())}>
return (
<TouchableOpacity
activeOpacity={1}
onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(rowData.toJS())}
>
<View style={styles.goodsContainer}>
<YH_Image style={styles.goodsImage} url={goodsImageUrl} />
<YH_Image
style={styles.goodsImage}
masksToBounds={true}
radius={{'topLeft':'2','topRight':'2','bottomRight':'2','bottomLeft':'2'}}
url={goodsImageUrl}
/>
<Text style={styles.goodsPrice} numberOfLines={1}>{goodsPrice}</Text>
<Text style={styles.goodsLookNum} numberOfLines={1}>{goodsLookNum}</Text>
<Text style={styles.goodsLookNum} numberOfLines={1}>正在浏览</Text>
<Text style={[styles.goodsLookNum, {marginTop: -5}]} numberOfLines={1}>正在浏览</Text>
</View>
</TouchableOpacity>
... ... @@ -98,8 +105,7 @@ const DEVICE_WIDTH_RATIO = width / 320;
let bannerHeight = Math.ceil(width * 234 / 750);
let goodsImageWidth = Math.ceil(90);
let goodsImageHeight = Math.ceil(120);
width = Math.ceil(width);
let containerHeight = 40 + bannerHeight + 202;
let containerHeight = 40 + bannerHeight + 192;
let styles = StyleSheet.create({
... ... @@ -127,28 +133,30 @@ let styles = StyleSheet.create({
width: 90,
height: 178,
marginLeft: 11,
borderRadius: 3,
backgroundColor: '#f0f0f0',
// backgroundColor: '#f0f0f0',
},
goodsImage: {
width: goodsImageWidth,
height: goodsImageHeight,
borderRadius: 2,
},
goodsPrice: {
width: goodsImageWidth,
height: 20,
fontSize: 12,
fontWeight: 'bold',
color: '#444444',
textAlign: 'center',
marginTop: 3,
marginTop: 5,
},
goodsLookNum: {
width: goodsImageWidth,
height: 15,
fontSize: 10,
fontSize: 9,
fontWeight: 'bold',
color: '#b0b0b0',
textAlign: 'center',
},
... ...
... ... @@ -24,7 +24,7 @@ export default class TrendgoodsTopic extends React.Component {
this.dot = <View
style={{
backgroundColor:'#ededed',
backgroundColor:'rgba(237, 237, 237, 0.5)',
width: 5,
height: 5,
borderRadius: 2.5,
... ... @@ -92,7 +92,7 @@ export default class TrendgoodsTopic extends React.Component {
width={sliderWidth}
height={sliderHeight}
paginationStyle={{
backgroundColor: '#dadada',
backgroundColor: 'rgba(68, 68, 68, 0.2)',
bottom: 50,
height: 10,
width: data.length * 12,
... ...
... ... @@ -12,6 +12,7 @@ import ReactNative, {
TouchableOpacity,
InteractionManager,
Platform,
RefreshControl,
} from 'react-native';
import Immutable, {Map} from 'immutable';
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
... ... @@ -44,7 +45,6 @@ import VipUserFloor from '../floor/VipUserFloor';
import ActivityProductFloor from '../floor/ActivityProductFloor';
import HotCategoryIndividualization from '../floor/HotCategoryIndividualization';
import ProductListCell from '../../../common/components/ListCell/ProductListCell';
import channelTransfer from '../../../common/utils/channelTransfer';
export default class Home extends Component {
... ... @@ -171,6 +171,7 @@ export default class Home extends Component {
<AppHotBrands
data={rowData.get('data')}
onPressTitleMore={this.props.onPressTitleMore}
onPressHotBrandItem={this.props.onPressHotBrandItem}
/>
);
}
... ... @@ -443,6 +444,10 @@ export default class Home extends Component {
return (
<View style={styles.container}>
{
Platform.OS === 'ios' ?
<ListView
ref={(c) => {
this.listView = c;
... ... @@ -463,6 +468,35 @@ export default class Home extends Component {
}}
renderFooter={this._renderFooter}
/>
:
<ListView
ref={(c) => {
this.listView = c;
}}
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
renderRow={this._renderRow}
renderSectionHeader={this._renderSectionHeader}
removeClippedSubviews={true}
enableEmptySections={true}
enablePullToRefresh={true}
isOnPullToRefresh={isPullToRefresh}
refreshControl={
<RefreshControl
refreshing={false}
onRefresh={() => {
this.props.onRefresh && this.props.onRefresh();
}}
colors={['#000000', '#ff0000']}
progressBackgroundColor="#ffffff"
/>
}
onEndReached={() => {
this.props.onEndReached && this.props.onEndReached();
}}
renderFooter={this._renderFooter}
/>
}
</View>
);
}
... ...
... ... @@ -222,9 +222,12 @@ class HomeContainer extends Component {
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
width,
height: height - 64 - 49,
},
});
... ...
... ... @@ -47,11 +47,13 @@ export default class OutletPageListView extends Component {
resource,
} = this.props;
if (resource.get('sort_name')=='即将开始' || resource.get('sort_name') == '即将结束') {
this.props.getOutletActivityList && this.props.getOutletActivityList(resource.get('content_code'));
if (resource.get('sort_name')=='即将开始') {
this.props.getOutletActivityList && this.props.getOutletActivityList(resource.get('content_code'),resource.get('yh_channel'),resource.get('type'));
}else if (resource.get('sort_name') == '即将结束') {
this.props.getOutletActivityList && this.props.getOutletActivityList(resource.get('content_code'),resource.get('yh_channel'),resource.get('type'));
}else {
this.props.getOutletHomeResource && this.props.getOutletHomeResource(resource.get('content_code'),ptr);
this.props.getOutletActivityList && this.props.getOutletActivityList(resource.get('content_code'));
this.props.getOutletActivityList && this.props.getOutletActivityList(resource.get('content_code'),resource.get('yh_channel'),resource.get('type'));
}
}
... ...
... ... @@ -68,8 +68,8 @@ class OutletContainer extends Component {
this.props.actions.getOutletHomeResource(content_code,ptr);
}
_getOutletActivityList(content_code){
this.props.actions.getOutletActivityList(content_code);
_getOutletActivityList(content_code,yh_channel,type){
this.props.actions.getOutletActivityList(content_code,yh_channel,type);
}
_setActivityFliter(content_code,activityMore) {
... ...
... ... @@ -78,10 +78,14 @@ function parseListFromCategory(json) {
json.map((item, i) => {
let url = item.sort_url;
let content_code = GetQueryString(url,'content_code');
let type = GetQueryString(url,'type');
let yh_channel = GetQueryString(url,'yh_channel');
if (!content_code) {
content_code = item.content_code;
}
item.content_code = content_code;
item.type = type?type:0;
item.yh_channel=yh_channel?yh_channel:0;
})
return json;
}
... ... @@ -228,12 +232,12 @@ export function getOutletActivityListFailure(content_code,error) {
}
}
export function getOutletActivityList(content_code) {
export function getOutletActivityList(content_code,yh_channel,type) {
return (dispatch, getState) => {
let {app, outlet} = getState();
let {categoryList} = outlet;
dispatch(getOutletActivityListRequest(content_code));
return new OutletService(app.host).getOutletActivityList(app.yh_channel)
return new OutletService(app.host).getOutletActivityList(yh_channel,type)
.then(json => {
dispatch(getOutletActivityListSuccess({'json':json,'content_code':content_code}));
})
... ...
... ... @@ -68,7 +68,7 @@ export default class OutletService {
});
}
async getOutletActivityList(yh_channel='',platform='2',size=0, type=0){
async getOutletActivityList(yh_channel='',type=0,platform='2',size=0){
return await this.api.get({
url: '',
body: {
... ...
... ... @@ -3,6 +3,6 @@
export function GetQueryString(url,name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = url.match(reg);
var r = url.substr(url.indexOf("\?")+1).match(reg);
if(r!=null)return unescape(r[2]); return null;
}
... ...
... ... @@ -85,9 +85,9 @@ export default class Header extends React.Component {
handleNavigationChange(navState) {
let heightT = parseInt(navState.title, 10) || 0; // turn NaN to 0
this.setState({
heightT>0?this.setState({
realContentHeight: heightT,
});
}):null;
}
shouldStartLoadWithRequest(event) {
... ...
... ... @@ -63,7 +63,7 @@ export default class Title extends React.Component {
}}>
<Image
source={require('../../../brandStore/image/btn_more_p.png')}
style={{width: 22, height: 4,backgroundColor:'white',marginLeft:3}}
style={{width: 22, height: 4,marginLeft:3}}
resizeMode={'contain'}
/>
</TouchableOpacity>:null}
... ...
... ... @@ -71,7 +71,7 @@ export default class RedPersonPicThree extends Component{
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<YH_Image url={backgroundImage1} style={styles.imagetype4}/>
{linkType1=='1'?<View style={styles.maskContainer4}>
<Text style={styles.titleText4}>{name1}</Text>
<Text style={styles.titleText4} numberOfLines={1}>{name1}</Text>
<View style={styles.saleView}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble1?'red':'white',}}>{price1}</Text>
{saleAble1?<Text style={styles.deleteSale}>{sale1}</Text>:null}
... ... @@ -81,7 +81,7 @@ export default class RedPersonPicThree extends Component{
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<YH_Image url={backgroundImage2} style={styles.imagetype4}/>
{linkType2=='1'?<View style={styles.maskContainer4}>
<Text style={styles.titleText4}>{name2}</Text>
<Text style={styles.titleText4} numberOfLines={1}>{name2}</Text>
<View style={styles.saleView}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble2?'red':'white',}}>{price2}</Text>
{saleAble2?<Text style={styles.deleteSale}>{sale2}</Text>:null}
... ... @@ -91,7 +91,7 @@ export default class RedPersonPicThree extends Component{
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<YH_Image url={backgroundImage3} style={styles.imagetype4}/>
{linkType3=='1'?<View style={styles.maskContainer4}>
<Text style={styles.titleText4}>{name3}</Text>
<Text style={styles.titleText4} numberOfLines={1}>{name3}</Text>
<View style={styles.saleView}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble3?'red':'white',}}>{price3}</Text>
{saleAble3?<Text style={styles.deleteSale}>{sale3}</Text>:null}
... ... @@ -299,7 +299,7 @@ let styles = StyleSheet.create({
textAlign :'left',
},
titleText4: {
width:width/3 ,
width:width/3 -10,
height:maskHeight / 2,
color: 'white',
marginLeft: 10,
... ...