studentReducer.js
3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
'use strict';
import InitialState from './studentInitialState';
import Immutable, {Map} from 'immutable';
const {
SET_PLATFORM,
SET_ZIMA_URL,
QUERY_REGISTER_PAGE_INFO_REQUEST,
QUERY_REGISTER_PAGE_INFO_SUCCESS,
QUERY_REGISTER_PAGE_INFO_FAILURE,
QUERY_PROVINCE_REQUEST,
QUERY_PROVINCE_SUCCESS,
QUERY_PROVINCE_FAILURE,
QUERY_STUDENT_PRODUCTS_REQUEST,
QUERY_STUDENT_PRODUCTS_SUCCESS,
QUERY_STUDENT_PRODUCTS_FAILURE,
QUERY_SCHOOL_INFO_LIST_REQUEST,
QUERY_SCHOOL_INFO_LIST_SUCCESS,
QUERY_SCHOOL_INFO_LIST_FAILURE,
UPDATE_REGISTER_PAGE_CELLS,
UPDATE_CUR_SCHOOL_INFO,
UPDATE_PROVINCE_SCHOOL_PAGE_INFO,
UPDATE_PICKER_INFO,
UPDATE_SEARCH_RESULT_PAGE_INFO,
SELECT_PROVINCE_ITEM,
SELECT_SCHOOL_ITEM,
CHECK_AGREE_YOHO_PROTOCOL,
SHOW_TIP_MESSAGE,
HIDE_TIP_MESSAGE,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
export default function studentReducer(state=initialState, action) {
switch(action.type) {
case SET_ZIMA_URL:{
return state.set('zimaRegisterUrl', action.payload);
}
case QUERY_REGISTER_PAGE_INFO_REQUEST: {
return state.setIn(['registerPageInfo', 'isFetching'], true);
}
case QUERY_REGISTER_PAGE_INFO_SUCCESS: {
return state.setIn(['registerPageInfo', 'isFetching'], false)
.setIn(['registerPageInfo', 'verifiedStudentTotal'], action.payload.studentTotal)
.setIn(['registerPageInfo', 'educationLevelList'], Immutable.fromJS(action.payload.educationLevelList))
.setIn(['registerPageInfo', 'schoolYearList'], Immutable.fromJS(action.payload.schoolYearList))
.setIn(['registerPageInfo', 'error'], null);
}
case QUERY_REGISTER_PAGE_INFO_FAILURE: {
return state.setIn(['registerPageInfo', 'isFetching'], false)
.setIn(['registerPageInfo', 'error'], action.payload);
}
case QUERY_STUDENT_PRODUCTS_REQUEST: {
return state.setIn(['productPageInfo', 'isFetching'], true);
}
case QUERY_STUDENT_PRODUCTS_SUCCESS:{
return state.setIn(['productPageInfo','studentProducts'],Immutable.fromJS(action.payload));
}
case QUERY_STUDENT_PRODUCTS_FAILURE:{
return state.setIn(['productPageInfo', 'isFetching'], false)
.setIn(['productPageInfo', 'error'], action.payload);
}
case UPDATE_REGISTER_PAGE_CELLS: {
return state.setIn(['registerPageInfo', 'registerPageCells'], action.payload.newRegisterPageCells)
.setIn(['registerPageInfo','registerNowEnable'], action.payload.registerNowEnable);
}
case QUERY_PROVINCE_SUCCESS: {
return state.setIn(['registerPageInfo', 'provinceWithLatterList'], Immutable.fromJS(action.payload.latterProvincelistSort))
.setIn(['registerPageInfo', 'provinceLatterList'], Immutable.fromJS(action.payload.latterList));
}
case QUERY_SCHOOL_INFO_LIST_SUCCESS: {
return state.setIn(['registerPageInfo', 'schoolCodeValueInfo'], Immutable.fromJS(action.payload.schoolCodeValueInfo))
.setIn(['registerPageInfo', 'curSchoolListInfo'], Immutable.fromJS(action.payload.curSchoolInfo));
}
case UPDATE_PROVINCE_SCHOOL_PAGE_INFO: {
return state.setIn(['registerPageInfo', 'provinceSchoolPageInfo'], Immutable.fromJS(action.payload));
}
case UPDATE_SEARCH_RESULT_PAGE_INFO: {
return state.setIn(['registerPageInfo', 'searchResultPageInfo'], Immutable.fromJS(action.payload));
}
case UPDATE_PICKER_INFO: {
return state.setIn(['registerPageInfo', 'pickerInfo'],action.payload);
}
case SELECT_PROVINCE_ITEM: {
return state.setIn(['registerPageInfo', 'curProvinceItem'], Immutable.fromJS(action.payload));
}
case SELECT_SCHOOL_ITEM: {
return state.setIn(['registerPageInfo', 'cueSchoolItem'], Immutable.fromJS(action.payload));
}
case SHOW_TIP_MESSAGE: {
return state.set('tipMessage',action.payload);
}
case HIDE_TIP_MESSAGE: {
return state.set('tipMessage','');
}
case CHECK_AGREE_YOHO_PROTOCOL: {
return state.setIn(['registerPageInfo', 'agreeYohoProtocol'], action.payload);
}
}
return state;
}