Authored by 张文文

新品到着配置资源位 reviewd by 朱傲哲

... ... @@ -26,6 +26,7 @@ import {
setHost,
setServiceHost,
setChannel,
setContentCode,
} from './reducers/app/appActions';
... ... @@ -48,6 +49,7 @@ export default function native(platform) {
store.dispatch(setHost(this.props.host));
store.dispatch(setChannel(this.props.channelId));
store.dispatch(setServiceHost(this.props.serviceHost));
store.dispatch(setContentCode(this.props.contentCode));
if (type == 'recForYou' ) {
return (
<Provider store={store}>
... ...
... ... @@ -6,6 +6,7 @@ export default keyMirror({
SET_HOST: null,
SET_SERVICE_HOST: null,
SET_CHANNEL: null,
SET_CONTENT_CODE: null,
RECOMMEND_SHOP_REQUEST: null,
RECOMMEND_SHOP_SUCCESS: null,
... ...
... ... @@ -7,6 +7,7 @@ const {
SET_CHANNEL,
SET_HOST,
SET_SERVICE_HOST,
SET_CONTENT_CODE,
} = require('../../constants/actionTypes').default;
export function setPlatform(platform) {
... ... @@ -36,3 +37,10 @@ export function setServiceHost(host) {
payload: host
};
}
export function setContentCode(contentCode) {
return {
type: SET_CONTENT_CODE,
payload: contentCode
};
}
... ...
... ... @@ -8,6 +8,7 @@ let InitialState = Record({
host: 'http://api.yoho.cn',
serviceHost: 'http://api.yoho.cn',
globalHost: 'http://api-global.yohobuy.com',
contentCode: '',
});
export default InitialState;
... ...
... ... @@ -7,6 +7,7 @@ const {
SET_CHANNEL,
SET_HOST,
SET_SERVICE_HOST,
SET_CONTENT_CODE,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -23,6 +24,8 @@ export default function appReducer(state = initialState, action) {
return state.set('host', action.payload);
case SET_SERVICE_HOST:
return state.set('serviceHost', action.payload);
case SET_CONTENT_CODE:
return state.set('contentCode', action.payload);
}
return state;
... ...
... ... @@ -110,8 +110,9 @@ export function getResourceInfoFailure(error) {
export function getResourceInfo(callback) {
return (dispatch, getState) => {
let {app} = getState();
let contentCode = app.contentCode ? app.contentCode : '1f2e07cb63811680154ba693c954dd62';
dispatch(getResourceInfoRequest());
return new NewArrivalService(app.host).fetchResourceInfo('1f2e07cb63811680154ba693c954dd62')
return new NewArrivalService(app.host).fetchResourceInfo(contentCode)
.then(json => {
let newJson = exposeResourceInfoData(json);
... ...