Authored by 李犇

个人中心获取猜你喜欢数据变量名称更换——review by 陈林

... ... @@ -63,8 +63,8 @@ export default class MineList extends React.Component {
render() {
let {
isFetching,
productListForInstallment,
installmentInfo,
productListForMineCenter,
mineCenterInfo,
profile,
mineInfoNum,
redPackageNum,
... ... @@ -76,7 +76,7 @@ export default class MineList extends React.Component {
globalOrderData
} = this.props;
let dataSource = null;
dataSource = productListForInstallment.list.toArray();
dataSource = productListForMineCenter.list.toArray();
return (
<View style={styles.container}>
... ...
... ... @@ -4,9 +4,9 @@ export default keyMirror({
SET_PLATFORM:null,
SET_CHANNEL:null,
INSTALLMENT_PRODUCT_REQUEST:null,
INSTALLMENT_PRODUCT_SUCCESS:null,
INSTALLMENT_PRODUCT_FAILURE:null,
MINECENTER_PRODUCT_REQUEST:null,
MINECENTER_PRODUCT_SUCCESS:null,
MINECENTER_PRODUCT_FAILURE:null,
GET_MINEUSERINFO_REQUEST:null,
GET_MINEUSERINFO_SUCCESS:null,
... ...
... ... @@ -60,7 +60,7 @@ class MineContainer extends Component {
this.subscription3 = NativeAppEventEmitter.addListener(
'ChannelDidChangeEvent',
(reminder) => {
this.props.actions.productListForInstallment();
this.props.actions.getProductListForMineCenter();
}
);
... ... @@ -73,7 +73,7 @@ class MineContainer extends Component {
}
componentDidMount() {
this.props.actions.productListForInstallment();
this.props.actions.getProductListForMineCenter();
this.props.actions.onMineCenterRefresh();
this.props.actions.getMineAllIcon();
}
... ... @@ -275,8 +275,8 @@ class MineContainer extends Component {
<MineList
isFetching={isFetching}
isLogin={isLogin}
productListForInstallment={open.productListForInstallment}
installmentInfo={open.installmentInfo}
productListForMineCenter={open.productListForMineCenter}
mineCenterInfo={open.mineCenterInfo}
profile={profile}
mineInfoNum={mineInfoNum}
redPackageNum={redPackageNum}
... ...
... ... @@ -9,9 +9,9 @@ const {
SET_PLATFORM,
INSTALLMENT_PRODUCT_REQUEST,
INSTALLMENT_PRODUCT_SUCCESS,
INSTALLMENT_PRODUCT_FAILURE,
MINECENTER_PRODUCT_REQUEST,
MINECENTER_PRODUCT_SUCCESS,
MINECENTER_PRODUCT_FAILURE,
GET_MINEUSERINFO_REQUEST,
GET_MINEUSERINFO_SUCCESS,
... ... @@ -66,22 +66,22 @@ const {
} = require('../../constants/actionTypes').default;
export function productListForInstallmentRequest() {
export function productListForMineCenterRequest() {
return {
type: INSTALLMENT_PRODUCT_REQUEST,
type: MINECENTER_PRODUCT_REQUEST,
}
}
export function productListForInstallmentSuccess(json) {
export function productListForMineCenterSuccess(json) {
return {
type: INSTALLMENT_PRODUCT_SUCCESS,
type: MINECENTER_PRODUCT_SUCCESS,
payload: json,
}
}
export function productListForInstallmentFailure() {
export function productListForMineCenterFailure() {
return {
type: INSTALLMENT_PRODUCT_FAILURE,
type: MINECENTER_PRODUCT_FAILURE,
}
}
... ... @@ -259,7 +259,7 @@ export function getMineAllIconSuccess(json) {
}
}
export function productListForInstallment() {
export function getProductListForMineCenter() {
return (dispatch, getState) => {
let {app, mine} = getState();
let {isFetching, open} = mine;
... ... @@ -267,21 +267,21 @@ export function productListForInstallment() {
return
}
console.log('----productListForInstallment-----');
dispatch(productListForInstallmentRequest());
return new MineService(app.host).fetchInstallmentProductList()
dispatch(productListForMineCenterRequest());
return new MineService(app.host).fetchMineCenterProductList()
.then(json => {
console.log(json);
let payload = json;//product_list
if (payload.page > 1) {
let oldList = open.fetchInstallmentProductList.list.toJS();
let oldList = open.productListForMineCenter.list.toJS();
let list = [...oldList, ...payload.list];
payload.product_list = list;
}
dispatch(productListForInstallmentSuccess(payload));
dispatch(productListForMineCenterSuccess(payload));
})
.catch(error => {
console.log(error);
dispatch(productListForInstallmentFailure());
dispatch(productListForMineCenterFailure());
});
}
}
... ...
... ... @@ -5,12 +5,12 @@ import {Record, List, Map} from 'immutable';
let InitialState = Record({
isFetching: false,
open: new (Record({
productListForInstallment: new (Record({
productListForMineCenter: new (Record({
list: List(),
page: 1,
totalPage: 1,
})),
installmentInfo: '',
mineCenterInfo: '',
})),
/** 个人信息state */
... ...
... ... @@ -6,9 +6,9 @@ import Immutable, {Map} from 'immutable';
const {
SET_PLATFORM,
INSTALLMENT_PRODUCT_REQUEST,
INSTALLMENT_PRODUCT_SUCCESS,
INSTALLMENT_PRODUCT_FAILURE,
MINECENTER_PRODUCT_REQUEST,
MINECENTER_PRODUCT_SUCCESS,
MINECENTER_PRODUCT_FAILURE,
GET_MINEUSERINFO_REQUEST,
GET_MINEUSERINFO_SUCCESS,
... ... @@ -69,17 +69,17 @@ export default function appReducer(state = initialState, action) {
if (!(state instanceof InitialState)) return initialState.merge(state);
switch (action.type) {
case INSTALLMENT_PRODUCT_SUCCESS: {
case MINECENTER_PRODUCT_SUCCESS: {
let {
page,
page_total,
product_list,
} = action.payload;
let productListForInstallment = state.open.productListForInstallment.set('list', Immutable.fromJS(product_list))
let productListForMineCenter = state.open.productListForMineCenter.set('list', Immutable.fromJS(product_list))
.set('page', page)
.set('totalPage', page_total);
return state.setIn(['open', 'productListForInstallment'], productListForInstallment);
return state.setIn(['open', 'productListForMineCenter'], productListForMineCenter);
}
case GET_MINEUSERINFO_SUCCESS: {
... ...
... ... @@ -2,7 +2,7 @@
import Request from '../../common/services/NativeRequest';
export default class InstallmentService {
export default class MineService {
constructor(host) {
let baseURL = 'http://api.yoho.cn';
if (host) {
... ... @@ -11,7 +11,7 @@ export default class InstallmentService {
this.api = new Request(baseURL);
}
async fetchInstallmentProductList(yh_channel = 1, rec_pos = 100004, limit = 30, fromPage = 'iFP_RecommendProduct', v = 7) {
async fetchMineCenterProductList(yh_channel = 1, rec_pos = 100004, limit = 30, fromPage = 'iFP_RecommendProduct', v = 7) {
return await this.api.get({
url: '',
body: {
... ...