Authored by 陈林

增加了个人中心切换频道。review by 李犇。

... ... @@ -69,6 +69,7 @@ export default class MineList extends React.Component {
return (
<MineListHeader
isNeedShowXsrz={this.props.isNeedShowXsrz}
channel={this.props.channel}
profile={this.props.profile}
mineInfoNum={this.props.mineInfoNum}
redPackageNum={this.props.redPackageNum}
... ...
... ... @@ -169,6 +169,7 @@ export default class MineListHeader extends React.Component {
let localUid = '0';
let {
isNeedShowXsrz,
channel,
profile,
mineInfoNum,
redPackageNum,
... ... @@ -373,12 +374,6 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
</View>
</Image>
<View style={{
width: width,
height: 10,
backgroundColor: '#f0f0f0',
}}/>
{profile.uid != '0' && certificationInfo && certificationInfo.isBindedOrRelated === 'N' ?
<TouchableOpacity activeOpacity={1} onPress={() => this.props.onPressItem('mineCertification','')}>
<View style={styles.sub_row}>
... ... @@ -420,11 +415,31 @@ export default class MineListHeader extends React.Component {
}
{(profile.uid != '0' && (certificationInfo.isBindedOrRelated === 'N') || (announcement && announcement.open === 'Y')) ?
<View style={{
width: width,
height: 0.5,
backgroundColor: '#f0f0f0',}}/>
: null
}
<TouchableOpacity activeOpacity={1} onPress={() => this.props.onPressItem('mineChangeChannel','')}>
<View style={styles.row}>
<Text style={[styles.icon_text,{fontSize:17, fontWeight:'bold'}]} numberOfLines={1}>
切换购物频道
</Text>
<Text style={{
marginRight: 5,
fontSize:14,
color:'#b0b0b0',
}} numberOfLines={1}>
{channel == '2' ? '女士WOMEN':'男士MEN'}
</Text>
<Image style={styles.arrow} source={require('../../image/arrow_gray.png')}/>
</View>
</TouchableOpacity>
<View style={{
width: width,
height: 10,
backgroundColor: '#f0f0f0',
}}/> : null
}
}}/>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.onPressItem('mineOrder','')}>
<View style={styles.row}>
<Text style={[styles.icon_text,{fontSize:17, fontWeight:'bold'}]} numberOfLines={1}>
... ...
... ... @@ -60,6 +60,8 @@ export default keyMirror({
GET_ANNOUNCEMENT_SUCCESS:null,
GET_ANNOUNCEMENT_FAILURE:null,
GET_CURRENT_CHANNEL_SUCCESS:null,
GET_GLOBALORDERSTATE_REQUEST:null,
GET_GLOBALORDERSTATE_SUCCESS:null,
GET_GLOBALORDERSTATE_FAILURE:null,
... ...
... ... @@ -194,6 +194,11 @@ class MineContainer extends Component {
}
NativeModules.YH_CommonHelper.logEvent('YB_MY_NOTICE_C', params);
break;
case 'mineChangeChannel':
//切换购物频道
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.channelpage","params":{"changechannel":"Y"}}`;
//NativeModules.YH_CommonHelper.logEvent('YB_MY_GO_BIND_C', {});
break;
case 'mineOrder':
//我的订单
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.order","params":{"index":"0"}}`;
... ... @@ -368,6 +373,7 @@ class MineContainer extends Component {
render() {
let {
isFetching,
channel,
isNeedShowXsrz,
isLogin,
open,
... ... @@ -389,6 +395,7 @@ class MineContainer extends Component {
<View style={styles.container}>
<MineList
isFetching={isFetching}
channel={channel}
isNeedShowXsrz={isNeedShowXsrz}
isLogin={isLogin}
productListForMineCenter={open.productListForMineCenter}
... ...
... ... @@ -60,6 +60,8 @@ const {
GET_ANNOUNCEMENT_SUCCESS,
GET_ANNOUNCEMENT_FAILURE,
GET_CURRENT_CHANNEL_SUCCESS,
GET_GLOBALORDERSTATE_REQUEST,
GET_GLOBALORDERSTATE_SUCCESS,
GET_GLOBALORDERSTATE_FAILURE,
... ... @@ -297,6 +299,13 @@ export function getAnnouncementFailure() {
}
}
export function getCurrentChannelSuccess(json) {
return {
type: GET_CURRENT_CHANNEL_SUCCESS,
payload: json,
}
}
export function getGlobalOrderStateSuccess(json) {
return {
type: GET_GLOBALORDERSTATE_SUCCESS,
... ... @@ -722,6 +731,23 @@ export function getAnnouncement() {
}
}
export function getCurrentChannel() {
return (dispatch, getState) => {
let {app, mine} = getState();
let channel;
Promise.all([
ReactNative.NativeModules.YH_CommonHelper.currentChannel()
]).then(result => {
channel = result[0];
dispatch(getCurrentChannelSuccess(channel));
})
.catch(error => {
});
}
}
export function getGlobalOrderState() {
return (dispatch, getState) => {
let {app, mine} = getState();
... ... @@ -778,6 +804,7 @@ export function onMineCenterRefresh() {
dispatch(getEnvelopesItem());
dispatch(getCertificationData());
dispatch(getAnnouncement());
dispatch(getCurrentChannel());
dispatch(getGlobalOrderState());
if (Platform.OS === 'android') {
dispatch(getNewCouponInfo());
... ...
... ... @@ -4,6 +4,7 @@ import {Record, List, Map} from 'immutable';
let InitialState = Record({
isFetching: false,
channel: 1,
isNeedShowXsrz:true,
delayExposeData:true,
open: new (Record({
... ...
... ... @@ -57,6 +57,8 @@ const {
GET_ANNOUNCEMENT_SUCCESS,
GET_ANNOUNCEMENT_FAILURE,
GET_CURRENT_CHANNEL_SUCCESS,
GET_GLOBALORDERSTATE_REQUEST,
GET_GLOBALORDERSTATE_SUCCESS,
GET_GLOBALORDERSTATE_FAILURE,
... ... @@ -357,6 +359,10 @@ export default function appReducer(state = initialState, action) {
break;
}
case GET_CURRENT_CHANNEL_SUCCESS: {
return state.set("channel", action.payload);;
}
case GET_GLOBALORDERSTATE_SUCCESS: {
let {
hasOrder,
... ...