Authored by 于良

品类数据曝光优化 review by liben

... ... @@ -42,7 +42,7 @@ import {
import {
setCurrentChannelB,
setPerloadStatus,
setDelayExposeData,
} from './reducers/categoryB/categoryBActions';
import {
... ... @@ -108,7 +108,7 @@ export default function native(platform) {
//如果是B版,则打开B版品类
if (this.props.abversion == "B") {
store.dispatch(setPerloadStatus(this.props.perload));
store.dispatch(setDelayExposeData(this.props.perload));
}
} else if (this.props.type == 1) {
if (this.props.channelId) {
... ...
... ... @@ -10,7 +10,7 @@ export default keyMirror({
SET_TYPE: null,
SET_INITIALLISTSIZE: null,
SET_PERLOAD_STATUS: null,
SET_DELAY_EXPOSE_DATA: null,
RESET_LIST_PAGE_INFO: null,
SHOW_LOGIN_TIP: null,
... ...
... ... @@ -61,7 +61,7 @@ class CategoryBContainer extends Component {
this.subscription = NativeAppEventEmitter.addListener(
'ChannelDidChangeEvent',
(reminder) => {
this.props.actions.setPerloadStatus(true);
this.props.actions.setDelayExposeData(true);
let id = reminder.channel;
let value;
if(id == 2){
... ... @@ -81,8 +81,8 @@ class CategoryBContainer extends Component {
this.subscription2 = NativeAppEventEmitter.addListener(
'CategoryViewDidAppearEvent',
() => {
this.props.categoryB.perload && this.props.actions.startExposeData();
this.props.actions.setPerloadStatus(false);
this.props.categoryB.delayExposeData && this.props.actions.startExposeData();
this.props.actions.setDelayExposeData(false);
}
);
}
... ...
... ... @@ -5,7 +5,7 @@ import CategoryBService from '../../services/CategoryBService';
import Immutable, {Map} from 'immutable';
const {
SET_TYPE,
SET_PERLOAD_STATUS,
SET_DELAY_EXPOSE_DATA,
GET_CATEGORY_B_LIST_REQUEST,
GET_CATEGORY_B_LIST_SUCCESS,
... ... @@ -25,10 +25,10 @@ const {
} = require('../../constants/actionTypes').default;
export function setPerloadStatus(perload) {
export function setDelayExposeData(delayExposeData) {
return {
type: SET_PERLOAD_STATUS,
payload: perload,
type: SET_DELAY_EXPOSE_DATA,
payload: delayExposeData,
}
}
... ... @@ -93,7 +93,7 @@ export function fetchSubCategory(categoryId, categoryValue, callback) {
currentCateId,
currentCateValue,
cacheSubCateData,
perload,
delayExposeData,
} = categoryB;
//检查缓存是否存在数据,如果不存在则获取
... ... @@ -103,7 +103,7 @@ export function fetchSubCategory(categoryId, categoryValue, callback) {
if (categoryData) {
dispatch(getCategoryBSubDetailFromCache(categoryData));
//曝光从缓存获取的数据
if (perload) {
if (delayExposeData) {
} else {
//曝光从缓存获取的数据
... ... @@ -195,7 +195,7 @@ export function getCategoryBSubDetail(channel_id, category_id, category_value) {
.then(json => {
let payload = parseCategoryBSubDetail(channel_id, category_id, json, categoryB);
dispatch(getCategoryBSubDetailSuccess(payload));
if (categoryB.perload) {
if (categoryB.delayExposeData) {
} else {
//曝光从网络获取的数据
... ... @@ -331,7 +331,7 @@ export function startExposeData() {
currentCateId,
currentCateValue,
cacheSubCateData,
perload,
delayExposeData,
} = categoryB;
//检查缓存是否存在数据,如果不存在则获取
... ...
... ... @@ -13,7 +13,7 @@ let InitialStateB = Record({
cacheSubCateData: Map(),
categoryList: Map(),
contentFetching: false,
perload: true,
delayExposeData: true,
});
export default InitialStateB;
... ...
... ... @@ -4,7 +4,7 @@ import InitialStateB from './categoryBInitialState';
import Immutable, {Map} from 'immutable';
const {
SET_PERLOAD_STATUS,
SET_DELAY_EXPOSE_DATA,
GET_CATEGORY_B_LIST_REQUEST,
GET_CATEGORY_B_LIST_SUCCESS,
... ... @@ -26,8 +26,8 @@ const initialStateB = new InitialStateB;
export default function categoryBReducer(state=initialStateB, action) {
switch(action.type) {
case SET_PERLOAD_STATUS: {
return state.set('perload', action.payload);
case SET_DELAY_EXPOSE_DATA: {
return state.set('delayExposeData', action.payload);
}
case GET_CATEGORY_B_LIST_REQUEST: {
... ...