Authored by 郁健超

有货有赚商品列表请求参数修改 reviewed by hy

... ... @@ -25,6 +25,7 @@ export default keyMirror({
SET_JUMP_URL: null,
SET_PRODUCT_POOL:null,
SET_SKNS: null,
SET_PRODUCT_ORDER: null,
SHOW_WITHDRAW_DIALOG: null,
DISMISS_WITHDRAW_DIALOG: null,
... ...
... ... @@ -86,14 +86,17 @@ class HomeContainer extends Component {
this.props.actions.getResourceInfo(function (json) {
json && json.forEach((item,index) => {
if (item.template_name === 'recommendGoodsGroup' && item.data) {
let productPool = item.data.recommendLogic;
let recommendLogic = item.data.recommendLogic;
let recommendLogicJson = JSON.parse(recommendLogic);
let productPool = recommendLogicJson.productPool;
let order = recommendLogicJson.order;
let skns = item.data.skns;
self.setState({
F_NAME: item.template_name,
F_ID: item.template_id,
F_INDEX: index+1
})
self.props.actions.getProductList(productPool, skns);
self.props.actions.getProductList(productPool, skns,0, order);
let params = {
TAB_ID: '0',
TAB_NAME: '热门推荐'
... ... @@ -187,6 +190,7 @@ class HomeContainer extends Component {
let {
productPool,
skns,
order,
} = this.props.app;
// _onEndReached 事件会出现在 productPool返回前触发,可能会导致数据不一致,因此控制为0时不调用_onEndReached
... ... @@ -196,9 +200,9 @@ class HomeContainer extends Component {
let data = this.state.categoryData;
if (data) {
this.props.actions.getProductList(productPool, skns,data.get('sort_id'));
this.props.actions.getProductList(productPool, skns,data.get('sort_id'),order);
} else {
this.props.actions.getProductList(productPool, skns);
this.props.actions.getProductList(productPool, skns,0, order);
}
}
... ...
... ... @@ -3,7 +3,7 @@
import ReactNative from 'react-native';
import {DeviceEventEmitter} from 'react-native';
import AllianceService from '../../services/AllianceService';
import {setproductPool, setSkns} from "../app/appActions";
import {setproductOrder, setproductPool, setSkns} from "../app/appActions";
import {Platform } from 'react-native';
import {CODE_ALLIANCE_BANNER_RESOURCE_CODE} from '../../constants'
... ... @@ -969,10 +969,14 @@ export function getResourceInfo(callback) {
json && json.forEach(item => {
if (item.template_name === 'recommendGoodsGroup' && item.data) {
let productPool = item.data.recommendLogic;
let recommendLogic = item.data.recommendLogic;
let recommendLogicJson = JSON.parse(recommendLogic);
let productPool = recommendLogicJson.productPool;
let order = recommendLogicJson.order;
let skns = item.data.skns;
dispatch(setproductPool(productPool));
dispatch(setSkns(skns));
dispatch(setproductOrder(order));
}
if (item.template_name === 'pusherGoodsRoll' && item.data) {
let skns = item.data.productSkns;
... ...
... ... @@ -15,6 +15,7 @@ const {
SET_SERVICE_HOST,
SET_PRODUCT_POOL,
SET_SKNS,
SET_PRODUCT_ORDER,
PRODUCT_LIST_REQUEST,
PRODUCT_LIST_SUCCESS,
... ... @@ -80,6 +81,13 @@ export function setSkns(skns) {
}
}
export function setproductOrder(order) {
return {
type: SET_PRODUCT_ORDER,
payload: order,
}
}
export function productListRequest() {
return {
type: PRODUCT_LIST_REQUEST,
... ... @@ -234,7 +242,7 @@ function exposeHtmlContent(json, callbackFun) {
}
export function getProductList(product_pool = 0, skns = 0,msort = 0) {
export function getProductList(product_pool = 0, skns = 0, msort = 0, order = '') {
return (dispatch, getState) => {
let {app} = getState();
let list = app.productList;
... ... @@ -254,7 +262,7 @@ export function getProductList(product_pool = 0, skns = 0,msort = 0) {
let pageSize = list.page_size;
let fetchProductList = (uid) => {
dispatch(productListRequest());
return new AppService(app.host).fetchProductList(uid, page, pageSize, msort, product_pool, skns)
return new AppService(app.host).fetchProductList(uid, page, pageSize, msort, product_pool, skns, order)
.then(json => {
let payload = json;
try {
... ...
... ... @@ -9,6 +9,7 @@ let InitialState = Record({
serviceHost: 'http://api.yoho.cn',
productPool: 0,
skns: 0,
order:'',
productList: new (Record({
isFetching: false,
... ...
... ... @@ -10,6 +10,7 @@ const {
SET_SERVICE_HOST,
SET_PRODUCT_POOL,
SET_SKNS,
SET_PRODUCT_ORDER,
PRODUCT_LIST_REQUEST,
PRODUCT_LIST_SUCCESS,
PRODUCT_LIST_FAILURE,
... ... @@ -36,6 +37,9 @@ export default function appReducer(state = initialState, action) {
case SET_PRODUCT_POOL: {
return state.set('productPool', action.payload);
}
case SET_PRODUCT_ORDER:{
return state.set('order', action.payload);
}
case SET_SKNS: {
return state.set('skns', action.payload);
}
... ...
... ... @@ -12,7 +12,7 @@ export default class AppService {
this.api = new Request(baseURL);
}
async fetchProductList(uid, page, limit = 20, msort = 0, product_pool = 680, firstProductSkn = 0) {
async fetchProductList(uid, page, limit = 20, msort = 0, product_pool = 680, firstProductSkn = 0,order = '') {
return await this.api.get({
url: '',
body: {
... ... @@ -24,6 +24,7 @@ export default class AppService {
msort: msort === 0 ? undefined : msort,
product_pool,
firstProductSkn: firstProductSkn === 0 ? undefined : firstProductSkn,
order
}
})
.then((json) => {
... ...