Authored by chenl

增加了我的界面获取资源位方法。review by liben。

... ... @@ -59,6 +59,7 @@ export default keyMirror({
GET_GLOBALORDERSTATE_FAILURE:null,
GET_MINEALLICON_SUCCESS:null,
GET_MINERESOURCE_SUCCESS:null,
SET_SIMILAR_PRODUCT_INDEX:null,
SET_SHOW_SIMILAR_GUIDER: null,
... ...
... ... @@ -88,6 +88,7 @@ class MineContainer extends Component {
this.props.actions.onMineCenterRefresh();
this.props.actions.getMineAllIcon();
this.props.actions.setShowSimilarGuider(true);
//this.props.actions.getMineResource();
}
componentWillUnmount() {
... ...
... ... @@ -65,6 +65,8 @@ const {
GET_MINEALLICON_SUCCESS,
GET_MINERESOURCE_SUCCESS,
SET_SIMILAR_PRODUCT_INDEX,
SET_SHOW_SIMILAR_GUIDER,
... ... @@ -632,3 +634,33 @@ export function onMineCenterRefresh() {
dispatch(getGlobalOrderState());
}
}
export function getMineResource() {
return (dispatch, getState) => {
let {app} = getState();
ReactNative.NativeModules.YH_MineHelper.currentMineContentCode()
.then(content_code => {
return new MineService(app.serviceHost).getMineResource(content_code)
.then(json => {
console.log("chenlin", JSON.stringify(json));
dispatch(getMineResourceSuccess(json));
})
.catch(error => {
});
})
.catch(error => {
});
}
}
export function getMineResourceSuccess(json) {
return {
type: GET_MINERESOURCE_SUCCESS,
payload: json,
}
}
... ...
... ... @@ -61,6 +61,7 @@ const {
GET_GLOBALORDERSTATE_FAILURE,
GET_MINEALLICON_SUCCESS,
GET_MINERESOURCE_SUCCESS,
SET_SIMILAR_PRODUCT_INDEX,
SET_SHOW_SIMILAR_GUIDER,
... ... @@ -491,6 +492,11 @@ export default function appReducer(state = initialState, action) {
return state.set('iconAll', newIconAll);
}
case GET_MINERESOURCE_SUCCESS: {
return state;
}
}
return state;
}
\ No newline at end of file
... ...
... ... @@ -262,4 +262,24 @@ export default class MineService {
throw(error);
});
}
/**
* 获取我的界面底部资源位
*/
async getMineResource(content_code, fromPage='aFP_My'){
return await this.api.get({
url: '/operations/api/v5/resource/get',
body: {
content_code,
fromPage,
}
})
.then((json) => {
return json;
})
.catch((error) => {
throw(error);
});
}
}
\ No newline at end of file
... ...