Authored by 鹿亮亮

Merge remote-tracking branch 'origin/5.5.0' into 5.5.0

... ... @@ -9,6 +9,8 @@ import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
import {getSlicedUrl} from '../../utils/Utils';
import DeviceInfo from 'react-native-device-info';
import RecyclerSwiper from '../../../common/recycler-swiper/recyclerswiper'
const {
View,
... ... @@ -19,6 +21,8 @@ const {
Platform,
} = ReactNative;
const YH_Swiper = (Platform.OS === 'ios') ? Swiper : RecyclerSwiper;
export default class BrandSwiper extends React.Component {
constructor(props) {
... ... @@ -26,7 +30,7 @@ export default class BrandSwiper extends React.Component {
this.dot = <View
style={{
backgroundColor:'rgba(255,255,255,.5)',
backgroundColor:'rgba(237, 237, 237, 0.5)',
width: 6,
height: 6,
borderRadius: 3,
... ... @@ -103,7 +107,7 @@ export default class BrandSwiper extends React.Component {
} else {
return (
<View style={styles.container}>
<Swiper
<YH_Swiper
style={styles.banner}
showsButtons={false}
loop={true}
... ... @@ -133,7 +137,7 @@ export default class BrandSwiper extends React.Component {
</TouchableOpacity>
);
})}
</Swiper>
</YH_Swiper>
</View>
);
}
... ...
... ... @@ -33,11 +33,13 @@ export default class HotCategoryList extends Component{
return(
<View style={styles.headerContainer}>
<Text style={styles.headerText}>{title}</Text>
<TouchableOpacity style={styles.headerMore} activeOpacity={1} onPress={() => this.props.onPressCategoryBMore && this.props.onPressCategoryBMore()}>
<Text style={styles.headerMoreText}>MORE</Text>
<Image style={styles.headerMoreArrow} source={require("../../images/category_b_arrow.png")}/>
</TouchableOpacity>
<View style={styles.headerTextContainer}>
<Text style={styles.headerText}>{title}</Text>
<TouchableOpacity style={styles.headerMore} activeOpacity={1} onPress={() => this.props.onPressCategoryBMore && this.props.onPressCategoryBMore()}>
<Text style={styles.headerMoreText}>MORE</Text>
<Image style={styles.headerMoreArrow} source={require("../../images/category_b_arrow.png")}/>
</TouchableOpacity>
</View>
<View style={styles.headerLine}/>
</View>
);
... ... @@ -116,18 +118,21 @@ let styles = StyleSheet.create({
backgroundColor: '#ffffff',
},
headerText:{
headerTextContainer:{
position: 'absolute',
left: 5 * DEVICE_WIDTH_RATIO,
bottom: 11 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems:'center',
},
headerText:{
flex: 1,
fontSize: 12 * DEVICE_WIDTH_RATIO,
color: '#B0B0B0',
},
headerMore:{
position: 'absolute',
right: 5 * DEVICE_WIDTH_RATIO,
bottom: 11 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
... ...
... ... @@ -50,11 +50,13 @@ export default class Detail extends Component {
style={styles.tag}>
{data.get('brand_info').get('brand_domain')}
</Text>
<Text
{data.get('middle_sort_name')&&data.get('middle_sort_name').length?
<Text
onPress={()=>{this.props.onPressTag&&this.props.onPressTag(data.get('middle_sort_name'))}}
style={styles.tag}>
{data.get('middle_sort_name')}
</Text>
</Text>:null}
</View>
</View>
);
... ...
... ... @@ -52,7 +52,10 @@ export default class List extends Component {
let {products, banner} = this.props.resource;
let isProductListFetching = products.isFetching;
let list = products.list && products.list.toJS();
let list = [];
if (products.list && products.list.toJS()) {
list = products.list.toJS();
}
let bannerData = [];
if (banner.data && banner.data.toJS()) {
let bannerDataArray = banner.data.toJS();
... ... @@ -64,8 +67,8 @@ export default class List extends Component {
'banner': bannerData.length ? [bannerData] : [],
'list': list ? list : [],
};
let isFetching = (isProductListFetching && products.page == 0) || banner.isFetching;
let isFetching = (products.isFetching&&!products.ptr&&!dataBlob.list.length);
let isFetchingAndroid = !products.isFetching && !banner.isFetching;
return (
<View style={styles.container}>
{
... ... @@ -77,7 +80,7 @@ export default class List extends Component {
dataSource={this.dataSource.cloneWithRowsAndSections(dataBlob)}
renderRow={this.renderRow}
enablePullToRefresh={true}
isOnPullToRefresh={isFetching}
isOnPullToRefresh={isProductListFetching&&products.ptr}
onRefreshData={() => {
this.props.onRefresh && this.props.onRefresh();
}}
... ... @@ -106,7 +109,7 @@ export default class List extends Component {
enablePullToRefresh={true}
refreshControl={
<YH_PtrRefresh
refreshing={isFetching}
refreshing={isFetchingAndroid}
onRefresh={() => {
this.props.onRefresh && this.props.onRefresh();
}}
... ...
... ... @@ -55,7 +55,7 @@ class ListContainer extends Component {
componentDidMount() {
this.props.actions.fetchBanner();
this.props.actions.getProductList();
this.props.actions.getProductList(false);
}
componentWillUnmount() {
... ... @@ -111,7 +111,7 @@ class ListContainer extends Component {
_onEndReached() {
InteractionManager.runAfterInteractions(() => {
this.props.actions.getProductList();
this.props.actions.getProductList(false);
});
}
... ...
... ... @@ -16,7 +16,7 @@ const {
FETCH_BANNER_FAILURE,
} = require('../../constants/actionTypes').default;
export function getProductList(reload = false) {
export function getProductList(reload) {
return (dispatch, getState) => {
let {app, list} = getState();
let {products} = list;
... ... @@ -26,10 +26,10 @@ export function getProductList(reload = false) {
}
let fetchList = (channel, gender, uid, page, pageSize) => {
dispatch(getProductListRequest());
dispatch(getProductListRequest(reload));
return new ListService(app.host).getProductListData(channel, gender, uid, page, pageSize)
.then(json => {
let count = products.list&&products.list.size();
let count = products.list&&products.list.size;
let payload = parseProductList(json, count);
NativeModules.YH_CommonHelper.logEvent('YB_FIND_GOOD_GDS_L', payload.logParam);
... ... @@ -98,9 +98,10 @@ function parseProductList(json, count) {
};
}
export function getProductListRequest() {
export function getProductListRequest(reload) {
return {
type: GET_PRODUCT_LIST_REQUEST,
payload: reload,
};
}
... ...
... ... @@ -9,6 +9,7 @@ let InitialState = Record({
data: null,
})),
products: new (Record({
ptr: false,
isFetching: false,
error: null,
list: null,
... ...
... ... @@ -17,7 +17,9 @@ const initialState = new InitialState;
export default function listReducer(state=initialState, action) {
switch(action.type) {
case GET_PRODUCT_LIST_REQUEST: {
return state.setIn(['products', 'isFetching'], true);
let newState = state.setIn(['products', 'isFetching'], true)
.setIn(['products', 'ptr'], action.payload);
return newState;
}
case GET_PRODUCT_LIST_SUCCESS: {
let {
... ... @@ -26,9 +28,11 @@ export default function listReducer(state=initialState, action) {
pageCount,
total,
endReached,
reload,
} = action.payload;
let newState = state.setIn(['products', 'isFetching'], false)
.setIn(['products', 'ptr'], reload)
.setIn(['products', 'error'], null)
.setIn(['products', 'list'], Immutable.fromJS(list))
.setIn(['products', 'currentPage'], currentPage)
... ... @@ -40,7 +44,8 @@ export default function listReducer(state=initialState, action) {
}
case GET_PRODUCT_LIST_FAILURE: {
return state.setIn(['products', 'isFetching'], false)
.setIn(['products', 'error'], action.payload);
.setIn(['products', 'error'], action.payload)
.setIn(['products', 'ptr'], false);
}
case FETCH_BANNER_REQUEST: {
return state.setIn(['banner', 'isFetching'], true);
... ...
... ... @@ -85,7 +85,7 @@ class BirthContainer extends Component {
let rec_id = product && product.get('rec_id', "");
let params = {
TYPE_ID: 8,
I_INDEX: rowId + 1,
I_INDEX: parseInt(rowId) + 1 + '',
PRD_ID: productId,
REC_ID: rec_id,
};
... ...
... ... @@ -81,7 +81,7 @@ class FastExpressContainer extends Component {
let rec_id = product && product.get('rec_id', "");
let params = {
TYPE_ID: 7,
I_INDEX: rowId + 1,
I_INDEX: parseInt(rowId) + 1 + '',
PRD_ID: productId,
REC_ID: rec_id,
};
... ...
... ... @@ -80,8 +80,7 @@ class YearActivityContainer extends Component {
let rec_id = product && product.get('rec_id', "");
let params = {
TYPE_ID: 11,
ENT_ID: "",
I_INDEX: rowId + 1,
I_INDEX: parseInt(rowId) + 1 + '',
PRD_ID: productId,
REC_ID: rec_id,
};
... ...
... ... @@ -20,6 +20,8 @@ export default class yearActivityService {
select_gender: channel,
limit,
page,
gender:'',
yh_channel:channel,
}
})
.then((json) => {
... ...