Authored by 陈林

Merge branch 'V1230_Date' into 'master'

V1230 date



See merge request !25
... ... @@ -182,9 +182,6 @@ export default class Home extends Component {
return (
<View style={styles.container}>
<GuideModal
isShowGuide={this.props.isShowGuide}
hiddenGuideDialog={this.props.hiddenGuideDialog}/>
<SectionList
stickySectionHeadersEnabled={true}
ref={(ref) => this.sectionList = ref}
... ...
... ... @@ -194,10 +194,8 @@ class HomeContainer extends Component {
return (
<View style={styles.container}>
<Home
isShowGuide={isShowGuide}
resourceInfo={resourceInfo}
data={this.props.app}
hiddenGuideDialog={this._hiddenGuideDialog}
jumpWithUrl={this._jumpWithUrl}
resourceJumpWithUrl={this._resourceJumpWithUrl}
onPressProduct={this._onPressProduct}
... ...
... ... @@ -49,7 +49,10 @@ export default function native(platform) {
} else if (type === 'detail') {
return (
<Provider store={store}>
<GroupPurchaseDetailContainer/>
<GroupPurchaseDetailContainer
FP_NAME={this.props.FP_NAME}
FP_PARAM={this.props.FP_PARAM}
/>
</Provider>
);
}
... ...
... ... @@ -62,7 +62,7 @@ class GroupPurchaseDetailContainer extends Component {
async componentDidMount() {
this.props.actions.getProductList();
this.props.actions.fetchActivityGroupDetail();
this.props.actions.fetchActivityGroupDetail(this.props.FP_NAME, this.props.FP_PARAM);
// this.props.actions.fetchResourceInfo();
}
... ...
... ... @@ -108,7 +108,7 @@ export function activityGroupDetailFailure(error) {
}
}
export function fetchActivityGroupDetail() {
export function fetchActivityGroupDetail(FP_NAME, FP_PARAM) {
return (dispatch, getState) => {
let {app,groupPurchaseDetail} = getState();
let {groupNo} = groupPurchaseDetail;
... ... @@ -117,6 +117,19 @@ export function fetchActivityGroupDetail() {
dispatch(activityGroupDetailRequest());
return new GroupPurchaseService(app.host).fetchActivityGroupDetail(groupNo ,uid)
.then(json => {
// 注释上报事件
// try {
// let event_params = {
// FP_NAME,
// FP_PARAM,
// PRD_ID: '',
// PRD_SKN: json.membershipItems[0].productSkn,
// PRD_TYPE: 1,
// }
// YH_CommonHelper.logEvent('YB_GDS_DT_INFO', event_params);
// } catch (e) {
// console.log(e);
// }
dispatch(activityGroupDetailSuccess(json));
})
.catch(error => {
... ...
... ... @@ -97,11 +97,14 @@ export default class productCell extends Component {
}
}else {
let highPrice = data && parseInt(data.get('highPrice'));
let lowPrice = data && parseInt(data.get('lowPrice'));
let cutPrice = highPrice - lowPrice;
return (
<View style={styles.actionContainer}>
<View style={styles.cutActionContainer}>
<Image source={require('../../images/cutPriceBg.png')} style={styles.cutPriceBg}></Image>
<Text style={styles.cutPrice}>-¥{data && data.get('lowPrice')}</Text>
<Text style={styles.cutPrice}>-¥{cutPrice}</Text>
</View>
</View>
)
... ...
... ... @@ -11,6 +11,8 @@ import HaggleList from '../components/HaggleList'
import LoadingIndicator from '../../common/components/LoadingIndicator';
import { TipsAlertItem, TipsAlert } from '../../common/components/YH_TipsAlert';
import { YHAlert, YHAlertItem } from '../components/cell/YH_Alert.js';
import DeviceInfo from 'react-native-device-info';
import Prompt from '../../common/components/Prompt';
const actions = [
allianceActions,
... ... @@ -38,7 +40,7 @@ function mapDispatchToProps(dispatch) {
class HaggleListContainer extends Component {
constructor(props) {
super(props);
this.state = {showAlert:false, productItem:null};
this.state = {showAlert:false, productItem:null, showVersionAlert:false};
this._onEndReached = this._onEndReached.bind(this);
this._onPressProduct = this._onPressProduct.bind(this);
this._jumpHaggleDetail = this._jumpHaggleDetail.bind(this);
... ... @@ -47,6 +49,7 @@ class HaggleListContainer extends Component {
this._timerStop = this._timerStop.bind(this);
this._resourceJumpWithUrl = this._resourceJumpWithUrl.bind(this);
this._onRefresh = this._onRefresh.bind(this);
this._onPromptHidden = this._onPromptHidden.bind(this);
}
componentDidMount() {
... ... @@ -124,7 +127,17 @@ class HaggleListContainer extends Component {
}
_onPromptHidden() {
this.setState({showVersionAlert:false});
}
_onPressProduct(product) {
let app_version = DeviceInfo.getVersion();
if (Platform.OS === 'ios' && app_version === '6.8.3') {
this.setState({showVersionAlert:true});
return;
}
let {categoryType} = this.props.haggle;
let that = this;
... ... @@ -182,6 +195,13 @@ class HaggleListContainer extends Component {
onRefresh={this._onRefresh}
/>
<LoadingIndicator isVisible={isFetching && !isPullToRefresh}/>
{this.state.showVersionAlert ? <Prompt
text={'您的版本不支持该功能,请更新版本!'}
duration={1600}
onPromptHidden={this._onPromptHidden}
/> : null}
</View>
);
}
... ...
... ... @@ -12,6 +12,7 @@ import ReactNative, {
InteractionManager,
Platform,
RefreshControl,
DeviceEventEmitter,
} from 'react-native';
import TimerMixin from 'react-timer-mixin';
... ... @@ -29,7 +30,16 @@ export default class Message extends Component {
});
}
componentDidMount() {
this.trigggePullToRefresh();
this.viewDidAppear = DeviceEventEmitter.addListener(
'VCDidAppear',
() => {
this.trigggePullToRefresh();
}
);
if(Platform.OS === 'android'){
this.trigggePullToRefresh();
}
}
trigggePullToRefresh() {
... ... @@ -43,6 +53,7 @@ export default class Message extends Component {
}
componentWillUnmount() {
this.viewDidAppear && this.viewDidAppear.remove();
this.timer && TimerMixin.clearTimeout(this.timer);
}
... ...
... ... @@ -23,6 +23,7 @@ export default class MessageCell extends Component {
3: require('../../images/message_new_service_ic.png'),
4: require('../../images/message_other_ic.png'),
5: require('../../images/message_push_ic.png'),
6: require('../../images/message_ufo_ic.png'),
99: require('../../images/message_zxkf_ic.png'),
}
}
... ... @@ -32,7 +33,7 @@ export default class MessageCell extends Component {
if (msgNumber <= 0) {
return null;
}
msgNumber = msgNumber > 9 ? '9+' : msgNumber;
msgNumber = msgNumber > 99 ? '99+' : msgNumber;
return (
<View style={styles.unreadMsgContainer}>
... ... @@ -65,6 +66,9 @@ export default class MessageCell extends Component {
case 5:
text = isEmpty ? '优惠促销、精选夯货推荐' : content;
break;
case 6:
text = isEmpty ? 'UFO出售、购买消息' : content;
break;
case 99:
text = isEmpty ? '服务时间:08:00-22:30' : content;
break;
... ... @@ -158,6 +162,7 @@ let styles = StyleSheet.create({
color: 'white',
backgroundColor: 'transparent',
padding: 5,
top: -2,
},
cellContent: {
flexDirection: 'column',
... ...
... ... @@ -66,6 +66,14 @@ class MessageContainer extends Component {
onPressListItem(item) {
this.props.actions.selectMessageCategory(item);
let id = item.get('id','');
if (id == 6) {
let url = item.get('url','');
NativeModules.YH_CommonHelper.jumpWithUrl(url);
return;
}
NativeModules.YH_CommonHelper.jumpToMessageList(item.toJS());
}
... ...

3.13 KB | W: | H:

2.51 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

7.61 KB | W: | H:

7.18 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -84,12 +84,12 @@ export function selectMessageCategory(item) {
let {latest} = message;
let data = latest.data.toJS();
for (var i = 0; i < data.length; i++) {
let category = data[i]
if (item.get('id') === category.id) {
category.unReadCount = 0;
}
}
// for (var i = 0; i < data.length; i++) {
// let category = data[i]
// if (item.get('id') === category.id) {
// category.unReadCount = 0;
// }
// }
dispatch(selectMessageCategorySucc(data))
}
... ...
... ... @@ -44,6 +44,15 @@ let defaults = Immutable.fromJS([
img_url: '',
},
{
id: 6,
inboxCatName: 'UFO消息',
content: 'UFO出售、购买消息',
unReadCount:0,
createTime:'',
img_url: '',
url:`http://m.yohobuy.com?openby:yohobuy={"action":"go.ufo","params":{"pagename":"message"}}`,
},
{
id: 99,
inboxCatName: '在线客服',
content: '服务时间:08:00-22:30',
... ...
... ... @@ -40,6 +40,10 @@ import {
setGlobalHost,
} from './reducers/app/appActions';
import {
setCurrentTab,
} from './reducers/product/productActions';
function getInitialState() {
const _initState = {
... ... @@ -72,6 +76,7 @@ export default function native(platform) {
store.dispatch(setHost(this.props.host));
store.dispatch(setServiceHost(this.props.serviceHost));
store.dispatch(setGlobalHost(this.props.globalHost));
store.dispatch(setCurrentTab(this.props.productType));
return (
<Provider store={store}>
... ...
... ... @@ -24,11 +24,11 @@ export default class Product extends Component {
super(props);
this.renderRow = this.renderRow.bind(this);
this.renderHeader = this.renderHeader.bind(this);
// this.renderHeader = this.renderHeader.bind(this);
this.handleScroll = this.handleScroll.bind(this);
this.onOpen = this.onOpen.bind(this);
this.onClose = this.onClose.bind(this);
this.renderSectionHeader = this.renderSectionHeader.bind(this);
// this.renderSectionHeader = this.renderSectionHeader.bind(this);
this.renderFooter = this.renderFooter.bind(this);
this.dataSource = new ListView.DataSource({
... ... @@ -148,9 +148,11 @@ export default class Product extends Component {
renderFooter() {
let {
commonProduct,
globalProduct,
currentTab,
} = this.props.data;
if (currentTab == 'common' && commonProduct.get('productList').size == 0) {
if ((currentTab == 'common' && commonProduct.get('productList').size == 0)
|| (currentTab == 'global' && globalProduct.get('productList').size == 0)) {
return (
<NoDataView type={'product'} onPressGuangGuang={this.props.onPressGuangGuang}/>
);
... ... @@ -164,72 +166,61 @@ export default class Product extends Component {
}
}
renderHeader() {
let {
commonProduct,
globalProduct,
editing,
currentTab,
} = this.props.data;
let {productList} = globalProduct;
let {selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
let isShow = currentTab === 'common' && selectedProductList.size > 0;
return (
<View>
{productList.size > 0 ? <TabHeader
currentTab={currentTab}
onPressTab={(tab)=>{
if (tab == currentTab) {
return;
}
this.state.currentlyOpenSwipeable && this.state.currentlyOpenSwipeable.recenter();
this.setState({currentlyOpenSwipeable: null});
this.props.onPressTab && this.props.onPressTab(tab);
}}
/> : null}
{isShow ? <CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/> : null}
</View>
)
}
renderSectionHeader(sectionData, sectionID) {
let {
commonProduct,
globalProduct,
editing,
currentTab,
} = this.props.data;
if (currentTab == 'global') {
return null;
}
if (currentTab == 'common') {
let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
if (selectedProductList.size == 0) {
return null;
}
return (
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/>
);
}
return null;
}
// renderHeader() {
// let {
// commonProduct,
// globalProduct,
// editing,
// currentTab,
// } = this.props.data;
// let {productList} = globalProduct;
// let {selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
// let isShow = currentTab === 'common' && selectedProductList.size > 0;
// return (
// <View>
// {isShow ? <CategorySelector
// data={categoryList}
// selectedCategoryIndex={selectedCategoryIndex}
// onPressCategory={(rowData, rowID) => {
// this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
// this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
// }}
// /> : null}
// </View>
// )
// }
// renderSectionHeader(sectionData, sectionID) {
// let {
// commonProduct,
// globalProduct,
// editing,
// currentTab,
// } = this.props.data;
// if (currentTab == 'global') {
// return null;
// }
// if (currentTab == 'common') {
// let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
// if (selectedProductList.size == 0) {
// return null;
// }
// return (
// <CategorySelector
// data={categoryList}
// selectedCategoryIndex={selectedCategoryIndex}
// onPressCategory={(rowData, rowID) => {
// this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
// this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
// }}
// />
// );
// }
// return null;
// }
render() {
... ... @@ -266,7 +257,7 @@ export default class Product extends Component {
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(dataArray)}
renderRow={this.renderRow}
renderHeader={this.renderHeader}
//renderHeader={this.renderHeader}
// renderSectionHeader={this.renderSectionHeader}
onScroll={this.handleScroll}
renderFooter={this.renderFooter}
... ...
... ... @@ -124,9 +124,12 @@ export default class Product extends Component {
renderFooter() {
let {
commonProduct,
globalProduct,
currentTab,
} = this.props.data;
if (currentTab == 'common' && commonProduct.get('productList').size == 0) {
if ((currentTab == 'common' && commonProduct.get('productList').size == 0)
|| (currentTab == 'global' && globalProduct.get('productList').size == 0)) {
return (
<NoDataView type={'product'} onPressGuangGuang={this.props.onPressGuangGuang}/>
);
... ... @@ -141,60 +144,61 @@ export default class Product extends Component {
}
renderHeader() {
let {
commonProduct,
globalProduct,
editing,
currentTab,
} = this.props.data;
let {productList} = globalProduct;
if (productList.size == 0) {
return null;
}
return (<TabHeader
currentTab={currentTab}
onPressTab={(tab)=>{
if (tab == currentTab) {
return;
}
this.props.onPressTab && this.props.onPressTab(tab);
}}
/>)
return null;
// let {
// commonProduct,
// globalProduct,
// editing,
// currentTab,
// } = this.props.data;
// let {productList} = globalProduct;
// if (productList.size == 0) {
// return null;
// }
// return (<TabHeader
// currentTab={currentTab}
// onPressTab={(tab)=>{
// if (tab == currentTab) {
// return;
// }
// this.props.onPressTab && this.props.onPressTab(tab);
// }}
// />)
}
renderSectionHeader(sectionData, sectionID) {
let {
commonProduct,
globalProduct,
editing,
currentTab,
} = this.props.data;
if (currentTab == 'global') {
return null;
}
let realHeight = 44;
let {productList} = globalProduct;
if (productList.size != 0) {
realHeight += 45;
}
if (currentTab == 'common') {
let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
if (selectedProductList.size == 0) {
return null;
}
return (
<CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
this.sectionList && this.sectionList.scrollToLocation({itemIndex: 0,sectionIndex: 0, viewOffset: realHeight, animated: false});
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/>
);
}
return null;
// let {
// commonProduct,
// globalProduct,
// editing,
// currentTab,
// } = this.props.data;
// if (currentTab == 'global') {
// return null;
// }
// let realHeight = 44;
// let {productList} = globalProduct;
// if (productList.size != 0) {
// realHeight += 45;
// }
// if (currentTab == 'common') {
// let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
// if (selectedProductList.size == 0) {
// return null;
// }
// return (
// <CategorySelector
// data={categoryList}
// selectedCategoryIndex={selectedCategoryIndex}
// onPressCategory={(rowData, rowID) => {
// this.sectionList && this.sectionList.scrollToLocation({itemIndex: 0,sectionIndex: 0, viewOffset: realHeight, animated: false});
// this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
// }}
// />
// );
// }
}
render() {
... ... @@ -208,8 +212,9 @@ export default class Product extends Component {
let dataArray = [];
let isLoading = false;
let showList = (commonProduct.get('productList').size && !commonProduct.get('isFetching')) || (globalProduct.get('productList').size && !commonProduct.get('isFetching'));
let showEmpty = commonProduct.get('showEmpty') && globalProduct.get('showEmpty');
let showList = (commonProduct.get('productList').size && !commonProduct.get('isFetching')) || (globalProduct.get('productList').size && !globalProduct.get('isFetching'));
let showEmpty = (currentTab == 'common' && commonProduct.get('showEmpty')) || (currentTab == 'global' && globalProduct.get('showEmpty'));
let categoryId = 0;
if (currentTab == 'common') {
let {isFetching, selectedProductList, categoryList, selectedCategoryIndex, isDeleting} = commonProduct;
... ...
... ... @@ -65,5 +65,7 @@ export default keyMirror({
SET_PRODUCT_TAB: null,
SET_EDITING: null,
SET_EDITED_INDEX: null,
SET_CATEGORY_LIST: null,
SET_CATEGORY_LIST: null,
SET_CURRENT_TAB: null,
});
... ...
... ... @@ -28,8 +28,17 @@ const {
SET_EDITING,
SET_EDITED_INDEX,
SET_CATEGORY_LIST,
SET_CURRENT_TAB,
} = require('../../constants/actionTypes').default;
export function setCurrentTab(tab) {
return {
type: SET_CURRENT_TAB,
payload: tab
};
}
export function setCategoryList(categoryList) {
return (dispatch) => {
dispatch({
... ... @@ -342,11 +351,11 @@ export function deleteCommon(product_id, index) {
productList = productList.delete(indexInAll);
}
dispatch(commonDeleteSuccess({productList, selectedProductList}));
if (selectedProductList.size == 0) {
dispatch(setSelectedCategory(-1, 0));
let newCategoryList =categoryList.delete(selectedCategoryIndex);
dispatch(setCategoryList(newCategoryList));
}
// if (selectedProductList.size == 0) {
// dispatch(setSelectedCategory(-1, 0));
// let newCategoryList =categoryList.delete(selectedCategoryIndex);
// dispatch(setCategoryList(newCategoryList));
// }
let show = productList.size > 0;
ReactNative.NativeModules.YH_RecorderHelper.setRightEditButtonVisiblity(show);
})
... ... @@ -410,11 +419,11 @@ export function deleteGlobal(skn, index) {
let {productList} = globalProduct;
productList = productList.delete(index);
dispatch(globalDeleteSuccess({productList}));
if (productList.size == 0) {
dispatch(setProductTab('common'));
let show = commonProduct.get('productList').size > 0;
ReactNative.NativeModules.YH_RecorderHelper.setRightEditButtonVisiblity(show);
}
// if (productList.size == 0) {
// dispatch(setProductTab('common'));
// let show = commonProduct.get('productList').size > 0;
// ReactNative.NativeModules.YH_RecorderHelper.setRightEditButtonVisiblity(show);
// }
dispatch(setEditedIndex(-1));
})
.catch(error => {
... ...
... ... @@ -26,13 +26,21 @@ const {
SET_EDITING,
SET_EDITED_INDEX,
SET_CATEGORY_LIST,
SET_CURRENT_TAB,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
export default function productReducer(state=initialState, action) {
switch(action.type) {
case SET_CURRENT_TAB: {
console.log("chenlin")
console.log(action.payload)
return state.set('currentTab', action.payload);
}
case SET_EDITED_INDEX: {
let rowID = action.payload;
let {
... ...