个人中心获取猜你喜欢数据变量名称更换——review by 陈林
Showing
7 changed files
with
35 additions
and
35 deletions
@@ -63,8 +63,8 @@ export default class MineList extends React.Component { | @@ -63,8 +63,8 @@ export default class MineList extends React.Component { | ||
63 | render() { | 63 | render() { |
64 | let { | 64 | let { |
65 | isFetching, | 65 | isFetching, |
66 | - productListForInstallment, | ||
67 | - installmentInfo, | 66 | + productListForMineCenter, |
67 | + mineCenterInfo, | ||
68 | profile, | 68 | profile, |
69 | mineInfoNum, | 69 | mineInfoNum, |
70 | redPackageNum, | 70 | redPackageNum, |
@@ -76,7 +76,7 @@ export default class MineList extends React.Component { | @@ -76,7 +76,7 @@ export default class MineList extends React.Component { | ||
76 | globalOrderData | 76 | globalOrderData |
77 | } = this.props; | 77 | } = this.props; |
78 | let dataSource = null; | 78 | let dataSource = null; |
79 | - dataSource = productListForInstallment.list.toArray(); | 79 | + dataSource = productListForMineCenter.list.toArray(); |
80 | 80 | ||
81 | return ( | 81 | return ( |
82 | <View style={styles.container}> | 82 | <View style={styles.container}> |
@@ -4,9 +4,9 @@ export default keyMirror({ | @@ -4,9 +4,9 @@ export default keyMirror({ | ||
4 | SET_PLATFORM:null, | 4 | SET_PLATFORM:null, |
5 | SET_CHANNEL:null, | 5 | SET_CHANNEL:null, |
6 | 6 | ||
7 | - INSTALLMENT_PRODUCT_REQUEST:null, | ||
8 | - INSTALLMENT_PRODUCT_SUCCESS:null, | ||
9 | - INSTALLMENT_PRODUCT_FAILURE:null, | 7 | + MINECENTER_PRODUCT_REQUEST:null, |
8 | + MINECENTER_PRODUCT_SUCCESS:null, | ||
9 | + MINECENTER_PRODUCT_FAILURE:null, | ||
10 | 10 | ||
11 | GET_MINEUSERINFO_REQUEST:null, | 11 | GET_MINEUSERINFO_REQUEST:null, |
12 | GET_MINEUSERINFO_SUCCESS:null, | 12 | GET_MINEUSERINFO_SUCCESS:null, |
@@ -60,7 +60,7 @@ class MineContainer extends Component { | @@ -60,7 +60,7 @@ class MineContainer extends Component { | ||
60 | this.subscription3 = NativeAppEventEmitter.addListener( | 60 | this.subscription3 = NativeAppEventEmitter.addListener( |
61 | 'ChannelDidChangeEvent', | 61 | 'ChannelDidChangeEvent', |
62 | (reminder) => { | 62 | (reminder) => { |
63 | - this.props.actions.productListForInstallment(); | 63 | + this.props.actions.getProductListForMineCenter(); |
64 | } | 64 | } |
65 | ); | 65 | ); |
66 | 66 | ||
@@ -73,7 +73,7 @@ class MineContainer extends Component { | @@ -73,7 +73,7 @@ class MineContainer extends Component { | ||
73 | } | 73 | } |
74 | 74 | ||
75 | componentDidMount() { | 75 | componentDidMount() { |
76 | - this.props.actions.productListForInstallment(); | 76 | + this.props.actions.getProductListForMineCenter(); |
77 | this.props.actions.onMineCenterRefresh(); | 77 | this.props.actions.onMineCenterRefresh(); |
78 | this.props.actions.getMineAllIcon(); | 78 | this.props.actions.getMineAllIcon(); |
79 | } | 79 | } |
@@ -275,8 +275,8 @@ class MineContainer extends Component { | @@ -275,8 +275,8 @@ class MineContainer extends Component { | ||
275 | <MineList | 275 | <MineList |
276 | isFetching={isFetching} | 276 | isFetching={isFetching} |
277 | isLogin={isLogin} | 277 | isLogin={isLogin} |
278 | - productListForInstallment={open.productListForInstallment} | ||
279 | - installmentInfo={open.installmentInfo} | 278 | + productListForMineCenter={open.productListForMineCenter} |
279 | + mineCenterInfo={open.mineCenterInfo} | ||
280 | profile={profile} | 280 | profile={profile} |
281 | mineInfoNum={mineInfoNum} | 281 | mineInfoNum={mineInfoNum} |
282 | redPackageNum={redPackageNum} | 282 | redPackageNum={redPackageNum} |
@@ -9,9 +9,9 @@ const { | @@ -9,9 +9,9 @@ const { | ||
9 | 9 | ||
10 | SET_PLATFORM, | 10 | SET_PLATFORM, |
11 | 11 | ||
12 | - INSTALLMENT_PRODUCT_REQUEST, | ||
13 | - INSTALLMENT_PRODUCT_SUCCESS, | ||
14 | - INSTALLMENT_PRODUCT_FAILURE, | 12 | + MINECENTER_PRODUCT_REQUEST, |
13 | + MINECENTER_PRODUCT_SUCCESS, | ||
14 | + MINECENTER_PRODUCT_FAILURE, | ||
15 | 15 | ||
16 | GET_MINEUSERINFO_REQUEST, | 16 | GET_MINEUSERINFO_REQUEST, |
17 | GET_MINEUSERINFO_SUCCESS, | 17 | GET_MINEUSERINFO_SUCCESS, |
@@ -66,22 +66,22 @@ const { | @@ -66,22 +66,22 @@ const { | ||
66 | 66 | ||
67 | } = require('../../constants/actionTypes').default; | 67 | } = require('../../constants/actionTypes').default; |
68 | 68 | ||
69 | -export function productListForInstallmentRequest() { | 69 | +export function productListForMineCenterRequest() { |
70 | return { | 70 | return { |
71 | - type: INSTALLMENT_PRODUCT_REQUEST, | 71 | + type: MINECENTER_PRODUCT_REQUEST, |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | -export function productListForInstallmentSuccess(json) { | 75 | +export function productListForMineCenterSuccess(json) { |
76 | return { | 76 | return { |
77 | - type: INSTALLMENT_PRODUCT_SUCCESS, | 77 | + type: MINECENTER_PRODUCT_SUCCESS, |
78 | payload: json, | 78 | payload: json, |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | -export function productListForInstallmentFailure() { | 82 | +export function productListForMineCenterFailure() { |
83 | return { | 83 | return { |
84 | - type: INSTALLMENT_PRODUCT_FAILURE, | 84 | + type: MINECENTER_PRODUCT_FAILURE, |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
@@ -259,7 +259,7 @@ export function getMineAllIconSuccess(json) { | @@ -259,7 +259,7 @@ export function getMineAllIconSuccess(json) { | ||
259 | } | 259 | } |
260 | } | 260 | } |
261 | 261 | ||
262 | -export function productListForInstallment() { | 262 | +export function getProductListForMineCenter() { |
263 | return (dispatch, getState) => { | 263 | return (dispatch, getState) => { |
264 | let {app, mine} = getState(); | 264 | let {app, mine} = getState(); |
265 | let {isFetching, open} = mine; | 265 | let {isFetching, open} = mine; |
@@ -267,21 +267,21 @@ export function productListForInstallment() { | @@ -267,21 +267,21 @@ export function productListForInstallment() { | ||
267 | return | 267 | return |
268 | } | 268 | } |
269 | console.log('----productListForInstallment-----'); | 269 | console.log('----productListForInstallment-----'); |
270 | - dispatch(productListForInstallmentRequest()); | ||
271 | - return new MineService(app.host).fetchInstallmentProductList() | 270 | + dispatch(productListForMineCenterRequest()); |
271 | + return new MineService(app.host).fetchMineCenterProductList() | ||
272 | .then(json => { | 272 | .then(json => { |
273 | console.log(json); | 273 | console.log(json); |
274 | let payload = json;//product_list | 274 | let payload = json;//product_list |
275 | if (payload.page > 1) { | 275 | if (payload.page > 1) { |
276 | - let oldList = open.fetchInstallmentProductList.list.toJS(); | 276 | + let oldList = open.productListForMineCenter.list.toJS(); |
277 | let list = [...oldList, ...payload.list]; | 277 | let list = [...oldList, ...payload.list]; |
278 | payload.product_list = list; | 278 | payload.product_list = list; |
279 | } | 279 | } |
280 | - dispatch(productListForInstallmentSuccess(payload)); | 280 | + dispatch(productListForMineCenterSuccess(payload)); |
281 | }) | 281 | }) |
282 | .catch(error => { | 282 | .catch(error => { |
283 | console.log(error); | 283 | console.log(error); |
284 | - dispatch(productListForInstallmentFailure()); | 284 | + dispatch(productListForMineCenterFailure()); |
285 | }); | 285 | }); |
286 | } | 286 | } |
287 | } | 287 | } |
@@ -5,12 +5,12 @@ import {Record, List, Map} from 'immutable'; | @@ -5,12 +5,12 @@ import {Record, List, Map} from 'immutable'; | ||
5 | let InitialState = Record({ | 5 | let InitialState = Record({ |
6 | isFetching: false, | 6 | isFetching: false, |
7 | open: new (Record({ | 7 | open: new (Record({ |
8 | - productListForInstallment: new (Record({ | 8 | + productListForMineCenter: new (Record({ |
9 | list: List(), | 9 | list: List(), |
10 | page: 1, | 10 | page: 1, |
11 | totalPage: 1, | 11 | totalPage: 1, |
12 | })), | 12 | })), |
13 | - installmentInfo: '', | 13 | + mineCenterInfo: '', |
14 | })), | 14 | })), |
15 | 15 | ||
16 | /** 个人信息state */ | 16 | /** 个人信息state */ |
@@ -6,9 +6,9 @@ import Immutable, {Map} from 'immutable'; | @@ -6,9 +6,9 @@ import Immutable, {Map} from 'immutable'; | ||
6 | const { | 6 | const { |
7 | SET_PLATFORM, | 7 | SET_PLATFORM, |
8 | 8 | ||
9 | - INSTALLMENT_PRODUCT_REQUEST, | ||
10 | - INSTALLMENT_PRODUCT_SUCCESS, | ||
11 | - INSTALLMENT_PRODUCT_FAILURE, | 9 | + MINECENTER_PRODUCT_REQUEST, |
10 | + MINECENTER_PRODUCT_SUCCESS, | ||
11 | + MINECENTER_PRODUCT_FAILURE, | ||
12 | 12 | ||
13 | GET_MINEUSERINFO_REQUEST, | 13 | GET_MINEUSERINFO_REQUEST, |
14 | GET_MINEUSERINFO_SUCCESS, | 14 | GET_MINEUSERINFO_SUCCESS, |
@@ -69,17 +69,17 @@ export default function appReducer(state = initialState, action) { | @@ -69,17 +69,17 @@ export default function appReducer(state = initialState, action) { | ||
69 | if (!(state instanceof InitialState)) return initialState.merge(state); | 69 | if (!(state instanceof InitialState)) return initialState.merge(state); |
70 | 70 | ||
71 | switch (action.type) { | 71 | switch (action.type) { |
72 | - case INSTALLMENT_PRODUCT_SUCCESS: { | 72 | + case MINECENTER_PRODUCT_SUCCESS: { |
73 | let { | 73 | let { |
74 | page, | 74 | page, |
75 | page_total, | 75 | page_total, |
76 | product_list, | 76 | product_list, |
77 | } = action.payload; | 77 | } = action.payload; |
78 | 78 | ||
79 | - let productListForInstallment = state.open.productListForInstallment.set('list', Immutable.fromJS(product_list)) | 79 | + let productListForMineCenter = state.open.productListForMineCenter.set('list', Immutable.fromJS(product_list)) |
80 | .set('page', page) | 80 | .set('page', page) |
81 | .set('totalPage', page_total); | 81 | .set('totalPage', page_total); |
82 | - return state.setIn(['open', 'productListForInstallment'], productListForInstallment); | 82 | + return state.setIn(['open', 'productListForMineCenter'], productListForMineCenter); |
83 | } | 83 | } |
84 | 84 | ||
85 | case GET_MINEUSERINFO_SUCCESS: { | 85 | case GET_MINEUSERINFO_SUCCESS: { |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | import Request from '../../common/services/NativeRequest'; | 3 | import Request from '../../common/services/NativeRequest'; |
4 | 4 | ||
5 | -export default class InstallmentService { | 5 | +export default class MineService { |
6 | constructor(host) { | 6 | constructor(host) { |
7 | let baseURL = 'http://api.yoho.cn'; | 7 | let baseURL = 'http://api.yoho.cn'; |
8 | if (host) { | 8 | if (host) { |
@@ -11,7 +11,7 @@ export default class InstallmentService { | @@ -11,7 +11,7 @@ export default class InstallmentService { | ||
11 | this.api = new Request(baseURL); | 11 | this.api = new Request(baseURL); |
12 | } | 12 | } |
13 | 13 | ||
14 | - async fetchInstallmentProductList(yh_channel = 1, rec_pos = 100004, limit = 30, fromPage = 'iFP_RecommendProduct', v = 7) { | 14 | + async fetchMineCenterProductList(yh_channel = 1, rec_pos = 100004, limit = 30, fromPage = 'iFP_RecommendProduct', v = 7) { |
15 | return await this.api.get({ | 15 | return await this.api.get({ |
16 | url: '', | 16 | url: '', |
17 | body: { | 17 | body: { |
-
Please register or login to post a comment