Authored by 李犇

个人中心图标获取本地存储——review by 陈林

... ... @@ -54,6 +54,7 @@ export default class MineList extends React.Component {
certificationInfo={this.props.certificationInfo}
announcement={this.props.announcement}
globalOrderData={this.props.globalOrderData}
iconAll={this.props.iconAll}
/>
);
}
... ...
... ... @@ -167,7 +167,8 @@ export default class MineListHeader extends React.Component {
showRedPacket,
certificationInfo,
announcement,
globalOrderData
globalOrderData,
iconAll,
} = this.props;
let oHigh = 0;
... ... @@ -208,7 +209,7 @@ export default class MineListHeader extends React.Component {
}}>
<Image style={styles.user_img}
source={{uri: YH_Image.getSlicedUrl(profile.head_ico, 60, 60, 2)}}
resizeMode={'contain'}/>
resizeMode={'cover'}/>
<View style={{
flexDirection:'column',
flex:1,
... ... @@ -289,7 +290,7 @@ export default class MineListHeader extends React.Component {
}}>
<TouchableOpacity onPress={() => this.props.onPressItem('mineLogin','')}>
<Text style={styles.login_text} numberOfLines={1}>
/注册
/注册
</Text>
</TouchableOpacity>
</View>
... ... @@ -410,7 +411,9 @@ export default class MineListHeader extends React.Component {
<View style={styles.order_container}>
<TouchableOpacity onPress={() => this.props.onPressItem('dfkOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_dfk.png')}/>
{
iconAll.willPay.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.willPay.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/dd_icon_dfk.png')}/>
}
<Text style={styles.order_text}>待付款</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMineOrderNumberPoint(mineInfoNum.wait_pay_num) : null
... ... @@ -419,7 +422,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('dfhOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_dfh.png')}/>
{
iconAll.willDeliver.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.willDeliver.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/dd_icon_dfh.png')}/>
}
<Text style={styles.order_text}>待发货</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMineOrderNumberPoint(mineInfoNum.send_cargo_num) : null
... ... @@ -428,7 +433,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('dshOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_dsh.png')}/>
{
iconAll.willReceived.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.willReceived.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/dd_icon_dsh.png')}/>
}
<Text style={styles.order_text}>待收货</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMineOrderNumberPoint(mineInfoNum.wait_cargo_num) : null
... ... @@ -437,7 +444,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('dsdOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/wddd_icon_dpj.png')}/>
{
iconAll.willComment.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.willComment.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/wddd_icon_dpj.png')}/>
}
<Text style={styles.order_text}>待晒单</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMineOrderNumberPoint(mineInfoNum.toShareOrderNum) : null
... ... @@ -446,7 +455,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('thhOrder','')}>
<View style={styles.order_content}>
<Image style={styles.icon_image} source={require('../../image/dd_icon_thh.png')}/>
{
iconAll.reback.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.reback.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/dd_icon_thh.png')}/>
}
<Text style={styles.order_text}>退/换货</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMineOrderNumberPoint(mineInfoNum.refund_exchange_num) : null
... ... @@ -498,7 +509,9 @@ export default class MineListHeader extends React.Component {
<View style={styles.order_container}>
<TouchableOpacity onPress={() => this.props.onPressItem('mineCoupon','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image} source={require('../../image/zc_icon_yhq_red.png')}/>
{
iconAll.coupon.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.coupon.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/zc_icon_yhq.png')}/>
}
<Text style={styles.order_text}>优惠券</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMinePropertyNumberPoint(mineInfoNum.coupon_num) : null
... ... @@ -507,7 +520,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('mineYohoCoin','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image} source={require('../../image/yh_mine_yoho_coin.png')}/>
{
iconAll.yohoCoin.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.yohoCoin.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/yh_mine_yoho_coin.png')}/>
}
<Text style={styles.order_text}>有货币</Text>
{
... ... @@ -518,8 +533,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('mineLimitCode','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image}
source={require('../../image/yh_mine_limitcode_icon.png')}/>
{
iconAll.myLimitCode.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.myLimitCode.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/yh_mine_limitcode_icon.png')}/>
}
<Text style={styles.order_text}>限购码</Text>
{
(profile.uid != '0' && mineInfoNum) ? this._renderMinePropertyNumberPoint(mineInfoNum.limitCodeNum) : null
... ... @@ -528,7 +544,9 @@ export default class MineListHeader extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.onPressItem('mineInstallment','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image} source={require('../../image/yh_mine_fenqi_icon.png')}/>
{
iconAll.instalment.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.instalment.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/yh_mine_fenqi_icon.png')}/>
}
<Text style={styles.order_text}>有货分期</Text>
{
(profile.uid != '0') ? this._renderMinePropertyNumberPoint(0) : this._renderMinePropertyNumberPoint('去开通')
... ... @@ -538,8 +556,9 @@ export default class MineListHeader extends React.Component {
{showRedPacket && showRedPacket.open === 'Y' ?
<TouchableOpacity onPress={() => this.props.onPressItem('mineRedPackage','')}>
<View style={styles.asset_content}>
<Image style={styles.icon_image}
source={require('../../image/yh_mine_redbag_icon.png')}/>
{
iconAll.redPackets.isExist ? <Image style={styles.icon_image} source={{uri:iconAll.redPackets.default_ico}}/> : <Image style={styles.icon_image} source={require('../../image/yh_mine_redbag_icon.png')}/>
}
<Text style={styles.order_text}>红包</Text>
{
(profile.uid != '0' && redPackageNum) ? this._renderMinePropertyNumberPoint(redPackageNum.redpacket_num) : null
... ... @@ -555,7 +574,9 @@ export default class MineListHeader extends React.Component {
}}/>
<TouchableOpacity onPress={() => this.props.onPressItem('mineGuang','')}>
<View style={styles.row}>
<Image style={styles.row_icon} source={require('../../image/mine_collectionTiezi_icon.png')}/>
{
iconAll.myguang.isExist ? <Image style={styles.row_icon} source={{uri:iconAll.myguang.default_ico}}/> : <Image style={styles.row_icon} source={require('../../image/mine_collectionTiezi_icon.png')}/>
}
<Text style={styles.icon_text} numberOfLines={1}>
我的逛
</Text>
... ... @@ -570,7 +591,9 @@ export default class MineListHeader extends React.Component {
}}/>
<TouchableOpacity onPress={() => this.props.onPressItem('mineShareOrder','')}>
<View style={styles.row}>
<Image style={styles.row_icon} source={require('../../image/shaidan.png')}/>
{
iconAll.myList.isExist ? <Image style={styles.row_icon} source={{uri:iconAll.myList.default_ico}}/> : <Image style={styles.row_icon} source={require('../../image/shaidan.png')}/>
}
<Text style={styles.icon_text} numberOfLines={1}>
我的晒单
</Text>
... ... @@ -587,8 +610,9 @@ export default class MineListHeader extends React.Component {
backgroundColor: '#e5e5e5',
}}/>
<View style={styles.row}>
<Image style={styles.row_icon} resizeMode={'contain'}
source={require('../../image/mine_bill_icon.png')}/>
{
iconAll.vipBill.isExist ? <Image style={styles.row_icon} resizeMode={'contain'} source={{uri:iconAll.vipBill.default_ico}}/> : <Image style={styles.row_icon} resizeMode={'contain'} source={require('../../image/mine_bill_icon.png')}/>
}
<Text style={styles.icon_text} numberOfLines={1}>
会员账单信息
</Text>
... ... @@ -613,7 +637,9 @@ export default class MineListHeader extends React.Component {
item.get('state') === 1?
<TouchableOpacity key={i} onPress={() => this.props.onPressItem('mineActivity',item)}>
<View style={styles.row}>
<Image style={styles.row_icon} source={require('../../image/mine_activity_icon.png')}/>
{
iconAll.invite.isExist ? <Image style={styles.row_icon} source={{uri:iconAll.invite.default_ico}}/> : <Image style={styles.row_icon} source={require('../../image/mine_activity_icon.png')}/>
}
<Text style={styles.icon_text} numberOfLines={1}>
{item.get('act_name')}
</Text>
... ... @@ -644,8 +670,9 @@ export default class MineListHeader extends React.Component {
<TouchableOpacity onPress={() => this.props.onPressItem('mineFeedback','')}>
<View style={styles.row}>
<Image style={styles.row_icon} resizeMode={'contain'}
source={require('../../image/mine_servicefeedback_icon.png')}/>
{
iconAll.suggestion.isExist ? <Image style={styles.row_icon} resizeMode={'contain'} source={{uri:iconAll.suggestion.default_ico}}/> : <Image style={styles.row_icon} resizeMode={'contain'} source={require('../../image/mine_servicefeedback_icon.png')}/>
}
<Text style={styles.icon_text} numberOfLines={1}>
服务与反馈
</Text>
... ... @@ -837,7 +864,6 @@ let styles = StyleSheet.create({
borderRadius: 30,
borderColor: 'white',
borderWidth: (Platform.OS === 'ios' ? 1.0 : 1.5) / PixelRatio.get(),
resizeMode: 'contain',
},
user_level: {
width: 45,
... ...
... ... @@ -56,4 +56,6 @@ export default keyMirror({
GET_GLOBALORDERSTATE_REQUEST:null,
GET_GLOBALORDERSTATE_SUCCESS:null,
GET_GLOBALORDERSTATE_FAILURE:null,
GET_MINEALLICON_SUCCESS:null,
});
... ...
... ... @@ -119,6 +119,7 @@ class MineContainer extends Component {
this.props.actions.getCertificationData();
this.props.actions.getAnnouncement();
this.props.actions.getGlobalOrderState();
this.props.actions.getMineAllIcon();
}
componentWillUnmount() {
... ... @@ -235,7 +236,7 @@ class MineContainer extends Component {
NativeModules.YH_CommonHelper.logEvent('YB_MY_STROLL', {});
break;
case 'mineShareOrder':
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.shareorder","params":{}}`;
url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.shareOrder","params":{}}`;
NativeModules.YH_CommonHelper.logEvent('YB_MY_SHOW', {});
break;
case 'mineMemberInfo':
... ... @@ -306,9 +307,8 @@ class MineContainer extends Component {
certificationInfo,
announcement,
globalOrderData,
iconAll,
} = this.props.mine;
console.log("open");
console.log(activityListInfo);
return (
<MineList
isFetching={isFetching}
... ... @@ -324,6 +324,7 @@ class MineContainer extends Component {
certificationInfo={certificationInfo}
announcement={announcement}
globalOrderData={globalOrderData}
iconAll={iconAll}
onPressItem={this._onPressItem}
onPressProductListProduct={this._onPressProductListProduct}
... ...
... ... @@ -62,6 +62,8 @@ const {
GET_GLOBALORDERSTATE_SUCCESS,
GET_GLOBALORDERSTATE_FAILURE,
GET_MINEALLICON_SUCCESS,
} = require('../../constants/actionTypes').default;
export function productListForInstallmentRequest() {
... ... @@ -244,6 +246,13 @@ export function getGlobalOrderStateFailure() {
}
}
export function getMineAllIconSuccess(json) {
return {
type: GET_MINEALLICON_SUCCESS,
payload: json,
}
}
export function productListForInstallment() {
return (dispatch, getState) => {
let {app, mine} = getState();
... ... @@ -427,8 +436,8 @@ export function getMineActivity() {
console.log('----getMineActivity-----');
return new MineService(app.host).getMineActivity()
.then(json => {
// 成功获取活动数据后,调用原生的getMineActivityNew方法获取是否点击过该活动,决定页面是否展示小红点
ReactNative.NativeModules.YH_MineHelper.getMineActivityNew(json)
// 成功获取活动数据后,调用原生的getMineActivityWithClicked方法获取是否点击过该活动,决定页面是否展示小红点
ReactNative.NativeModules.YH_MineHelper.getMineActivityWithClicked(json)
.then(data => {
// 如果成功获取到活动关联的小红点数据,那么就返回由原生方法返回的data数据
let result = data;
... ... @@ -528,11 +537,9 @@ export function getGlobalOrderState() {
console.log('----getMineRedPackageNum-----');
return new MineService(app.globalApiHost).getGlobalOrderState()
.then(json => {
console.log(json);
dispatch(getGlobalOrderStateSuccess(json));
})
.catch(error => {
console.log(error);
});
};
... ... @@ -544,4 +551,24 @@ export function getGlobalOrderState() {
dispatch(getGlobalOrderStateFailure());
});
}
}
export function getMineAllIcon() {
return (dispatch, getState) => {
let {app, mine} = getState();
let {isFetching, open} = mine;
console.log('----getMineAllIcon-----');
ReactNative.NativeModules.YH_MineHelper.getMineAllIcon()
.then(data => {
let result = data;
//result = '[{"act_id":28,"act_name":"邀请好友赢福利","isHasClicked":false,"state":1,"url":"http://m.yohobuy.com/activity/invite/index?act_id=28"},{"act_id":29,"act_name":"邀请好友赢福利","isHasClicked":false,"state":1,"url":"http://m.yohobuy.com/activity/invite/index?act_id=29"},{"act_id":30,"act_name":"邀请好友赢福利","isHasClicked":true,"state":0,"url":"http://m.yohobuy.com/activity/invite/index?act_id=30"}]';
if (Platform.OS === 'android') {
result = JSON.parse(result);
}
dispatch(getMineAllIconSuccess(result));
})
.catch(error => {
});
}
}
\ No newline at end of file
... ...
... ... @@ -119,6 +119,99 @@ let InitialState = Record({
cancelOrder: 0,
tradingOrder: 0,
})),
iconAll:new (Record({
willPay: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
willDeliver: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
willReceived: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
willComment: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
reback: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
coupon: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
yohoCoin: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
myLimitCode: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
instalment: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
redPackets: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
myguang: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
myList: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
suggestion: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
invite: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
vipBill: new (Record({
default_ico: '',
ico: '',
ico_name: '',
isExist: false,
})),
})),
});
export default InitialState;
\ No newline at end of file
... ...
... ... @@ -59,6 +59,8 @@ const {
GET_GLOBALORDERSTATE_SUCCESS,
GET_GLOBALORDERSTATE_FAILURE,
GET_MINEALLICON_SUCCESS,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -81,8 +83,6 @@ export default function appReducer(state = initialState, action) {
}
case GET_MINEUSERINFO_SUCCESS: {
console.log("----------GET_USERINFO_SUCCESS");
console.log(state);
let {
head_ico,
nickname,
... ... @@ -93,7 +93,6 @@ export default function appReducer(state = initialState, action) {
} = action.payload;
let newVipInfo = state.profile.vip_info.set("cur_level", vip_info.cur_level)
.set("is_student", vip_info.is_student);
console.log(newVipInfo);
let newProfile = state.profile.set("vip_info", newVipInfo)
.set("head_ico", head_ico)
.set("nickname", nickname)
... ... @@ -326,6 +325,136 @@ export default function appReducer(state = initialState, action) {
.set('hasOrder', "N");
return state.set("globalOrderData", newGlobalOrderData);
}
case GET_MINEALLICON_SUCCESS: {
console.log("liben6666");
let {
willPay,
willDeliver,
willReceived,
willComment,
reback,
coupon,
yohoCoin,
myLimitCode,
instalment,
redPackets,
myguang,
myList,
suggestion,
invite,
vipBill,
} = action.payload;
let newWillPay = state.iconAll.willPay
.set('default_ico', willPay.default_ico)
.set('ico', willPay.ico)
.set('ico_name', willPay.ico_name)
.set('isExist', willPay.isExist);
let newWillDeliver = state.iconAll.willDeliver
.set('default_ico', willDeliver.default_ico)
.set('ico', willDeliver.ico)
.set('ico_name', willDeliver.ico_name)
.set('isExist', willDeliver.isExist);
let newWillReceived = state.iconAll.willReceived
.set('default_ico', willReceived.default_ico)
.set('ico', willReceived.ico)
.set('ico_name', willReceived.ico_name)
.set('isExist', willReceived.isExist);
let newWillComment = state.iconAll.willComment
.set('default_ico', willComment.default_ico)
.set('ico', willComment.ico)
.set('ico_name', willComment.ico_name)
.set('isExist', willComment.isExist);
let newReback = state.iconAll.reback
.set('default_ico', reback.default_ico)
.set('ico', reback.ico)
.set('ico_name', reback.ico_name)
.set('isExist', reback.isExist);
let newCoupon = state.iconAll.coupon
.set('default_ico', coupon.default_ico)
.set('ico', coupon.ico)
.set('ico_name', coupon.ico_name)
.set('isExist', coupon.isExist);
let newYohoCoin = state.iconAll.yohoCoin
.set('default_ico', yohoCoin.default_ico)
.set('ico', yohoCoin.ico)
.set('ico_name', yohoCoin.ico_name)
.set('isExist', yohoCoin.isExist);
let newMyLimitCode = state.iconAll.myLimitCode
.set('default_ico', myLimitCode.default_ico)
.set('ico', myLimitCode.ico)
.set('ico_name', myLimitCode.ico_name)
.set('isExist', myLimitCode.isExist);
let newInstalment = state.iconAll.instalment
.set('default_ico', instalment.default_ico)
.set('ico', instalment.ico)
.set('ico_name', instalment.ico_name)
.set('isExist', instalment.isExist);
let newRedPackets = state.iconAll.redPackets
.set('default_ico', redPackets.default_ico)
.set('ico', redPackets.ico)
.set('ico_name', redPackets.ico_name)
.set('isExist', redPackets.isExist);
let newMyguang = state.iconAll.myguang
.set('default_ico', myguang.default_ico)
.set('ico', myguang.ico)
.set('ico_name', myguang.ico_name)
.set('isExist', myguang.isExist);
let newMyList = state.iconAll.myList
.set('default_ico', myList.default_ico)
.set('ico', myList.ico)
.set('ico_name', myList.ico_name)
.set('isExist', myList.isExist);
let newSuggestion = state.iconAll.suggestion
.set('default_ico', suggestion.default_ico)
.set('ico', suggestion.ico)
.set('ico_name', suggestion.ico_name)
.set('isExist', suggestion.isExist);
let newInvite = state.iconAll.invite
.set('default_ico', invite.default_ico)
.set('ico', invite.ico)
.set('ico_name', invite.ico_name)
.set('isExist', invite.isExist);
let newVipBill = state.iconAll.vipBill
.set('default_ico', vipBill.default_ico)
.set('ico', vipBill.ico)
.set('ico_name', vipBill.ico_name)
.set('isExist', vipBill.isExist);
let newIconAll = state.iconAll
.set('willPay', newWillPay)
.set('willDeliver', newWillDeliver)
.set('willReceived', newWillReceived)
.set('willComment', newWillComment)
.set('reback', newReback)
.set('coupon', newCoupon)
.set('yohoCoin', newYohoCoin)
.set('myLimitCode', newMyLimitCode)
.set('instalment', newInstalment)
.set('redPackets', newRedPackets)
.set('myguang', newMyguang)
.set('myList', newMyList)
.set('suggestion', newSuggestion)
.set('invite', newInvite)
.set('vipBill', newVipBill);
return state.set('iconAll', newIconAll);
}
}
return state;
}
\ No newline at end of file
... ...