Authored by 于良

Merge branch '5.4' into 5.4.1

... ... @@ -58,8 +58,6 @@ export default function native(platform) {
store.dispatch(setServiceHost(this.props.serviceHost));
let type = this.props.type;
console.log('-------------');
console.log(this.props);
if (type == 'list') {
store.dispatch(setListType(this.props.listType));
store.dispatch(setAuthorId(this.props.authorId));
... ...
... ... @@ -176,6 +176,8 @@ let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
width: width,
height: height - 64,
},
contentContainer:{
backgroundColor: 'white',
... ...
... ... @@ -17,7 +17,7 @@ export default class ListService {
return await this.api.get({
url: '/guang/api/v2/article/getList',
body: {
gender,
// gender, // 接口增加此字段后,数据不对,与接口确认后,去掉
sort_id,
uid,
tag,
... ...
... ... @@ -194,6 +194,8 @@ export default class MessageList extends Component {
let {isFetching, endReached, list, listId, shouldShowEmpty} = this.props.data;
let isLoadingMore = list.size != 0 && isFetching;
let isShowLoading = list.size == 0 && isFetching;
if (shouldShowEmpty) {
return (
<View style={styles.container}>
... ... @@ -234,7 +236,7 @@ export default class MessageList extends Component {
}}
/>
<LoadingIndicator
isVisible={isFetching}
isVisible={isShowLoading}
/>
</View>
);
... ...
... ... @@ -61,7 +61,7 @@ export default class ProductListCell extends Component {
<Image style={styles.clockImage} source={require('../../image/time_ic.png')}/>
<Text style={styles.text}>{publish_time}</Text>
<Image style={styles.eyeImage} source={require('../../image/eye_ic.png')}/>
<Text style={styles.text}>{browse}{show10K?'万':''}</Text>
<Text style={styles.eyeText} numberOfLines={1}>{browse}{show10K?'万':''}</Text>
</View>
</View>
... ... @@ -96,6 +96,8 @@ let priceMarginTop = Math.ceil(-4 * DEVICE_WIDTH_RATIO);
let gpSoldOutImageHeight = Math.ceil(25 * DEVICE_WIDTH_RATIO);
let tagHeight = Math.ceil(14 * DEVICE_WIDTH_RATIO);
let footerWidth = Platform.OS === 'ios' ? rowWidth-20 : rowWidth-16;
let styles = StyleSheet.create({
container: {
width: rowWidth,
... ... @@ -136,7 +138,7 @@ let styles = StyleSheet.create({
lineHeight: 22,
},
footContainer: {
width: Platform.OS === 'ios' ? rowWidth-20 : rowWidth-16,
width: footerWidth,
height: 18,
flexDirection: 'row',
alignItems: 'center',
... ... @@ -158,5 +160,12 @@ let styles = StyleSheet.create({
marginLeft: 5,
marginRight: 0,
},
eyeText: {
fontSize: 10,
color: 'white',
marginLeft: 5,
marginRight: 0,
width: width==320?10:28,
},
});
... ...
... ... @@ -12,6 +12,8 @@ const {
TouchableOpacity,
StyleSheet,
Dimensions,
Platform,
} = ReactNative;
export default class Banner extends React.Component {
... ... @@ -56,6 +58,25 @@ export default class Banner extends React.Component {
let width = this.props.width;
let height = this.props.height;
let data = this.props.data.toArray();
width = Math.ceil(width);
height = Math.ceil(height);
if (data.length == 1) {
return (
<TouchableOpacity
activeOpacity={1}
style={{width: width, height: height}}
onPress={() => {
this.props.onPress && this.props.onPress(data[0].get('url'), 0);
}}
>
<SlicedImage
source={{uri: data[0].get('src').replace('{width}', width).replace('{height}', height).replace('{mode}',2)}}
style={{ width: width, height: height}}
/>
</TouchableOpacity>
);
}
return (
<Swiper
... ... @@ -66,7 +87,7 @@ export default class Banner extends React.Component {
autoplayTimeout={this.props.duration}
paginationStyle={{bottom: 8}}
dot={this.dot}
activeDot={this.activeDot}
activeDot={(Platform.OS === 'ios')?this.activeDot:null}
height={height}
>
{data.map((item, i) => {
... ...
... ... @@ -47,7 +47,6 @@ export default class NewArrival extends Component {
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
... ... @@ -329,6 +328,7 @@ export default class NewArrival extends Component {
recommend = [topPart.get('brandList')];
}
let featured = topPart.get('featuredList')&&topPart.get('featuredList').size?[topPart.get('featuredList')]:[];
let dataSource = {
banner,
recommend,
... ... @@ -349,7 +349,7 @@ export default class NewArrival extends Component {
renderRow={this._renderRow}
enableEmptySections={true}
renderSectionHeader={this._renderSectionHeader}
removeClippedSubviews={false}
removeClippedSubviews={true}
renderFooter={()=>{
if (endReached) {
return <View style={styles.placeholder} />;
... ... @@ -365,16 +365,16 @@ export default class NewArrival extends Component {
this.props.onEndReached && this.props.onEndReached();
}
}}
scrollEventThrottle={300}
initialListSize={40}
onScroll={(event) => {
if (this.state.showBackToTopButton && event.nativeEvent.contentOffset.y < height) {
this.setState({showBackToTopButton: false});
}
if (this.state.showBackToTopButton == false && event.nativeEvent.contentOffset.y > height) {
this.setState({showBackToTopButton: true});
}
}}
initialListSize={30}
pageSize={30}
onScrollEndDrag={(event) => {
if (this.state.showBackToTopButton && event.nativeEvent.contentOffset.y < height) {
this.setState({showBackToTopButton: false});
}
if (this.state.showBackToTopButton == false && event.nativeEvent.contentOffset.y > height) {
this.setState({showBackToTopButton: true});
}
}}
/>
{productList.isFilter ?
<NewArrivalCategoryList
... ... @@ -400,6 +400,7 @@ export default class NewArrival extends Component {
style={styles.backToTopButton}
onPress={()=>{
this.listView && this.listView.scrollTo({x: 0, y: 0, animated: true});
this.setState({showBackToTopButton: false});
}}>
<Image style={{flex:1}} source={require('../../image/backtop.png')}/>
</TouchableOpacity>: null
... ... @@ -414,6 +415,8 @@ export default class NewArrival extends Component {
}
let {width, height} = Dimensions.get('window');
width = Math.ceil(width);
height = Math.ceil(height);
let bannerHeight = Math.ceil((363 / 750) * width);
let yPosition = 0;
let rowWidth = Math.ceil(137.5 * width / 320);
... ...
... ... @@ -92,8 +92,8 @@ let styles = StyleSheet.create({
backgroundColor: '#999999',
borderRadius: 8,
flexDirection:'row',
marginLeft: 32,
marginRight: 22,
marginLeft: 28,
marginRight: 18,
justifyContent: 'center',
},
newSaleText: {
... ... @@ -101,6 +101,7 @@ let styles = StyleSheet.create({
fontSize: 9,
color: 'white',
marginTop: 2,
backgroundColor: 'transparent'
},
iconStyle: {
marginTop: 4,
... ...
... ... @@ -84,7 +84,7 @@ let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
width: width,
height: height - 64,
height: height - 30,
backgroundColor: '#f0f0f0',
},
contentContainer: {
... ...
... ... @@ -106,10 +106,13 @@ class NewArrivalContainer extends Component {
);
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
width: width,
height: height,
},
});
... ...
... ... @@ -57,7 +57,9 @@ export default class BrandArticleCell extends Component {
onPress={()=>{
this.props.onPressArticleLike && this.props.onPressArticleLike(id, rowID, !isliked, likeNum)
}}>
<Image style={styles.likeicon} source={likeicon} />
<View><Image style={styles.likeicon} source={likeicon} /></View>
<Text style={likestyle} numberOfLines={1}>{likeNum}</Text>
</TouchableOpacity>
... ... @@ -170,11 +172,13 @@ let styles = StyleSheet.create({
fontSize: 15,
color: '#A5A5A5',
marginLeft: 5,
marginTop: 2,
},
darkgrayfont:{
fontSize: 15,
color: '#444444',
marginLeft: 5,
marginTop: 2,
},
timeicon:{
width: 12,
... ...
... ... @@ -36,7 +36,9 @@ export default class BrandArticleList extends Component {
_renderHeader(){
return(
<View style={styles.headerContainer}>
<Text style={styles.headerText}>相关资讯</Text>
<View style={styles.headerContainerWithoutBorder}>
<Text style={styles.headerText}>相关资讯</Text>
</View>
</View>
);
}
... ... @@ -51,7 +53,7 @@ export default class BrandArticleList extends Component {
onPressArticle={this.props.onPressArticle}
onPressArticleLike={this.props.onPressArticleLike}
/>
);
}
... ... @@ -114,13 +116,17 @@ let styles = StyleSheet.create({
height: 36 * DEVICE_WIDTH_RATIO,
marginLeft: 30 * DEVICE_WIDTH_RATIO,
marginRight: 30 * DEVICE_WIDTH_RATIO,
borderColor: '#e0e0e0',
backgroundColor: "#e0e0e0",
},
headerContainerWithoutBorder: {
marginTop: 0.5 *DEVICE_WIDTH_RATIO,
height: 35.5 * DEVICE_WIDTH_RATIO,
marginLeft: 0.5 * DEVICE_WIDTH_RATIO,
marginRight: 0.5 * DEVICE_WIDTH_RATIO,
flex:1,
justifyContent: 'center',
alignItems: 'center',
borderColor: '#e0e0e0',
borderTopWidth: 0.5,
borderLeftWidth: 0.5,
borderRightWidth: 0.5,
borderBottomWidth: 0,
backgroundColor: "#ffffff",
},
headerText:{
... ...
... ... @@ -44,7 +44,6 @@ function mapDispatchToProps(dispatch) {
class DetailContainer extends Component {
componentDidMount() {
this.props.actions.uidBrandFav();
this.props.actions.brandInfo();
}
... ...
... ... @@ -115,7 +115,8 @@ export function brandInfo(reload = false) {
dispatch(brandInfoSuccess(json));
dispatch(setBrandId(json.brand_id));
dispatch(newArrive());
dispatch(articleByBrand());
dispatch(uidBrandFav(json.brand_id))
dispatch(articleByBrand(json.brand_id));
let isDifferent = json.is_different;
let url = '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + json.brand_id + '","is_different":"' + isDifferent + '"}}';
dispatch(setMoreProductUrl(url));
... ... @@ -187,14 +188,9 @@ export function uidBrandFavFailure(){
};
}
export function uidBrandFav(){
export function uidBrandFav(brandId){
return (dispatch, getState) => {
let {app,detail} = getState();
let {brandId} = detail;
if (!brandId) {
return;
}
let fetchUidBrandFav = (brandId,uid) => {
dispatch(uidBrandFavRequest());
return new DetailService(app.servicehost).getUidBrandFav(brandId,uid)
... ... @@ -272,14 +268,9 @@ export function articleByBrandFailure(){
type: ARTICLE_BY_BRAND_FAILURE,
};
}
export function articleByBrand(){
export function articleByBrand(brandId){
return (dispatch, getState) => {
let {detail,app} = getState();
let {brandId} = detail;
if (!brandId) {
return;
}
let fetchUidBrandFav = (brandId,uid) => {
dispatch(articleByBrandRequest());
return new DetailService(app.servicehost).getArticleByBrand(brandId,uid)
... ...
... ... @@ -104,7 +104,7 @@ export default class DetailService {
url: '',
body: {
method: 'app.favorite.cancel',
id,
fav_id: id,
uid,
type,
}
... ...